net.dpml.library
Interface Library

All Known Implementing Classes:
DefaultLibrary

public interface Library

The Library interface is the application root for module management.

Version:
1.1.0
Author:
Digital Product Meta Library

Field Summary
static String INDEX_FILENAME
          Index filename.
 
Method Summary
 Module[] getAllModules()
          Return a array of all modules in the library.
 Module getModule(String ref)
          Return a named module.
 Module[] getModules()
          Return a array of the top-level modules within the library.
 Resource getResource(String ref)
          Recursively lookup a resource using a fully qualified reference.
 Resource locate(File base)
          Locate a resource relative to a base directory.
 Resource[] select(File base)
          Select all local projects with a basedir equal to or depper than the supplied directory.
 Resource[] select(File base, boolean self)
          Select all local projects relative to the supplied basedir.
 Resource[] select(String criteria, boolean sort)
          Select a set of resource matching a supplied a resource selection constraint.
 Resource[] select(String criteria, boolean local, boolean sort)
          Select a set of resource matching a supplied a resource selection constraint.
 Resource[] sort(Resource[] resources)
          Utility operation to sort a collection of resources.
 

Field Detail

INDEX_FILENAME

public static final String INDEX_FILENAME
Index filename.

See Also:
Constant Field Values
Method Detail

sort

public Resource[] sort(Resource[] resources)
Utility operation to sort a collection of resources.

Parameters:
resources - the resources to sort
Returns:
the sorted resource array

getModules

public Module[] getModules()
Return a array of the top-level modules within the library.

Returns:
the module array

getAllModules

public Module[] getAllModules()
Return a array of all modules in the library.

Returns:
module array

getModule

public Module getModule(String ref)
                 throws ModuleNotFoundException
Return a named module.

Parameters:
ref - the fully qualified module name
Returns:
the module
Throws:
ModuleNotFoundException - if the module cannot be found

getResource

public Resource getResource(String ref)
                     throws ResourceNotFoundException
Recursively lookup a resource using a fully qualified reference.

Parameters:
ref - the fully qualified resource name
Returns:
the resource instance
Throws:
ResourceNotFoundException - if the resource cannot be found

select

public Resource[] select(String criteria,
                         boolean sort)

Select a set of resource matching a supplied a resource selection constraint. The constraint may contain the wildcards '**' and '*'.

Parameters:
criteria - the selection criteria
sort - if true the returned array will be sorted relative to dependencies otherwise the array will be sorted alphanumerically with respect to the resource path
Returns:
an array of resources matching the selction criteria

select

public Resource[] select(String criteria,
                         boolean local,
                         boolean sort)

Select a set of resource matching a supplied a resource selection constraint. The constraint may contain the wildcards '**' and '*'.

Parameters:
local - if true limit the selection to local projects
criteria - the selection criteria
sort - if true the returned array will be sorted relative to dependencies otherwise the array will be sorted alphanumerically with respect to the resource path
Returns:
an array of resources matching the selction criteria

select

public Resource[] select(File base)
Select all local projects with a basedir equal to or depper than the supplied directory.

Parameters:
base - the reference basedir
Returns:
an array of projects within or lower than the supplied basedir

select

public Resource[] select(File base,
                         boolean self)
Select all local projects relative to the supplied basedir.

Parameters:
base - the reference basedir
self - if true and the basedir resolves to a project then include the project otherwise the project will be expluded from selection
Returns:
an array of projects relative to the basedir

locate

public Resource locate(File base)
                throws ResourceNotFoundException
Locate a resource relative to a base directory.

Parameters:
base - the base directory
Returns:
a resource with a matching basedir
Throws:
ResourceNotFoundException - if resource match relative to the supplied base