net.dpml.library
Interface Resource

All Superinterfaces:
Dictionary, Resolver
All Known Subinterfaces:
Module
All Known Implementing Classes:
DefaultModule, DefaultResource

public interface Resource
extends Dictionary, Resolver

The Resource interface describes infomation about a published resource.

Version:
1.1.0
Author:
Digital Product Meta Library

Field Summary
static String DECIMAL_VERSIONING_KEY
          System property name used to declare the decimal versioning enabled flag.
 
Method Summary
 Resource[] getAggregatedProviders(Scope scope, boolean expand, boolean sort)
          Return an array of resource that are providers to this resource.
 Artifact getArtifact(String type)
          Construct an artifact for the supplied type.
 File getBaseDir()
          Return the basedir for this resource.
 ResourceDirective.Classifier getClassifier()
          Return the resource classifier.
 Resource[] getClasspathProviders(Category category)
          Return an array of runtime providers filtered relative to a supplied classloading category.
 Resource[] getClasspathProviders(Scope scope)
          Return a sorted and filtered array of providers.
 Resource[] getConsumers(boolean expand, boolean sort)
          Return an array of resources that are consumers of this resource.
 Data[] getData()
          Return the array of production data.
 Version getDecimalVersion()
          Return the decimal version.
 Filter[] getFilters()
          Return an array of filters associated with the resource.
 Info getInfo()
          Return the info block.
 String getLayoutPath(String id)
          Return a filename using the layout strategy employed by the cache.
 Library getLibrary()
          Return the singleton library.
 Artifact getLinkArtifact(String type)
          Construct an unversion link artifact for the supplied type.
 String getName()
          Return the name of the resource.
 Module getParent()
          Return the enclosing parent module.
 Resource[] getProviders(Scope scope, boolean expand, boolean sort)
          Return an array of resource that are providers to this resource.
 String getResourcePath()
          Return the fully qualified path to the resource.
 String getStatutoryVersion()
          Return the statutory resource version.
 Type getType(String id)
          Return a resource type relative to a supplied type id.
 Type[] getTypes()
          Return the expanded array of types associated with the resource.
 String getVersion()
          Return the resource version.
 boolean isa(String type)
          Test if this resource is associated with a type of the supplied name.
 
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
 

Field Detail

DECIMAL_VERSIONING_KEY

public static final String DECIMAL_VERSIONING_KEY
System property name used to declare the decimal versioning enabled flag.

See Also:
Constant Field Values
Method Detail

getLibrary

public Library getLibrary()
Return the singleton library.

Returns:
the library

getName

public String getName()
Return the name of the resource.

Returns:
the resource name

getVersion

public String getVersion()
Return the resource version.

Returns:
the version

getStatutoryVersion

public String getStatutoryVersion()
Return the statutory resource version.

Returns:
the version

getDecimalVersion

public Version getDecimalVersion()
Return the decimal version.

Returns:
the version

getResourcePath

public String getResourcePath()
Return the fully qualified path to the resource.

Returns:
the path

getBaseDir

public File getBaseDir()
Return the basedir for this resource.

Returns:
the base directory (possibly null)

getInfo

public Info getInfo()
Return the info block.

Returns:
the info block

getClassifier

public ResourceDirective.Classifier getClassifier()
Return the resource classifier.

Returns:
the classifier (LOCAL, EXTERNAL or ANONYMOUS)

getTypes

public Type[] getTypes()
Return the expanded array of types associated with the resource. The returned array is a function of the types declared by a resource expanded relative to any types implied by processor dependencies.

Returns:
the type array

isa

public boolean isa(String type)
Test if this resource is associated with a type of the supplied name.

Parameters:
type - the type id
Returns:
TRUE if this resource produces an artifact of the supplied type

getType

public Type getType(String id)
Return a resource type relative to a supplied type id.

Parameters:
id - the type name to retrieve
Returns:
the type instance

getArtifact

public Artifact getArtifact(String type)
Construct an artifact for the supplied type.

Parameters:
type - the resource type id
Returns:
the artifact

getLinkArtifact

public Artifact getLinkArtifact(String type)
Construct an unversion link artifact for the supplied type.

Parameters:
type - the resource type id
Returns:
the link artifact

getParent

public Module getParent()
Return the enclosing parent module.

Returns:
the enclosing module of null if this a top-level module.

getProviders

public Resource[] getProviders(Scope scope,
                               boolean expand,
                               boolean sort)
Return an array of resource that are providers to this resource.

Parameters:
scope - the operational scope
expand - if true include transitive dependencies
sort - if true the array will sorted relative to dependencies
Returns:
the resource providers

getAggregatedProviders

public Resource[] getAggregatedProviders(Scope scope,
                                         boolean expand,
                                         boolean sort)
Return an array of resource that are providers to this resource. If the supplied scope is BUILD the returned resource array is equivalent getProviders( Scope.BUILD, .. ). If the scope is RUNTIME the returned resource array includes BUILD and RUNTIME resources. If the scope is TEST the returned array includes BUILD, RUNTIME and TEST resources.

Parameters:
scope - the scope of aggregation to be applied to the selection
expand - if TRUE include transitive dependencies
sort - if true the array will sorted relative to dependencies
Returns:
the resource providers

getClasspathProviders

public Resource[] getClasspathProviders(Scope scope)
Return a sorted and filtered array of providers. Resources not declaring the "jar" type as a produced type are excluded from selection. The resource array will include transitive dependencies. The method is suitable for the construction of build and test phase classloaders.

Parameters:
scope - the aggregation scope
Returns:
the scoped resource chain

getClasspathProviders

public Resource[] getClasspathProviders(Category category)
Return an array of runtime providers filtered relative to a supplied classloading category. Resources not declaring the "jar" type as a produced type are excluded from selection. The resource array returned from this operation is a sorted transitive sequence excluding all resource references by any category higher than the supplied category. This method is typically used to construct information suitable for the gerneration of plugin metadata.

Parameters:
category - the classloader category
Returns:
the category scoped resource chain

getConsumers

public Resource[] getConsumers(boolean expand,
                               boolean sort)
Return an array of resources that are consumers of this resource.

Parameters:
expand - if true the returned array includes consumers associated through transitive dependency relationships, otherwise the array is limited to direct consumers
sort - if true the array is sorted relative to depenency relationships
Returns:
the array of consumer projects

getFilters

public Filter[] getFilters()
Return an array of filters associated with the resource.

Returns:
the array of filters

getLayoutPath

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

Parameters:
id - the artifact type
Returns:
the filename

getData

public Data[] getData()
Return the array of production data.

Returns:
the associated production data