net.dpml.metro.tools
Class ComponentBuilderTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended bynet.dpml.tools.tasks.GenericTask
              extended bynet.dpml.tools.tasks.PartTask
                  extended bynet.dpml.metro.tools.ComponentBuilderTask
All Implemented Interfaces:
PartReferenceBuilder

public class ComponentBuilderTask
extends PartTask
implements PartReferenceBuilder

Task that handles the construction of a serialized container part.

Version:
1.1.0
Author:
Digital Product Meta Library

Nested Class Summary
static class ComponentBuilderTask.URIPersistenceDelegate
          Utility class used to handle uri persistence.
 
Field Summary
static URI PART_BUILDER_URI
          Constant builder uri.
static URI PART_HANDLER_URI
          Constant controller uri.
static URI STRATEGY_BUILDER_URI
          Constant strategy builder uri.
 
Fields inherited from class net.dpml.tools.tasks.PartTask
PLUGIN_DESCRIPTION_KEY, PLUGIN_HANDLER_KEY, PLUGIN_TITLE_KEY, TYPE
 
Fields inherited from class net.dpml.tools.tasks.GenericTask
ASC_EXT, GPG_EXE_KEY, MD5_EXT
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
ComponentBuilderTask()
           
 
Method Summary
protected  Part build(Resource resource)
          Build the plugin definition.
 Directive buildDirective(ClassLoader classloader)
          Build the part.
 PartReference buildPartReference(ClassLoader classloader, Type type)
          Build a part reference.
 CategoriesDataType createCategories()
          Create a new categories data type.
protected  ClassLoader createClassLoader()
          Return the runtime classloader.
 ContextDataType createContext()
          Create a new context data type.
 PartsDataType createParts()
          Create a new part datatype.
 ActivationPolicy getActivationPolicy()
          Return the activation policy.
 URI getBuilderURI()
          Return a uri identitifying the builder.
protected  String getClassname()
          Return the component classname.
 CollectionPolicy getCollectionPolicy(Type type)
          Return the collection policy.
 String getKey()
          Return the part key.
 LifestylePolicy getLifestylePolicy()
          Return the lifestyle policy declared relative to usage.
protected  String getName(String typeName)
          Return the component name.
 URI getPartHandlerURI()
          Return a urn identitifying the part handler for this builder.
 void setActivation(String policy)
          Set the activation policy value.
 void setAlias(boolean alias)
          Set the alias production flag value.
 void setCollection(String policy)
          Set the gabage collection policy value.
 void setExtends(URI uri)
          Set the extends uri feature.
 void setKey(String key)
          Set the part key.
 void setLifestyle(String policy)
          Set the lifestyle policy vlaue.
 void setName(String name)
          Set the component name.
 void setType(String classname)
          Set the component classname.
protected static URI setupURI(String spec)
          Utility function to create a static uri.
 
Methods inherited from class net.dpml.tools.tasks.PartTask
execute, getClasspath, getContext, getInfo, setDest, setTest, writePart
 
Methods inherited from class net.dpml.tools.tasks.GenericTask
asc, checksum, copy, deleteDir, getContext, getLibrary, getResource, init, isInitialized, mkDir
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PART_HANDLER_URI

public static final URI PART_HANDLER_URI
Constant controller uri.


STRATEGY_BUILDER_URI

public static final URI STRATEGY_BUILDER_URI
Constant strategy builder uri.


PART_BUILDER_URI

public static final URI PART_BUILDER_URI
Constant builder uri.

Constructor Detail

ComponentBuilderTask

public ComponentBuilderTask()
Method Detail

setKey

public void setKey(String key)
Set the part key.

Parameters:
key - the key

setAlias

public void setAlias(boolean alias)
Set the alias production flag value.

Parameters:
alias - true if alias production is requested

setExtends

public void setExtends(URI uri)
Set the extends uri feature.

Parameters:
uri - the uri from which the component extends

setName

public void setName(String name)
Set the component name.

Parameters:
name - the component name

setType

public void setType(String classname)
Set the component classname.

Parameters:
classname - the component type classname

setLifestyle

public void setLifestyle(String policy)
Set the lifestyle policy vlaue.

Parameters:
policy - the lifestyle policy

setCollection

public void setCollection(String policy)
Set the gabage collection policy value.

Parameters:
policy - the collection policy

setActivation

public void setActivation(String policy)
Set the activation policy value.

Parameters:
policy - the activation policy

createCategories

public CategoriesDataType createCategories()
Create a new categories data type.

Returns:
the categories datatype

createContext

public ContextDataType createContext()
Create a new context data type.

Returns:
the context datatype

createParts

public PartsDataType createParts()
Create a new part datatype.

Returns:
a new part datatype

build

protected Part build(Resource resource)
Build the plugin definition.

Overrides:
build in class PartTask
Parameters:
resource - the project resource definition
Returns:
the part definition

createClassLoader

protected ClassLoader createClassLoader()
Return the runtime classloader.

Returns:
the classloader

getBuilderURI

public URI getBuilderURI()
Return a uri identitifying the builder.

Returns:
the builder uri

getPartHandlerURI

public URI getPartHandlerURI()
Return a urn identitifying the part handler for this builder.

Returns:
a strategy uri

buildDirective

public Directive buildDirective(ClassLoader classloader)
                         throws IntrospectionException,
                                IOException,
                                ClassNotFoundException
Build the part.

Parameters:
classloader - the classloader
Returns:
the part
Throws:
IntrospectionException - if an error occurs while introspecting the component class
IOException - if an I/O error occurs
ClassNotFoundException - if the component class cannot be found

getKey

public String getKey()
Return the part key.

Specified by:
getKey in interface PartReferenceBuilder
Returns:
the key

buildPartReference

public PartReference buildPartReference(ClassLoader classloader,
                                        Type type)
                                 throws IntrospectionException,
                                        IOException,
                                        ClassNotFoundException
Build a part reference.

Specified by:
buildPartReference in interface PartReferenceBuilder
Parameters:
classloader - the classloader
type - the component type
Returns:
the part reference
Throws:
IntrospectionException - if an error occurs while introspecting the component class
IOException - if an I/O error occurs
ClassNotFoundException - if the component class cannot be found

getName

protected String getName(String typeName)
Return the component name.

Parameters:
typeName - the component type name (used as a default)
Returns:
the name

getClassname

protected String getClassname()
Return the component classname.

Returns:
the classname

getLifestylePolicy

public LifestylePolicy getLifestylePolicy()
Return the lifestyle policy declared relative to usage. If undefined then default to the lifestyle declared by the component type. Lifestyle policies that may be declared under the 'lifestyle' attribute of a component are 'transient', 'thread' or 'singleton'. If 'transient' is supplied the assigned lefestyle policy is InfoDescriptor.TRANSIENT resulting in the creation of a new instance per request. If 'thread' is declared the assigned lifestyle policy shall be InfoDescriptor.THREAD in which case a supplied instance will be reused for all requests within the same thread of execution. If the supplied policy is 'singleton' then the established instance will be shared across consumers referencing the component.

Returns:
the lifestyle policy

getCollectionPolicy

public CollectionPolicy getCollectionPolicy(Type type)
Return the collection policy.

Parameters:
type - the component type from which the default collection policy can be resolved if needed
Returns:
the collection policy

getActivationPolicy

public ActivationPolicy getActivationPolicy()
Return the activation policy.

Returns:
the component activation policy

setupURI

protected static URI setupURI(String spec)
Utility function to create a static uri.

Parameters:
spec - the uri spec
Returns:
the uri