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.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. -
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 voidaddToCache(String type, org.eclipse.emf.ecore.EObject instance) protected org.eclipse.emf.ecore.resource.ResourceSetprotected voiddeterminePackagesFrom(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) protected 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) getEnumerationLabelOf(Object literal) Returns the enumeration label of the literal parameter.getEnumerationTypeOf(Object literal) Returns the name of the enumeration type of the literal parameter.getMetamodel(StringProperties properties, IRelativePathResolver resolver) List<org.eclipse.emf.common.util.URI>org.eclipse.emf.common.util.URIgetPropertiesOf(String type) Returns a collection containing all of the properties that instances of type know about.booleanhasPackage(String packageName) Returns true iff this model contains a package with the given name.booleanhasProperty(String type, String property) booleanisEnumerationValue(Object object) Returns true iff object is an enumeration value.booleanDeprecated.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 voidvoidbooleanPrevents the loading of model elements that are referenced by this model but are not contained in this model.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.AbstractEmfModel
addMetamodelUri, allContentsFromModel, classForName, classForName, classForName, createInstanceInModel, deleteElementInModel, disposeModel, 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, wrapMethods 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, 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
-
getPropertySetter
- Specified by:
getPropertySetterin interfaceIModel- Specified by:
getPropertySetterin interfaceIReflectiveModel- Overrides:
getPropertySetterin classModel
-
getPropertiesOf
Description copied from interface:IReflectiveModelReturns a collection containing all of the properties that instances of type know about.- Specified by:
getPropertiesOfin interfaceIReflectiveModel- Parameters:
type- The type of model object whose properties are to be determined.- Returns:
- all of the properties that instances of type knows about.
- Throws:
EolModelElementTypeNotFoundException- when this model has no such type
-
preventLoadingOfExternalModelElements
public boolean preventLoadingOfExternalModelElements()Description copied from interface:IReflectiveModelPrevents the loading of model elements that are referenced by this model but are not contained in this model. This is useful for clients, such as Epsilon Flock, which create a clone or conservative copy of this model.- Specified by:
preventLoadingOfExternalModelElementsin interfaceIReflectiveModel- Returns:
- true iff this method had an effect (i.e. when this model supports external references, was configured to load external references and is no longer configured to load external references).
-
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
-
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) -
hasProperty
public boolean hasProperty(String type, String property) throws EolModelElementTypeNotFoundException - Specified by:
hasPropertyin interfaceIReflectiveModel- Throws:
EolModelElementTypeNotFoundException
-
isEnumerationValue
Description copied from interface:IReflectiveModelReturns true iff object is an enumeration value.- Specified by:
isEnumerationValuein interfaceIReflectiveModel
-
getEnumerationTypeOf
Description copied from interface:IReflectiveModelReturns the name of the enumeration type of the literal parameter.- Specified by:
getEnumerationTypeOfin interfaceIReflectiveModel- Throws:
EolNotAnEnumerationValueException- when literal is not an enumeration value
-
getEnumerationLabelOf
Description copied from interface:IReflectiveModelReturns the enumeration label of the literal parameter.- Specified by:
getEnumerationLabelOfin interfaceIReflectiveModel- Throws:
EolNotAnEnumerationValueException- when literal is not an enumeration value
-
toString
-
determinePackagesFrom
protected void determinePackagesFrom(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) throws EolModelLoadingException - Throws:
EolModelLoadingException
-
hasPackage
Description copied from interface:IReflectiveModelReturns true iff this model contains a package with the given name. In general, a "package" is a group of types (and potentially other packages) and a namespace for the grouped elements. The precise semantics of "package" is specific to the implementation. For example, an Ecore implementation might use EPackage. An XML implementation might use XML namespaces. A CSV implementation might not support any notion of packages (and hence always return false).- Specified by:
hasPackagein interfaceIReflectiveModel
-
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.