/**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Jonathan Rajotte - machine interface support and utility function
*********************************************************************/
+
package org.eclipse.linuxtools.internal.lttng2.control.core.model;
/**
- * <p>
* Session state enumeration.
- * </p>
*
* @author Bernd Hufmann
*/
// Enum definition
// ------------------------------------------------------------------------
/** Trace session inactive */
- INACTIVE("inactive"), //$NON-NLS-1$
+ INACTIVE("inactive", "false"), //$NON-NLS-1$ //$NON-NLS-2$
/** Trace session active */
- ACTIVE("active"); //$NON-NLS-1$
+ ACTIVE("active", "true"); //$NON-NLS-1$ //$NON-NLS-2$
// ------------------------------------------------------------------------
// Attributes
* Name of enum.
*/
private final String fInName;
+ private final String fMiName;
// ------------------------------------------------------------------------
// Constuctors
/**
* Private constructor
- * @param name the name of state
+ *
+ * @param name
+ * the name of state
*/
- private TraceSessionState(String name) {
+ private TraceSessionState(String name, String miName) {
fInName = name;
+ fMiName = miName;
}
// ------------------------------------------------------------------------
public String getInName() {
return fInName;
}
+
+ /**
+ * @return the machine interface name
+ */
+ public String getfMiName() {
+ return fMiName;
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+ /**
+ * Return the corresponding {@link TraceSessionState} to String "name"
+ *
+ * @param name
+ * String to compare to retrieve the good
+ * {@link TraceSessionState}
+ * @return the corresponding {@link TraceSessionState}
+ */
+ public static TraceSessionState valueOfString(String name) {
+ if (name == null) {
+ return INACTIVE;
+ }
+ for (TraceSessionState tst : TraceSessionState.values()) {
+ boolean isEqual = tst.fInName.equalsIgnoreCase(name) || tst.fMiName.equalsIgnoreCase(name);
+ if (isEqual) {
+ return tst;
+ }
+ }
+ // No match
+ return INACTIVE;
+ }
}
@Override
public void setEventType(String typeName) {
- if(TraceEventType.TRACEPOINT.getInName().equals(typeName)) {
+ if(TraceEventType.TRACEPOINT.getInName().equalsIgnoreCase(typeName)) {
fEventType = TraceEventType.TRACEPOINT;
- } else if(TraceEventType.SYSCALL.getInName().equals(typeName)) {
+ } else if(TraceEventType.SYSCALL.getInName().equalsIgnoreCase(typeName)) {
fEventType = TraceEventType.SYSCALL;
- } else if (TraceEventType.PROBE.getInName().equals(typeName)) {
+ } else if (TraceEventType.PROBE.getInName().equalsIgnoreCase(typeName)) {
fEventType = TraceEventType.PROBE;
- } else if (TraceEventType.FUNCTION.getInName().equals(typeName)) {
+ } else if (TraceEventType.FUNCTION.getInName().equalsIgnoreCase(typeName)) {
fEventType = TraceEventType.FUNCTION;
} else {
fEventType = TraceEventType.UNKNOWN;
@Override
public void setLogLevel(String levelName) {
- if(TraceLogLevel.TRACE_EMERG.getInName().equals(levelName)) {
+ if(TraceLogLevel.TRACE_EMERG.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_EMERG;
- } else if(TraceLogLevel.TRACE_ALERT.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_ALERT.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_ALERT;
- } else if(TraceLogLevel.TRACE_CRIT.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_CRIT.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_CRIT;
- } else if(TraceLogLevel.TRACE_ERR.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_ERR.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_ERR;
- } else if(TraceLogLevel.TRACE_WARNING.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_WARNING.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_WARNING;
- } else if(TraceLogLevel.TRACE_NOTICE.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_NOTICE.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_NOTICE;
- } else if(TraceLogLevel.TRACE_INFO.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_INFO.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_INFO;
- } else if(TraceLogLevel.TRACE_DEBUG_SYSTEM.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_SYSTEM.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_SYSTEM;
- } else if(TraceLogLevel.TRACE_DEBUG_PROGRAM.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_PROGRAM.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_PROGRAM;
- } else if(TraceLogLevel.TRACE_DEBUG_PROCESS.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_PROCESS.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_PROCESS;
- } else if(TraceLogLevel.TRACE_DEBUG_MODULE.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_MODULE.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_MODULE;
- } else if(TraceLogLevel.TRACE_DEBUG_UNIT.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_UNIT.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_UNIT;
- } else if(TraceLogLevel.TRACE_DEBUG_FUNCTION.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_FUNCTION.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_FUNCTION;
- } else if(TraceLogLevel.TRACE_DEBUG_LINE.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG_LINE.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG_LINE;
- } else if(TraceLogLevel.TRACE_DEBUG.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.TRACE_DEBUG.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.TRACE_DEBUG;
- } else if(TraceLogLevel.LEVEL_UNKNOWN.getInName().equals(levelName)) {
+ } else if(TraceLogLevel.LEVEL_UNKNOWN.getInName().equalsIgnoreCase(levelName)) {
fLogLevel = TraceLogLevel.LEVEL_UNKNOWN;
} else {
fLogLevel = TraceLogLevel.TRACE_DEBUG;
/**********************************************************************
+
* Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* Bernd Hufmann - Updated for support of LTTng Tools 2.1
* Marc-Andre Laperle - Support for creating a live session
**********************************************************************/
+
package org.eclipse.linuxtools.internal.lttng2.control.core.model.impl;
import java.util.ArrayList;
import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState;
/**
- * <p>
* Implementation of the trace session interface (ISessionInfo) to store session
* related data.
- * </p>
*
* @author Bernd Hufmann
*/
// ------------------------------------------------------------------------
/**
* Constructor
- * @param name - name of base event
+ *
+ * @param name
+ * - name of base event
*/
public SessionInfo(String name) {
super(name);
/**
* Copy constructor
- * @param other - the instance to copy
+ *
+ * @param other
+ * - the instance to copy
*/
public SessionInfo(SessionInfo other) {
super(other);
for (Iterator<IDomainInfo> iterator = other.fDomains.iterator(); iterator.hasNext();) {
IDomainInfo domain = iterator.next();
if (domain instanceof DomainInfo) {
- fDomains.add(new DomainInfo((DomainInfo)domain));
+ fDomains.add(new DomainInfo((DomainInfo) domain));
} else {
fDomains.add(domain);
}
@Override
public void setSessionState(String stateName) {
- if (TraceSessionState.INACTIVE.getInName().equals(stateName)) {
- fState = TraceSessionState.INACTIVE;
- } else if (TraceSessionState.ACTIVE.getInName().equals(stateName)) {
- fState = TraceSessionState.ACTIVE;
- }
+ fState = TraceSessionState.valueOfString(stateName);
}
@Override
fDomains.add(domainInfo);
}
-
@SuppressWarnings("nls")
@Override
public String toString() {
StringBuffer output = new StringBuffer();
- output.append("[SessionInfo(");
- output.append(super.toString());
- output.append(",Path=");
- output.append(getSessionPath());
- output.append(",State=");
- output.append(fState);
- output.append(",isStreamedTrace=");
- output.append(fIsStreamedTrace);
- output.append(",isSnapshot=");
- output.append(fIsSnapshot);
-
- if (fSnapshotInfo != null) {
- output.append(",snapshotInfo=");
- output.append(fSnapshotInfo.toString());
- }
- output.append(",Domains=");
- for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
- IDomainInfo domain = iterator.next();
- output.append(domain.toString());
- }
+ output.append("[SessionInfo(");
+ output.append(super.toString());
+ output.append(",Path=");
+ output.append(getSessionPath());
+ output.append(",State=");
+ output.append(fState);
+ output.append(",isStreamedTrace=");
+ output.append(fIsStreamedTrace);
+ output.append(",isSnapshot=");
+ output.append(fIsSnapshot);
+
+ if (fSnapshotInfo != null) {
+ output.append(",snapshotInfo=");
+ output.append(fSnapshotInfo.toString());
+ }
+ output.append(",Domains=");
+ for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
+ IDomainInfo domain = iterator.next();
+ output.append(domain.toString());
+ }
- output.append(",NetworkUrl=");
- output.append(getNetworkUrl());
- output.append(",ControlUrl=");
- output.append(getControlUrl());
- output.append(",DataUrl=");
- output.append(getDataUrl());
+ output.append(",NetworkUrl=");
+ output.append(getNetworkUrl());
+ output.append(",ControlUrl=");
+ output.append(getControlUrl());
+ output.append(",DataUrl=");
+ output.append(getDataUrl());
- output.append(")]");
- return output.toString();
+ output.append(")]");
+ return output.toString();
}
@Override
fShell.setScenario(SCEN_LTTNG_VERSION);
ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
assertNotNull(service);
- assertEquals("2.1.0", service.getVersion());
+ assertEquals("2.1.0", service.getVersionString());
} catch (ExecutionException e) {
fail("Exeption thrown " + e);
}
fShell.setScenario(SCEN_LTTNG_VERSION_WITH_PROMPT);
ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
assertNotNull(service);
- assertEquals("2.0.0", service.getVersion());
+ assertEquals("2.0.0", service.getVersionString());
} catch (ExecutionException e) {
fail("Exeption thrown " + e);
}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jonathan Rajotte - Initial implementation
+ **********************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.control.ui.views.handlers;
+
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.LTTngControlServiceMI;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.Activator;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * <p>
+ * Error handler for xml xsd validation while using machine interface mode
+ * in {@link LTTngControlServiceMI}.
+ * </p>
+ *
+ * @author Jonathan Rajotte
+ */
+public class XmlMiValidationErrorHandler implements ErrorHandler {
+
+ @Override
+ public void error(SAXParseException e) throws SAXException {
+ Activator.getDefault().logError(Messages.TraceControl_XmlValidationError, e);
+ throw new SAXException(Messages.TraceControl_XmlValidationError, e);
+ }
+
+ @Override
+ public void fatalError(SAXParseException e) throws SAXException {
+ Activator.getDefault().logError(Messages.TraceControl_XmlValidationError, e);
+ throw new SAXException(Messages.TraceControl_XmlValidationError, e);
+ }
+
+ @Override
+ public void warning(SAXParseException e) throws SAXException {
+ Activator.getDefault().logWarning(Messages.TraceControl_XmlValidationWarning, e);
+ }
+
+}
public static String TraceControl_UnsupportedVersionError;
public static String TraceControl_GettingVersionError;
+ // Xml parsing related failures
+ public static String TraceControl_InvalidSchemaError;
+ public static String TraceControl_XmlDocumentBuilderError;
+ public static String TraceControl_XmlParsingError;
+ public static String TraceControl_XmlValidationError;
+ public static String TraceControl_XmlValidationWarning;
+
+ // Xml machine interface failures
+ public static String TraceControl_MiInvalidNumberOfElementError;
+ public static String TraceControl_MiInvalidProviderError;
+ public static String TraceControl_MiMissingRequiredError;
+
// Commands
public static String TraceControl_ErrorTitle;
public static String TraceControl_RetrieveNodeConfigurationJob;
TraceControl_ExecutionTimeout=Command Execution timed-out
TraceControl_ShellNotConnected=Command shell not connected
TraceControl_CommandShellError=Could not create HostShellProcessAdapter
-TraceControl_CommandError=Command failed! Command:
+TraceControl_CommandError=Command failed! Command:
TraceControl_UnexpectedCommandOutputFormat=Unexpected command output
TraceControl_UnexpectedNameError=Unexpected session name returned
TraceControl_UnexpectedPathError=Unexpected session path returned
TraceControl_UnsupportedVersionError=Unsupported LTTng Tracer Control version
TraceControl_GettingVersionError=Could not get version of LTTng Tracer Control
-
-# Commands
+
+# Xml parsing related failures
+TraceControl_InvalidSchemaError=Could not open/validate xsd Schema
+TraceControl_XmlDocumentBuilderError=Unable to create the xml document builder
+TraceControl_XmlParsingError=Unable to parse the xml document
+TraceControl_XmlValidationError=Could not validate the xml response
+TraceControl_XmlValidationWarning=Xml validation warning
+
+# Xml machine interface failures
+TraceControl_MiInvalidNumberOfElementError=Invalid number of element
+TraceControl_MiInvalidProviderError=Invalid provider data
+TraceControl_MiMissingRequiredError=Missing required data
+
+# Commands
TraceControl_ErrorTitle=Error
TraceControl_ListSessionFailure=List sessions failed
TraceControl_RetrieveNodeConfigurationJob=Retrieving Target Node Configuration...
public String getNodeVersion() {
// Control service is null during connection to node
if (getControlService() != null) {
- return getControlService().getVersion();
+ return getControlService().getVersionString();
}
return ""; //$NON-NLS-1$
}
public interface ILttngControlService {
/**
- * @return the version string.
+ * @return the LTTng version object
*/
- String getVersion();
+ LttngVersion getVersion();
+
+ /**
+ * @return the version string
+ */
+ String getVersionString();
/**
* Checks if given version is supported by this ILTTngControlService implementation.
// ------------------------------------------------------------------------
@Override
- public String getVersion() {
+ public String getVersionString() {
if (fVersion == null) {
return "Unknown"; //$NON-NLS-1$
}
return fVersion.toString();
}
+ @Override
+ public LttngVersion getVersion() {
+ return fVersion;
+ }
+
/**
* Sets the version of the LTTng 2.0 control service.
* @param version - a version to set
fVersion = new LttngVersion(version);
}
+ /**
+ * Sets the version of the LTTng 2.x control service.
+ * @param version - a version to set
+ */
+ public void setVersion(LttngVersion version) {
+ fVersion = version;
+ }
+
@Override
public boolean isVersionSupported(String version) {
LttngVersion tmp = new LttngVersion(version);
* Unused value
*/
static final int UNUSED_VALUE = -1;
+ /**
+ * String representation of numerical true element
+ */
+ static final String TRUE_NUMERICAL = "1"; //$NON-NLS-1$
+ // ------------------------------------------------------------------------
+ // LTTng Machine Interface constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * Name of the XSD to validate against the xml machine interface
+ * output from LTTng
+ */
+ static final String MI_XSD_FILENAME = "mi_lttng.xsd"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Command constants
// ------------------------------------------------------------------------
* The lttng tools command.
*/
static final String CONTROL_COMMAND = "lttng"; //$NON-NLS-1$
+ /**
+ * The lttng tools machine interface command.
+ */
+ static final String CONTROL_COMMAND_MI = CONTROL_COMMAND + " --mi "; //$NON-NLS-1$
+ /**
+ * The lttng tools XML machine interface command.
+ */
+ static final String CONTROL_COMMAND_MI_XML = CONTROL_COMMAND_MI + " xml "; //$NON-NLS-1$
/**
* Command: lttng version.
*/
* Note: file for protocol is not considered as network trace since local consumer will be used.
*/
static final Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net4|net6|tcp|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
+ /**
+ * Pattern to match session path for network tracing
+ * Note: file for protocol is not considered as network trace since local consumer will be used.
+ */
+ static final Pattern TRACE_NETWORK_PATTERN = Pattern.compile("\\s*(net|net4|net6|tcp|tcp4|tcp6)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$
/**
* Sub-pattern to pattern TRACE_NETWORK_PATH_PATTERN to match file protocol
*/
/**********************************************************************
- * Copyright (c) 2012, 2013. 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Jonathan Rajotte - machine interface support
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.service;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.ICommandShell;
/**
- * <p>
- * Factory to create LTTngControlService instances depending on the version of the LTTng Trace Control
- * installed on the remote host.
- * </p>
+ * Factory to create LTTngControlService instances depending on the version of
+ * the LTTng Trace Control installed on the remote host.
*
* @author Bernd Hufmann
*/
* Gets the LTTng Control Service implementation based on the version of the
* remote LTTng Tools.
*
- * @param shell - the shell implementation to pass to the service
+ * @param shell
+ * - the shell implementation to pass to the service
* @return - LTTng Control Service implementation
- * @throws ExecutionException If the command fails
+ * @throws ExecutionException
+ * If the command fails
*/
public ILttngControlService getLttngControlService(ICommandShell shell) throws ExecutionException {
// get the version
+ boolean machineInterfaceMode = true;
String command = LTTngControlServiceConstants.CONTROL_COMMAND + LTTngControlServiceConstants.COMMAND_VERSION;
+ String commandMi = LTTngControlServiceConstants.CONTROL_COMMAND_MI_XML + LTTngControlServiceConstants.COMMAND_VERSION;
+ // Logging
if (ControlPreferences.getInstance().isLoggingEnabled()) {
- ControlCommandLogger.log(command);
+ ControlCommandLogger.log(commandMi);
}
+
ICommandResult result = null;
+ // Looking for a machine interface on LTTng side
try {
- result = shell.executeCommand(command, new NullProgressMonitor());
+ result = shell.executeCommand(commandMi, new NullProgressMonitor());
} catch (ExecutionException e) {
- throw new ExecutionException(Messages.TraceControl_GettingVersionError + ": " + e); //$NON-NLS-1$
+ throw new ExecutionException(Messages.TraceControl_GettingVersionError, e);
}
+ // Output logging
if (ControlPreferences.getInstance().isLoggingEnabled()) {
ControlCommandLogger.log(LTTngControlService.formatOutput(result));
}
+ if (result.getResult() != 0) {
+ machineInterfaceMode = false;
+ // Fall back if no machine interface is present
+
+ // Logging
+ if (ControlPreferences.getInstance().isLoggingEnabled()) {
+ ControlCommandLogger.log(command);
+ }
+
+ try {
+ result = shell.executeCommand(command, new NullProgressMonitor());
+ } catch (ExecutionException e) {
+ throw new ExecutionException(Messages.TraceControl_GettingVersionError + ": " + e); //$NON-NLS-1$
+ }
+
+ // Output logging
+ if (ControlPreferences.getInstance().isLoggingEnabled()) {
+ ControlCommandLogger.log(LTTngControlService.formatOutput(result));
+ }
+ }
+
+
if ((result != null) && (result.getResult() == 0) && (result.getOutput().length >= 1)) {
+ if (machineInterfaceMode) {
+ LTTngControlServiceMI service = new LTTngControlServiceMI(shell, LTTngControlService.class.getResource(LTTngControlServiceConstants.MI_XSD_FILENAME));
+ service.setVersion(result.getOutput());
+ return service;
+ }
int index = 0;
while (index < result.getOutput().length) {
String line = result.getOutput()[index];
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jonathan Rajotte - Initial support for machine interface lttng 2.6
+ **********************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.control.ui.views.service;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IBaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IDomainInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IFieldInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISnapshotInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.IUstProviderInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BaseEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.FieldInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.SessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.SnapshotInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.UstProviderInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.handlers.XmlMiValidationErrorHandler;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.ICommandResult;
+import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.ICommandShell;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Service for sending LTTng trace control commands to remote host via machine
+ * interface mode.
+ *
+ * @author Jonathan Rajotte
+ */
+public class LTTngControlServiceMI extends LTTngControlService {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final DocumentBuilder fDocumentBuilder;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param shell
+ * the command shell implementation to use
+ * @param xsdUrl
+ * the xsd schema file for validation
+ * @throws ExecutionException
+ * if the creation of the Schema and DocumentBuilder objects
+ * fails
+ */
+ public LTTngControlServiceMI(ICommandShell shell, URL xsdUrl) throws ExecutionException {
+ super(shell);
+
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setValidating(false);
+
+ // TODO: Add xsd validation for machine interface via mi_lttng.xsd from LTTng
+ try {
+ fDocumentBuilder = docBuilderFactory.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new ExecutionException(Messages.TraceControl_XmlDocumentBuilderError, e);
+ }
+
+ fDocumentBuilder.setErrorHandler(new XmlMiValidationErrorHandler());
+
+ }
+
+ /**
+ * Generate a Document object from an array of String.
+ *
+ * @param xmlStrings
+ * array of strings representing an xml input
+ * @return Document generated from strings input
+ * @throws ExecutionException
+ * when parsing has failed
+ */
+ private Document getDocumentFromStrings(String[] xmlStrings) throws ExecutionException {
+ StringBuilder concatenedString = new StringBuilder();
+ for (String string : xmlStrings) {
+ concatenedString.append(string);
+ }
+ InputSource stream = new InputSource(new StringReader(concatenedString.toString()));
+
+ Document document;
+ try {
+ document = fDocumentBuilder.parse(stream);
+ } catch (SAXException | IOException e) {
+ throw new ExecutionException(Messages.TraceControl_XmlParsingError, e);
+ }
+ return document;
+
+ }
+
+ /**
+ * Parse, populate and set the internal LTTngVersion variable
+ *
+ * @param xmlOutput
+ * the mi xml output of lttng version
+ * @throws ExecutionException
+ * when xml extraction fail
+ */
+ public void setVersion(String[] xmlOutput) throws ExecutionException {
+ Document doc = getDocumentFromStrings(xmlOutput);
+ NodeList element = doc.getElementsByTagName(MIStrings.VERSION);
+ int major = 0;
+ int minor = 0;
+ int patchLevel = 0;
+ String license = ""; //$NON-NLS-1$
+ String commit = ""; //$NON-NLS-1$
+ String name = ""; //$NON-NLS-1$
+ String description = ""; //$NON-NLS-1$
+ String url = ""; //$NON-NLS-1$
+ String fullVersion = ""; //$NON-NLS-1$
+ if (element.getLength() == 1) {
+ NodeList child = element.item(0).getChildNodes();
+ // Get basic information
+ for (int i = 0; i < child.getLength(); i++) {
+ Node node = child.item(i);
+ switch (node.getNodeName()) {
+ case MIStrings.VERSION_MAJOR:
+ major = Integer.parseInt(node.getTextContent());
+ break;
+ case MIStrings.VERSION_MINOR:
+ minor = Integer.parseInt(node.getTextContent());
+ break;
+ case MIStrings.VERSION_PATCH_LEVEL:
+ patchLevel = Integer.parseInt(node.getTextContent());
+ break;
+ case MIStrings.VERSION_COMMIT:
+ commit = node.getTextContent();
+ break;
+ case MIStrings.VERSION_DESCRIPTION:
+ description = node.getTextContent();
+ break;
+ case MIStrings.VERSION_LICENSE:
+ license = node.getTextContent();
+ break;
+ case MIStrings.VERSION_NAME:
+ name = node.getTextContent();
+ break;
+ case MIStrings.VERSION_STR:
+ fullVersion = node.getTextContent();
+ break;
+ case MIStrings.VERSION_WEB:
+ url = node.getTextContent();
+ break;
+ default:
+ break;
+ }
+ }
+ setVersion(new LttngVersion(major, minor, patchLevel, license, commit, name, description, url, fullVersion));
+ } else {
+ throw new ExecutionException(Messages.TraceControl_UnsupportedVersionError);
+ }
+ }
+
+ @Override
+ public String[] getSessionNames(IProgressMonitor monitor) throws ExecutionException {
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST);
+ ICommandResult result = executeCommand(command.toString(), monitor);
+
+ Document doc = getDocumentFromStrings(result.getOutput());
+
+ NodeList elements = doc.getElementsByTagName(MIStrings.NAME);
+
+ ArrayList<String> retArray = new ArrayList<>();
+ for (int i = 0; i < elements.getLength(); i++) {
+ Node node = elements.item(i);
+ if (node.getParentNode().getNodeName().equalsIgnoreCase(MIStrings.SESSION)) {
+ retArray.add(node.getTextContent());
+ }
+ }
+ return retArray.toArray(new String[retArray.size()]);
+ }
+
+ @Override
+ public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, sessionName);
+ ICommandResult result = executeCommand(command.toString(), monitor);
+
+ ISessionInfo sessionInfo = new SessionInfo(sessionName);
+ Document document = getDocumentFromStrings(result.getOutput());
+
+ NodeList sessionsNode = document.getElementsByTagName(MIStrings.SESSION);
+ // There should be only one session
+ if (sessionsNode.getLength() != 1) {
+ throw new ExecutionException(Messages.TraceControl_MiInvalidNumberOfElementError);
+ }
+
+ // Populate session information
+ NodeList rawSessionInfos = sessionsNode.item(0).getChildNodes();
+ for (int i = 0; i < rawSessionInfos.getLength(); i++) {
+ Node rawInfo = rawSessionInfos.item(i);
+ switch (rawInfo.getNodeName()) {
+ case MIStrings.PATH:
+ sessionInfo.setSessionPath(rawInfo.getTextContent());
+ break;
+ case MIStrings.ENABLED:
+ sessionInfo.setSessionState(rawInfo.getTextContent());
+ break;
+ case MIStrings.SNAPSHOT_MODE:
+ if (rawInfo.getTextContent().equals(LTTngControlServiceConstants.TRUE_NUMERICAL)) {
+ // real name will be set later
+ ISnapshotInfo snapshotInfo = new SnapshotInfo(""); //$NON-NLS-1$
+ sessionInfo.setSnapshotInfo(snapshotInfo);
+ }
+ break;
+ case MIStrings.LIVE_TIMER_INTERVAL:
+ // TODO : live mode not supported yet in TMF:lttng-control
+ break;
+ case MIStrings.DOMAINS:
+ // Extract the domains node
+ NodeList rawDomains = rawInfo.getChildNodes();
+ IDomainInfo domain = null;
+ for (int j = 0; j < rawDomains.getLength(); j++) {
+ if (rawDomains.item(j).getNodeName().equalsIgnoreCase(MIStrings.DOMAIN)) {
+ domain = parseDomain(rawDomains.item(j));
+ sessionInfo.addDomain(domain);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (!sessionInfo.isSnapshotSession()) {
+ Matcher matcher = LTTngControlServiceConstants.TRACE_NETWORK_PATTERN.matcher(sessionInfo.getSessionPath());
+ if (matcher.matches()) {
+ sessionInfo.setStreamedTrace(true);
+ }
+ }
+
+
+ // Fetch the snapshot info
+ if (sessionInfo.isSnapshotSession()) {
+ ISnapshotInfo snapshot = getSnapshotInfo(sessionName, monitor);
+ sessionInfo.setSnapshotInfo(snapshot);
+ }
+
+ return sessionInfo;
+ }
+
+ /**
+ * @param domain
+ * a domain xml node
+ * @return {@link IDomainInfo}
+ */
+ protected IDomainInfo parseDomain(Node domain) {
+ // TODO JRJ - STUB
+ return null;
+ }
+
+ @Override
+ public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ // TODO JRJ - STUB
+ return null;
+ }
+
+ @Override
+ public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException {
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_KERNEL);
+ ICommandResult result = executeCommand(command.toString(), monitor, false);
+ List<IBaseEventInfo> events = new ArrayList<>();
+
+ if (isError(result)) {
+ return events;
+ }
+
+ Document document = getDocumentFromStrings(result.getOutput());
+ NodeList rawEvents = document.getElementsByTagName(MIStrings.EVENT);
+ parseXmlEvents(rawEvents, events);
+ return events;
+ }
+
+ @Override
+ public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException {
+ StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_UST);
+ // Get the field to
+ command.append(LTTngControlServiceConstants.OPTION_FIELDS);
+
+ // Execute
+ ICommandResult result = executeCommand(command.toString(), monitor, false);
+ List<IUstProviderInfo> allProviders = new ArrayList<>();
+
+ if (isError(result)) {
+ return allProviders;
+ }
+
+ Document document = getDocumentFromStrings(result.getOutput());
+ NodeList rawProviders = document.getElementsByTagName(MIStrings.PID);
+
+ IUstProviderInfo providerInfo = null;
+
+ for (int i = 0; i < rawProviders.getLength(); i++) {
+ Node provider = rawProviders.item(i);
+ Node name = getFirstOf(provider.getChildNodes(), MIStrings.NAME);
+ if (name == null) {
+ throw new ExecutionException(Messages.TraceControl_MiInvalidProviderError);
+ }
+ providerInfo = new UstProviderInfo(name.getTextContent());
+
+ // Populate provider
+ NodeList infos = provider.getChildNodes();
+ for (int j = 0; j < infos.getLength(); j++) {
+ Node info = infos.item(j);
+ switch (info.getNodeName()) {
+ case MIStrings.PID_ID:
+ providerInfo.setPid(Integer.parseInt(info.getTextContent()));
+ break;
+ case MIStrings.EVENTS:
+ List<IBaseEventInfo> events = new ArrayList<>();
+ NodeList rawEvents = info.getChildNodes();
+ parseXmlEvents(rawEvents, events);
+ providerInfo.setEvents(events);
+ break;
+ default:
+ break;
+ }
+ }
+ allProviders.add(providerInfo);
+ }
+
+ return allProviders;
+ }
+
+ @Override
+ public ISessionInfo createSession(ISessionInfo sessionInfo, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void startSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void disableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<String> getContextList(IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void recordSnapshot(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void runCommands(IProgressMonitor monitor, List<String> commands) throws ExecutionException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @param strings
+ * array of string that make up a command line
+ * @return string buffer with created command line
+ */
+ @Override
+ protected StringBuffer createCommand(String... strings) {
+ StringBuffer command = new StringBuffer();
+ command.append(LTTngControlServiceConstants.CONTROL_COMMAND_MI_XML);
+ command.append(getTracingGroupOption());
+ for (String string : strings) {
+ command.append(string);
+ }
+ return command;
+ }
+
+ /**
+ * @param xmlEvents
+ * a Node list of xml event element
+ * @param events
+ * list of event generated by the parsing of the xml event
+ * element
+ * @throws ExecutionException
+ * when a raw event is not a complete/valid xml event
+ */
+ protected void parseXmlEvents(NodeList xmlEvents, List<IBaseEventInfo> events) throws ExecutionException {
+ IBaseEventInfo eventInfo = null;
+ for (int i = 0; i < xmlEvents.getLength(); i++) {
+ NodeList rawInfos = xmlEvents.item(i).getChildNodes();
+ // Search for name
+ if (xmlEvents.item(i).getNodeName().equalsIgnoreCase(MIStrings.EVENT)) {
+ Node rawName = getFirstOf(rawInfos, MIStrings.NAME);
+ if (rawName == null) {
+ throw new ExecutionException(Messages.TraceControl_MiMissingRequiredError);
+ }
+ eventInfo = new BaseEventInfo(rawName.getTextContent());
+
+ // Populate the event
+ for (int j = 0; j < rawInfos.getLength(); j++) {
+ Node infoNode = rawInfos.item(j);
+ switch (infoNode.getNodeName()) {
+ case MIStrings.TYPE:
+ eventInfo.setEventType(infoNode.getTextContent());
+ break;
+ case MIStrings.LOGLEVEL:
+ eventInfo.setLogLevel(infoNode.getTextContent());
+ break;
+ case MIStrings.EVENT_FIELDS:
+ List<IFieldInfo> fields = new ArrayList<>();
+ getFieldInfo(infoNode.getChildNodes(), fields);
+ eventInfo.setFields(fields);
+ break;
+ default:
+ break;
+ }
+ }
+ events.add(eventInfo);
+ }
+ }
+ }
+
+ /**
+ * @param fieldsList
+ * a list of xml event_field element
+ * @param fields
+ * a list of field generated by xml parsing
+ * @throws ExecutionException
+ * when parsing fail or required elements are missing
+ */
+ private static void getFieldInfo(NodeList fieldsList, List<IFieldInfo> fields) throws ExecutionException {
+ IFieldInfo fieldInfo = null;
+ for (int i = 0; i < fieldsList.getLength(); i++) {
+ Node field = fieldsList.item(i);
+ if (field.getNodeName().equalsIgnoreCase(MIStrings.EVENT_FIELD)) {
+ // Get name
+ Node name = getFirstOf(field.getChildNodes(), MIStrings.NAME);
+ if (name == null) {
+ throw new ExecutionException(Messages.TraceControl_MiMissingRequiredError);
+ }
+ fieldInfo = new FieldInfo(name.getTextContent());
+
+ // Populate the field information
+ NodeList infos = field.getChildNodes();
+ for (int j = 0; j < infos.getLength(); j++) {
+ Node info = infos.item(j);
+ switch (info.getNodeName()) {
+ case MIStrings.TYPE:
+ fieldInfo.setFieldType(info.getTextContent());
+ break;
+ default:
+ break;
+ }
+ }
+ fields.add(fieldInfo);
+ }
+ }
+ }
+
+ /**
+ * Retrieve the fist instance of a given node with tag name equal to tagName
+ * parameter
+ *
+ * @param nodeList
+ * the list of Node to search against
+ * @param tagName
+ * the tag name of the desired node
+ * @return the first occurrence of a node with a tag name equals to tagName
+ */
+ private static Node getFirstOf(NodeList nodeList, String tagName) {
+ Node node = null;
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ if (nodeList.item(i).getNodeName() == tagName) {
+ node = nodeList.item(i);
+ break;
+ }
+ }
+ return node;
+ }
+
+}
/**********************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Jonathan Rajotte - Machine interface support and new information
**********************************************************************/
+
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.service;
import org.osgi.framework.Version;
/**
- * A version implementation with a special compareTo implementation
- * to bypass problems of older implementation of org.osgi.framework.Version.
+ * A version implementation with a special compareTo implementation to bypass
+ * problems of older implementation of org.osgi.framework.Version.
*
* @author Bernd Hufmann
*/
public class LttngVersion extends Version {
+ private final String fLicense;
+ private final String fCommit;
+ private final String fName;
+ private final String fDescription;
+ private final String fUrl;
+ private final String fFullVersion;
+
/**
* Constructor
*
* @param version
- * The version string
+ * The version string
*/
public LttngVersion(String version) {
super(version);
+ fLicense = ""; //$NON-NLS-1$
+ fCommit = ""; //$NON-NLS-1$
+ fName = ""; //$NON-NLS-1$
+ fDescription = ""; //$NON-NLS-1$
+ fUrl = ""; //$NON-NLS-1$
+ fFullVersion = ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @param major
+ * major version number
+ * @param minor
+ * minor version number
+ * @param micro
+ * micro version number
+ * @param license
+ * licence text of LTTng
+ * @param commit
+ * current git commit information about LTTng
+ * @param name
+ * name of the version
+ * @param description
+ * description of the version
+ * @param url
+ * url to website
+ * @param fullVersion
+ * complete string representation of the version
+ */
+ public LttngVersion(int major, int minor, int micro, String license, String commit, String name, String description, String url, String fullVersion) {
+ super(major, minor, micro);
+ fLicense = license;
+ fCommit = commit;
+ fName = name;
+ fDescription = description;
+ fUrl = url;
+ fFullVersion = fullVersion;
}
/**
- * Special compareTo method to fix problem of older implementations of org.osgi.framework.Version
- * where {@code Version.compareTo} takes an {@code Object} instead a {@code Version} as argument.
+ * Special compareTo method to fix problem of older implementations of
+ * org.osgi.framework.Version where {@code Version.compareTo} takes an
+ * {@code Object} instead a {@code Version} as argument.
*
* @param other
- * - Other version to compare
+ * - Other version to compare
* @return a negative integer, zero, or a positive integer if this version
* is less than, equal to, or greater than the specified
* {@code LttngVersion} object.
if (other == this) { // quicktest
return 0;
}
-
int result = getMajor() - other.getMajor();
if (result != 0) {
return result;
}
return getQualifier().compareTo(other.getQualifier());
}
+
+ /**
+ * @return String representing the lttng license
+ */
+ public String getLicense() {
+ return fLicense;
+ }
+
+ /**
+ * @return commit id of lttng
+ */
+ public String getCommit() {
+ return fCommit;
+ }
+
+ /**
+ * @return name of lttng version
+ */
+ public String getName() {
+ return fName;
+ }
+
+ /**
+ * @return full description of lttng
+ */
+ public String getDescription() {
+ return fDescription;
+ }
+
+ /**
+ * @return url of lttng
+ */
+ public String getUrl() {
+ return fUrl;
+ }
+
+ /**
+ * @return the full_version
+ */
+ public String getFullVersion() {
+ return fFullVersion;
+ }
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jonathan Rajotte Julien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.control.ui.views.service;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Non-externalized strings for use with the LTTng Control services. This
+ * nformation is extracted from mi_lttng.xsd from lttng-tool libmi.
+ *
+ * @author Jonathan Rajotte
+ */
+@SuppressWarnings("nls")
+@NonNullByDefault
+public interface MIStrings {
+
+ /**
+ * Represent the command_action xml element
+ */
+ String COMMAND_ACTION = "snapshot_action";
+
+ /**
+ * Represent the command_add_context xml element
+ */
+ String COMMAND_ADD_CONTEXT = "add-context";
+
+ /**
+ * Represent the command_calibrate xml element
+ */
+ String COMMAND_CALIBRATE = "calibrate";
+
+ /**
+ * Represent the command_create xml element
+ */
+ String COMMAND_CREATE = "create";
+
+ /**
+ * Represent the command_destroy xml element
+ */
+ String COMMAND_DESTROY = "destroy";
+
+ /**
+ * Represent the command_disable_channel xml element
+ */
+ String COMMAND_DISABLE_CHANNEL = "disable-channel";
+
+ /**
+ * Represent the command_disable_event xml element
+ */
+ String COMMAND_DISABLE_EVENT = "disable-event";
+
+ /**
+ * Represent the command_enable_channels xml element
+ */
+ String COMMAND_ENABLE_CHANNELS = "enable-channel";
+
+ /**
+ * Represent the command_enable_event xml element
+ */
+ String COMMAND_ENABLE_EVENT = "enable-event";
+
+ /**
+ * Represent the command_list xml element
+ */
+ String COMMAND_LIST = "list";
+
+ /**
+ * Represent the command_load xml element
+ */
+ String COMMAND_LOAD = "load";
+
+ /**
+ * Represent the command_name xml element
+ */
+ String COMMAND_NAME = "name";
+
+ /**
+ * Represent the command_output xml element
+ */
+ String COMMAND_OUTPUT = "output";
+
+ /**
+ * Represent the command_save xml element
+ */
+ String COMMAND_SAVE = "save";
+
+ /**
+ * Represent the command_set_session xml element
+ */
+ String COMMAND_SET_SESSION = "set-session";
+
+ /**
+ * Represent the command_snapshot xml element
+ */
+ String COMMAND_SNAPSHOT = "snapshot";
+
+ /**
+ * Represent the command_snapshot_add xml element
+ */
+ String COMMAND_SNAPSHOT_ADD = "add_snapshot";
+
+ /**
+ * Represent the command_snapshot_del xml element
+ */
+ String COMMAND_SNAPSHOT_DEL = "del_snapshot";
+
+ /**
+ * Represent the command_snapshot_list xml element
+ */
+ String COMMAND_SNAPSHOT_LIST = "list_snapshot";
+
+ /**
+ * Represent the command_snapshot_record xml element
+ */
+ String COMMAND_SNAPSHOT_RECORD = "record_snapshot";
+
+ /**
+ * Represent the command_start xml element
+ */
+ String COMMAND_START = "start";
+
+ /**
+ * Represent the command_stop xml element
+ */
+ String COMMAND_STOP = "stop";
+
+ /**
+ * Represent the command_success xml element
+ */
+ String COMMAND_SUCCESS = "success";
+
+ /**
+ * Represent the command_version xml element
+ */
+ String COMMAND_VERSION = "version";
+
+ /**
+ * Represent the version xml element
+ */
+ String VERSION = "version";
+
+ /**
+ * Represent the version_commit xml element
+ */
+ String VERSION_COMMIT = "commit";
+
+ /**
+ * Represent the version_description xml element
+ */
+ String VERSION_DESCRIPTION = "description";
+
+ /**
+ * Represent the version_license xml element
+ */
+ String VERSION_LICENSE = "license";
+
+ /**
+ * Represent the version_major xml element
+ */
+ String VERSION_MAJOR = "major";
+
+ /**
+ * Represent the version_minor xml element
+ */
+ String VERSION_MINOR = "minor";
+
+ /**
+ * Represent the version_patch_level xml element
+ */
+ String VERSION_PATCH_LEVEL = "patchLevel";
+
+ /**
+ * Represent the version_str xml element
+ */
+ String VERSION_STR = "string";
+
+ /**
+ * Represent the version_web xml element
+ */
+ String VERSION_WEB = "url";
+
+ /**
+ * Represent the version_name xml element
+ */
+ String VERSION_NAME = "name";
+ /* String related to a lttng_event_field */
+
+ /**
+ * Represent the event_field xml element
+ */
+ String EVENT_FIELD = "event_field";
+
+ /**
+ * Represent the event_fields xml element
+ */
+ String EVENT_FIELDS = "event_fields";
+
+ /**
+ * Represent the perf_counter_context xml element
+ */
+ String PERF_COUNTER_CONTEXT = "perf_counter_context";
+
+ // ------------------------------------------------------------------------
+ // String related to pid
+ // ------------------------------------------------------------------------/
+
+ /**
+ * Represent the pids xml element
+ */
+ String PIDS = "pids";
+
+ /**
+ * Represent the pid xml element
+ */
+ String PID = "pid";
+
+ /**
+ * Represent the pid_id xml element
+ */
+ String PID_ID = "id";
+
+ // ------------------------------------------------------------------------
+ // String related to save command
+ // ------------------------------------------------------------------------
+ /**
+ * Represent the save xml element
+ */
+ String SAVE = "save";
+
+ // ------------------------------------------------------------------------
+ // String related to load command
+ // ------------------------------------------------------------------------
+ /**
+ * Represent the load xml element
+ */
+ String LOAD = "load";
+
+ // ------------------------------------------------------------------------
+ // String related to general element of mi_lttng
+ // ------------------------------------------------------------------------
+ /**
+ * Represent the empty xml element
+ */
+ String EMPTY = "";
+
+ /**
+ * Represent the id xml element
+ */
+ String ID = "id";
+
+ /**
+ * Represent the nowrite xml element
+ */
+ String NOWRITE = "nowrite";
+
+ /**
+ * Represent the success xml element
+ */
+ String SUCCESS = "success";
+
+ /**
+ * Represent the type_enum xml element
+ */
+ String TYPE_ENUM = "ENUM";
+
+ /**
+ * Represent the type_float xml element
+ */
+ String TYPE_FLOAT = "FLOAT";
+
+ /**
+ * Represent the type_integer xml element
+ */
+ String TYPE_INTEGER = "INTEGER";
+
+ /**
+ * Represent the type_other xml element
+ */
+ String TYPE_OTHER = "OTHER";
+
+ /**
+ * Represent the type_string xml element
+ */
+ String TYPE_STRING = "STRING";
+
+ // ------------------------------------------------------------------------
+ // String related to lttng_calibrate
+ // ------------------------------------------------------------------------
+ /**
+ * Represent the calibrate xml element
+ */
+ String CALIBRATE = "calibrate";
+
+ /**
+ * Represent the calibrate_function xml element
+ */
+ String CALIBRATE_FUNCTION = "FUNCTION";
+
+ // ------------------------------------------------------------------------
+ // String related to a lttng_snapshot_output
+ // ------------------------------------------------------------------------
+ /**
+ * Represent the snapshot_ctrl_url xml element
+ */
+ String SNAPSHOT_CTRL_URL = "ctrl_url";
+
+ /**
+ * Represent the snapshot_data_url xml element
+ */
+ String SNAPSHOT_DATA_URL = "data_url";
+
+ /**
+ * Represent the snapshot_max_size xml element
+ */
+
+ String SNAPSHOT_MAX_SIZE = "max_size";
+
+ /**
+ * Represent the snapshot_n_ptr xml element
+ */
+ String SNAPSHOT_N_PTR = "n_ptr";
+
+ /**
+ * Represent the snapshot_session_name xml element
+ */
+ String SNAPSHOT_SESSION_NAME = "session_name";
+
+ /**
+ * Represent the snapshots xml element
+ */
+ String SNAPSHOTS = "snapshots";
+ /**
+ * Represent the channel xml element
+ */
+ String CHANNEL = "channel";
+
+ /**
+ * Represent the channels xml element
+ */
+ String CHANNELS = "channels";
+
+ /**
+ * Represent the domain xml element
+ */
+ String DOMAIN = "domain";
+
+ /**
+ * Represent the domains xml element
+ */
+ String DOMAINS = "domains";
+
+ /**
+ * Represent the event xml element
+ */
+ String EVENT = "event";
+
+ /**
+ * Represent the events xml element
+ */
+ String EVENTS = "events";
+
+ /**
+ * Represent the context xml element
+ */
+ String CONTEXT = "context";
+
+ /**
+ * Represent the contexts xml element
+ */
+ String CONTEXTS = "contexts";
+
+ /**
+ * Represent the attributes xml element
+ */
+ String ATTRIBUTES = "attributes";
+
+ /**
+ * Represent the exclusion xml element
+ */
+ String EXCLUSION = "exclusion";
+
+ /**
+ * Represent the exclusions xml element
+ */
+ String EXCLUSIONS = "exclusions";
+
+ /**
+ * Represent the function_attributes xml element
+ */
+ String FUNCTION_ATTRIBUTES = "function_attributes";
+
+ /**
+ * Represent the probe_attributes xml element
+ */
+ String PROBE_ATTRIBUTES = "probe_attributes";
+
+ /**
+ * Represent the symbol_name xml element
+ */
+ String SYMBOL_NAME = "symbol_name";
+
+ /**
+ * Represent the address xml element
+ */
+ String ADDRESS = "address";
+
+ /**
+ * Represent the offset xml element
+ */
+ String OFFSET = "offset";
+
+ /**
+ * Represent the name xml element
+ */
+ String NAME = "name";
+
+ /**
+ * Represent the enabled xml element
+ */
+ String ENABLED = "enabled";
+
+ /**
+ * Represent the overwrite_mode xml element
+ */
+ String OVERWRITE_MODE = "overwrite_mode";
+
+ /**
+ * Represent the subbuf_size xml element
+ */
+ String SUBBUF_SIZE = "subbuffer_size";
+
+ /**
+ * Represent the num_subbuf xml element
+ */
+ String NUM_SUBBUF = "subbuffer_count";
+
+ /**
+ * Represent the switch_timer_interval xml element
+ */
+ String SWITCH_TIMER_INTERVAL = "switch_timer_interval";
+
+ /**
+ * Represent the read_timer_interval xml element
+ */
+ String READ_TIMER_INTERVAL = "read_timer_interval";
+
+ /**
+ * Represent the output xml element
+ */
+ String OUTPUT = "output";
+
+ /**
+ * Represent the output_type xml element
+ */
+ String OUTPUT_TYPE = "output_type";
+
+ /**
+ * Represent the tracefile_size xml element
+ */
+ String TRACEFILE_SIZE = "tracefile_size";
+
+ /**
+ * Represent the tracefile_count xml element
+ */
+ String TRACEFILE_COUNT = "tracefile_count";
+
+ /**
+ * Represent the live_timer_interval xml element
+ */
+ String LIVE_TIMER_INTERVAL = "live_timer_interval";
+
+ /**
+ * Represent the type xml element
+ */
+ String TYPE = "type";
+
+ /**
+ * Represent the buffer_type xml element
+ */
+ String BUFFER_TYPE = "buffer_type";
+
+ /**
+ * Represent the session xml element
+ */
+ String SESSION = "session";
+
+ /**
+ * Represent the sessions xml element
+ */
+ String SESSIONS = "sessions";
+
+ /**
+ * Represent the perf xml element
+ */
+ String PERF = "perf";
+
+ /**
+ * Represent the config xml element
+ */
+ String CONFIG = "config";
+
+ /**
+ * Represent the started xml element
+ */
+ String STARTED = "started";
+
+ /**
+ * Represent the snapshot_mode xml element
+ */
+ String SNAPSHOT_MODE = "snapshot_mode";
+
+ /**
+ * Represent the loglevel xml element
+ */
+ String LOGLEVEL = "loglevel";
+
+ /**
+ * Represent the loglevel_type xml element
+ */
+ String LOGLEVEL_TYPE = "loglevel_type";
+
+ /**
+ * Represent the filter xml element
+ */
+ String FILTER = "filter";
+
+ /**
+ * Represent the snapshot_outputs xml element
+ */
+ String SNAPSHOT_OUTPUTS = "snapshot_outputs";
+
+ /**
+ * Represent the consumer_output xml element
+ */
+ String CONSUMER_OUTPUT = "consumer_output";
+
+ /**
+ * Represent the destination xml element
+ */
+ String DESTINATION = "destination";
+
+ /**
+ * Represent the path xml element
+ */
+ String PATH = "path";
+
+ /**
+ * Represent the net_output xml element
+ */
+ String NET_OUTPUT = "net_output";
+
+ /**
+ * Represent the control_uri xml element
+ */
+ String CONTROL_URI = "control_uri";
+
+ /**
+ * Represent the data_uri xml element
+ */
+ String DATA_URI = "data_uri";
+
+ /**
+ * Represent the max_size xml element
+ */
+ String MAX_SIZE = "max_size";
+}