net.dpml.metro.runtime
Class CompositionController

java.lang.Object
  extended by net.dpml.metro.runtime.CompositionController
All Implemented Interfaces:
Controller, Builder

public class CompositionController
extends Object
implements Controller, Builder

The composition controller is the controller used to establish remotely accessible component controls.

Version:
1.2.0
Author:
Digital Product Meta Library

Field Summary
static URI CONTROLLER_URI
          Static URI of this controller.
 
Fields inherited from interface net.dpml.component.Controller
STANDARD
 
Constructor Summary
CompositionController(ControllerContext context)
          Creation of a new controller.
 
Method Summary
 Part build(Logger logger, Info info, Classpath classpath, Element strategy, Resolver resolver)
          Construct the deployment information from a part definition.
 Component createComponent(Model model)
          Create and return a remote reference to a component handler.
 Component createComponent(URI uri)
          Create and return a remote reference to a component handler.
 Model createModel(Composition composition)
          Create and return a new management context using the supplied directive uri.
 Model createModel(URI uri)
          Create and return a new management context using the supplied directive uri.
protected  void finalize()
          Controller finalization.
 ClassLoader getClassLoader(String name, ClassLoader anchor, Classpath classpath)
          Build a classloader stack.
 ControllerContext getControllerContext()
          Return the controllers runtime context.
 URI getURI()
          Returns the uri of this controller.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTROLLER_URI

public static final URI CONTROLLER_URI
Static URI of this controller.

Constructor Detail

CompositionController

public CompositionController(ControllerContext context)
                      throws ControlException
Creation of a new controller.

Parameters:
context - the control context
Throws:
ControlException - if an error occurs during controller creation
Method Detail

finalize

protected void finalize()
                 throws Throwable
Controller finalization.

Overrides:
finalize in class Object
Throws:
Throwable - if a finalization error occurs

build

public Part build(Logger logger,
                  Info info,
                  Classpath classpath,
                  Element strategy,
                  Resolver resolver)
           throws IOException
Construct the deployment information from a part definition.

Specified by:
build in interface Builder
Parameters:
logger - the logging channel
info - the part info definition
classpath - the part classpath definition
strategy - the DOM element definining the deplyment streategy
resolver - build-time uri resolver
Returns:
the part definition
Throws:
IOException - if an I/O error occurs

getClassLoader

public ClassLoader getClassLoader(String name,
                                  ClassLoader anchor,
                                  Classpath classpath)
                           throws IOException
Build a classloader stack.

Parameters:
name - the name to assign to the classloader
anchor - the anchor classloader to server as the classloader chain root
classpath - the part classpath definition
Returns:
the new classloader
Throws:
IOException - if an IO error occurs during classpath evaluation

getURI

public URI getURI()
Returns the uri of this controller.

Specified by:
getURI in interface Controller
Returns:
the controller uri

createModel

public Model createModel(URI uri)
                  throws ControlException,
                         IOException
Create and return a new management context using the supplied directive uri.

Specified by:
createModel in interface Controller
Parameters:
uri - a uri identifying a deployment directive
Returns:
the management context model
Throws:
ControlException - if an error occurs
IOException - if an error occurs reading the identified resource

createModel

public Model createModel(Composition composition)
                  throws ControlException,
                         IOException
Create and return a new management context using the supplied directive uri.

Specified by:
createModel in interface Controller
Parameters:
composition - a composition directive
Returns:
the management model
Throws:
ControlException - if an error occurs
IOException - if an I/O error occurs

createComponent

public Component createComponent(URI uri)
                          throws Exception
Create and return a remote reference to a component handler.

Specified by:
createComponent in interface Controller
Parameters:
uri - a uri identifying a deployment directive
Returns:
the component handler
Throws:
Exception - if an error occurs

createComponent

public Component createComponent(Model model)
                          throws Exception
Create and return a remote reference to a component handler.

Specified by:
createComponent in interface Controller
Parameters:
model - the component model
Returns:
the component handler
Throws:
Exception - if an error occurs during component creation

getControllerContext

public ControllerContext getControllerContext()
Return the controllers runtime context. The runtime context holds infromation about the working and temporary directories and a uri identifying the execution domain.

Returns:
the runtime context