Class DataStorage
- java.lang.Object
-
- net.ssehub.easy.producer.core.persistence.internal.DataStorage
-
- All Implemented Interfaces:
StorageConnector
public class DataStorage extends java.lang.Object implements StorageConnector
Extensible delegator for persistent access. This delegator supports saving and (partial) loading ofModels. Supported persistent formats can be found inStorageType.- Author:
- Kapeluch, El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private StorageConnectorconnectorprivate java.lang.Stringlocationprivate PathEnvironmentpathEnvprivate StorageTypetype
-
Constructor Summary
Constructors Constructor Description DataStorage(StorageType type, java.lang.String location, PathEnvironment pathEnv)Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateConnector()Creates and returns a specific storage-connector.java.lang.StringgetLocation()Returns the storage-location.PathEnvironmentgetPathEnvironment()Returns the path environment used for making paths relative.java.lang.StringgetProjectID()Returns the UUID of a given pl project.voidloadModels(Model... models)Loads the specified models.voidloadModels(PersistentProject project)Method for loading models out of a persistent file/database.voidsaveModels(PersistentProject project)Saves data from given model to storage.voidsetLocation(java.lang.String storageLocation)Setter for the location of the file to be read/written.
-
-
-
Field Detail
-
type
private StorageType type
-
location
private java.lang.String location
-
connector
private StorageConnector connector
-
pathEnv
private PathEnvironment pathEnv
-
-
Constructor Detail
-
DataStorage
public DataStorage(StorageType type, java.lang.String location, PathEnvironment pathEnv)
Sole constructor.- Parameters:
type- Storage typelocation- LocationpathEnv- an instance to make locations relative
-
-
Method Detail
-
getLocation
public java.lang.String getLocation()
Returns the storage-location.- Returns:
- the storageLocation
-
setLocation
public void setLocation(java.lang.String storageLocation)
Setter for the location of the file to be read/written.- Parameters:
storageLocation- the storageLocation to set
-
createConnector
public void createConnector()
Creates and returns a specific storage-connector.
-
loadModels
public void loadModels(Model... models) throws PersistenceException
Description copied from interface:StorageConnectorLoads the specified models.- Specified by:
loadModelsin interfaceStorageConnector- Parameters:
models- the models to load- Throws:
PersistenceException- in case of reading errors
-
loadModels
public void loadModels(PersistentProject project) throws PersistenceException
Description copied from interface:StorageConnectorMethod for loading models out of a persistent file/database.- Specified by:
loadModelsin interfaceStorageConnector- Parameters:
project- APersistentProjectholding an empty array ofModelsfor storing the information read in a persistent file/database. These models must only contain the correctModelTypes, for managing which parts should be loaded.- Throws:
PersistenceException- Will be thrown if an error is occurred during reading the persistent information.
-
saveModels
public void saveModels(PersistentProject project) throws PersistenceException
Description copied from interface:StorageConnectorSaves data from given model to storage.- Specified by:
saveModelsin interfaceStorageConnector- Parameters:
project- The information which should be saved in non ivml files.- Throws:
PersistenceException- Will be thrown if an error is occurred during reading the persistent information.
-
getProjectID
public java.lang.String getProjectID()
Description copied from interface:StorageConnectorReturns the UUID of a given pl project.- Specified by:
getProjectIDin interfaceStorageConnector- Returns:
- the id or null if the specified project has no configuration file.
-
getPathEnvironment
public PathEnvironment getPathEnvironment()
Description copied from interface:StorageConnectorReturns the path environment used for making paths relative.- Specified by:
getPathEnvironmentin interfaceStorageConnector- Returns:
- the path environment
-
-