Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2014-03-10 17:39:31 -0400
committerAlexandre Montplaisir2014-05-22 17:09:25 -0400
commitb6f2330768c2bc2c00a05aa16b172aa43a09c831 (patch)
tree4ca682c77762dc39782e036105715e4d7233e5a3
parent1f3fdcdd4d44dd2b5025a57a567b4fdbcc9449dc (diff)
downloadorg.eclipse.linuxtools-b6f2330768c2bc2c00a05aa16b172aa43a09c831.tar.gz
org.eclipse.linuxtools-b6f2330768c2bc2c00a05aa16b172aa43a09c831.tar.xz
org.eclipse.linuxtools-b6f2330768c2bc2c00a05aa16b172aa43a09c831.zip
TMF: Remove XML header classes, they are not useful anymore
With the XmlUtils utility methods, there is no added value to wrap them in a class and they are accessible from everywhere. Change-Id: I66d15423ef4dadc18a77caef6af2d63faa426173 Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/25584 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java13
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/IXmlModuleMetadata.java31
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlHeadInfo.java100
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java28
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/TmfAnalysisModuleHelperXml.java47
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/XmlHeadInfoUi.java66
8 files changed, 50 insertions, 246 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF
index 2ea92d403f..25a1a36d46 100644
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF
@@ -12,7 +12,8 @@ Require-Bundle: org.junit,
org.eclipse.linuxtools.tmf.core,
org.eclipse.linuxtools.tmf.core.tests,
org.eclipse.linuxtools.tmf.ctf.core,
- org.eclipse.linuxtools.tmf.ctf.core.tests
+ org.eclipse.linuxtools.tmf.ctf.core.tests,
+ org.eclipse.linuxtools.statesystem.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Import-Package: org.junit.runners
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java
index 9b099223af..b705182c33 100644
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java
@@ -27,7 +27,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlHeadInfo;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.XmlStateSystemModule;
import org.eclipse.linuxtools.tmf.analysis.xml.core.tests.common.TmfXmlTestFiles;
@@ -94,12 +93,6 @@ public class StateProviderModuleTest {
assertEquals(ANALYSIS_ID, fModule.getId());
fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath()));
- NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD);
- XmlHeadInfo headInfo = null;
- if (head.getLength() == 1) {
- headInfo = new XmlHeadInfo(head.item(0));
- }
- fModule.setHeadInfo(headInfo);
assertEquals(ANALYSIS_NAME, fModule.getName());
}
@@ -123,12 +116,6 @@ public class StateProviderModuleTest {
fModule.setId(moduleId);
fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath()));
- NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD);
- XmlHeadInfo headInfo = null;
- if (head.getLength() == 1) {
- headInfo = new XmlHeadInfo(head.item(0));
- }
- fModule.setHeadInfo(headInfo);
try {
ITmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java
index 6a4cae9c31..79bc3e290a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java
@@ -28,7 +28,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlHeadInfo;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.XmlStateSystemModule;
import org.eclipse.linuxtools.tmf.analysis.xml.core.tests.common.TmfXmlTestFiles;
@@ -90,12 +89,7 @@ public class StateProviderTest {
fModule.setId(moduleId);
fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath()));
- NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD);
- XmlHeadInfo headInfo = null;
- if (head.getLength() == 1) {
- headInfo = new XmlHeadInfo(head.item(0));
- }
- fModule.setHeadInfo(headInfo);
+
try {
fModule.setTrace(fTrace);
fModule.schedule();
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/IXmlModuleMetadata.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/IXmlModuleMetadata.java
deleted file mode 100644
index 079910e78e..0000000000
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/IXmlModuleMetadata.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.analysis.xml.core.module;
-
-/**
- * Interface that XML analysis modules may implement to interpret the extra
- * metadata they may get for example from the header element in the XML file.
- *
- * @author Geneviève Bastien
- */
-public interface IXmlModuleMetadata {
-
- /**
- * Set the header information node associated with this module
- *
- * @param headInfo
- * The header information
- */
- void setHeadInfo(XmlHeadInfo headInfo);
-
-}
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlHeadInfo.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlHeadInfo.java
deleted file mode 100644
index 58d827e188..0000000000
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlHeadInfo.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.analysis.xml.core.module;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Class to store and interpret the header information of XML-defined components
- *
- * @author Geneviève Bastien
- */
-public class XmlHeadInfo {
-
- private final Node fHeadInfo;
-
- /**
- * Constructor
- *
- * @param item
- * The XML node corresponding to this header
- */
- public XmlHeadInfo(Node item) {
- fHeadInfo = item;
- }
-
- /**
- * Get a list of child elements with the requested name
- *
- * @param nodeName
- * The name of the nodes to get
- * @return List of child elements
- */
- public List<Element> getElements(String nodeName) {
- List<Element> list = new ArrayList<>();
- NodeList nodes = fHeadInfo.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++) {
- Node node = nodes.item(i);
- if (node instanceof Element) {
- Element element = (Element) node;
- if (element.getNodeName().equals(nodeName)) {
- list.add(element);
- }
- }
- }
- return list;
- }
-
- /**
- * Check whether, if this header information has trace types defined, this
- * component applies to a given trace type.
- *
- * @param traceClass
- * The trace type to check for
- * @return True if there is no trace type information in header or if the
- * trace type applies
- */
- public boolean checkTraceType(Class<? extends ITmfTrace> traceClass) {
- /*
- * By default this returns true, child implementation who have access to
- * trace types will override this
- *
- * TODO: actually check the trace type here when trace types are moved
- * to o.e.l.tmf.core instead of o.e.l.tmf.ui
- */
- return true;
- }
-
- /**
- * Get the name of this component from the header information
- *
- * @return The name of the component
- */
- public String getName() {
- List<Element> elements = getElements(TmfXmlStrings.LABEL);
- if (elements.isEmpty()) {
- return null;
- }
-
- Element element = elements.get(0);
- return element.getAttribute(TmfXmlStrings.VALUE);
- }
-
-}
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java
index 1e284e3ea7..bb59326623 100644
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java
+++ b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateSystemModule.java
@@ -12,12 +12,14 @@
package org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider;
+import java.util.List;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.linuxtools.tmf.analysis.xml.core.module.IXmlModuleMetadata;
-import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlHeadInfo;
+import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import org.w3c.dom.Element;
/**
* Analysis module for the data-driven state systems, defined in XML.
@@ -25,11 +27,9 @@ import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
* @author Geneviève Bastien
* @since 3.0
*/
-public class XmlStateSystemModule extends TmfStateSystemAnalysisModule
- implements IXmlModuleMetadata {
+public class XmlStateSystemModule extends TmfStateSystemAnalysisModule {
private IPath fXmlFile;
- private XmlHeadInfo fHeadInfo = null;
@Override
protected StateSystemBackendType getBackendType() {
@@ -44,10 +44,17 @@ public class XmlStateSystemModule extends TmfStateSystemAnalysisModule
@Override
public String getName() {
- String name = fHeadInfo.getName();
- if (name == null) {
- name = getId();
+ String name = getId();
+ Element doc = XmlUtils.getElementInFile(fXmlFile.makeAbsolute().toString(), TmfXmlStrings.STATE_PROVIDER, getId());
+ /* Label may be available in XML header */
+ List<Element> head = XmlUtils.getChildElements(doc, TmfXmlStrings.HEAD);
+ if (head.size() == 1) {
+ List<Element> labels = XmlUtils.getChildElements(head.get(0), TmfXmlStrings.LABEL);
+ if (!labels.isEmpty()) {
+ name = labels.get(0).getAttribute(TmfXmlStrings.VALUE);
+ }
}
+
return name;
}
@@ -61,11 +68,6 @@ public class XmlStateSystemModule extends TmfStateSystemAnalysisModule
fXmlFile = file;
}
- @Override
- public void setHeadInfo(XmlHeadInfo headInfo) {
- fHeadInfo = headInfo;
- }
-
/**
* Get the path to the XML file containing this state provider definition.
*
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/TmfAnalysisModuleHelperXml.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/TmfAnalysisModuleHelperXml.java
index 8b6b3c39b8..2288bb33cc 100644
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/TmfAnalysisModuleHelperXml.java
+++ b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/TmfAnalysisModuleHelperXml.java
@@ -14,9 +14,11 @@ package org.eclipse.linuxtools.tmf.analysis.xml.ui.module;
import java.io.File;
import java.util.Collections;
+import java.util.List;
import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.internal.tmf.analysis.xml.ui.Activator;
+import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.XmlStateSystemModule;
import org.eclipse.linuxtools.tmf.core.analysis.IAnalysisModule;
@@ -24,10 +26,11 @@ import org.eclipse.linuxtools.tmf.core.analysis.IAnalysisModuleHelper;
import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisManager;
import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisRequirement;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
+import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.osgi.framework.Bundle;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
/**
* Analysis module helpers for modules provided by XML files
@@ -47,7 +50,6 @@ public class TmfAnalysisModuleHelperXml implements IAnalysisModuleHelper {
private final File fSourceFile;
private final Element fSourceElement;
private final XmlAnalysisModuleType fType;
- private final XmlHeadInfoUi fHeadInfo;
/**
* Constructor
@@ -63,13 +65,6 @@ public class TmfAnalysisModuleHelperXml implements IAnalysisModuleHelper {
fSourceFile = xmlFile;
fSourceElement = node;
fType = type;
-
- NodeList head = fSourceElement.getElementsByTagName(TmfXmlStrings.HEAD);
- if (head.getLength() == 1) {
- fHeadInfo = new XmlHeadInfoUi(head.item(0));
- } else {
- fHeadInfo = null;
- }
}
@Override
@@ -79,7 +74,16 @@ public class TmfAnalysisModuleHelperXml implements IAnalysisModuleHelper {
@Override
public String getName() {
- String name = fHeadInfo.getName();
+ String name = null;
+ /* Label may be available in XML header */
+ List<Element> head = XmlUtils.getChildElements(fSourceElement, TmfXmlStrings.HEAD);
+ if (head.size() == 1) {
+ List<Element> labels = XmlUtils.getChildElements(head.get(0), TmfXmlStrings.LABEL);
+ if (!labels.isEmpty()) {
+ name = labels.get(0).getAttribute(TmfXmlStrings.VALUE);
+ }
+ }
+
if (name == null) {
name = getId();
}
@@ -107,13 +111,28 @@ public class TmfAnalysisModuleHelperXml implements IAnalysisModuleHelper {
}
@Override
- public boolean appliesToTraceType(Class<? extends ITmfTrace> traceclass) {
+ public boolean appliesToTraceType(Class<? extends ITmfTrace> traceClass) {
/* Trace types may be available in XML header */
- if (fHeadInfo == null) {
+ List<Element> head = XmlUtils.getChildElements(fSourceElement, TmfXmlStrings.HEAD);
+ if (head.size() != 1) {
+ return true;
+ }
+ /*
+ * TODO: Test with custom trace types
+ */
+ List<Element> elements = XmlUtils.getChildElements(head.get(0), TmfXmlStrings.TRACETYPE);
+ if (elements.isEmpty()) {
return true;
}
- return fHeadInfo.checkTraceType(traceclass);
+ for (Element element : elements) {
+ String traceTypeId = element.getAttribute(TmfXmlStrings.ID);
+ TraceTypeHelper helper = TmfTraceType.getInstance().getTraceType(traceTypeId);
+ if ((helper != null) && helper.getTrace().getClass().isAssignableFrom(traceClass)) {
+ return true;
+ }
+ }
+ return false;
}
@Override
@@ -137,8 +156,6 @@ public class TmfAnalysisModuleHelperXml implements IAnalysisModuleHelper {
module.setId(analysisid);
ssModule.setXmlFile(new Path(fSourceFile.getAbsolutePath()));
- /* Set header information if available */
- ssModule.setHeadInfo(fHeadInfo);
/*
* FIXME: There is no way to know if a module is automatic, so we
* default to true
diff --git a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/XmlHeadInfoUi.java b/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/XmlHeadInfoUi.java
deleted file mode 100644
index 1184880a85..0000000000
--- a/lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/module/XmlHeadInfoUi.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.analysis.xml.ui.module;
-
-import java.util.List;
-
-import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlHeadInfo;
-import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
-import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
-import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Class to store and interpret the header information of XML-defined components
- *
- * TODO: When trace types are moved to the o.e.l.tmf.core plug-in, there will be
- * no need for this class anymore, move to o.e.l.tmf.analysis.xml.core plug-in.
- *
- * @author Geneviève Bastien
- */
-public class XmlHeadInfoUi extends XmlHeadInfo {
-
- /**
- * Constructor
- *
- * @param item
- * The XML node corresponding to this header
- */
- public XmlHeadInfoUi(Node item) {
- super(item);
- }
-
- @Override
- public boolean checkTraceType(Class<? extends ITmfTrace> traceClass) {
- /*
- * TODO: This wouldn't work for custom traces since {@link
- * TmfTraceType#getTraceType(String)} has no helper for those traces
- */
- List<Element> elements = getElements(TmfXmlStrings.TRACETYPE);
- if (elements.isEmpty()) {
- return true;
- }
-
- for (Element element : elements) {
- String traceTypeId = element.getAttribute(TmfXmlStrings.ID);
- TraceTypeHelper helper = TmfTraceType.getInstance().getTraceType(traceTypeId);
- if ((helper != null) && helper.getTrace().getClass().isAssignableFrom(traceClass)) {
- return true;
- }
- }
- return false;
- }
-
-}

Back to the top