net.dpml.tools
Interface Context

All Known Implementing Classes:
DefaultContext

public interface Context

Project context.

Version:
1.1.0
Author:
Digital Product Meta Library

Method Summary
 File createFile(String path)
          Create a file relative to the resource basedir.
 Path createPath(Resource[] resources)
          Utility operation to construct a new path using a supplied array of resources.
 Path createPath(Resource[] resources, boolean resolve, boolean filter)
          Utility operation to construct a new path using a supplied array of resources.
 Path createPath(Scope scope)
          Utility operation to construct a new classpath path instance.
 File getEtcDataDirectory()
          Return the project etc/data directory.
 File getEtcDirectory()
          Return the project etc directory.
 File getEtcMainDirectory()
          Return the project etc/main directory.
 File getEtcTestDirectory()
          Return the project etc/test directory.
 String getLayoutBase(String id)
          Return the directory path representing the module structure and type using the layout strategy employed by the cache.
 String getLayoutFilename(String id)
          Return a filename using the layout strategy employed by the cache.
 String getLayoutPath(String id)
          Return the full path to an artifact using the layout employed by the cache.
 Library getLibrary()
          Return the resource library.
 Path getPath(Scope scope)
          Return an Ant path suitable for compile or runtime usage.
 Project getProject()
          Return the associated project.
 String getProperty(String key)
          Return the value of a property.
 String getProperty(String key, String value)
          Return the value of a property.
 Resource getResource()
          Return the active resource.
 File getSrcDirectory()
          Return the project source directory.
 File getSrcDocsDirectory()
          Return the project source docs directory.
 File getSrcMainDirectory()
          Return the project source main directory.
 File getSrcTestDirectory()
          Return the project source test directory.
 File getTargetBuildDirectory()
          Return the project target build directory.
 File getTargetBuildDocsDirectory()
          Return the project target build docs directory.
 File getTargetBuildMainDirectory()
          Return the project target build main directory.
 File getTargetBuildTestDirectory()
          Return the project target build test directory.
 File getTargetClassesDirectory()
          Return the project target root classes directory.
 File getTargetClassesMainDirectory()
          Return the project target main classes directory.
 File getTargetClassesTestDirectory()
          Return the project target test classes directory.
 File getTargetDeliverable(String type)
          Return the project target deliverables directory.
 File getTargetDeliverablesDirectory()
          Return the project target deliverables directory.
 File getTargetDirectory()
          Return the project target directory.
 File getTargetDirectory(String path)
          Return a directory within the target directory.
 File getTargetDocsDirectory()
          Return the project target reports docs directory.
 File getTargetReportsDirectory()
          Return the project target reports directory.
 File getTargetReportsJavadocDirectory()
          Return the project target javadoc reports directory.
 File getTargetReportsMainDirectory()
          Return the project target main reports directory.
 File getTargetReportsTestDirectory()
          Return the project target test reports directory.
 File getTargetTempDirectory()
          Return the project target temp directory.
 File getTargetTestDirectory()
          Return the project target test directory.
 void init()
          Initialize the context.
 

Method Detail

getProject

public Project getProject()
Return the associated project.

Returns:
the ant project

getProperty

public String getProperty(String key)
Return the value of a property.

Parameters:
key - the property key
Returns:
the property value or null if undefined

getProperty

public String getProperty(String key,
                          String value)
Return the value of a property. If the project contains a declaration for the property then that value will be returned, otherwise the property will be resolved relative to the current resource.

Parameters:
key - the property key
value - the default value
Returns:
the property value or null if undefined

init

public void init()
Initialize the context.


getPath

public Path getPath(Scope scope)
Return an Ant path suitable for compile or runtime usage. If the supplied scope is less than Scope.RUNTIME a runtime path is returned otherwise the test path is returned.

Parameters:
scope - the build scope
Returns:
the path object

getResource

public Resource getResource()
Return the active resource.

Returns:
the resource definition

getLibrary

public Library getLibrary()
Return the resource library.

Returns:
the library

getSrcDirectory

public File getSrcDirectory()
Return the project source directory.

Returns:
the directory

getSrcMainDirectory

public File getSrcMainDirectory()
Return the project source main directory.

Returns:
the directory

getSrcTestDirectory

public File getSrcTestDirectory()
Return the project source test directory.

Returns:
the directory

getSrcDocsDirectory

public File getSrcDocsDirectory()
Return the project source docs directory.

Returns:
the directory

getEtcDirectory

public File getEtcDirectory()
Return the project etc directory.

Returns:
the directory

getEtcMainDirectory

public File getEtcMainDirectory()
Return the project etc/main directory.

Returns:
the directory

getEtcTestDirectory

public File getEtcTestDirectory()
Return the project etc/test directory.

Returns:
the directory

getEtcDataDirectory

public File getEtcDataDirectory()
Return the project etc/data directory.

Returns:
the directory

getTargetDirectory

public File getTargetDirectory()
Return the project target directory.

Returns:
the directory

getTargetDirectory

public File getTargetDirectory(String path)
Return a directory within the target directory.

Parameters:
path - the path
Returns:
the directory

getTargetTempDirectory

public File getTargetTempDirectory()
Return the project target temp directory.

Returns:
the directory

getTargetBuildDirectory

public File getTargetBuildDirectory()
Return the project target build directory.

Returns:
the directory

getTargetBuildMainDirectory

public File getTargetBuildMainDirectory()
Return the project target build main directory.

Returns:
the directory

getTargetBuildTestDirectory

public File getTargetBuildTestDirectory()
Return the project target build test directory.

Returns:
the directory

getTargetBuildDocsDirectory

public File getTargetBuildDocsDirectory()
Return the project target build docs directory.

Returns:
the directory

getTargetClassesDirectory

public File getTargetClassesDirectory()
Return the project target root classes directory.

Returns:
the directory

getTargetClassesMainDirectory

public File getTargetClassesMainDirectory()
Return the project target main classes directory.

Returns:
the directory

getTargetClassesTestDirectory

public File getTargetClassesTestDirectory()
Return the project target test classes directory.

Returns:
the directory

getTargetReportsDirectory

public File getTargetReportsDirectory()
Return the project target reports directory.

Returns:
the directory

getTargetReportsTestDirectory

public File getTargetReportsTestDirectory()
Return the project target test reports directory.

Returns:
the directory

getTargetReportsMainDirectory

public File getTargetReportsMainDirectory()
Return the project target main reports directory.

Returns:
the directory

getTargetReportsJavadocDirectory

public File getTargetReportsJavadocDirectory()
Return the project target javadoc reports directory.

Returns:
the directory

getTargetDocsDirectory

public File getTargetDocsDirectory()
Return the project target reports docs directory.

Returns:
the directory

getTargetTestDirectory

public File getTargetTestDirectory()
Return the project target test directory.

Returns:
the directory

getTargetDeliverablesDirectory

public File getTargetDeliverablesDirectory()
Return the project target deliverables directory.

Returns:
the directory

getTargetDeliverable

public File getTargetDeliverable(String type)
Return the project target deliverables directory.

Parameters:
type - the deliverable type
Returns:
the directory

createFile

public File createFile(String path)
Create a file relative to the resource basedir.

Parameters:
path - the relative path
Returns:
the directory

getLayoutFilename

public String getLayoutFilename(String id)
Return a filename using the layout strategy employed by the cache.

Parameters:
id - the artifact type
Returns:
the filename

getLayoutBase

public String getLayoutBase(String id)
Return the directory path representing the module structure and type using the layout strategy employed by the cache.

Parameters:
id - the artifact type
Returns:
the path from the root of the cache to the directory containing the artifact

getLayoutPath

public String getLayoutPath(String id)
Return the full path to an artifact using the layout employed by the cache.

Parameters:
id - the artifact type
Returns:
the full path including base path and filename

createPath

public Path createPath(Scope scope)
Utility operation to construct a new classpath path instance.

Parameters:
scope - the build scope
Returns:
the path

createPath

public Path createPath(Resource[] resources)
Utility operation to construct a new path using a supplied array of resources.

Parameters:
resources - the resource to use in path construction
Returns:
the path

createPath

public Path createPath(Resource[] resources,
                       boolean resolve,
                       boolean filter)
Utility operation to construct a new path using a supplied array of resources.

Parameters:
resources - the resources to use in path construction
resolve - if true force local caching of the artifact
filter - if true restrict path entries to resources that produce jars
Returns:
the path