Class DataRepositoryManager
- java.lang.Object
-
- java.util.Observable
-
- org.palladiosimulator.pcmtx.pcmtxviews.manager.EObjectManager<DataRepository>
-
- org.palladiosimulator.pcmtx.pcmtxviews.manager.DataRepositoryManager
-
- All Implemented Interfaces:
Observer
public final class DataRepositoryManager extends EObjectManager<DataRepository>
This class encapsulates the access to aDataRepository
in a pcmtx model. It provides methods to addTable
s andDatabase
s to and to removeTable
s andDatabase
s from a pcmtx model. AResourceManager
provides access to the model resource.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createAndAddEmptyDatabase()
Creates a defaultDatabase
and adds it to theDataRepository
.void
createAndAddEmptyTable()
Creates a defaultTable
and adds it to theDataRepository
.List<Database>
getAvailableDatabases()
Returns the list of availableDatabase
s contained in the currently managedDataRepository
or in one of the other loadedDataRepositories
.DataRepository
getEObject()
Returns theDataRepository
of the pcmtx model.static DataRepositoryManager
getInstance()
Returns the singleton instance of this class.List<org.palladiosimulator.pcm.resourcetype.ResourceRepository>
getLoadedResourceRepositories()
Returns the list of loadedResourceRepositories
.void
loadResource(URI uri)
void
reloadEObject()
Reloads the currentDataRepository
to see modifications made by other parties.void
removeDatabase(Database db)
Removes the givenDatabase
from theDataRepository
.void
removeTable(Table table)
Removes the givenTable
from theDataRepository
.void
saveEObject()
Persists theDataRepository
to the model file.void
setEObject(IResource newResource)
Sets theDataRepository
to the one contained in the given emf workspace resource.void
update(Observable o, Object arg)
Notifies theDataRepositoriesManager
about changes.-
Methods inherited from class org.palladiosimulator.pcmtx.pcmtxviews.manager.EObjectManager
clear, getResourceManager, isDirty, runLastUpdate, setDirty, setLastUpdate
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Method Detail
-
getInstance
public static DataRepositoryManager getInstance()
Returns the singleton instance of this class.- Returns:
- the singleton instance
-
getEObject
public DataRepository getEObject()
Returns theDataRepository
of the pcmtx model.- Specified by:
getEObject
in classEObjectManager<DataRepository>
- Returns:
- the
DataRepository
of the pcmtx model
-
createAndAddEmptyTable
public void createAndAddEmptyTable()
Creates a defaultTable
and adds it to theDataRepository
.
-
removeTable
public void removeTable(Table table)
Removes the givenTable
from theDataRepository
.- Parameters:
table
- theTable
to remove
-
createAndAddEmptyDatabase
public void createAndAddEmptyDatabase()
Creates a defaultDatabase
and adds it to theDataRepository
.
-
removeDatabase
public void removeDatabase(Database db)
Removes the givenDatabase
from theDataRepository
.- Parameters:
db
- theDatabase
to remove
-
setEObject
public void setEObject(IResource newResource) throws CoreException
Sets theDataRepository
to the one contained in the given emf workspace resource. Persists the oldDataRepository
to the model file if it contains unsaved changes.- Specified by:
setEObject
in classEObjectManager<DataRepository>
- Parameters:
newResource
- the emf workspace resource containing the newDataRepository
- Throws:
CoreException
- if persisting of the oldDataRepository
failed.
-
reloadEObject
public void reloadEObject()
Reloads the currentDataRepository
to see modifications made by other parties.- Specified by:
reloadEObject
in classEObjectManager<DataRepository>
-
saveEObject
public void saveEObject() throws CoreException
Persists theDataRepository
to the model file.- Specified by:
saveEObject
in classEObjectManager<DataRepository>
- Throws:
CoreException
- if persisting failed
-
getAvailableDatabases
public List<Database> getAvailableDatabases()
Returns the list of availableDatabase
s contained in the currently managedDataRepository
or in one of the other loadedDataRepositories
.- Returns:
- the list of available
Database
s
-
update
public void update(Observable o, Object arg)
Notifies theDataRepositoriesManager
about changes. Used by theResourceManager
to notify about loaded resources which are containing furtherDataRepositories
orResourceRepositories
. Also used by theResourceRepositoryManager
to notify about a newResourceRepository
or about modifications in the current one.
-
getLoadedResourceRepositories
public List<org.palladiosimulator.pcm.resourcetype.ResourceRepository> getLoadedResourceRepositories()
Returns the list of loadedResourceRepositories
.- Returns:
- the list of loaded
ResourceRepositories
-
-