net.dpml.component
Class InitialContext

java.lang.Object
  extended bynet.dpml.component.LocalEventProducer
      extended bynet.dpml.component.InitialContext
All Implemented Interfaces:
ControllerContext, Disposable

public final class InitialContext
extends net.dpml.component.LocalEventProducer
implements ControllerContext, Disposable

The CompositionControllerContext class wraps a ContentModel and supplies convinience operations that translate ContentModel properties and events to type-safe values used in the conposition controller.

Version:
1.0.0
Author:
Digital Product Meta Library

Constructor Summary
InitialContext()
          Creation of a new InitialContext.
InitialContext(String partition)
          Creation of a new InitialContext.
InitialContext(String partition, File work, File temp)
          Creation of a new InitialContext.
 
Method Summary
 void addControllerContextListener(ControllerContextListener listener)
          Add the supplied controller context listener to the controller context.
protected  void addListener(EventListener listener)
          Add a listener to the set of listeners handled by this producer.
static Controller createController()
          Create the default controller using the default initial context.
static Controller createController(InitialContext context)
          Create the default controller.
 void dispose()
          Initiate disposal.
protected  void enqueueEvent(EventObject event)
          Enqueue an event for delivery to registered listeners unless there are no registered listeners.
protected  void enqueueEvent(EventObject event, boolean asynchronouse)
          Enqueue an event for delivery to registered listeners unless there are no registered listeners.
protected  Logger getInternalLogger()
          Return the internal context logging channel.
protected  Object getLock()
          Return the synchronization lock.
 String getPartition()
          Return the partition name
 File getTempDirectory()
          Return the root temporary directory.
 File getWorkingDirectory()
          Return the root working directory.
protected  EventListener[] listeners()
          Return this node's preference/node change listeners.
protected  void processEvent(EventObject event)
          Process a context related event.
 void removeControllerContextListener(ControllerContextListener listener)
          Remove the supplied controller context listener from the controller context.
protected  void removeListener(EventListener listener)
          Remove a listener to the set of listeners handled by this producer.
 void setWorkingDirectory(File dir)
          Set the root working directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitialContext

public InitialContext()
Creation of a new InitialContext.


InitialContext

public InitialContext(String partition)
Creation of a new InitialContext.

Parameters:
partition - the assigned partition name

InitialContext

public InitialContext(String partition,
                      File work,
                      File temp)
Creation of a new InitialContext.

Parameters:
partition - the partition name
work - the working directory
temp - the temporary directory
Method Detail

createController

public static Controller createController()
Create the default controller using the default initial context. The default context and associated controller disposal will be triggered on JVM shutdown.

Returns:
the default controller

createController

public static Controller createController(InitialContext context)
Create the default controller. Controller disposal is the responsiblity of the client application.

Parameters:
context - the controller context
Returns:
the controller

dispose

public void dispose()
Initiate disposal.

Specified by:
dispose in interface Disposable

getPartition

public String getPartition()
Return the partition name

Specified by:
getPartition in interface ControllerContext
Returns:
the partion name

getWorkingDirectory

public File getWorkingDirectory()
Return the root working directory.

Specified by:
getWorkingDirectory in interface ControllerContext
Returns:
directory representing the root of the working directory hierachy

setWorkingDirectory

public void setWorkingDirectory(File dir)
Set the root working directory.

Parameters:
dir - the root of the working directory hierachy

getTempDirectory

public File getTempDirectory()
Return the root temporary directory.

Specified by:
getTempDirectory in interface ControllerContext
Returns:
directory representing the root of the temporary directory hierachy.

addControllerContextListener

public void addControllerContextListener(ControllerContextListener listener)
Add the supplied controller context listener to the controller context. A controller implementation should not maintain strong references to supplied listeners.

Specified by:
addControllerContextListener in interface ControllerContext
Parameters:
listener - the controller context listener to add

removeControllerContextListener

public void removeControllerContextListener(ControllerContextListener listener)
Remove the supplied controller context listener from the controller context.

Specified by:
removeControllerContextListener in interface ControllerContext
Parameters:
listener - the controller context listener to remove

processEvent

protected void processEvent(EventObject event)
Process a context related event.

Parameters:
event - the event to process

getInternalLogger

protected Logger getInternalLogger()
Return the internal context logging channel.

Returns:
the logging channel

getLock

protected Object getLock()
Return the synchronization lock.

Returns:
the lock

addListener

protected void addListener(EventListener listener)
Add a listener to the set of listeners handled by this producer.

Parameters:
listener - the event listener

removeListener

protected void removeListener(EventListener listener)
Remove a listener to the set of listeners handled by this producer.

Parameters:
listener - the event listener

listeners

protected EventListener[] listeners()
Return this node's preference/node change listeners. Even though we're using a copy-on-write lists, we use synchronized accessors to ensure information transmission from the writing thread to the reading thread.


enqueueEvent

protected void enqueueEvent(EventObject event)
Enqueue an event for delivery to registered listeners unless there are no registered listeners.


enqueueEvent

protected void enqueueEvent(EventObject event,
                            boolean asynchronouse)
Enqueue an event for delivery to registered listeners unless there are no registered listeners.