net.dpml.library.info
Class ResourceDirective

java.lang.Object
  extended bynet.dpml.library.info.AbstractDirective
      extended bynet.dpml.library.info.ResourceDirective
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ModuleDirective

public class ResourceDirective
extends AbstractDirective

The ResourceDirective class describes an available resource.

Version:
1.1.0
Author:
Digital Product Meta Library
See Also:
Serialized Form

Nested Class Summary
static class ResourceDirective.Classifier
          Resource classifier enumeration.
 
Field Summary
static ResourceDirective.Classifier ANONYMOUS
          Anonymous resource constant identifier.
static ResourceDirective.Classifier EXTERNAL
          External resource constant identifier.
static ResourceDirective.Classifier LOCAL
          Local resource constant identifier.
 
Method Summary
static ResourceDirective createAnonymousResource(String scheme, String name, String version, String type, Properties properties)
          Creation of a new anonymous resource directive.
static ResourceDirective createResourceDirective(String name, String version, ResourceDirective.Classifier classifier, String basedir, InfoDirective info, DataDirective[] data, DependencyDirective[] dependencies, Properties properties, FilterDirective[] filters)
          Creation of a new resource directive.
 boolean equals(Object other)
          Compare this object with another for equality.
 String getBasedir()
          Return the resource basedir.
 ResourceDirective.Classifier getClassifier()
          Return the resource classifier.
 DataDirective[] getDataDirectives()
          Return an array of supporting production data directives (including all produced types).
 DependencyDirective getDependencyDirective(Scope scope)
          Return an dependency directive matching a supplied scope.
 DependencyDirective[] getDependencyDirectives()
          Return an array of dependency directives.
 FilterDirective[] getFilterDirectives()
          Return an array of supplimentary filter directives.
 InfoDirective getInfoDirective()
          Return the info descriptor.
 String getName()
          Return the resource name.
 String getScheme()
          Return the scheme to use when declaring the published artifact (used in conjunction with anonymous resources.
 TypeDirective getTypeDirective(String name)
          Return an named type.
 TypeDirective[] getTypeDirectives()
          Return an array of types representing artifacts associated with the resource.
 String getVersion()
          Return the resource version.
 int hashCode()
          Compute the hash value.
 boolean isAnonymous()
          Return true if this represents a anonymous resource.
 boolean isLocal()
          Return true if this represents a local project.
 
Methods inherited from class net.dpml.library.info.AbstractDirective
equals, getProperties, getProperty, hashArray, hashValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTERNAL

public static final ResourceDirective.Classifier EXTERNAL
External resource constant identifier.


LOCAL

public static final ResourceDirective.Classifier LOCAL
Local resource constant identifier.


ANONYMOUS

public static final ResourceDirective.Classifier ANONYMOUS
Anonymous resource constant identifier.

Method Detail

createAnonymousResource

public static ResourceDirective createAnonymousResource(String scheme,
                                                        String name,
                                                        String version,
                                                        String type,
                                                        Properties properties)
Creation of a new anonymous resource directive.

Parameters:
scheme - the schema name
name - the resource name
version - the resource version
type - the resource type
properties - suppliementary properties
Returns:
the resource directive

createResourceDirective

public static ResourceDirective createResourceDirective(String name,
                                                        String version,
                                                        ResourceDirective.Classifier classifier,
                                                        String basedir,
                                                        InfoDirective info,
                                                        DataDirective[] data,
                                                        DependencyDirective[] dependencies,
                                                        Properties properties,
                                                        FilterDirective[] filters)
Creation of a new resource directive. If the resource name if composite then the resource directive will be a module directive instance that either encloses the resource or enclosed a resource containing the resource.

Parameters:
name - the resource name
version - the resource version
classifier - LOCAL or EXTERNAL classifier
basedir - the project basedir
info - info descriptor
data - types produced by the resource
dependencies - resource dependencies
properties - suppliementary properties
filters - project filters
Returns:
the immediate enclosing resource

getName

public String getName()
Return the resource name.

Returns:
the name

getVersion

public String getVersion()
Return the resource version.

Returns:
the version

getBasedir

public String getBasedir()
Return the resource basedir.

Returns:
the basedir

getInfoDirective

public InfoDirective getInfoDirective()
Return the info descriptor.

Returns:
the info descriptor

getClassifier

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

Returns:
the classifier (LOCAL, EXTERNAL or ANONYMOUS)

isLocal

public boolean isLocal()
Return true if this represents a local project.

Returns:
true if local

isAnonymous

public boolean isAnonymous()
Return true if this represents a anonymous resource.

Returns:
true if anonymous

getScheme

public String getScheme()
Return the scheme to use when declaring the published artifact (used in conjunction with anonymous resources.

Returns:
the scheme

getTypeDirectives

public TypeDirective[] getTypeDirectives()
Return an array of types representing artifacts associated with the resource.

Returns:
the type directives

getFilterDirectives

public FilterDirective[] getFilterDirectives()
Return an array of supplimentary filter directives.

Returns:
the filter directives

getDataDirectives

public DataDirective[] getDataDirectives()
Return an array of supporting production data directives (including all produced types).

Returns:
the data directives

getTypeDirective

public TypeDirective getTypeDirective(String name)
                               throws TypeUnknownException
Return an named type.

Parameters:
name - the type name
Returns:
the type directives
Throws:
TypeUnknownException - if the type name if not recornized within the scope of the resource

getDependencyDirectives

public DependencyDirective[] getDependencyDirectives()
Return an array of dependency directives.

Returns:
the dependency directive array

getDependencyDirective

public DependencyDirective getDependencyDirective(Scope scope)
Return an dependency directive matching a supplied scope.

Parameters:
scope - the scope
Returns:
the dependency directive matching the supplied scope

equals

public boolean equals(Object other)
Compare this object with another for equality.

Overrides:
equals in class AbstractDirective
Parameters:
other - the other object
Returns:
true if equal

hashCode

public int hashCode()
Compute the hash value.

Overrides:
hashCode in class AbstractDirective
Returns:
the hashcode value