Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.server.projects.impl.internal
Class ProjectHandler

java.lang.Object
  extended by eu.esdihumboldt.hale.server.projects.impl.internal.ProjectHandler

public class ProjectHandler
extends Object

Represents a project residing in a specific folder and its configuration. The configuration is stored in a file in the project folder.

Author:
Simon Templer

Field Summary
static String CONFIG_FILE_NAME
          The name of the project configuration file in the project folder.
static String REPORT_FILE_NAME
          The name of the log file in the project folder, containing the reports from loading the project.
 
Constructor Summary
ProjectHandler(File projectFolder, String overrideProjectFile, String projectId)
           
 
Method Summary
 void activate(EnvironmentManager environments)
          Activate the project.
 void deactivate(EnvironmentManager environments)
          Deactivate the project.
protected  String findProjectFile(File projectDir)
          Find a candidate for the project file to load.
 File getLoadReportFile()
          Get the file the reports for loading the project are stored in.
protected  File getProjectFile()
          Get the project file is possible.
 ProjectInfo getProjectInfo()
          Get the project information if available.
 ProjectScavenger.Status getStatus()
          Get the project status.
protected  Set<String> getSupportedExtensions()
          Get the supported file extensions for projects.
 TransformationEnvironment getTransformationEnvironment()
          Get the transformation environment if available.
 void update(EnvironmentManager envManager)
          Updates the project status from the configuration and if needed loads the project and transformation environment and adds or removes the transformation environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_FILE_NAME

public static final String CONFIG_FILE_NAME
The name of the project configuration file in the project folder.

See Also:
Constant Field Values

REPORT_FILE_NAME

public static final String REPORT_FILE_NAME
The name of the log file in the project folder, containing the reports from loading the project.

See Also:
Constant Field Values
Constructor Detail

ProjectHandler

public ProjectHandler(File projectFolder,
                      String overrideProjectFile,
                      String projectId)
               throws IOException
Parameters:
projectFolder - the project folder
overrideProjectFile - the name of the project file if it should override the configuration, otherwise null
projectId - the project identifier
Throws:
IOException - if accessing the project configuration file failed
Method Detail

update

public void update(EnvironmentManager envManager)
Updates the project status from the configuration and if needed loads the project and transformation environment and adds or removes the transformation environment.

Parameters:
envManager - the environment manager

getTransformationEnvironment

public TransformationEnvironment getTransformationEnvironment()
Get the transformation environment if available.

Returns:
the transformationEnvironment

getProjectInfo

public ProjectInfo getProjectInfo()
Get the project information if available.

Returns:
the projectInfo

getStatus

public ProjectScavenger.Status getStatus()
Get the project status.

Returns:
the status

getLoadReportFile

public File getLoadReportFile()
Get the file the reports for loading the project are stored in.

Returns:
the report file

getProjectFile

protected File getProjectFile()
Get the project file is possible.

Returns:
the project file or null

findProjectFile

protected String findProjectFile(File projectDir)
Find a candidate for the project file to load.

Parameters:
projectDir - the project directory
Returns:
the name of the project file candidate in that directory, null if none was found

getSupportedExtensions

protected Set<String> getSupportedExtensions()
Get the supported file extensions for projects.

Returns:
the set of file extensions (with leading dot)

activate

public void activate(EnvironmentManager environments)
Activate the project.

Parameters:
environments - the environment manager to publish the transformation environment to

deactivate

public void deactivate(EnvironmentManager environments)
Deactivate the project.

Parameters:
environments - the environment manager to remove the transformation environment from if applicable

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d