Class ResourceSetPartition
java.lang.Object
de.uka.ipd.sdq.workflow.mdsd.blackboard.ResourceSetPartition
Implementation of a blackboard partition based on EMF Resource Sets. Each partition has a
resource set configured for the given EPackages. It can load a set of model resources.
Inter-Model links are resolved up to the boundaries of the underlying resource set
-
Field Summary
Modifier and TypeFieldDescriptionprotected ResourceSet
Common EMF resource set for all models in this partition. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetContents
(URI modelURI) Returns all top level EObjects of the given model stored under the given URI.getElement
(EClass targetType) Helper to find root objects of a specified class.getFirstContentElement
(URI modelURI) Returns the first top level EObject of the given model stored under the given URI.Gets the resource set.boolean
hasElement
(EClass targetType) Helper to determine whether root objects of a specified class exist.boolean
Determines if the Resource referenced by the parameter contains an EMF model.void
initialiseResourceSetEPackages
(EPackage[] ePackages) Initialize the EPackages of the models to be stored in this blackboard partition.Deprecated.Use loadModel taking a URI insteadLoad the model with the given URI into this blackboard partition.void
Resolve all model proxies, i.e., load all dependent models.void
setContents
(URI modelID, List<EObject> newContents) Replaces the contents of the given model with newContents.void
setContents
(URI modelID, EObject newContents) Replaces the contents of the given model with newContents.void
Stores all resources in the resource set.void
storeAllResources
(Map<String, Object> saveOptions) Stores all resources in the resource set.
-
Field Details
-
rs
Common EMF resource set for all models in this partition.
-
-
Constructor Details
-
ResourceSetPartition
public ResourceSetPartition()
-
-
Method Details
-
getResourceSet
Gets the resource set.- Returns:
- Returns the internal used resource set of this blackboard partition
-
initialiseResourceSetEPackages
Initialize the EPackages of the models to be stored in this blackboard partition.- Parameters:
ePackages
- The list of EPackages which form the meta-model of the model stored in this model partition
-
loadModel
Load the model with the given URI into this blackboard partition.- Parameters:
modelURI
- The URI of the model to be loaded- Returns:
- The loaded resource
-
getContents
Returns all top level EObjects of the given model stored under the given URI. The model has to be created first.- Parameters:
modelURI
- The model URI- Returns:
- All top level elements of the model. Empty list if none have been found.
-
getFirstContentElement
Returns the first top level EObject of the given model stored under the given URI. The model has to be created first and it has to have at least one top level element- Parameters:
modelURI
- The model URI- Returns:
- The first top level element of the model
-
loadModel
Deprecated.Use loadModel taking a URI insteadLoad the model with the given URI into this blackboard partition.- Parameters:
modelURI
- The URI of the model to be loaded- Returns:
- The loaded resource
-
resolveAllProxies
public void resolveAllProxies()Resolve all model proxies, i.e., load all dependent models. -
setContents
Replaces the contents of the given model with newContents.- Parameters:
modelID
- The model extent whose contents get replacednewContents
- The new contents
-
setContents
Replaces the contents of the given model with newContents.- Parameters:
modelID
- The model extent whose contents get replacednewContents
- The new contents, single object
-
hasModel
Determines if the Resource referenced by the parameter contains an EMF model.- Parameters:
modelURI
- URI of the Resource.- Returns:
true
if, and only if, an EMF model is contained.
-
storeAllResources
Stores all resources in the resource set.- Throws:
IOException
- If saving leads to I/O-Errors.
-
storeAllResources
Stores all resources in the resource set.- Parameters:
saveOptions
- Save options to use- Throws:
IOException
- IOException If saving leads to I/O-Errors.
-
getElement
Helper to find root objects of a specified class.- Type Parameters:
T
- the generic type- Parameters:
targetType
- the target type- Returns:
- The list of found root elements. Empty list if none have been found.
-
hasElement
Helper to determine whether root objects of a specified class exist.- Parameters:
targetType
- the target type- Returns:
- true if elements have been found; false otherwise.
-