SMILA (incubation) API documentation

org.eclipse.smila.processing.bpel
Class ExtensionManager

java.lang.Object
  extended by org.eclipse.smila.processing.bpel.ExtensionManager
Direct Known Subclasses:
PipeletManager, ProcessingServiceManager

public abstract class ExtensionManager
extends java.lang.Object

Utility class with methods needed in implementating ODE extension actitivities for SMILA.

Author:
jschumacher

Constructor Summary
ExtensionManager()
           
 
Method Summary
abstract  void checkAvailability(ExtensionAdapter adapter, ODEWorkflowProcessor processor)
          check if element invoked by the adapter is already available.
 void copyAnnotations(Blackboard blackboard, ProcessorMessage message, Annotatable annotatable)
          copy annotations from annotable object to each record on blackboard identified by the given Ids.
protected  CompilationMessage createErrorCompilationMessage(java.lang.String key, java.lang.String message)
          utility method for subclasses to use for creating error messages during activity registration.
abstract  ProcessorMessage doInvoke(ExtensionAdapter adapter, ODEWorkflowProcessor processor, Blackboard blackboard, ProcessorMessage request)
          actually invoke the adapter.
abstract  ExtensionAdapter doRegisterActivity(OProcess pipelineProcess, OExtensionActivity activity, org.w3c.dom.Element content, java.lang.String key)
          register extension actvity.
 java.lang.String getActivityKey(OActivity activity)
          create unique name for given key.
 java.util.Collection<ExtensionAdapter> getAdapters()
           
 java.lang.String getAttributeOfElement(org.w3c.dom.Element content, java.lang.String localName, java.lang.String attribute)
          find element with given local name (proc: namespace) and return value of given attribute. return null, if not found.
 ExtensionAdapter getExtensionAdapter(java.lang.String key)
          get extension adapter for key.
abstract  java.lang.String getExtensionName()
           
 ODEWorkflowProcessor getProcessor(OActivity activity)
           
 void invokeActivity(ExtensionContext context, org.w3c.dom.Element element)
          invoke extension activity from BPEL process.
 void parseAnnotations(org.w3c.dom.Element content, AnnotatableImpl annotatable)
          parse annotations from given element and attach them to annotatble object.
 void registerActivity(OExtensionActivity activity, ExtensibleElement element)
          create adapter for detected extension actitity.
 void registerPipeline(ODEWorkflowProcessor processor, javax.xml.namespace.QName processName)
          register owner of pipeline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionManager

public ExtensionManager()
Method Detail

registerActivity

public void registerActivity(OExtensionActivity activity,
                             ExtensibleElement element)
create adapter for detected extension actitity. Throws a org.apache.ode.bpel.compiler.api.CompilationException if an error occurs.

Parameters:
activity - the activity to register
element - DOM element from BPEL describing the actvity

doRegisterActivity

public abstract ExtensionAdapter doRegisterActivity(OProcess pipelineProcess,
                                                    OExtensionActivity activity,
                                                    org.w3c.dom.Element content,
                                                    java.lang.String key)
register extension actvity. Should throw a org.apache.ode.bpel.compiler.api.CompilationException if an error occurs.

Parameters:
pipelineProcess - process that contains the activity.
activity - the activity to register
content - XML content of actvity
key - key of actvity
Returns:
adapter for activity.

registerPipeline

public void registerPipeline(ODEWorkflowProcessor processor,
                             javax.xml.namespace.QName processName)
register owner of pipeline.

Parameters:
processor - ODE processor that owns this pipeline.
processName - pipeline to register

getExtensionName

public abstract java.lang.String getExtensionName()
Returns:
local name of tag of watched extension activities

invokeActivity

public void invokeActivity(ExtensionContext context,
                           org.w3c.dom.Element element)
invoke extension activity from BPEL process.

Parameters:
context - BPEL extension context.
element - DOM representation of extension element.

checkAvailability

public abstract void checkAvailability(ExtensionAdapter adapter,
                                       ODEWorkflowProcessor processor)
                                throws ProcessingException
check if element invoked by the adapter is already available.

Parameters:
adapter - adapter to check
processor - associated processor
Throws:
ProcessingException - if elements represented by adapter cannot be invoked.

doInvoke

public abstract ProcessorMessage doInvoke(ExtensionAdapter adapter,
                                          ODEWorkflowProcessor processor,
                                          Blackboard blackboard,
                                          ProcessorMessage request)
                                   throws ProcessingException
actually invoke the adapter.

Parameters:
adapter - adapter to invoke
processor - associated processor
blackboard - blackboard instance to work on.
request - record Ids of request.
Returns:
Ids of result records
Throws:
ProcessingException - error while processing.

getActivityKey

public java.lang.String getActivityKey(OActivity activity)
create unique name for given key.

Parameters:
activity - a ODE activity
Returns:
unique name.

getAdapters

public java.util.Collection<ExtensionAdapter> getAdapters()
Returns:
an unmodifiable collection of all currently known adapters.

getExtensionAdapter

public ExtensionAdapter getExtensionAdapter(java.lang.String key)
                                     throws ProcessingException
get extension adapter for key.

Parameters:
key - activity key
Returns:
associated adapter, if any.
Throws:
ProcessingException - no adapter found.

getProcessor

public ODEWorkflowProcessor getProcessor(OActivity activity)
                                  throws ProcessingException
Parameters:
activity - an extension activity
Returns:
processor owning the process containing this activity.
Throws:
ProcessingException - no processor found.

getAttributeOfElement

public java.lang.String getAttributeOfElement(org.w3c.dom.Element content,
                                              java.lang.String localName,
                                              java.lang.String attribute)
find element with given local name (proc: namespace) and return value of given attribute. return null, if not found.

Parameters:
content - an element to search in.
localName - local name of element to look for.
attribute - attribute name.
Returns:
attribute value if found, else null.

parseAnnotations

public void parseAnnotations(org.w3c.dom.Element content,
                             AnnotatableImpl annotatable)
parse annotations from given element and attach them to annotatble object.

Parameters:
content - DOM objects to search for annotations
annotatable - object to attach annotations to.

copyAnnotations

public void copyAnnotations(Blackboard blackboard,
                            ProcessorMessage message,
                            Annotatable annotatable)
                     throws BlackboardAccessException
copy annotations from annotable object to each record on blackboard identified by the given Ids.

Parameters:
blackboard - blackboard
message - target record Ids.
annotatable - annotation source.
Throws:
BlackboardAccessException - error copying annotations

createErrorCompilationMessage

protected CompilationMessage createErrorCompilationMessage(java.lang.String key,
                                                           java.lang.String message)
utility method for subclasses to use for creating error messages during activity registration. They must throw a org.apache.ode.bpel.compiler.api.CompilationException which needs to be created with a CompilationMessage. The causing exception can be added to the org.apache.ode.bpel.compiler.api.CompilationException itself.

Parameters:
key - activity key
message - message describing the error.
Returns:
CompilationMessage describing an error in phase=0.

SMILA (incubation) API documentation