TMF: Add XML state provider analysis module and XML utilities
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.analysis.xml.core / src / org / eclipse / linuxtools / tmf / analysis / xml / core / stateprovider / XmlStateSystemModule.java
1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider;
14
15 import org.eclipse.core.runtime.IPath;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.eclipse.linuxtools.tmf.analysis.xml.core.module.IXmlModuleMetadata;
18 import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlHeadInfo;
19 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
20 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
21
22 /**
23 * Analysis module for the data-driven state systems, defined in XML.
24 *
25 * @author Geneviève Bastien
26 * @since 3.0
27 */
28 public class XmlStateSystemModule extends TmfStateSystemAnalysisModule
29 implements IXmlModuleMetadata {
30
31 private IPath fXmlFile;
32 private XmlHeadInfo fHeadInfo = null;
33
34 @Override
35 protected StateSystemBackendType getBackendType() {
36 return StateSystemBackendType.FULL;
37 }
38
39 @Override
40 @NonNull
41 protected ITmfStateProvider createStateProvider() {
42 return new XmlStateProvider(getTrace(), getId(), fXmlFile);
43 }
44
45 @Override
46 public String getName() {
47 String name = fHeadInfo.getName();
48 if (name == null) {
49 name = getId();
50 }
51 return name;
52 }
53
54 /**
55 * Sets the file path of the XML file containing the state provider
56 *
57 * @param file
58 * The full path to the XML file
59 */
60 public void setXmlFile(IPath file) {
61 fXmlFile = file;
62 }
63
64 @Override
65 public void setHeadInfo(XmlHeadInfo headInfo) {
66 fHeadInfo = headInfo;
67 }
68
69 /**
70 * Get the path to the XML file containing this state provider definition.
71 *
72 * @return XML file path
73 */
74 public IPath getXmlFile() {
75 return fXmlFile;
76 }
77
78 }
This page took 0.031631 seconds and 5 git commands to generate.