net.dpml.lang
Class Resource

java.lang.Object
  extended by net.dpml.lang.Part
      extended by net.dpml.lang.Resource

public class Resource
extends Part

Resource part strategy implementation datatype.

Version:
1.1.0
Author:
Digital Product Meta Library

Field Summary
 
Fields inherited from class net.dpml.lang.Part
PART_FOOTER, PART_HEADER, PART_SCHEMA_URN, VALUE_ENCODER, XML_HEADER
 
Constructor Summary
Resource(Logger logger, Info info, Classpath classpath, String urn, String path)
          Creation of resource datatype.
 
Method Summary
protected  void encodeStrategy(Writer writer, String pad)
          Encode the resource strategy to XML.
 boolean equals(Object other)
          Test if this instance is equal to the supplied instance.
protected  Object getContent(Class c)
          Return the part content or null if the result type is unresolvable relative to the supplied classes argument.
 String getPath()
          Get the resource path.
 String getURN()
          Get the resource urn.
 int hashCode()
          Get the hashcode for this instance.
 Object instantiate(Object[] args)
          Instantiate a value.
 
Methods inherited from class net.dpml.lang.Part
encode, getClassLoader, getClasspath, getContent, getContent, getInfo, getLogger, load, load
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resource

public Resource(Logger logger,
                Info info,
                Classpath classpath,
                String urn,
                String path)
         throws IOException
Creation of resource datatype.

Parameters:
logger - the assigned logging channel
info - the part info descriptor
classpath - the part classpath descriptor
urn - the resource urn
path - the resource path
Throws:
IOException - if an I/O error occurs
Method Detail

getContent

protected Object getContent(Class c)
                     throws IOException
Return the part content or null if the result type is unresolvable relative to the supplied classes argument. Class arguments recognized over an above plugin include the URL and String classes. If the URL class is supplied a URL referencing the resource identified by path is returned. If a String is requested the urn value is returned.

Overrides:
getContent in class Part
Parameters:
c - the content class
Returns:
the content
Throws:
IOException - if an IO error occurs

getURN

public String getURN()
Get the resource urn.

Returns:
the urn

getPath

public String getPath()
Get the resource path.

Returns:
the path

instantiate

public Object instantiate(Object[] args)
                   throws Exception
Instantiate a value.

Specified by:
instantiate in class Part
Parameters:
args - supplimentary arguments
Returns:
the resolved instance
Throws:
Exception - if a deployment error occurs

encodeStrategy

protected void encodeStrategy(Writer writer,
                              String pad)
                       throws IOException
Encode the resource strategy to XML.

Specified by:
encodeStrategy in class Part
Parameters:
writer - the output stream writer
pad - the character offset
Throws:
IOException - if an I/O error occurs

equals

public boolean equals(Object other)
Test if this instance is equal to the supplied instance.

Overrides:
equals in class Part
Parameters:
other - the supplied instance
Returns:
the equality status

hashCode

public int hashCode()
Get the hashcode for this instance.

Overrides:
hashCode in class Part
Returns:
the hash value