net.dpml.tools
Interface Context

All Known Implementing Classes:
DefaultContext

public interface Context

Project context.

Version:
1.2.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

Project getProject()
Return the associated project.

Returns:
the ant project

getProperty

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

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

getProperty

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

void init()
Initialize the context.


getPath

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

Resource getResource()
Return the active resource.

Returns:
the resource definition

getLibrary

Library getLibrary()
Return the resource library.

Returns:
the library

getSrcDirectory

File getSrcDirectory()
Return the project source directory.

Returns:
the directory

getSrcMainDirectory

File getSrcMainDirectory()
Return the project source main directory.

Returns:
the directory

getSrcTestDirectory

File getSrcTestDirectory()
Return the project source test directory.

Returns:
the directory

getSrcDocsDirectory

File getSrcDocsDirectory()
Return the project source docs directory.

Returns:
the directory

getEtcDirectory

File getEtcDirectory()
Return the project etc directory.

Returns:
the directory

getEtcMainDirectory

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

Returns:
the directory

getEtcTestDirectory

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

Returns:
the directory

getEtcDataDirectory

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

Returns:
the directory

getTargetDirectory

File getTargetDirectory()
Return the project target directory.

Returns:
the directory

getTargetDirectory

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

Parameters:
path - the path
Returns:
the directory

getTargetTempDirectory

File getTargetTempDirectory()
Return the project target temp directory.

Returns:
the directory

getTargetBuildDirectory

File getTargetBuildDirectory()
Return the project target build directory.

Returns:
the directory

getTargetBuildMainDirectory

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

Returns:
the directory

getTargetBuildTestDirectory

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

Returns:
the directory

getTargetBuildDocsDirectory

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

Returns:
the directory

getTargetClassesDirectory

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

Returns:
the directory

getTargetClassesMainDirectory

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

Returns:
the directory

getTargetClassesTestDirectory

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

Returns:
the directory

getTargetReportsDirectory

File getTargetReportsDirectory()
Return the project target reports directory.

Returns:
the directory

getTargetReportsTestDirectory

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

Returns:
the directory

getTargetReportsMainDirectory

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

Returns:
the directory

getTargetReportsJavadocDirectory

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

Returns:
the directory

getTargetDocsDirectory

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

Returns:
the directory

getTargetTestDirectory

File getTargetTestDirectory()
Return the project target test directory.

Returns:
the directory

getTargetDeliverablesDirectory

File getTargetDeliverablesDirectory()
Return the project target deliverables directory.

Returns:
the directory

getTargetDeliverable

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

Parameters:
type - the deliverable type
Returns:
the directory

createFile

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

Parameters:
path - the relative path
Returns:
the directory

getLayoutFilename

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

Parameters:
id - the artifact type
Returns:
the filename

getLayoutBase

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

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

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

Parameters:
scope - the build scope
Returns:
the path

createPath

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

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