org.milyn.container
Interface ExecutionContext

All Superinterfaces:
BoundAttributeStore
All Known Implementing Classes:
MockExecutionContext, StandaloneExecutionContext

public interface ExecutionContext
extends BoundAttributeStore

Smooks execution context interface definition.

Author:
tfennelly

Field Summary
static URI DOCUMENT_URI
          Sometimes the document being transformed/analysed has a URI associated with it.
 
Method Summary
 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.
 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 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 interface org.milyn.container.BoundAttributeStore
getAttribute, getAttributes, removeAttribute, setAttribute
 

Field Detail

DOCUMENT_URI

static final URI DOCUMENT_URI
Sometimes the document being transformed/analysed has a URI associated with it. This can be bound to the execution context under this key.

Method Detail

setDocumentSource

void setDocumentSource(URI docSource)
Set the document source URI.

Parameters:
docSource - The document URI.

getDocumentSource

URI getDocumentSource()
Get the document source URI.

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

Returns:
The document URI.

getContext

ApplicationContext getContext()
Get the application context within which this execution context "lives".

Returns:
The ApplicationContext instance.

getTargetProfiles

ProfileSet getTargetProfiles()
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.

Returns:
The target ProfileSet.

getDeliveryConfig

ContentDeliveryConfig getDeliveryConfig()
Get the content delivery configuration for the profile set at which this context is targeted.

Returns:
ContentDeliveryConfig instance.

setContentEncoding

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

Parameters:
contentEncoding - Character encoding to be used when parsing content. Null defaults to "UTF-8".
Throws:
IllegalArgumentException - Invalid encoding.

getContentEncoding

String getContentEncoding()
Get the content encoding to be used when parsing content on this context.

Returns:
Character encoding to be used when parsing content. Defaults to "UTF-8".

setEventListener

void setEventListener(ExecutionEventListener listener)
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.

Parameters:
listener - The listener instance.
See Also:
BasicExecutionEventListener

getEventListener

ExecutionEventListener getEventListener()
Get the ExecutionEventListener for the ExecutionContext.

Returns:
The listener instance.
See Also:
setEventListener(ExecutionEventListener)

setTerminationError

void setTerminationError(Throwable terminationError)
Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.

Parameters:
terminationError - The termination Error/Exception.

getTerminationError

Throwable getTerminationError()
Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.

Returns:
The Error/Exception that caused the associated filter operation to terminate (if it did terminate), otherwise null.

getConfigParameter

String getConfigParameter(String name)
Get a global configuration parameter associated with this execution context.

For more fine grained control, see the ParameterAccessor class.

Parameters:
name - The name of the parameter.
Returns:
The parameter value, or null if the parameter is not configured.

getConfigParameter

String getConfigParameter(String name,
                          String defaultVal)
Get a global configuration parameter associated with this execution context.

For more fine grained control, see the ParameterAccessor class.

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

boolean isDefaultSerializationOn()
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>
 

Returns:
True if default serialization is on, otherwise false.


Copyright © 2008. All Rights Reserved.