org.schmant.project.eclipse
Class EclipseWorkspaceInfoCollector

java.lang.Object
  extended by org.schmant.project.eclipse.EclipseWorkspaceInfoCollector
All Implemented Interfaces:
ProjectRepositoryInfoCollector<EclipseWorkspace,EclipseWorkspaceConfiguration>

public class EclipseWorkspaceInfoCollector
extends Object
implements ProjectRepositoryInfoCollector<EclipseWorkspace,EclipseWorkspaceConfiguration>

This is the default ProjectRepositoryInfoCollector used by EclipseWorkspace. It scans for Eclipse workspace configuration files in the .metadata directory and for project configuration files in all other directories under the workspace root directory and in directories supplied separately in an EclipseWorkspaceSettings object, if any. It creates creates Project objects for all projects found.

The following workspace configuration files are parsed (paths relative to .metadata:

The following files are parsed in each project:

This object uses EclipseProjectCreatorPlugin:s registered in the PluginRegistry for creating Project objects. By registering new plugins, this object can be made to create new kinds of Project objects for new project types.

This class can be also extended by inheritance to give it knowledge about new project types, etc. However, plugins is the preferred extension method.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
EclipseWorkspaceInfoCollector(Object wosDir, EclipseWorkspaceSettings settings)
          Create an Eclipse workspace information collector for the workspace in the provided directory.
 
Method Summary
 ProjectRepositoryInfo<EclipseWorkspaceConfiguration> collect(EclipseWorkspace wos)
          Collect information for the workspace and return an object containing the parsed information.
protected  Project createEclipseProject(EclipseWorkspace wos, DirectoryView projDir, EclipseWorkspaceConfiguration parsedSettings, Report r)
          Create an Eclipse project from the contents in a project directory.
protected  EntityRepository getWorkspaceDir()
          Get the workspace directory.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EclipseWorkspaceInfoCollector

public EclipseWorkspaceInfoCollector(Object wosDir,
                                     EclipseWorkspaceSettings settings)
Create an Eclipse workspace information collector for the workspace in the provided directory.

Parameters:
wosDir - The workspace directory. Interpreted with InterpretAsReadOnlyDirectoryStrategy. (Any filters in the in the DirectoryRepresentation object are ignored, but directory views work as usual.)
settings - Workspace settings. This may be null.
Method Detail

getWorkspaceDir

protected EntityRepository getWorkspaceDir()
Get the workspace directory.

Returns:
The workspace directory.

createEclipseProject

protected Project createEclipseProject(EclipseWorkspace wos,
                                       DirectoryView projDir,
                                       EclipseWorkspaceConfiguration parsedSettings,
                                       Report r)
Create an Eclipse project from the contents in a project directory. This method uses all registered EclipseProjectCreatorPlugin plugins with the name "org.schmant.project.eclipse.EclipseProjectCreatorPlugin" to process the supplied directory.

This may be overridden by subclasses if they want to introduce new kinds of Eclipse projects. The recommended way to do that, however, is via EclipseProjectCreatorPlugin:s.

Parameters:
projDir - The project directory
r - The current Report.
parsedSettings - Settings parsed from the workspace metadata. User- supplied settings should override the values in this object.
Returns:
The created Project or null if the project directory should be ignored.

collect

public ProjectRepositoryInfo<EclipseWorkspaceConfiguration> collect(EclipseWorkspace wos)
Description copied from interface: ProjectRepositoryInfoCollector
Collect information for the workspace and return an object containing the parsed information.

Specified by:
collect in interface ProjectRepositoryInfoCollector<EclipseWorkspace,EclipseWorkspaceConfiguration>
Parameters:
wos - A reference to the workspace object. This method is called from the workspace constructor, so no methods may be called on this object since it is not fully initialized yet. The created projects can save it for future reference, though.
Returns:
Workspace information.

toString

public String toString()
Overrides:
toString in class Object