org.milyn.container
Class MockExecutionContext

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

public class MockExecutionContext
extends Object
implements ExecutionContext

Author:
tfennelly

Field Summary
 MockApplicationContext context
           
 String contextPath
           
 ContentDeliveryConfig deliveryConfig
           
 URI docSource
           
 Hashtable elementListTable
           
 Hashtable headers
           
 LinkedHashMap parameters
           
 ProfileSet profileSet
           
 
Fields inherited from interface org.milyn.container.ExecutionContext
DOCUMENT_URI
 
Constructor Summary
MockExecutionContext()
           
 
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.
 Map getAttributes()
          Returns the Map of attributes bound in this BoundAttributeStore
 String getConfigParameter(String name)
          Get a global configuration parameter associated with this execution context.
 String getConfigParameter(String name, String defaultVal)
          Get a global configuration parameter associated with this execution context.
 String getContentEncoding()
          Get the content encoding to be used when parsing content on this context.
 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.
 MockContentDeliveryConfig getMockDeliveryConfig()
           
 Enumeration getParameterNames()
           
 String[] getParameterValues(String name)
           
 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.
 boolean isDefaultSerializationOn()
          Is default serialization on for this execution context.
 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 context.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contextPath

public String contextPath

docSource

public URI docSource

profileSet

public ProfileSet profileSet

deliveryConfig

public ContentDeliveryConfig deliveryConfig

context

public MockApplicationContext context

parameters

public LinkedHashMap parameters

headers

public Hashtable headers

elementListTable

public Hashtable elementListTable
Constructor Detail

MockExecutionContext

public MockExecutionContext()
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.

getParameterNames

public Enumeration getParameterNames()

getParameterValues

public String[] getParameterValues(String name)

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
Description copied from interface: ExecutionContext
Set the content encoding to be used when parsing content on this context.

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()
Description copied from interface: ExecutionContext
Get the content encoding to be used when parsing content on this context.

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.

getConfigParameter

public String getConfigParameter(String name)
Description copied from interface: ExecutionContext
Get a global configuration parameter associated with this execution context.

For more fine grained control, see the ParameterAccessor class.

Specified by:
getConfigParameter in interface ExecutionContext
Parameters:
name - The name of the parameter.
Returns:
The parameter value, or null if the parameter is not configured.

getConfigParameter

public String getConfigParameter(String name,
                                 String defaultVal)
Description copied from interface: ExecutionContext
Get a global configuration parameter associated with this execution context.

For more fine grained control, see the ParameterAccessor class.

Specified by:
getConfigParameter in interface ExecutionContext
Parameters:
name - The name of the parameter.
defaultVal - The default value to be returned if the configuration parameter is not set.
Returns:
The parameter value, or "defaultVal" if the parameter is not configured.

isDefaultSerializationOn

public boolean isDefaultSerializationOn()
Description copied from interface: ExecutionContext
Is default serialization on for this execution context.

This is controlled by the Filter.DEFAULT_SERIALIZATION_ON global param. Default Serialization is on by default.

Example Configuration:

 <params>
     <param name="default.serialization.on">false</param>
 </params>
 

Specified by:
isDefaultSerializationOn in interface ExecutionContext
Returns:
True if default serialization is on, otherwise false.

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.

getMockDeliveryConfig

public MockContentDeliveryConfig getMockDeliveryConfig()

getAttributes

public Map 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 © 2009. All Rights Reserved.