Package org.eclipse.epsilon.emc.emf
Class EmfModel
java.lang.Object
org.eclipse.epsilon.eol.models.Model
org.eclipse.epsilon.eol.models.CachedModel<org.eclipse.emf.ecore.EObject>
org.eclipse.epsilon.emc.emf.AbstractEmfModel
org.eclipse.epsilon.emc.emf.AbstractReflectiveEmfModel
org.eclipse.epsilon.emc.emf.EmfModel
- All Implemented Interfaces:
AutoCloseable
,IModel
,IReflectiveModel
- Direct Known Subclasses:
DecoratorEmfModel
,EmfM0Model
,InMemoryEmfModel
,UmlModel
,XmlModel
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
This listener is the one that keeps the cached .allInstances and model .allContents() lists up to date, instead of the usual createInstance/deleteInstance methods.Nested classes/interfaces inherited from interface org.eclipse.epsilon.eol.models.IModel
IModel.AmbiguityCheckResult
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Deprecated.protected List<org.eclipse.emf.common.util.URI>
protected List<org.eclipse.emf.common.util.URI>
protected org.eclipse.emf.common.util.URI
protected List<org.eclipse.emf.ecore.EPackage>
static final String
One of the keys used to construct the first argument toModel.load(StringProperties, String)
.static final String
Deprecated.static final String
Deprecated.Replaced byPROPERTY_FILE_BASED_METAMODEL_URI
.static final String
One of the keys used to construct the first argument toModel.load(StringProperties, String)
.static final String
Deprecated.Replaced byPROPERTY_MODEL_URI
.static final String
One of the keys used to construct the first argument toModel.load(StringProperties, String)
.static final String
One of the keys used to construct the first argument toModel.load(StringProperties, String)
.static final String
One of the keys used to construct the first argument toModel.load(StringProperties, String)
.protected boolean
protected boolean
protected boolean
Fields inherited from class org.eclipse.epsilon.emc.emf.AbstractEmfModel
expand, modelImpl, PROPERTY_EXPAND, PROPERTY_PARALLELALLOF, registry, resourceLoadOptions, resourceStoreOptions, transactionSupport
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds an adapter which incrementally maintainsType.all
queries.protected void
addToCache
(String type, org.eclipse.emf.ecore.EObject instance) protected org.eclipse.emf.ecore.resource.ResourceSet
protected void
determinePackagesFrom
(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) void
protected void
forceAddToCache
(org.eclipse.emf.ecore.EObject instance) We want to use the overridden method, but not fromCachedModel.createInstance(String)
, but rather from the adapter we set up to track additions and removals from the contents of a model.protected void
forceRemoveFromCache
(org.eclipse.emf.ecore.EObject instance) getMetamodel
(StringProperties properties, IRelativePathResolver resolver) List<org.eclipse.emf.common.util.URI>
org.eclipse.emf.common.util.URI
boolean
Deprecated.This value is no longer used to load models: it is only kept for backwards compatibility, and it now simply indicates whether a file metamodel was loaded at all, or not.boolean
boolean
void
load
(StringProperties properties, IRelativePathResolver resolver) Load the model using the set of properties specified by the first argument.protected void
void
protected void
Removes the contents adapter that was added byaddContentsAdapter()
.protected void
removeFromCache
(org.eclipse.emf.ecore.EObject instance) void
setCachingEnabled
(boolean cachingEnabled) void
setMetamodelFile
(String path) void
setMetamodelFileBased
(boolean isMetamodelFileBased) Deprecated.This value is no longer honored anymore.void
setMetamodelFiles
(List<String> paths) void
setMetamodelFileUri
(org.eclipse.emf.common.util.URI uri) void
setMetamodelFileUris
(List<org.eclipse.emf.common.util.URI> fileUris) void
setMetamodelUri
(String uri) void
setMetamodelUris
(List<String> uris) void
setModelFile
(String path) void
setModelFileUri
(org.eclipse.emf.common.util.URI modelFileUri) void
setReuseUnmodifiedFileBasedMetamodels
(boolean reuseUnmodifiedFileBasedMetamodels) void
void
setValidate
(boolean validate) boolean
store()
toString()
Methods inherited from class org.eclipse.epsilon.emc.emf.AbstractReflectiveEmfModel
getEnumerationLabelOf, getEnumerationTypeOf, getPropertiesOf, getPropertySetter, hasPackage, hasProperty, isEnumerationValue, preventLoadingOfExternalModelElements
Methods inherited from class org.eclipse.epsilon.emc.emf.AbstractEmfModel
addMetamodelUri, allContentsFromModel, checkAmbiguity, classesForName, classForName, classForName, classForName, createInstanceInModel, deleteElementInModel, getAllOfKindFromModel, getAllOfTypeFromModel, getAllTypeNamesOf, getCacheKeyForType, getContainerOf, getElementById, getElementId, getEnumerationValue, getFullyQualifiedName, getFullyQualifiedTypeNameOf, getInputStream, getModelImpl, getPackageRegistry, getResource, getResourceLoadOptions, getResources, getResourceStoreOptions, getTransactionSupport, getTypeNameOf, getTypeOf, hasAdapter, hasType, initCaches, isExpand, isInstantiable, isLoaded, isModelElement, isOfKind, isOfType, isParallelAllOf, isPropertySet, knowsAboutProperty, knowsAboutProperty, owns, putResourceLoadOption, putResourceStoreOption, setElementId, setExpand, setModelImpl, setParallelAllOf, setResource, setResourceLoadOptions, setResourceStoreOptions, store, store, store, validate
Methods inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContents, clearCache, createInstance, deleteElement, dispose, getAllOfKind, getAllOfKindOrType, getAllOfType, isCachingEnabled, isConcurrent, load, setConcurrent, wrap
Methods inherited from class org.eclipse.epsilon.eol.models.Model
allInstances, createInstance, getAliases, getName, getPropertyGetter, isReadOnLoad, isStoredOnDisposal, load, load, setName, setReadOnLoad, setStoredOnDisposal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.epsilon.eol.models.IModel
allContents, checkAmbiguity, close, createInstance, createInstance, deleteElement, dispose, getAliases, getAllOfKind, getAllOfType, getElementById, getElementId, getEnumerationValue, getFullyQualifiedTypeNameOf, getName, getPropertyGetter, getTransactionSupport, getTypeNameOf, getTypeOf, hasType, isInstantiable, isModelElement, isOfKind, isOfType, isPropertySet, isReadOnLoad, isStoredOnDisposal, knowsAboutProperty, load, load, load, owns, setElementId, setName, setReadOnLoad, setStoredOnDisposal, store
Methods inherited from interface org.eclipse.epsilon.eol.models.IReflectiveModel
getContainerOf
-
Field Details
-
PROPERTY_IS_METAMODEL_FILE_BASED
Deprecated.PROPERTY_METAMODEL_URI
andPROPERTY_FILE_BASED_METAMODEL_URI
are now interpreted as comma-separated lists of 0+ metamodel locations, and it is allowed to mix both types of metamodels now. This property is no longer used.- See Also:
-
PROPERTY_METAMODEL_URI
One of the keys used to construct the first argument toModel.load(StringProperties, String)
. This key is a comma-separated list of zero or more namespaces URI of some of the metamodels to which this model conforms. Users may combine this key withPROPERTY_FILE_BASED_METAMODEL_URI
to load both file-based and URI-based metamodels at the same time.- See Also:
-
PROPERTY_FILE_BASED_METAMODEL_URI
One of the keys used to construct the first argument toModel.load(StringProperties, String)
. This key is a comma-separated list of zero or moreURI
s that can be used to locate some of the metamodels to which this model conforms. Users may combine this key withPROPERTY_METAMODEL_URI
to load both file-based and URI-based metamodels at the same time.- See Also:
-
PROPERTY_METAMODEL_FILE
Deprecated.Replaced byPROPERTY_FILE_BASED_METAMODEL_URI
. This property will be removed in a future release of Epsilon.- See Also:
-
PROPERTY_MODEL_URI
One of the keys used to construct the first argument toModel.load(StringProperties, String)
. This key is paired with aURI
that can be used to locate this model. This key must always be paired with a value.- See Also:
-
PROPERTY_MODEL_FILE
Deprecated.Replaced byPROPERTY_MODEL_URI
. This property will be removed in a future release of Epsilon.- See Also:
-
PROPERTY_REUSE_UNMODIFIED_FILE_BASED_METAMODELS
One of the keys used to construct the first argument toModel.load(StringProperties, String)
. This key is a Boolean value that if set totrue
(the default), tries to reuse previously registered file-based EPackages that have not been modified since the last time they were registered.- See Also:
-
PROPERTY_VALIDATE
One of the keys used to construct the first argument toModel.load(StringProperties, String)
. This key is a Boolean value that if set totrue
it triggers validation of all the resources in the model's resource set after loading (default isfalse
)- See Also:
-
metamodelUris
-
packages
-
isMetamodelFileBased
Deprecated. -
modelUri
protected org.eclipse.emf.common.util.URI modelUri -
metamodelFileUris
-
useExtendedMetadata
protected boolean useExtendedMetadata -
validate
protected boolean validate -
reuseUnmodifiedFileBasedMetamodels
protected boolean reuseUnmodifiedFileBasedMetamodels -
fileBasedMetamodels
-
fileBasedMetamodelTimestamps
-
-
Constructor Details
-
EmfModel
public EmfModel()
-
-
Method Details
-
load
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException Load the model using the set of properties specified by the first argument.- Specified by:
load
in interfaceIModel
- Overrides:
load
in classAbstractEmfModel
- Throws:
EolModelLoadingException
- See Also:
-
loadModel
- Specified by:
loadModel
in classCachedModel<org.eclipse.emf.ecore.EObject>
- Throws:
EolModelLoadingException
-
addToCache
protected void addToCache(String type, org.eclipse.emf.ecore.EObject instance) throws EolModelElementTypeNotFoundException - Overrides:
addToCache
in classCachedModel<org.eclipse.emf.ecore.EObject>
- Throws:
EolModelElementTypeNotFoundException
-
removeFromCache
protected void removeFromCache(org.eclipse.emf.ecore.EObject instance) throws EolModelElementTypeNotFoundException - Overrides:
removeFromCache
in classCachedModel<org.eclipse.emf.ecore.EObject>
- Throws:
EolModelElementTypeNotFoundException
-
forceAddToCache
protected void forceAddToCache(org.eclipse.emf.ecore.EObject instance) throws EolModelElementTypeNotFoundException We want to use the overridden method, but not fromCachedModel.createInstance(String)
, but rather from the adapter we set up to track additions and removals from the contents of a model. For this reason, we leave the overridden method empty and define this one that can be safely called from the adapter. -
forceRemoveFromCache
protected void forceRemoveFromCache(org.eclipse.emf.ecore.EObject instance) throws EolModelElementTypeNotFoundException - Throws:
EolModelElementTypeNotFoundException
- See Also:
-
#forceAddToCache(String, EObject)
-
setupContainmentChangeListeners
public void setupContainmentChangeListeners() -
createResourceSet
protected org.eclipse.emf.ecore.resource.ResourceSet createResourceSet() -
loadModelFromUri
- Throws:
EolModelLoadingException
-
setCachingEnabled
public void setCachingEnabled(boolean cachingEnabled) - Overrides:
setCachingEnabled
in classCachedModel<org.eclipse.emf.ecore.EObject>
- Since:
- 1.6
-
removeContentsAdapter
protected void removeContentsAdapter()Removes the contents adapter that was added byaddContentsAdapter()
. -
addContentsAdapter
protected void addContentsAdapter()Adds an adapter which incrementally maintainsType.all
queries. If you override this method to add a different implementation, make sure thatremoveContentsAdapter()
will still remove it. -
disposeModel
public void disposeModel()- Overrides:
disposeModel
in classAbstractEmfModel
-
getMetamodelFiles
-
isMetamodelFileBased
Deprecated.This value is no longer used to load models: it is only kept for backwards compatibility, and it now simply indicates whether a file metamodel was loaded at all, or not. -
setMetamodelFileBased
Deprecated.This value is no longer honored anymore. Please populate the lists ingetMetamodelUris()
(URI-based metamodels) andgetMetamodelFileUris()
(file-based metamodels) appropriately instead. -
getMetamodelUris
-
getModelFile
-
getModelFileUri
public org.eclipse.emf.common.util.URI getModelFileUri() -
setModelFileUri
public void setModelFileUri(org.eclipse.emf.common.util.URI modelFileUri) -
getMetamodelFileUris
-
setMetamodelFileUris
-
setMetamodelFileUri
public void setMetamodelFileUri(org.eclipse.emf.common.util.URI uri) -
setMetamodelUris
-
setMetamodelUri
-
setMetamodelFiles
-
setMetamodelFile
-
setModelFile
-
isReuseUnmodifiedFileBasedMetamodels
public boolean isReuseUnmodifiedFileBasedMetamodels() -
setReuseUnmodifiedFileBasedMetamodels
public void setReuseUnmodifiedFileBasedMetamodels(boolean reuseUnmodifiedFileBasedMetamodels) -
toString
-
determinePackagesFrom
protected void determinePackagesFrom(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) throws EolModelLoadingException - Throws:
EolModelLoadingException
-
getMetamodel
- Specified by:
getMetamodel
in interfaceIModel
- Overrides:
getMetamodel
in classModel
-
store
public boolean store() -
isValidate
public boolean isValidate() -
setValidate
public void setValidate(boolean validate)
-
PROPERTY_METAMODEL_URI
andPROPERTY_FILE_BASED_METAMODEL_URI
are now interpreted as comma-separated lists of 0+ metamodel locations, and it is allowed to mix both types of metamodels now.