Commit | Line | Data |
---|---|---|
1d7e62f9 GB |
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 | ||
b1ebf44e | 13 | package org.eclipse.linuxtools.tmf.analysis.xml.core.model.readonly; |
1d7e62f9 GB |
14 | |
15 | import java.util.List; | |
16 | ||
17 | import org.eclipse.jdt.annotation.NonNull; | |
18 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.ITmfXmlModelFactory; | |
19 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.ITmfXmlStateAttribute; | |
20 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.ITmfXmlStateValue; | |
21 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.TmfXmlCondition; | |
22 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.TmfXmlEventHandler; | |
23 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.TmfXmlLocation; | |
24 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.TmfXmlStateChange; | |
b1ebf44e | 25 | import org.eclipse.linuxtools.tmf.analysis.xml.core.model.readwrite.TmfXmlReadWriteModelFactory; |
1d7e62f9 GB |
26 | import org.eclipse.linuxtools.tmf.analysis.xml.core.module.IXmlStateSystemContainer; |
27 | import org.w3c.dom.Element; | |
28 | ||
29 | /** | |
b1ebf44e | 30 | * Concrete factory for XML model elements in read only mode |
1d7e62f9 GB |
31 | * |
32 | * @author Geneviève Bastien | |
33 | */ | |
b1ebf44e | 34 | public class TmfXmlReadOnlyModelFactory implements ITmfXmlModelFactory { |
1d7e62f9 GB |
35 | |
36 | private static ITmfXmlModelFactory fInstance = null; | |
37 | ||
38 | /** | |
39 | * Get the instance of this model creator | |
40 | * | |
b1ebf44e | 41 | * @return The {@link TmfXmlReadWriteModelFactory} instance |
1d7e62f9 GB |
42 | */ |
43 | @NonNull | |
44 | public static synchronized ITmfXmlModelFactory getInstance() { | |
45 | ITmfXmlModelFactory instance = fInstance; | |
46 | if (instance == null) { | |
b1ebf44e | 47 | instance = new TmfXmlReadOnlyModelFactory(); |
1d7e62f9 GB |
48 | fInstance = instance; |
49 | } | |
50 | return instance; | |
51 | } | |
52 | ||
53 | @Override | |
54 | public ITmfXmlStateAttribute createStateAttribute(Element attribute, IXmlStateSystemContainer container) { | |
b1ebf44e | 55 | return new TmfXmlReadOnlyStateAttribute(this, attribute, container); |
1d7e62f9 GB |
56 | } |
57 | ||
58 | @Override | |
59 | public ITmfXmlStateValue createStateValue(Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes) { | |
b1ebf44e | 60 | return new TmfXmlReadOnlyStateValue(this, node, container, attributes); |
1d7e62f9 GB |
61 | } |
62 | ||
63 | @Override | |
64 | public ITmfXmlStateValue createStateValue(Element node, IXmlStateSystemContainer container, String eventField) { | |
b1ebf44e | 65 | return new TmfXmlReadOnlyStateValue(this, node, container, eventField); |
1d7e62f9 GB |
66 | } |
67 | ||
68 | @Override | |
69 | public TmfXmlCondition createCondition(Element node, IXmlStateSystemContainer container) { | |
70 | return new TmfXmlCondition(this, node, container); | |
71 | } | |
72 | ||
73 | @Override | |
74 | public TmfXmlEventHandler createEventHandler(Element node, IXmlStateSystemContainer container) { | |
75 | return new TmfXmlEventHandler(this, node, container); | |
76 | } | |
77 | ||
78 | @Override | |
79 | public TmfXmlStateChange createStateChange(Element node, IXmlStateSystemContainer container) { | |
80 | return new TmfXmlStateChange(this, node, container); | |
81 | } | |
82 | ||
83 | @Override | |
84 | public TmfXmlLocation createLocation(Element node, IXmlStateSystemContainer container) { | |
85 | return new TmfXmlLocation(this, node, container); | |
86 | } | |
87 | ||
88 | } |