org.springframework.roo.project
Class AbstractPathResolver

java.lang.Object
  extended by org.springframework.roo.project.AbstractPathResolver
All Implemented Interfaces:
PathResolver

public abstract class AbstractPathResolver
extends Object
implements PathResolver

Abstract PathResolver implementation.

Subclasses should be created for common build system structures.

Since:
1.0
Author:
Ben Alex

Constructor Summary
AbstractPathResolver()
           
 
Method Summary
 String getFriendlyName(String identifier)
          Converts the presented canonical path into a human-friendly name.
 String getIdentifier(Path path, String relativePath)
          Produces a canonical path for the presented Path and relative path.
 List<Path> getNonSourcePaths()
          Similar to PathResolver.getSourcePaths(), but only returns Paths which are not compiled.
 Path getPath(String identifier)
          Attempts to determine which Path the specified canonical path falls under.
protected abstract  List<PathInformation> getPathInformation()
          Called by the init() method when it wishes to obtain a list of paths to register.
 List<Path> getPaths()
          Returns all paths supported by the implementation, in an order defined by the implementation.
 String getRelativeSegment(String identifier)
          Attempts to determine which Path the specified canonical path falls under, and then returns the relative portion of the file name.
 String getRoot(Path path)
          Returns a canonical path that represents the root of the presented Path.
 List<Path> getSourcePaths()
          Indicates all the source code Paths known to this PathResolver.
protected  void init()
          Called by the subclass when they are ready to complete initialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPathResolver

public AbstractPathResolver()
Method Detail

getPathInformation

protected abstract List<PathInformation> getPathInformation()
Called by the init() method when it wishes to obtain a list of paths to register.

Returns:
an unmodifiable list of path (required)

init

protected void init()
Called by the subclass when they are ready to complete initialization. This means their getPathInformation() method is ready to be called.


getFriendlyName

public String getFriendlyName(String identifier)
Description copied from interface: PathResolver
Converts the presented canonical path into a human-friendly name.

Specified by:
getFriendlyName in interface PathResolver
Parameters:
identifier - to resolve (required)
Returns:
a human-friendly name for the identifier (required)

getRoot

public String getRoot(Path path)
Description copied from interface: PathResolver
Returns a canonical path that represents the root of the presented Path.

Specified by:
getRoot in interface PathResolver
Parameters:
path - to lookup (required)
Returns:
the root of the path (never null or empty)

getPaths

public List<Path> getPaths()
Description copied from interface: PathResolver
Returns all paths supported by the implementation, in an order defined by the implementation.

By default this method will return, in the following order:

Specified by:
getPaths in interface PathResolver
Returns:
all supported paths (never null and never empty)

getNonSourcePaths

public List<Path> getNonSourcePaths()
Description copied from interface: PathResolver
Similar to PathResolver.getSourcePaths(), but only returns Paths which are not compiled.

By default this method will return, in the following order:

Specified by:
getNonSourcePaths in interface PathResolver
Returns:
the paths which are not compiled, in an order defined by the implementation (never null and never empty).

getSourcePaths

public List<Path> getSourcePaths()
Description copied from interface: PathResolver
Indicates all the source code Paths known to this PathResolver.

Whilst generally add-ons should know which paths contain source and which do not, this method abstracts add-ons from direct knowledge of available paths.

By default this method will return, in the following order:

Specified by:
getSourcePaths in interface PathResolver
Returns:
the paths, in order of compilation priority (never null and never empty)

getPath

public Path getPath(String identifier)
Description copied from interface: PathResolver
Attempts to determine which Path the specified canonical path falls under.

Specified by:
getPath in interface PathResolver
Parameters:
identifier - to lookup (required)
Returns:
the Path, or null if the identifier refers to a location not under a know path.

getRelativeSegment

public String getRelativeSegment(String identifier)
Description copied from interface: PathResolver
Attempts to determine which Path the specified canonical path falls under, and then returns the relative portion of the file name.

See FileDetails.getRelativeSegment(String) for related information.

Specified by:
getRelativeSegment in interface PathResolver
Parameters:
identifier - to resolve (required)
Returns:
the relative segment (which may be an empty string if the identifier referred to the Path directly), or null if the identifier does not have a corresponding Path

getIdentifier

public String getIdentifier(Path path,
                            String relativePath)
Description copied from interface: PathResolver
Produces a canonical path for the presented Path and relative path.

Specified by:
getIdentifier in interface PathResolver
Parameters:
path - to use (required)
relativePath - to use (cannot be null, but may be empty if referring to the path itself)
Returns:
the canonical path to the file (never null)


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.