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
Nested ClassesModifier and TypeClassDescriptionprotected classThis 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
FieldsModifier and TypeFieldDescriptionprotected booleanDeprecated.protected List<org.eclipse.emf.common.util.URI>protected List<org.eclipse.emf.common.util.URI>protected org.eclipse.emf.common.util.URIprotected List<org.eclipse.emf.ecore.EPackage>static final StringOne of the keys used to construct the first argument toModel.load(StringProperties, String).static final StringDeprecated.static final StringDeprecated.Replaced byPROPERTY_FILE_BASED_METAMODEL_URI.static final StringOne of the keys used to construct the first argument toModel.load(StringProperties, String).static final StringDeprecated.Replaced byPROPERTY_MODEL_URI.static final StringOne of the keys used to construct the first argument toModel.load(StringProperties, String).static final StringOne of the keys used to construct the first argument toModel.load(StringProperties, String).static final StringOne of the keys used to construct the first argument toModel.load(StringProperties, String).protected booleanprotected booleanprotected booleanFields inherited from class org.eclipse.epsilon.emc.emf.AbstractEmfModel
expand, modelImpl, PROPERTY_EXPAND, PROPERTY_PARALLELALLOF, registry, resourceLoadOptions, resourceStoreOptions, transactionSupportFields inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContentsCache, kindCache, PROPERTY_CACHED, PROPERTY_CONCURRENT, typeCacheFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds an adapter which incrementally maintainsType.allqueries.protected voidaddToCache(String type, org.eclipse.emf.ecore.EObject instance) protected org.eclipse.emf.ecore.resource.ResourceSetprotected voiddeterminePackagesFrom(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) voidprotected voidforceAddToCache(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 voidforceRemoveFromCache(org.eclipse.emf.ecore.EObject instance) getMetamodel(StringProperties properties, IRelativePathResolver resolver) List<org.eclipse.emf.common.util.URI>org.eclipse.emf.common.util.URIbooleanDeprecated.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.booleanbooleanvoidload(StringProperties properties, IRelativePathResolver resolver) Load the model using the set of properties specified by the first argument.protected voidvoidprotected voidRemoves the contents adapter that was added byaddContentsAdapter().protected voidremoveFromCache(org.eclipse.emf.ecore.EObject instance) voidsetCachingEnabled(boolean cachingEnabled) voidsetMetamodelFile(String path) voidsetMetamodelFileBased(boolean isMetamodelFileBased) Deprecated.This value is no longer honored anymore.voidsetMetamodelFiles(List<String> paths) voidsetMetamodelFileUri(org.eclipse.emf.common.util.URI uri) voidsetMetamodelFileUris(List<org.eclipse.emf.common.util.URI> fileUris) voidsetMetamodelUri(String uri) voidsetMetamodelUris(List<String> uris) voidsetModelFile(String path) voidsetModelFileUri(org.eclipse.emf.common.util.URI modelFileUri) voidsetReuseUnmodifiedFileBasedMetamodels(boolean reuseUnmodifiedFileBasedMetamodels) voidvoidsetValidate(boolean validate) booleanstore()toString()Methods inherited from class org.eclipse.epsilon.emc.emf.AbstractReflectiveEmfModel
getEnumerationLabelOf, getEnumerationTypeOf, getPropertiesOf, getPropertySetter, hasPackage, hasProperty, isEnumerationValue, preventLoadingOfExternalModelElementsMethods 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, validateMethods inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContents, clearCache, createInstance, deleteElement, dispose, getAllOfKind, getAllOfKindOrType, getAllOfType, isCachingEnabled, isConcurrent, load, setConcurrent, wrap, wrapUnmodifiableMethods inherited from class org.eclipse.epsilon.eol.models.Model
allInstances, createInstance, getAliases, getName, getPropertyGetter, isReadOnLoad, isStoredOnDisposal, load, load, setName, setReadOnLoad, setStoredOnDisposalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, storeMethods inherited from interface org.eclipse.epsilon.eol.models.IReflectiveModel
getContainerOf
-
Field Details
-
PROPERTY_IS_METAMODEL_FILE_BASED
Deprecated.PROPERTY_METAMODEL_URIandPROPERTY_FILE_BASED_METAMODEL_URIare 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_URIto 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 moreURIs that can be used to locate some of the metamodels to which this model conforms. Users may combine this key withPROPERTY_METAMODEL_URIto 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 aURIthat 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 totrueit 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:
loadin interfaceIModel- Overrides:
loadin classAbstractEmfModel- Throws:
EolModelLoadingException- See Also:
-
loadModel
- Specified by:
loadModelin classCachedModel<org.eclipse.emf.ecore.EObject>- Throws:
EolModelLoadingException
-
addToCache
protected void addToCache(String type, org.eclipse.emf.ecore.EObject instance) throws EolModelElementTypeNotFoundException - Overrides:
addToCachein classCachedModel<org.eclipse.emf.ecore.EObject>- Throws:
EolModelElementTypeNotFoundException
-
removeFromCache
protected void removeFromCache(org.eclipse.emf.ecore.EObject instance) throws EolModelElementTypeNotFoundException - Overrides:
removeFromCachein 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:
setCachingEnabledin 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.allqueries. If you override this method to add a different implementation, make sure thatremoveContentsAdapter()will still remove it. -
disposeModel
public void disposeModel()- Overrides:
disposeModelin 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:
getMetamodelin interfaceIModel- Overrides:
getMetamodelin classModel
-
store
public boolean store() -
isValidate
public boolean isValidate() -
setValidate
public void setValidate(boolean validate)
-
PROPERTY_METAMODEL_URIandPROPERTY_FILE_BASED_METAMODEL_URIare now interpreted as comma-separated lists of 0+ metamodel locations, and it is allowed to mix both types of metamodels now.