org.milyn.container.standalone
Class StandaloneExecutionContext

java.lang.Object
  extended by org.milyn.container.standalone.StandaloneExecutionContext
All Implemented Interfaces:
BoundAttributeStore, ExecutionContext

public class StandaloneExecutionContext
extends Object
implements ExecutionContext

Standalone Container Request implementation.

Author:
tfennelly

Field Summary
 
Fields inherited from interface org.milyn.container.ExecutionContext
DOCUMENT_URI
 
Constructor Summary
StandaloneExecutionContext(String targetProfile, ApplicationContext context)
          Public Constructor.
StandaloneExecutionContext(String targetProfile, ApplicationContext context, String contentEncoding)
          Public Constructor.
 
Method Summary
 Object getAttribute(Object key)
          Returns the object bound with the specified name in this BoundAttributeStore implementation, or null if no object is bound under the name.
 Hashtable getAttributes()
          Returns the Map of attributes bound in this BoundAttributeStore
 String getContentEncoding()
          Get the content encoding to be used when parsing content on this standalone request instance.
 ApplicationContext getContext()
          Get the application context within which this execution context "lives".
 ContentDeliveryConfig getDeliveryConfig()
          Get the content delivery configuration for the profile set at which this context is targeted.
 URI getDocumentSource()
          Get the document source URI.
 ExecutionEventListener getEventListener()
          Get the ExecutionEventListener for the ExecutionContext.
 ProfileSet getTargetProfiles()
          Get the set of profiles at which this execution context is targeted.
 Throwable getTerminationError()
          Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.
 void removeAttribute(Object key)
          Removes the object bound with the specified name from this BoundAttributeStore implementation.
 void setAttribute(Object key, Object value)
          Binds an object to this BoundAttributeStore implementation, using the name specified.
 void setContentEncoding(String contentEncoding)
          Set the content encoding to be used when parsing content on this standalone request instance.
 void setDocumentSource(URI docSource)
          Set the document source URI.
 void setEventListener(ExecutionEventListener listener)
          Set the ExecutionEventListener for the ExecutionContext.
 void setTerminationError(Throwable terminationError)
          Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandaloneExecutionContext

public StandaloneExecutionContext(String targetProfile,
                                  ApplicationContext context)
                           throws UnknownProfileMemberException
Public Constructor.

The execution context is constructed within the context of a target profile and application context.

Parameters:
targetProfile - The target base profile for the execution context. These parameters are not appended to the supplied requestURI. This arg must be supplied, even if it's empty.
context - The application context.
Throws:
UnknownProfileMemberException - Unknown target profile.

StandaloneExecutionContext

public StandaloneExecutionContext(String targetProfile,
                                  ApplicationContext context,
                                  String contentEncoding)
                           throws UnknownProfileMemberException
Public Constructor.

The execution context is constructed within the context of a target profile and application context.

Parameters:
targetProfile - The target profile (base profile) for this context. These parameters are not appended to the supplied requestURI. This arg must be supplied, even if it's empty.
context - The application context.
contentEncoding - Character encoding to be used when parsing content. Null defaults to "UTF-8".
Throws:
UnknownProfileMemberException - Unknown target profile.
Method Detail

setDocumentSource

public void setDocumentSource(URI docSource)
Description copied from interface: ExecutionContext
Set the document source URI.

Specified by:
setDocumentSource in interface ExecutionContext
Parameters:
docSource - The document URI.

getDocumentSource

public URI getDocumentSource()
Description copied from interface: ExecutionContext
Get the document source URI.

If the document source URI is not set for the context, implementations should return the ExecutionContext.DOCUMENT_URI constant.

Specified by:
getDocumentSource in interface ExecutionContext
Returns:
The document URI.

getContext

public ApplicationContext getContext()
Description copied from interface: ExecutionContext
Get the application context within which this execution context "lives".

Specified by:
getContext in interface ExecutionContext
Returns:
The ApplicationContext instance.

getTargetProfiles

public ProfileSet getTargetProfiles()
Description copied from interface: ExecutionContext
Get the set of profiles at which this execution context is targeted.

Basically, the set of profiles for which this execution context is to perform transformation/analysis.

Specified by:
getTargetProfiles in interface ExecutionContext
Returns:
The target ProfileSet.

getDeliveryConfig

public ContentDeliveryConfig getDeliveryConfig()
Description copied from interface: ExecutionContext
Get the content delivery configuration for the profile set at which this context is targeted.

Specified by:
getDeliveryConfig in interface ExecutionContext
Returns:
ContentDeliveryConfig instance.

setContentEncoding

public void setContentEncoding(String contentEncoding)
                        throws IllegalArgumentException
Set the content encoding to be used when parsing content on this standalone request instance.

Specified by:
setContentEncoding in interface ExecutionContext
Parameters:
contentEncoding - Character encoding to be used when parsing content. Null defaults to "UTF-8".
Throws:
IllegalArgumentException - Invalid encoding.

getContentEncoding

public String getContentEncoding()
Get the content encoding to be used when parsing content on this standalone request instance.

Specified by:
getContentEncoding in interface ExecutionContext
Returns:
Character encoding to be used when parsing content. Defaults to "UTF-8".

setEventListener

public void setEventListener(ExecutionEventListener listener)
Description copied from interface: ExecutionContext
Set the ExecutionEventListener for the ExecutionContext.

Allows calling code to listen to (and capture data on) specific context execution events e.g. the targeting of resources.

Note, this is not a logging facility and should be used with care. It's overuse should be avoided as it can have a serious negative effect on performance. By default, no listenrs are applied and so no overhead is incured.

Specified by:
setEventListener in interface ExecutionContext
Parameters:
listener - The listener instance.
See Also:
BasicExecutionEventListener

getEventListener

public ExecutionEventListener getEventListener()
Description copied from interface: ExecutionContext
Get the ExecutionEventListener for the ExecutionContext.

Specified by:
getEventListener in interface ExecutionContext
Returns:
The listener instance.
See Also:
ExecutionContext.setEventListener(ExecutionEventListener)

setTerminationError

public void setTerminationError(Throwable terminationError)
Description copied from interface: ExecutionContext
Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.

Specified by:
setTerminationError in interface ExecutionContext
Parameters:
terminationError - The termination Error/Exception.

getTerminationError

public Throwable getTerminationError()
Description copied from interface: ExecutionContext
Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.

Specified by:
getTerminationError in interface ExecutionContext
Returns:
The Error/Exception that caused the associated filter operation to terminate (if it did terminate), otherwise null.

setAttribute

public void setAttribute(Object key,
                         Object value)
Description copied from interface: BoundAttributeStore
Binds an object to this BoundAttributeStore implementation, using the name specified. If an object of the same name is already bound, the object is replaced.

Specified by:
setAttribute in interface BoundAttributeStore
Parameters:
key - The key against which the object is bound; cannot be null.
value - The object to be bound; cannot be null.

getAttribute

public Object getAttribute(Object key)
Description copied from interface: BoundAttributeStore
Returns the object bound with the specified name in this BoundAttributeStore implementation, or null if no object is bound under the name.

Specified by:
getAttribute in interface BoundAttributeStore
Parameters:
key - The key against which the object is bound; cannot be null.
Returns:
The object bound with the specified name in this BoundAttributeStore implementation, or null if no object is bound under the name.

removeAttribute

public void removeAttribute(Object key)
Description copied from interface: BoundAttributeStore
Removes the object bound with the specified name from this BoundAttributeStore implementation. If the BoundAttributeStore implementation does not have an object bound with the specified name, this method does nothing.

Specified by:
removeAttribute in interface BoundAttributeStore
Parameters:
key - The key against which the object is bound; cannot be null.

toString

public String toString()
Overrides:
toString in class Object

getAttributes

public Hashtable getAttributes()
Description copied from interface: BoundAttributeStore
Returns the Map of attributes bound in this BoundAttributeStore

Specified by:
getAttributes in interface BoundAttributeStore
Returns:
Map of all objects bound in this BoundAttributeStore


Copyright © 2008. All Rights Reserved.