net.dpml.library.impl
Class DefaultModule

java.lang.Object
  extended bynet.dpml.library.impl.DefaultDictionary
      extended bynet.dpml.library.impl.DefaultResource
          extended bynet.dpml.library.impl.DefaultModule
All Implemented Interfaces:
Comparable, Dictionary, Module, Resolver, Resource

public final class DefaultModule
extends DefaultResource
implements Module

A Module is a collection of resources. It serves to establish a namespace and a framework for sharing properties and characteristics defined within within the module with resources contained within the module.

Version:
1.1.0
Author:
Digital Product Meta Library

Field Summary
 
Fields inherited from class net.dpml.library.impl.DefaultResource
ANONYMOUS, BOOTSTRAP, RELEASE, SNAPSHOT, TIMESTAMP
 
Fields inherited from interface net.dpml.library.Resource
DECIMAL_VERSIONING_KEY
 
Method Summary
 ModuleDirective export()
          Return a directive suitable for publication as an external description.
 Module[] getAllModules()
          Return the array of modules that are descendants of this module.
 Module getModule(String ref)
          Return a module using a supplied reference.
 Module[] getModules()
          Return the array of modules that are direct children of this module.
 Resource getResource(String ref)
          Return a resource using a supplied name.
 Resource[] getResources()
          Return an array of immediate resources contained within the module.
 Resource locate(File base)
          Locate a resource relative to a base directory.
 Resource[] select(String criteria, boolean local, boolean sort)
          Select a set of resource matching a supplied a resource selection constraint.
 String toString()
          Return the string representation of the module.
 
Methods inherited from class net.dpml.library.impl.DefaultResource
compareTo, getAggregatedProviders, getArtifact, getBaseDir, getClassifier, getClasspathProviders, getClasspathProviders, getConsumers, getData, getDecimalVersion, getFilters, getInfo, getLayoutPath, getLibrary, getLinkArtifact, getName, getParent, getProviders, getResourceDirective, getResourcePath, getStatutoryVersion, getTimestamp, getTimestamp, getType, getTypes, getVersion, isa, toURI
 
Methods inherited from class net.dpml.library.impl.DefaultDictionary
getBooleanProperty, getIntegerProperty, getLocalPropertyNames, getProperty, getProperty, getPropertyNames, resolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.dpml.library.Resource
getAggregatedProviders, getArtifact, getBaseDir, getClassifier, getClasspathProviders, getClasspathProviders, getConsumers, getData, getDecimalVersion, getFilters, getInfo, getLayoutPath, getLibrary, getLinkArtifact, getName, getParent, getProviders, getResourcePath, getStatutoryVersion, getType, getTypes, getVersion, isa
 
Methods inherited from interface net.dpml.library.Dictionary
getBooleanProperty, getIntegerProperty, getLocalPropertyNames, getProperty, getProperty, getPropertyNames, resolve
 
Methods inherited from interface net.dpml.util.Resolver
getProperty, getProperty, resolve, toURI
 

Method Detail

getResources

public Resource[] getResources()
Return an array of immediate resources contained within the module.

Specified by:
getResources in interface Module
Returns:
the resource array

getResource

public Resource getResource(String ref)
                     throws ResourceNotFoundException
Return a resource using a supplied name.

Specified by:
getResource in interface Module
Parameters:
ref - a path relative to the module
Returns:
the resource array
Throws:
ResourceNotFoundException - if the resource does not exist

getModules

public Module[] getModules()
Return the array of modules that are direct children of this module.

Specified by:
getModules in interface Module
Returns:
the child modules

getModule

public Module getModule(String ref)
                 throws ModuleNotFoundException
Return a module using a supplied reference.

Specified by:
getModule in interface Module
Parameters:
ref - a path relative to the module
Returns:
the module array
Throws:
ModuleNotFoundException - if the module does not exist

getAllModules

public Module[] getAllModules()
Return the array of modules that are descendants of this module.

Specified by:
getAllModules in interface Module
Returns:
the descendants module array

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 '*'.

Specified by:
select in interface Module
Parameters:
criteria - the selection criteria
local - if true limit the selection to local projects
sort - if true the returned array will be sorted relative to dependencies otherwise the array will be sorted alphanumerically
Returns:
an array of resources matching the selection criteria

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

export

public ModuleDirective export()
Return a directive suitable for publication as an external description.

Specified by:
export in interface Module
Returns:
the resource directive

toString

public String toString()
Return the string representation of the module.

Overrides:
toString in class DefaultResource
Returns:
the string value