net.dpml.lang
Class AntlibStrategy

java.lang.Object
  extended by net.dpml.lang.Strategy
      extended by net.dpml.lang.AntlibStrategy
All Implemented Interfaces:
Comparable<Strategy>

public class AntlibStrategy
extends Strategy

Simple resource deployment strategy.

Version:
2.0.1
Author:
Digital Product Management Laboratory

Constructor Summary
AntlibStrategy(ClassLoader classloader, String urn, String path)
          Creation of resource datatype.
 
Method Summary
 void encode(Buffer buffer, String key)
          Encode the resource strategy to XML.
 boolean equals(Object other)
          Test if this instance is equal to the supplied instance.
<T> T
getContentForClass(Class<T> c)
          Return the part content or null if the result type is unresolvable relative to the supplied classes argument.
<T> T
getInstance(Class<T> type)
          Instantiate a value.
 String getName()
          Return the short name of this strategy.
 String getPath()
          Get the resource path.
 int getPriority()
          Return the priority assigned to this strategy.
 String getURN()
          Get the resource urn.
 int hashCode()
          Get the hashcode for this instance.
 void initialize(ServiceRegistry registry)
          Composite strategies are strategy implementations that contain subidary strategies.
 boolean isaCandidate(Class<?> type)
          Return true if this strategy is a candidate with result to the supply of an instance assignable to the supplied type.
 
Methods inherited from class net.dpml.lang.Strategy
compareTo, getClassLoader, load, load, load
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntlibStrategy

public AntlibStrategy(ClassLoader classloader,
                      String urn,
                      String path)
               throws IOException
Creation of resource datatype.

Parameters:
classloader - the classloader
urn - the resource urn
path - the resource path
Throws:
IOException - if an I/O error occurs
Method Detail

getName

public String getName()
Description copied from class: Strategy
Return the short name of this strategy.

Specified by:
getName in class Strategy
Returns:
the name

getPriority

public int getPriority()
Description copied from class: Strategy
Return the priority assigned to this strategy.

Specified by:
getPriority in class Strategy
Returns:
the priority value

getContentForClass

public <T> T getContentForClass(Class<T> 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.

Specified by:
getContentForClass in class Strategy
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

isaCandidate

public boolean isaCandidate(Class<?> type)
Description copied from class: Strategy
Return true if this strategy is a candidate with result to the supply of an instance assignable to the supplied type.

Specified by:
isaCandidate in class Strategy
Parameters:
type - the requested type
Returns:
type if this strategy is a condidate

initialize

public void initialize(ServiceRegistry registry)
Description copied from class: Strategy
Composite strategies are strategy implementations that contain subidary strategies. During lookup operations, a subsidiary strategy may request a service from the enclosing strategy. To enable traversal from a subsidary to enclosing context a service registry shall be provided to all subsidiary strategies.

Specified by:
initialize in class Strategy
Parameters:
registry - the service registry

getInstance

public <T> T getInstance(Class<T> type)
Instantiate a value.

Specified by:
getInstance in class Strategy
Parameters:
type - the return type
Returns:
the resolved instance

encode

public void encode(Buffer buffer,
                   String key)
            throws IOException
Encode the resource strategy to XML.

Specified by:
encode in class Strategy
Parameters:
buffer - the output buffer
key - the key
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 Object
Parameters:
other - the supplied instance
Returns:
the equality status

hashCode

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

Overrides:
hashCode in class Object
Returns:
the hash value