Class Persistencer

  • All Implemented Interfaces:
    IPersistencer, PersistenceConstants

    public class Persistencer
    extends java.lang.Object
    implements IPersistencer, PersistenceConstants
    This class represents an interlayer between persistency-layer and model. It provides functions for loading a model from the storage or saving it to storage. Therefore it performs a conversion between the persistency model and the application model. Uses UrlResolver.
    Author:
    El-Sharkawy
    • Field Detail

      • LOGGER

        private static final net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLogger LOGGER
      • observer

        private net.ssehub.easy.basics.progress.ProgressObserver observer
      • projectFolder

        private java.io.File projectFolder
    • Constructor Detail

      • Persistencer

        public Persistencer​(PathEnvironment pathEnv,
                            java.io.File projectFolder,
                            java.lang.String storageFile,
                            net.ssehub.easy.basics.progress.ProgressObserver observer)
        Sole constructor for this class for saving/reading persistence information out of a xml file.
        Parameters:
        pathEnv - a path environment for making files and paths relative
        projectFolder - The location of the product line project.
        storageFile - The absolute path of the file, which should be read/be written. for loading (nested) ivml models.
        observer - a progress observer, may be ProgressObserver.NO_OBSERVER
    • Method Detail

      • loadDefaultModels

        private void loadDefaultModels()
        Loads the default models if existent.
      • load

        public PersistentProject load()
                               throws PersistenceException
        Description copied from interface: IPersistencer
        Loads a PersistentProject, which is an EASy project representation, from a storage (file system).
        Specified by:
        load in interface IPersistencer
        Returns:
        The PersistentProject of the project which should be loaded.
        Throws:
        PersistenceException - In case of an incorrect data format of the configuration file, this exception will be thrown.
      • createProject

        public IProjectCreationResult createProject​(java.lang.String projectName,
                                                    java.io.File parentFolder,
                                                    java.lang.String projectID,
                                                    boolean lazy)
                                             throws PersistenceException
        Description copied from interface: IPersistencer
        Creates an empty EASy project without any eclipse specific stuff.
        Specified by:
        createProject in interface IPersistencer
        Parameters:
        projectName - The name of the project, which should be created.
        parentFolder - The parentFolder, where the project should be created.
        projectID - The unique ID of the project which should be created.
        lazy - if true, create only required parts, else assume that project does not exist before
        Returns:
        IProjectCreationResult Information of newly created items.
        Throws:
        PersistenceException - Will be thrown if the System cannot create folders and files in the parentFolder.
      • getProjectID

        public java.lang.String getProjectID()
        Returns the ID of a given EASy project.
        Specified by:
        getProjectID in interface IPersistencer
        Returns:
        the id or null if the specified project has no configuration file.