Class 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 of Models. Supported persistent formats can be found in StorageType.
    Author:
    Kapeluch, El-Sharkawy
    • Constructor Detail

      • DataStorage

        public DataStorage​(StorageType type,
                           java.lang.String location,
                           PathEnvironment pathEnv)
        Sole constructor.
        Parameters:
        type - Storage type
        location - Location
        pathEnv - 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​(PersistentProject project)
                        throws PersistenceException
        Description copied from interface: StorageConnector
        Method for loading models out of a persistent file/database.
        Specified by:
        loadModels in interface StorageConnector
        Parameters:
        project - A PersistentProject holding an empty array of Models for storing the information read in a persistent file/database. These models must only contain the correct ModelTypes, for managing which parts should be loaded.
        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: StorageConnector
        Returns the UUID of a given pl project.
        Specified by:
        getProjectID in interface StorageConnector
        Returns:
        the id or null if the specified project has no configuration file.