net.dpml.lang
Class PartContentHandler

java.lang.Object
  extended by java.net.ContentHandler
      extended by net.dpml.transit.ContentHandler
          extended by net.dpml.lang.PartContentHandler
All Implemented Interfaces:
ApplianceFactory, PartContentManager, ContentManager

public final class PartContentHandler
extends ContentHandler
implements PartContentManager, ApplianceFactory

Content handler for the 'part' artifact type.

Version:
2.1.0
Author:
Digital Product Management Library

Field Summary
static String NAMESPACE
          Part XSD uri.
 
Constructor Summary
PartContentHandler()
          Creation of a new part content handler.
 
Method Summary
 Object getContent(URLConnection connection)
          Returns the content in the form of a Strategy datatype.
 Object getContent(URLConnection connection, Class[] classes)
          Returns the content assignable to the first recognized class in the list os supppied classes.
 PartManager[] getPartManagers()
          Return the part managers handled by the content handler.
static StrategyHandler getStrategyHandler(Class<?> subject)
          Return the strategy handler supporting the supplied class.
static StrategyHandler getStrategyHandler(Component annotation)
          Return a strategy handler based on the supplied component annotation.
static StrategyHandler getStrategyHandler(Element element)
          Load a potentially foreign strategy handler.
 String getType()
          Returns the type tha the content handler supports.
 Appliance newAppliance(URLConnection connection, String partition)
          Create a new appliance using the supplied connection object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE

public static final String NAMESPACE
Part XSD uri.

See Also:
Constant Field Values
Constructor Detail

PartContentHandler

public PartContentHandler()
                   throws Exception
Creation of a new part content handler.

Throws:
Exception - if an error occurs
Method Detail

getStrategyHandler

public static StrategyHandler getStrategyHandler(Component annotation)
                                          throws Exception
Return a strategy handler based on the supplied component annotation.

Parameters:
annotation - the component annotation
Returns:
the strategy handler
Throws:
Exception - if an error ocurrs during handler establishment

getStrategyHandler

public static StrategyHandler getStrategyHandler(Class<?> subject)
                                          throws Exception
Return the strategy handler supporting the supplied class. If the class contains the component annotation the handler is resolved relative to the annotation properties, otherwise a default strategy handler is returned.

Parameters:
subject - the subject class
Returns:
the strategy handler
Throws:
Exception - if a general loading error occurs

getStrategyHandler

public static StrategyHandler getStrategyHandler(Element element)
                                          throws Exception
Load a potentially foreign strategy handler. Strategy resolution is based on the following rules relative to the namespace of the supplied element:

Parameters:
element - the strategy element
Returns:
the strategy handler
Throws:
Exception - if loading error occurs

getType

public String getType()
Returns the type tha the content handler supports.

Specified by:
getType in interface ContentManager
Specified by:
getType in class ContentHandler
Returns:
the content type name

getContent

public Object getContent(URLConnection connection)
                  throws IOException
Returns the content in the form of a Strategy datatype.

Specified by:
getContent in class ContentHandler
Parameters:
connection - the url connection
Returns:
the part datatype
Throws:
IOException - if an IO error occurs

getContent

public Object getContent(URLConnection connection,
                         Class[] classes)
                  throws IOException
Returns the content assignable to the first recognized class in the list os supppied classes. If the class array is empty the part datatype is returned. If none of the classes are recognized, null is returned.

Overrides:
getContent in class ContentHandler
Parameters:
connection - the url connection
classes - the selection class array
Returns:
the resolved instance
Throws:
IOException - if an IO error occurs

newAppliance

public Appliance newAppliance(URLConnection connection,
                              String partition)
                       throws IOException
Create a new appliance using the supplied connection object.

Specified by:
newAppliance in interface ApplianceFactory
Parameters:
connection - the URL connection
partition - an optional partition name
Returns:
the appliance
Throws:
IOException - if an IO error occurs

getPartManagers

public PartManager[] getPartManagers()
Return the part managers handled by the content handler.

Specified by:
getPartManagers in interface PartContentManager
Returns:
the part manager array