Class ResourceManager<T extends EObject>
- java.lang.Object
-
- java.util.Observable
-
- org.palladiosimulator.pcmtx.pcmtxviews.resource.ResourceManager<T>
-
public class ResourceManager<T extends EObject> extends Observable
This class encapsulates the access to emf model files of type pcmtx and resourcetype.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PCMTX_FILE_EXTENSION
static String
RESOURCETYPE_FILE_EXTENSION
-
Constructor Summary
Constructors Constructor Description ResourceManager()
Creates a newResourceManager
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the state of theResourceManager
.T
getEObject(Class<T> c)
Returns the firstEObject
of the mainResource
of theResourceSet
ornull
if theResourceSet
does not contain anyResource
s or the mainResource
does not contain anyEObject
.List<EObject>
getResourceSetContents()
Returns a list of the contents contained in the resources of the resource set.URI
getResourceURI()
void
loadResourceToResourceSet(URI uri)
void
persistChangesToWorkspaceResource(T eobj)
Persists the givenEObject
to the current model resource in the workspace.void
removeListener()
Removes workspace listener.void
setResource(IResource workspaceResource)
Clears theResourceSet
and sets the main model resource to the one specified by the given workspaceresource
.-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Field Detail
-
PCMTX_FILE_EXTENSION
public static final String PCMTX_FILE_EXTENSION
- See Also:
- Constant Field Values
-
RESOURCETYPE_FILE_EXTENSION
public static final String RESOURCETYPE_FILE_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
setResource
public void setResource(IResource workspaceResource)
Clears theResourceSet
and sets the main model resource to the one specified by the given workspaceresource
.workspaceResource
may benull
.
-
loadResourceToResourceSet
public void loadResourceToResourceSet(URI uri)
-
persistChangesToWorkspaceResource
public void persistChangesToWorkspaceResource(T eobj) throws CoreException
Persists the givenEObject
to the current model resource in the workspace.- Parameters:
eobj
- theEObject
to persist- Throws:
CoreException
- if persisting failed.
-
getEObject
public T getEObject(Class<T> c)
Returns the firstEObject
of the mainResource
of theResourceSet
ornull
if theResourceSet
does not contain anyResource
s or the mainResource
does not contain anyEObject
.
-
getResourceURI
public URI getResourceURI()
- Returns:
- the
URI
of the mainResource
in theResourceSet
-
getResourceSetContents
public List<EObject> getResourceSetContents()
Returns a list of the contents contained in the resources of the resource set.- Returns:
- a list of the contents contained in the resources of the resource set
-
removeListener
public void removeListener()
Removes workspace listener.
-
clear
public void clear()
Clears the state of theResourceManager
.
-
-