Class EclipsePersistencer
java.lang.Object
net.ssehub.easy.producer.eclipse.persistency.eclipse.EclipsePersistencer
- All Implemented Interfaces:
net.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
public class EclipsePersistencer
extends Object
implements net.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
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.
This EclipsePersistencer can be used if the whole eclipse infrastructure is available.
The another Persistencer can be used if Eclipse shall not be loaded/used.
- Author:
- El-Sharkawy
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEclipsePersistencer(File projectFolder, EclipseProgressObserver obs, org.eclipse.core.resources.IProject project) This constructor can be used if a project shall be/is stored outside the workspace (e.g.EclipsePersistencer(String projectName, EclipseProgressObserver obs, org.eclipse.core.resources.IProject project) Creates a new Persistencer instance for a project with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionprivate EclipseProjectCreationResultcreateEASyEclipseProject(String projectID, boolean lazy, String... natures) Creates an empty IProject inside the Eclipse workspace which is suitable for EASy.createEASyProject(String projectID, boolean lazy, String... natures) Creates an empty IProject inside the Eclipse workspace which is suitable for EASy.createEASyProject(String projectID, net.ssehub.easy.varModel.model.Project varModel, String... natures) Creates an empty IProject inside the Eclipse workspace which is suitable for EASy.net.ssehub.easy.producer.core.persistence.datatypes.IProjectCreationResultcreateProject(String projectName, File parentFolder, String projectID, boolean lazy) net.ssehub.easy.producer.core.persistence.datatypes.PathEnvironmentnet.ssehub.easy.producer.core.persistence.datatypes.PersistentProjectload()voidsave(net.ssehub.easy.producer.core.mgmt.PLPInfo plp) voidsetStorageFolder(File folder) voidupdate()
-
Field Details
-
WORKSPACE_FOLDER
-
persistencer
private net.ssehub.easy.producer.core.persistence.standard.Persistencer persistencer -
monitor
private org.eclipse.core.runtime.IProgressMonitor monitor -
project
private org.eclipse.core.resources.IProject project -
projectFolder
-
-
Constructor Details
-
EclipsePersistencer
public EclipsePersistencer(String projectName, EclipseProgressObserver obs, org.eclipse.core.resources.IProject project) Creates a new Persistencer instance for a project with the specified name. This project must/will be stored directly into the workspace (no linking supported). If the project shall not be stored directly into the workspace, than please use the other constructor.- Parameters:
projectName- The name of the project (which must be stored inside the workspace).obs- progress observerproject- the project instance to operate on , may be null then a default one may be obtained
-
EclipsePersistencer
public EclipsePersistencer(File projectFolder, EclipseProgressObserver obs, org.eclipse.core.resources.IProject project) This constructor can be used if a project shall be/is stored outside the workspace (e.g. is only linked).- Parameters:
projectFolder- The top level folder of the project.obs- progress observerproject- the project instance to operate on , may be null then a default one may be obtained
-
-
Method Details
-
createEASyEclipseProject
private EclipseProjectCreationResult createEASyEclipseProject(String projectID, boolean lazy, String... natures) throws net.ssehub.easy.producer.core.persistence.PersistenceException, org.eclipse.core.runtime.CoreException Creates an empty IProject inside the Eclipse workspace which is suitable for EASy.- Parameters:
projectID- The unique ID of the project which should be created. Ifnullis inserted, a random ID will be generatedlazy- iftrue, create only required parts, else assume that project does not exist beforenatures- Additional natures which shall be added to the newly created IProject.- Returns:
- An data object which holds information about newly created files, folders, and the IProject.
- Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException- Will be thrown if the System cannot create folders and files in the parentFolder.org.eclipse.core.runtime.CoreException- If Eclipse cannot create a new IProject, e.g. because a project with the desired name already exists
-
createEASyProject
public IEclipseProjectCreationResult createEASyProject(String projectID, boolean lazy, String... natures) throws net.ssehub.easy.producer.core.persistence.PersistenceException, org.eclipse.core.runtime.CoreException Creates an empty IProject inside the Eclipse workspace which is suitable for EASy.- Parameters:
projectID- The unique ID of the project which should be created. Ifnullis inserted, a random ID will be generatedlazy- iftrue, create only required parts, else assume that project does not exist beforenatures- Additional natures which shall be added to the newly created IProject.- Returns:
- An data object which holds information about newly created files, folders, and the IProject.
- Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException- Will be thrown if the System cannot create folders and files in the parentFolder.org.eclipse.core.runtime.CoreException- If Eclipse cannot create a new IProject, e.g. because a project with the desired name already exists
-
createEASyProject
public IEclipseProjectCreationResult createEASyProject(String projectID, net.ssehub.easy.varModel.model.Project varModel, String... natures) throws net.ssehub.easy.producer.core.persistence.PersistenceException, org.eclipse.core.runtime.CoreException Creates an empty IProject inside the Eclipse workspace which is suitable for EASy.- Parameters:
projectID- The unique ID of the project which should be created. Ifnullis inserted, a random ID will be generatedvarModel- An already existing varmodel, which should be integrated into the newly created project.natures- Additional natures which shall be added to the newly created IProject.- Returns:
- An data object which holds information about newly created files, folders, and the IProject.
Contrary to the
createEASyProject(String, boolean, String...)method, theIProjectCreationResult.getVarModelProjectPath()will return the location of the created file for the given varModel. - Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException- Will be thrown if the System cannot create folders and files in the parentFolder.org.eclipse.core.runtime.CoreException- If Eclipse cannot create a new IProject, e.g. because a project with the desired name already exists
-
load
public net.ssehub.easy.producer.core.persistence.datatypes.PersistentProject load() throws net.ssehub.easy.producer.core.persistence.PersistenceException- Specified by:
loadin interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer- Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException
-
save
public void save(net.ssehub.easy.producer.core.mgmt.PLPInfo plp) throws net.ssehub.easy.producer.core.persistence.PersistenceException - Specified by:
savein interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer- Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException
-
createProject
public net.ssehub.easy.producer.core.persistence.datatypes.IProjectCreationResult createProject(String projectName, File parentFolder, String projectID, boolean lazy) throws net.ssehub.easy.producer.core.persistence.PersistenceException - Specified by:
createProjectin interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer- Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException
-
getProjectID
- Specified by:
getProjectIDin interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
-
update
public void update() throws net.ssehub.easy.producer.core.persistence.PersistenceException- Specified by:
updatein interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer- Throws:
net.ssehub.easy.producer.core.persistence.PersistenceException
-
getPathEnvironment
public net.ssehub.easy.producer.core.persistence.datatypes.PathEnvironment getPathEnvironment()- Specified by:
getPathEnvironmentin interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
-
getProjectFolder
- Specified by:
getProjectFolderin interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
-
getEasyConfigFile
- Specified by:
getEasyConfigFilein interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
-
setStorageFolder
- Specified by:
setStorageFolderin interfacenet.ssehub.easy.producer.core.persistence.datatypes.IPersistencer
-