Package org.eclipse.epsilon.emc.plainxml
Class PlainXmlModel
- java.lang.Object
-
- org.eclipse.epsilon.eol.models.Model
-
- org.eclipse.epsilon.eol.models.CachedModel<org.w3c.dom.Element>
-
- org.eclipse.epsilon.emc.plainxml.PlainXmlModel
-
- All Implemented Interfaces:
java.lang.AutoCloseable,IModel
public class PlainXmlModel extends CachedModel<org.w3c.dom.Element>
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<Binding>bindingsprotected java.util.ArrayList<org.w3c.dom.Element>createdElementsprotected static java.lang.StringDEFAULT_NEW_TAG_NAMEprotected org.w3c.dom.Documentdocumentprotected static java.lang.StringELEMENT_TYPEprotected java.io.Filefileprotected java.lang.StringidAttributeNamestatic java.lang.StringPROPERTY_FILEstatic java.lang.StringPROPERTY_URIprotected java.lang.Stringuriprotected java.lang.Stringxml-
Fields inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContentsCache, kindCache, PROPERTY_CACHED, PROPERTY_CONCURRENT, typeCache
-
Fields inherited from class org.eclipse.epsilon.eol.models.Model
aliases, ENV_PREFIX, name, PROPERTY_ALIASES, PROPERTY_NAME, PROPERTY_READONLOAD, PROPERTY_READONLY, PROPERTY_STOREONDISPOSAL, propertyGetter, propertySetter, readOnLoad, storeOnDisposal
-
-
Constructor Summary
Constructors Constructor Description PlainXmlModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<org.w3c.dom.Element>allContentsFromModel()voidbind(java.lang.String sourceTag, java.lang.String sourceAttribute, java.lang.String targetTag, java.lang.String targetAttribute, boolean many)voidcollectAllElements(org.w3c.dom.Node root, java.util.Collection<org.w3c.dom.Element> elements)org.w3c.dom.ElementcreateInstance(java.lang.String type, java.util.Collection<java.lang.Object> parameters)protected org.w3c.dom.ElementcreateInstanceInModel(java.lang.String type)protected booleandeleteElementInModel(java.lang.Object instance)Returns true iff the given instance was deleted from the model.protected voiddisposeModel()protected java.util.Collection<org.w3c.dom.Element>getAllOfKindFromModel(java.lang.String type)protected java.util.Collection<org.w3c.dom.Element>getAllOfTypeFromModel(java.lang.String type)protected java.util.Collection<java.lang.String>getAllTypeNamesOf(java.lang.Object instance)Returns the fully qualified names of every type to which the given object conforms.java.util.List<Binding>getBindings()protected java.lang.ObjectgetCacheKeyForType(java.lang.String type)Returns an identity for the given type, which will be used byCachedModelas a key for the memoization of model elements by type.org.w3c.dom.DocumentgetDocument()java.lang.ObjectgetElementById(java.lang.String id)java.lang.StringgetElementId(java.lang.Object instance)java.lang.ObjectgetEnumerationValue(java.lang.String enumeration, java.lang.String label)java.io.FilegetFile()java.lang.StringgetIdAttributeName()org.w3c.dom.NodegetRoot()java.lang.StringgetTypeNameOf(java.lang.Object instance)Returns a string representing the type of the instance object.java.lang.ObjectgetTypeOf(java.lang.Object instance)java.lang.StringgetUri()java.lang.StringgetXml()booleanhasType(java.lang.String type)booleanisInstantiable(java.lang.String type)booleanisLoaded()Convenience method for determining when a model has been loaded.booleanisModelElement(java.lang.Object instance)Used to test whether a Java object can be contained by this model.voidload(StringProperties properties, IRelativePathResolver resolver)protected voidloadModel()booleanowns(java.lang.Object instance)Used to test whether an object is contained in this model.voidsetElementId(java.lang.Object instance, java.lang.String newId)voidsetFile(java.io.File file)voidsetIdAttributeName(java.lang.String idAttributeName)voidsetRoot(org.w3c.dom.Node node)voidsetUri(java.lang.String uri)voidsetXml(java.lang.String xml)booleanstore()booleanstore(java.lang.String location)booleantagMatches(org.w3c.dom.Element element, java.lang.String name)-
Methods inherited from class org.eclipse.epsilon.eol.models.CachedModel
addToCache, allContents, clearCache, createInstance, deleteElement, dispose, getAllOfKind, getAllOfKindOrType, getAllOfType, initCaches, isCachingEnabled, isConcurrent, load, removeFromCache, setCachingEnabled, setConcurrent, wrap
-
Methods inherited from class org.eclipse.epsilon.eol.models.Model
allInstances, getAliases, getFullyQualifiedTypeNameOf, getMetamodel, getName, getPropertyGetter, getPropertySetter, getTransactionSupport, isOfKind, isOfType, isPropertySet, isReadOnLoad, isStoredOnDisposal, knowsAboutProperty, load, load, setName, setReadOnLoad, setStoredOnDisposal
-
-
-
-
Field Detail
-
idAttributeName
protected java.lang.String idAttributeName
-
document
protected org.w3c.dom.Document document
-
uri
protected java.lang.String uri
-
file
protected java.io.File file
-
xml
protected java.lang.String xml
-
createdElements
protected java.util.ArrayList<org.w3c.dom.Element> createdElements
-
bindings
protected java.util.ArrayList<Binding> bindings
-
ELEMENT_TYPE
protected static final java.lang.String ELEMENT_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_NEW_TAG_NAME
protected static final java.lang.String DEFAULT_NEW_TAG_NAME
- See Also:
- Constant Field Values
-
PROPERTY_FILE
public static final java.lang.String PROPERTY_FILE
- See Also:
- Constant Field Values
-
PROPERTY_URI
public static final java.lang.String PROPERTY_URI
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRoot
public org.w3c.dom.Node getRoot()
-
setRoot
public void setRoot(org.w3c.dom.Node node)
-
allContentsFromModel
protected java.util.Collection<org.w3c.dom.Element> allContentsFromModel()
- Specified by:
allContentsFromModelin classCachedModel<org.w3c.dom.Element>
-
getBindings
public java.util.List<Binding> getBindings()
-
getUri
public java.lang.String getUri()
-
setUri
public void setUri(java.lang.String uri)
-
getXml
public java.lang.String getXml()
-
setXml
public void setXml(java.lang.String xml)
-
getFile
public java.io.File getFile()
-
setFile
public void setFile(java.io.File file)
-
getDocument
public org.w3c.dom.Document getDocument()
-
bind
public void bind(java.lang.String sourceTag, java.lang.String sourceAttribute, java.lang.String targetTag, java.lang.String targetAttribute, boolean many)
-
isLoaded
public boolean isLoaded()
Description copied from class:CachedModelConvenience method for determining when a model has been loaded.- Overrides:
isLoadedin classCachedModel<org.w3c.dom.Element>- Returns:
- Whether the cache has been populated.
- Since:
- 1.6
-
createInstanceInModel
protected org.w3c.dom.Element createInstanceInModel(java.lang.String type) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException- Specified by:
createInstanceInModelin classCachedModel<org.w3c.dom.Element>- Throws:
EolModelElementTypeNotFoundExceptionEolNotInstantiableModelElementTypeException
-
createInstance
public org.w3c.dom.Element createInstance(java.lang.String type, java.util.Collection<java.lang.Object> parameters) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException- Specified by:
createInstancein interfaceIModel- Overrides:
createInstancein classModel- Throws:
EolModelElementTypeNotFoundExceptionEolNotInstantiableModelElementTypeException
-
deleteElementInModel
protected boolean deleteElementInModel(java.lang.Object instance) throws EolRuntimeExceptionDescription copied from class:CachedModelReturns true iff the given instance was deleted from the model.- Specified by:
deleteElementInModelin classCachedModel<org.w3c.dom.Element>- Throws:
EolRuntimeException
-
collectAllElements
public void collectAllElements(org.w3c.dom.Node root, java.util.Collection<org.w3c.dom.Element> elements)
-
getAllOfKindFromModel
protected java.util.Collection<org.w3c.dom.Element> getAllOfKindFromModel(java.lang.String type) throws EolModelElementTypeNotFoundException- Specified by:
getAllOfKindFromModelin classCachedModel<org.w3c.dom.Element>- Throws:
EolModelElementTypeNotFoundException
-
getAllOfTypeFromModel
protected java.util.Collection<org.w3c.dom.Element> getAllOfTypeFromModel(java.lang.String type) throws EolModelElementTypeNotFoundException- Specified by:
getAllOfTypeFromModelin classCachedModel<org.w3c.dom.Element>- Throws:
EolModelElementTypeNotFoundException
-
tagMatches
public boolean tagMatches(org.w3c.dom.Element element, java.lang.String name)
-
disposeModel
protected void disposeModel()
- Specified by:
disposeModelin classCachedModel<org.w3c.dom.Element>
-
getElementById
public java.lang.Object getElementById(java.lang.String id)
-
getElementId
public java.lang.String getElementId(java.lang.Object instance)
-
setElementId
public void setElementId(java.lang.Object instance, java.lang.String newId)
-
setIdAttributeName
public void setIdAttributeName(java.lang.String idAttributeName)
-
getIdAttributeName
public java.lang.String getIdAttributeName()
-
getEnumerationValue
public java.lang.Object getEnumerationValue(java.lang.String enumeration, java.lang.String label) throws EolEnumerationValueNotFoundException
-
getTypeNameOf
public java.lang.String getTypeNameOf(java.lang.Object instance)
Description copied from interface:IModelReturns a string representing the type of the instance object. The value returned by this function can be passed to createInstance to instantiate another object of the same type as instance.- Parameters:
instance- The model object whose type is to be determined.- Returns:
- the name of the type of the model object, instance.
-
getCacheKeyForType
protected java.lang.Object getCacheKeyForType(java.lang.String type) throws EolModelElementTypeNotFoundExceptionDescription copied from class:CachedModelReturns an identity for the given type, which will be used byCachedModelas a key for the memoization of model elements by type.- Specified by:
getCacheKeyForTypein classCachedModel<org.w3c.dom.Element>- Throws:
EolModelElementTypeNotFoundException
-
getAllTypeNamesOf
protected java.util.Collection<java.lang.String> getAllTypeNamesOf(java.lang.Object instance)
Description copied from class:CachedModelReturns the fully qualified names of every type to which the given object conforms. The values are used by byCachedModelfor the memoization of model elements by their kind (CachedModel.getAllOfKind(String)).- Specified by:
getAllTypeNamesOfin classCachedModel<org.w3c.dom.Element>
-
getTypeOf
public java.lang.Object getTypeOf(java.lang.Object instance)
-
hasType
public boolean hasType(java.lang.String type)
-
isInstantiable
public boolean isInstantiable(java.lang.String type)
-
isModelElement
public boolean isModelElement(java.lang.Object instance)
Description copied from interface:IModelUsed to test whether a Java object can be contained by this model. For example, EMF models can contain instances of EObject, but not instances of just Object.- Specified by:
isModelElementin interfaceIModel- Overrides:
isModelElementin classModel- Parameters:
instance- the Java object to test.- Returns:
- true if and only if instance can be contained by this model.
-
loadModel
protected void loadModel() throws EolModelLoadingException- Specified by:
loadModelin classCachedModel<org.w3c.dom.Element>- Throws:
EolModelLoadingException
-
load
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException
- Specified by:
loadin interfaceIModel- Overrides:
loadin classCachedModel<org.w3c.dom.Element>- Throws:
EolModelLoadingException
-
owns
public boolean owns(java.lang.Object instance)
Description copied from interface:IModelUsed to test whether an object is contained in this model.- Parameters:
instance- the Java object to test.- Returns:
- true if and only if instance is contained by this model.
-
store
public boolean store(java.lang.String location)
-
store
public boolean store()
-
-