Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.server.projects.impl
Class ProjectScavengerImpl

java.lang.Object
  extended by eu.esdihumboldt.hale.server.projects.impl.ProjectScavengerImpl
All Implemented Interfaces:
ProjectScavenger

public class ProjectScavengerImpl
extends Object
implements ProjectScavenger

Scans for projects in a directory. Manages if projects are active and in that case publishes them as TransformationEnvironments to an EnvironmentManager.

Author:
Simon Templer

Nested Class Summary
 
Nested classes/interfaces inherited from interface eu.esdihumboldt.hale.server.projects.ProjectScavenger
ProjectScavenger.Status
 
Field Summary
static String DEFAULT_PROJECT_ID
          Project identifier in one project mode.
 
Constructor Summary
ProjectScavengerImpl(EnvironmentManager environments, File scavengeLocation)
          Create a scavenger instance.
 
Method Summary
 void activate(String projectId)
          Activate the project with the given identifier.
 boolean allowAddProject()
          Determines if adding a project generally is allowed/possible.
 void deactivate(String projectId)
          Activate the project with the given identifier.
 ProjectInfo getInfo(String projectId)
          Get the project info for the project with the given identifier, if available.
 File getLoadReports(String projectId)
          Get the file where the reports form loading the project are stored.
 Set<String> getProjects()
          Get the identifiers of the available projects.
 ProjectScavenger.Status getStatus(String projectId)
          Get the status of the project with the given identifier.
protected  ProjectHandler loadProjectHandler(File projectFolder, String projectFileName, String projectId)
          Load a project handler.
 void releaseProjectId(String projectId)
          Release a previously reserved project identifier.
 File reserveProjectId(String projectId)
          Reserve a project identifier, e.g.
 void triggerScan()
          Check if there are any new projects available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROJECT_ID

public static final String DEFAULT_PROJECT_ID
Project identifier in one project mode.

See Also:
Constant Field Values
Constructor Detail

ProjectScavengerImpl

public ProjectScavengerImpl(EnvironmentManager environments,
                            File scavengeLocation)
Create a scavenger instance.

Parameters:
environments - the environments manager to populate
scavengeLocation - the location to scan, if the location does not exist or is not accessible, a default location inside the platform instance location is used
Method Detail

triggerScan

public void triggerScan()
Description copied from interface: ProjectScavenger
Check if there are any new projects available.

Specified by:
triggerScan in interface ProjectScavenger
See Also:
ProjectScavenger.triggerScan()

loadProjectHandler

protected ProjectHandler loadProjectHandler(File projectFolder,
                                            String projectFileName,
                                            String projectId)
                                     throws IOException
Load a project handler.

Parameters:
projectFolder - the project folder
projectFileName - the name of the project file in that folder, may be null if unknown
projectId - the project identifier
Returns:
the project handler
Throws:
IOException - if the project configuration cannot be accessed

reserveProjectId

public File reserveProjectId(String projectId)
                      throws ScavengerException
Description copied from interface: ProjectScavenger
Reserve a project identifier, e.g. if a new project should be uploaded

Specified by:
reserveProjectId in interface ProjectScavenger
Parameters:
projectId - the project identifier
Returns:
the project directory
Throws:
ScavengerException - if the projectId is already taken/reserved or adding new projects is not possible

releaseProjectId

public void releaseProjectId(String projectId)
Description copied from interface: ProjectScavenger
Release a previously reserved project identifier. Also removes the project folder.

Specified by:
releaseProjectId in interface ProjectScavenger
Parameters:
projectId - the project idnetifier
See Also:
ProjectScavenger.releaseProjectId(String)

allowAddProject

public boolean allowAddProject()
Description copied from interface: ProjectScavenger
Determines if adding a project generally is allowed/possible.

Specified by:
allowAddProject in interface ProjectScavenger
Returns:
if adding new projects is allowed

getProjects

public Set<String> getProjects()
Description copied from interface: ProjectScavenger
Get the identifiers of the available projects.

Specified by:
getProjects in interface ProjectScavenger
Returns:
the set of identifiers of all available projects

getStatus

public ProjectScavenger.Status getStatus(String projectId)
Description copied from interface: ProjectScavenger
Get the status of the project with the given identifier.

Specified by:
getStatus in interface ProjectScavenger
Parameters:
projectId - the project identifier
Returns:
the project status

getLoadReports

public File getLoadReports(String projectId)
Description copied from interface: ProjectScavenger
Get the file where the reports form loading the project are stored. The file may not be changed, deleted, etc.

Specified by:
getLoadReports in interface ProjectScavenger
Parameters:
projectId - the project identifier
Returns:
the log file or null if the project with the given identifier does not exist

getInfo

public ProjectInfo getInfo(String projectId)
Description copied from interface: ProjectScavenger
Get the project info for the project with the given identifier, if available.

Specified by:
getInfo in interface ProjectScavenger
Parameters:
projectId - the project identifier
Returns:
the project info or null
See Also:
ProjectScavenger.getInfo(String)

activate

public void activate(String projectId)
Description copied from interface: ProjectScavenger
Activate the project with the given identifier.

Specified by:
activate in interface ProjectScavenger
Parameters:
projectId - the project identifier

deactivate

public void deactivate(String projectId)
Description copied from interface: ProjectScavenger
Activate the project with the given identifier.

Specified by:
deactivate in interface ProjectScavenger
Parameters:
projectId - the project identifier

Humboldt Alignment Editor 2.5.0

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