net.dpml.lang
Class Plugin

java.lang.Object
  extended bynet.dpml.lang.Part
      extended bynet.dpml.lang.Plugin

public class Plugin
extends Part

Plugin part strategy implementation datatype.

Version:
1.0.1
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
Plugin(Logger logger, Info info, Classpath classpath, String classname)
          Creation of an new plugin datatype.
Plugin(Logger logger, Info info, Classpath classpath, String classname, Value[] params)
          Creation of an new plugin datatype.
 
Method Summary
protected  void encodeStrategy(Writer writer, String pad)
          Encode the pluginstrategy to XML.
 boolean equals(Object other)
          Test if this instance is equal to the supllied object.
 String getClassname()
          Get the target classname.
protected  Object getContent(Class c)
          Return the part content or null if the result type is unresolvable relative to the supplied class argument.
 Class getPluginClass()
          Get the default plugin class.
 Value[] getValues()
          Get the array of default constructor values.
 int hashCode()
          Get the has code for this instance.
static Object instantiate(Class clazz, Object[] args)
          Create a factory using a supplied class and command line arguments.
 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

Plugin

public Plugin(Logger logger,
              Info info,
              Classpath classpath,
              String classname)
       throws IOException
Creation of an new plugin datatype.

Parameters:
logger - the assigned logging channel
info - the part info descriptor
classpath - the classpath descriptor
classname - the target class
Throws:
IOException - if an I/O error occurs

Plugin

public Plugin(Logger logger,
              Info info,
              Classpath classpath,
              String classname,
              Value[] params)
       throws IOException
Creation of an new plugin datatype.

Parameters:
logger - the assigned logging channel
info - the part info descriptor
classpath - the classpath descriptor
classname - the target class
params - an array of default value arguments
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 class argument.

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

getClassname

public String getClassname()
Get the target classname.

Returns:
the classname

getValues

public Value[] getValues()
Get the array of default constructor values.

Returns:
the value array

getPluginClass

public Class getPluginClass()
Get the default plugin class.

Returns:
the plugin class

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

equals

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

Overrides:
equals in class Part
Parameters:
other - the other object
Returns:
true if the supplied object is equal to this instance

hashCode

public int hashCode()
Get the has code for this instance.

Overrides:
hashCode in class Part
Returns:
the hash value

encodeStrategy

protected void encodeStrategy(Writer writer,
                              String pad)
                       throws IOException
Encode the pluginstrategy 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

instantiate

public static Object instantiate(Class clazz,
                                 Object[] args)
                          throws IOException,
                                 InvocationTargetException
Create a factory using a supplied class and command line arguments.

Parameters:
clazz - the the factory class
args - the command line args
Returns:
the plugin instance
Throws:
IOException - if a plugin creation error occurs
InvocationTargetException - if a plugin constructor invocation error occurs