org.apache.ode.bpel.engine
Class BpelServerImpl

java.lang.Object
  extended by org.apache.ode.bpel.engine.BpelServerImpl
All Implemented Interfaces:
BpelServer, Scheduler.JobProcessor

public class BpelServerImpl
extends java.lang.Object
implements BpelServer, Scheduler.JobProcessor

The BPEL server implementation.

This implementation is intended to be thread safe. The key concurrency mechanism is a "management" read/write lock that synchronizes all management operations (they require "write" access) and prevents concurrent management operations and processing (processing requires "read" access). Write access to the lock is scoped to the method, while read access is scoped to a transaction.


Constructor Summary
BpelServerImpl()
           
 
Method Summary
protected  void assertNoTransaction()
           
protected  void assertTransaction()
           
 void cleanupProcess(javax.xml.namespace.QName pid)
           
 MyRoleMessageExchange createMessageExchange(InvocationStyle istyle, javax.xml.namespace.QName targetService, java.lang.String operation, java.lang.String clientKey)
          Create a "my role" message exchange for invoking a BPEL process.
 BpelDatabase getBpelDb()
           
 ODEProcess getBpelProcess(javax.xml.namespace.QName processId)
           
 OdeConfigProperties getConfigProperties()
           
 MessageExchange getMessageExchange(java.lang.String mexId)
          Retrieve a message identified by the given identifer.
 MessageExchange getMessageExchangeByForeignKey(java.lang.String foreignKey)
           
 ProcessModel getProcessModel(javax.xml.namespace.QName processId)
           
 SharedEndpoints getSharedEndpoints()
           
 java.util.Set<InvocationStyle> getSupportedInvocationStyle(javax.xml.namespace.QName serviceId)
          Inquire of the engine the invocation styles that are supported for a given service.
 void init()
          Initialize the BPEL engine.
 void onScheduledJob(Scheduler.JobInfo jobInfo)
           
 void register(ProcessConf conf)
          Register a process with the server.
 void registerBpelEventListener(BpelEventListener listener)
          Register a global listener to receive BpelEvents froom all processes.
 void registerExtensionBundle(ExtensionBundleRuntime bundle)
           
 void registerExternalVariableEngine(ExternalVariableModule eve)
           
 void registerMessageExchangeInterceptor(MessageExchangeInterceptor interceptor)
          Register a global message exchange interceptor.
 void setBindingContext(BindingContext bc)
          Configure the with a binding context.
 void setConfigProperties(OdeConfigProperties properties)
           
 void setDaoConnectionFactory(BpelDAOConnectionFactory daoCF)
          Set the DAO connection factory.
 void setDehydrationPolicy(DehydrationPolicy dehydrationPolicy)
           
 void setEndpointReferenceContext(EndpointReferenceContext eprContext)
          Configure the with an endpoint-reference (EPR) context.
 void setExecutor(java.util.concurrent.ExecutorService exec)
           
 void setMessageExchangeContext(MessageExchangeContext mexContext)
          Configure the with a message-exchange context.
 void setScheduler(Scheduler scheduler)
          Configure the with a scheduler.
 void setTransacted(boolean atomicScope)
           
 void setTransactionManager(javax.transaction.TransactionManager txm)
           
 void shutdown()
          Called to shutdown the BPEL egnine.
 void start()
          Start the BPEL engine.
 void stop()
          Stop the BPEL engine: results in the cessation of process execution.
 void unregister(javax.xml.namespace.QName pid)
          Unregister a process from the server.
 void unregisterBpelEventListener(BpelEventListener listener)
          Unregister a global listener from receive BpelEvents from all processes.
 void unregisterExtensionBundle(java.lang.String nsURI)
           
 void unregisterMessageExchangeInterceptor(MessageExchangeInterceptor interceptor)
          Unregister a global message exchange interceptor.
protected  void waitForQuiessence()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BpelServerImpl

public BpelServerImpl()
Method Detail

waitForQuiessence

protected void waitForQuiessence()

start

public void start()
Description copied from interface: BpelServer
Start the BPEL engine. The BPEL engine will not execute process instances until it is started.

Specified by:
start in interface BpelServer

getBpelDb

public BpelDatabase getBpelDb()

registerExternalVariableEngine

public void registerExternalVariableEngine(ExternalVariableModule eve)

registerBpelEventListener

public void registerBpelEventListener(BpelEventListener listener)
Register a global listener to receive BpelEvents froom all processes.

Parameters:
listener -

unregisterBpelEventListener

public void unregisterBpelEventListener(BpelEventListener listener)
Unregister a global listener from receive BpelEvents from all processes.

Parameters:
listener -

registerExtensionBundle

public void registerExtensionBundle(ExtensionBundleRuntime bundle)

unregisterExtensionBundle

public void unregisterExtensionBundle(java.lang.String nsURI)

stop

public void stop()
Description copied from interface: BpelServer
Stop the BPEL engine: results in the cessation of process execution.

Specified by:
stop in interface BpelServer

init

public void init()
          throws BpelEngineException
Description copied from interface: BpelServer
Initialize the BPEL engine. The various contexts needed by the engine must be configured before this method is called.

Specified by:
init in interface BpelServer
Throws:
BpelEngineException

shutdown

public void shutdown()
              throws BpelEngineException
Description copied from interface: BpelServer
Called to shutdown the BPEL egnine.

Specified by:
shutdown in interface BpelServer
Throws:
BpelEngineException

register

public void register(ProcessConf conf)
Description copied from interface: BpelServer
Register a process with the server.

Specified by:
register in interface BpelServer

unregister

public void unregister(javax.xml.namespace.QName pid)
                throws BpelEngineException
Description copied from interface: BpelServer
Unregister a process from the server.

Specified by:
unregister in interface BpelServer
Parameters:
pid - process to unregister
Throws:
BpelEngineException

cleanupProcess

public void cleanupProcess(javax.xml.namespace.QName pid)
                    throws BpelEngineException
Throws:
BpelEngineException

registerMessageExchangeInterceptor

public void registerMessageExchangeInterceptor(MessageExchangeInterceptor interceptor)
Register a global message exchange interceptor.

Parameters:
interceptor - message-exchange interceptor

unregisterMessageExchangeInterceptor

public void unregisterMessageExchangeInterceptor(MessageExchangeInterceptor interceptor)
Unregister a global message exchange interceptor.

Parameters:
interceptor - message-exchange interceptor

onScheduledJob

public void onScheduledJob(Scheduler.JobInfo jobInfo)
                    throws Scheduler.JobProcessorException
Specified by:
onScheduledJob in interface Scheduler.JobProcessor
Throws:
Scheduler.JobProcessorException

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager txm)

setDehydrationPolicy

public void setDehydrationPolicy(DehydrationPolicy dehydrationPolicy)

setConfigProperties

public void setConfigProperties(OdeConfigProperties properties)

getConfigProperties

public OdeConfigProperties getConfigProperties()

setMessageExchangeContext

public void setMessageExchangeContext(MessageExchangeContext mexContext)
                               throws BpelEngineException
Description copied from interface: BpelServer
Configure the with a message-exchange context. BPEL engine uses this context to initiate communication with external services.

Specified by:
setMessageExchangeContext in interface BpelServer
Parameters:
mexContext - MessageExchangeContext implementation
Throws:
BpelEngineException
See Also:
MessageExchangeContext

setScheduler

public void setScheduler(Scheduler scheduler)
                  throws BpelEngineException
Description copied from interface: BpelServer
Configure the with a scheduler.

Specified by:
setScheduler in interface BpelServer
Throws:
BpelEngineException

setEndpointReferenceContext

public void setEndpointReferenceContext(EndpointReferenceContext eprContext)
                                 throws BpelEngineException
Description copied from interface: BpelServer
Configure the with an endpoint-reference (EPR) context. BPEL engine uses this context to EPRs.

Specified by:
setEndpointReferenceContext in interface BpelServer
Parameters:
eprContext - EndpointReferenceContext implementation
Throws:
BpelEngineException
See Also:
EndpointReferenceContext

setDaoConnectionFactory

public void setDaoConnectionFactory(BpelDAOConnectionFactory daoCF)
                             throws BpelEngineException
Set the DAO connection factory. The DAO is used by the BPEL engine to persist information about active processes.

Parameters:
daoCF - BpelDAOConnectionFactory implementation.
Throws:
BpelEngineException

setBindingContext

public void setBindingContext(BindingContext bc)
Description copied from interface: BpelServer
Configure the with a binding context. The BPEL engine uses this context to register the services that it exposes and obtain communication links to partner services.

Specified by:
setBindingContext in interface BpelServer
Parameters:
bc - BindingContext implementation
See Also:
BindingContext

getSharedEndpoints

public SharedEndpoints getSharedEndpoints()

setExecutor

public void setExecutor(java.util.concurrent.ExecutorService exec)

createMessageExchange

public MyRoleMessageExchange createMessageExchange(InvocationStyle istyle,
                                                   javax.xml.namespace.QName targetService,
                                                   java.lang.String operation,
                                                   java.lang.String clientKey)
                                            throws BpelEngineException
Description copied from interface: BpelServer
Create a "my role" message exchange for invoking a BPEL process.

Specified by:
createMessageExchange in interface BpelServer
targetService - the service id of the process being called, if known
operation - name of the operation
Returns:
MyRoleMessageExchange the newly created message exchange
Throws:
BpelEngineException

getMessageExchange

public MessageExchange getMessageExchange(java.lang.String mexId)
                                   throws BpelEngineException
Description copied from interface: BpelServer
Retrieve a message identified by the given identifer.

Specified by:
getMessageExchange in interface BpelServer
Parameters:
mexId - message exhcange identifier
Returns:
associated message exchange
Throws:
BpelEngineException

getMessageExchangeByForeignKey

public MessageExchange getMessageExchangeByForeignKey(java.lang.String foreignKey)
                                               throws BpelEngineException
Specified by:
getMessageExchangeByForeignKey in interface BpelServer
Throws:
BpelEngineException

getSupportedInvocationStyle

public java.util.Set<InvocationStyle> getSupportedInvocationStyle(javax.xml.namespace.QName serviceId)
Description copied from interface: BpelServer
Inquire of the engine the invocation styles that are supported for a given service.

Specified by:
getSupportedInvocationStyle in interface BpelServer
Parameters:
serviceId - service identifier
Returns:
set of supported InvocationStyles

getProcessModel

public ProcessModel getProcessModel(javax.xml.namespace.QName processId)

assertTransaction

protected void assertTransaction()

assertNoTransaction

protected void assertNoTransaction()

getBpelProcess

public ODEProcess getBpelProcess(javax.xml.namespace.QName processId)

setTransacted

public void setTransacted(boolean atomicScope)