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 aDataRepositoryin a pcmtx model. It provides methods to addTables andDatabases to and to removeTables andDatabases from a pcmtx model. AResourceManagerprovides access to the model resource.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateAndAddEmptyDatabase()Creates a defaultDatabaseand adds it to theDataRepository.voidcreateAndAddEmptyTable()Creates a defaultTableand adds it to theDataRepository.List<Database>getAvailableDatabases()Returns the list of availableDatabases contained in the currently managedDataRepositoryor in one of the other loadedDataRepositories.DataRepositorygetEObject()Returns theDataRepositoryof the pcmtx model.static DataRepositoryManagergetInstance()Returns the singleton instance of this class.List<org.palladiosimulator.pcm.resourcetype.ResourceRepository>getLoadedResourceRepositories()Returns the list of loadedResourceRepositories.voidloadResource(URI uri)voidreloadEObject()Reloads the currentDataRepositoryto see modifications made by other parties.voidremoveDatabase(Database db)Removes the givenDatabasefrom theDataRepository.voidremoveTable(Table table)Removes the givenTablefrom theDataRepository.voidsaveEObject()Persists theDataRepositoryto the model file.voidsetEObject(IResource newResource)Sets theDataRepositoryto the one contained in the given emf workspace resource.voidupdate(Observable o, Object arg)Notifies theDataRepositoriesManagerabout 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 theDataRepositoryof the pcmtx model.- Specified by:
getEObjectin classEObjectManager<DataRepository>- Returns:
- the
DataRepositoryof the pcmtx model
-
createAndAddEmptyTable
public void createAndAddEmptyTable()
Creates a defaultTableand adds it to theDataRepository.
-
removeTable
public void removeTable(Table table)
Removes the givenTablefrom theDataRepository.- Parameters:
table- theTableto remove
-
createAndAddEmptyDatabase
public void createAndAddEmptyDatabase()
Creates a defaultDatabaseand adds it to theDataRepository.
-
removeDatabase
public void removeDatabase(Database db)
Removes the givenDatabasefrom theDataRepository.- Parameters:
db- theDatabaseto remove
-
setEObject
public void setEObject(IResource newResource) throws CoreException
Sets theDataRepositoryto the one contained in the given emf workspace resource. Persists the oldDataRepositoryto the model file if it contains unsaved changes.- Specified by:
setEObjectin classEObjectManager<DataRepository>- Parameters:
newResource- the emf workspace resource containing the newDataRepository- Throws:
CoreException- if persisting of the oldDataRepositoryfailed.
-
reloadEObject
public void reloadEObject()
Reloads the currentDataRepositoryto see modifications made by other parties.- Specified by:
reloadEObjectin classEObjectManager<DataRepository>
-
saveEObject
public void saveEObject() throws CoreExceptionPersists theDataRepositoryto the model file.- Specified by:
saveEObjectin classEObjectManager<DataRepository>- Throws:
CoreException- if persisting failed
-
getAvailableDatabases
public List<Database> getAvailableDatabases()
Returns the list of availableDatabases contained in the currently managedDataRepositoryor in one of the other loadedDataRepositories.- Returns:
- the list of available
Databases
-
update
public void update(Observable o, Object arg)
Notifies theDataRepositoriesManagerabout changes. Used by theResourceManagerto notify about loaded resources which are containing furtherDataRepositoriesorResourceRepositories. Also used by theResourceRepositoryManagerto notify about a newResourceRepositoryor 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
-
-