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.1.0
Author:
Digital Product Management Library

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 strategy name.
 String getPath()
          Get the resource path.
 int getPriority()
          Return the strategy priority.
 String getURN()
          Get the resource urn.
 int hashCode()
          Get the hashcode for this instance.
 void initialize(ServiceRegistry registry)
          Strategy initialization (not used).
 boolean isaCandidate(Class<?> type)
          Return true if the strategy is a candidate for the supplied class.
 
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()
Return the strategy name.

Specified by:
getName in class Strategy
Returns:
the name

getPriority

public int getPriority()
Return the strategy priority.

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)
Return true if the strategy is a candidate for the supplied class. This calss will always throw a UnsupportedOperationException (anltib support is not applicable).

Specified by:
isaCandidate in class Strategy
Parameters:
type - a service type
Returns:
the supported status flag

initialize

public void initialize(ServiceRegistry registry)
Strategy initialization (not used).

Specified by:
initialize in class Strategy
Parameters:
registry - a 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