org.apache.uima.adapter.jms.client
Class BaseUIMAAsynchronousEngine_impl

java.lang.Object
  extended by org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
      extended by org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngine_impl
All Implemented Interfaces:
javax.jms.MessageListener, UimaAsynchronousEngine, org.apache.uima.aae.controller.ControllerCallbackListener

public class BaseUIMAAsynchronousEngine_impl
extends org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
implements UimaAsynchronousEngine, javax.jms.MessageListener, org.apache.uima.aae.controller.ControllerCallbackListener


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.ClientRequest, org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.ClientState, org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.SharedConnection, org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor, org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.UimaASShutdownHook
 
Field Summary
protected static Object connectionMux
           
protected  InitialContext jndiContext
           
protected static Semaphore sharedConnectionSemaphore
           
 
Fields inherited from class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
abort, asynchManager, brokerURI, clientCache, clientSideJmxStats, collectionReader, consumer, cpcReadySemaphore, cpcReplySemaphore, cpcSemaphore, cpcTimeout, CpCTimeout, exc, getMetaSemaphore, idGenerator, initialized, listeners, metadataTimeout, MetadataTimeout, outstandingCasRequests, pendingMessageQueue, PingTimeout, processTimeout, ProcessTimeout, producerInitialized, producerSemaphore, remoteService, resourceMetadata, running, sendAndReceiveCAS, serializationStrategy, serviceDelegate, SHADOW_CAS_POOL, sharedConnections, shutdownHookThread, springContainerRegistry, state, threadMonitorMap, totalCasRequestsSentBetweenCpCs, uniqueIdentifier
 
Fields inherited from interface org.apache.uima.aae.client.UimaAsynchronousEngine
ApplicationContext, ApplicationName, CasPoolSize, CpcTimeout, DD2SpringXsltFilePath, Endpoint, GetMetaTimeout, password, ReplyWindow, SaxonClasspath, SerializationStrategy, ServerUri, ShadowCasPoolSize, SharedConnection, Timeout, UimaEeDebug, userName
 
Constructor Summary
BaseUIMAAsynchronousEngine_impl()
           
 
Method Summary
protected  void cleanup()
          Called at the end of collectionProcessingComplete - WAS closes receiving thread here
protected  javax.jms.BytesMessage createBytesMessage()
           
protected  org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.SharedConnection createSharedConnection(String aBrokerURI)
           
protected  javax.jms.TextMessage createTextMessage()
           
 String deploy(String[] aDeploymentDescriptorList, Map anApplicationContext)
          Deploys a single UIMA AS container and all services defined in provided deployment descriptors.
 String deploy(String aDeploymentDescriptor, Map anApplicationContext)
          First generates a Spring context from a given deploy descriptor and than deploys the context into a Spring Container.
protected  void deployEmbeddedBroker()
           
protected  String deploySpringContainer(String[] springContextFiles)
          Deploys provided context files ( and beans) in a new Spring container.
protected  org.apache.uima.adapter.jms.client.MessageSender getDispatcher()
           
 String getEndPointName()
          Return a name of the queue to which the JMS Producer is connected to.
protected  javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
           
protected  javax.jms.Session getSession(javax.jms.Connection aConnection)
           
protected  javax.jms.Session getSession(String aBrokerURI)
           
 void initialize(Map anApplicationContext)
          Initialize the uima ee client.
protected  void initializeConsumer(String aBrokerURI)
          Create a JMS Consumer on a temporary queue.
protected  void initializeConsumer(String aBrokerURI, javax.jms.Connection connection)
           
protected  void initializeProducer(String aBrokerURI, String aQueueName)
           
protected  void initializeProducer(String aBrokerURI, String aQueueName, javax.jms.Connection aConnection)
           
protected  javax.jms.MessageProducer lookupProducerForEndpoint(org.apache.uima.aae.controller.Endpoint anEndpoint)
           
static void main(String[] args)
           
 void notifyOnInitializationFailure(org.apache.uima.aae.controller.AnalysisEngineController aController, Exception e)
           
 void notifyOnInitializationFailure(Exception e)
           
 void notifyOnInitializationSuccess()
           
 void notifyOnInitializationSuccess(org.apache.uima.aae.controller.AnalysisEngineController aController)
           
 void notifyOnReconnecting(String aMessage)
           
 void notifyOnReconnectionSuccess()
           
 void notifyOnTermination(String aServiceName)
           
 void notifyOnTermination(String aServiceName, String aCasReferenceId, Exception cause)
           
protected  void setCASMessage(String aCasReferenceId, byte[] aSerializedCAS, javax.jms.Message msg)
           
protected  void setCASMessage(String aCasReferenceId, CAS aCAS, javax.jms.Message msg)
          Initialize JMS Message with properties relevant to Process CAS request.
protected  void setCASMessage(String aCasReferenceId, String aSerializedCAS, javax.jms.Message msg)
           
protected  void setCommonProperties(String aCasReferenceId, javax.jms.Message msg, String aSerializationStrategy)
           
 void setCPCMessage(javax.jms.Message msg)
           
protected  void setMetaRequestMessage(javax.jms.Message msg)
           
 void setReleaseCASMessage(javax.jms.TextMessage msg, String aCasReferenceId)
           
 void stop()
          Stops the asynchronous client.
 void stopProducingCases()
          Request Uima AS client to initiate sending Stop requests to a service for all outstanding CASes awaiting reply.
 void stopProducingCases(String aCasReferenceId)
          Request Uima AS client to initiate sending Stop request to a service for a given CAS id If the service is a Cas Multiplier, it will stop producing new CASes, will wait until all child CASes finish and finally returns the input CAS.
 void undeploy()
           
 void undeploy(String aSpringContainerId)
          Undeploys specified UIMA AS container and all services running within it.
 void undeploy(String aSpringContainerId, int stop_level)
          Undeploys Spring container with a given container Id.
protected  void waitForServiceNotification()
           
 
Methods inherited from class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
acquireCpcReadySemaphore, addStatusCallbackListener, cancelTimer, collectionProcessingComplete, connectionOpen, decrementOutstandingCasCounter, delayCasIfDelegateInTimedOutState, deserialize, deserialize, deserialize, deserializeCAS, deserializeCAS, deserializeCAS, deserializeCAS, deserializeCAS, deserializeCAS, doStop, getBrokerURI, getCache, getCAS, getMetaData, getPerformanceReport, getSerializationStrategy, handleCollectionProcessCompleteReply, handleException, handleException, handleException, handleMetadataReply, handleNonProcessException, handleProcessReply, handleServiceInfo, lookupConnection, notifyListeners, notifyListeners, notifyOnTimout, onBeforeMessageSend, onBeforeProcessCAS, onException, onMessage, onProducerInitialized, process, recoverSharedConnectionIfClosed, removeFromCache, removeStatusCallbackListener, reset, sendAndReceiveCAS, sendAndReceiveCAS, sendAndReceiveCAS, sendAndReceiveCAS, sendCAS, sendMetaRequest, serializeCAS, serializeCAS, setBrokeryURI, setCollectionReader, setSerializationStrategy, waitForCpcReply, waitForMetadataReply, wakeUpSendThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.uima.aae.client.UimaAsynchronousEngine
addStatusCallbackListener, collectionProcessingComplete, getCAS, getMetaData, getPerformanceReport, getSerializationStrategy, process, removeStatusCallbackListener, sendAndReceiveCAS, sendAndReceiveCAS, sendCAS, setCollectionReader
 
Methods inherited from interface javax.jms.MessageListener
onMessage
 

Field Detail

sharedConnectionSemaphore

protected static Semaphore sharedConnectionSemaphore

connectionMux

protected static Object connectionMux

jndiContext

protected InitialContext jndiContext
Constructor Detail

BaseUIMAAsynchronousEngine_impl

public BaseUIMAAsynchronousEngine_impl()
Method Detail

createTextMessage

protected javax.jms.TextMessage createTextMessage()
                                           throws ResourceInitializationException
Specified by:
createTextMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceInitializationException

createBytesMessage

protected javax.jms.BytesMessage createBytesMessage()
                                             throws ResourceInitializationException
Specified by:
createBytesMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceInitializationException

cleanup

protected void cleanup()
                throws Exception
Called at the end of collectionProcessingComplete - WAS closes receiving thread here

Specified by:
cleanup in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
Exception

getEndPointName

public String getEndPointName()
                       throws ResourceProcessException
Return a name of the queue to which the JMS Producer is connected to.

Specified by:
getEndPointName in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceProcessException

setMetaRequestMessage

protected void setMetaRequestMessage(javax.jms.Message msg)
                              throws Exception
Specified by:
setMetaRequestMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
Exception

setCASMessage

protected void setCASMessage(String aCasReferenceId,
                             CAS aCAS,
                             javax.jms.Message msg)
                      throws ResourceProcessException
Initialize JMS Message with properties relevant to Process CAS request.

Specified by:
setCASMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceProcessException

setCASMessage

protected void setCASMessage(String aCasReferenceId,
                             String aSerializedCAS,
                             javax.jms.Message msg)
                      throws ResourceProcessException
Specified by:
setCASMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceProcessException

setCASMessage

protected void setCASMessage(String aCasReferenceId,
                             byte[] aSerializedCAS,
                             javax.jms.Message msg)
                      throws ResourceProcessException
Specified by:
setCASMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceProcessException

setCommonProperties

protected void setCommonProperties(String aCasReferenceId,
                                   javax.jms.Message msg,
                                   String aSerializationStrategy)
                            throws ResourceProcessException
Throws:
ResourceProcessException

stop

public void stop()
Description copied from interface: UimaAsynchronousEngine
Stops the asynchronous client. Cleans up resources, drops connection to UIMA AS service queue and stops listening on a response queue.

Specified by:
stop in interface UimaAsynchronousEngine

setCPCMessage

public void setCPCMessage(javax.jms.Message msg)
                   throws Exception
Specified by:
setCPCMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
Exception

createSharedConnection

protected org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.SharedConnection createSharedConnection(String aBrokerURI)
                                                                                                                    throws Exception
Throws:
Exception

getSession

protected javax.jms.Session getSession(String aBrokerURI)
                                throws Exception
Throws:
Exception

getSession

protected javax.jms.Session getSession(javax.jms.Connection aConnection)
                                throws Exception
Throws:
Exception

lookupProducerForEndpoint

protected javax.jms.MessageProducer lookupProducerForEndpoint(org.apache.uima.aae.controller.Endpoint anEndpoint)
                                                       throws Exception
Throws:
Exception

initializeProducer

protected void initializeProducer(String aBrokerURI,
                                  String aQueueName)
                           throws Exception
Throws:
Exception

initializeProducer

protected void initializeProducer(String aBrokerURI,
                                  String aQueueName,
                                  javax.jms.Connection aConnection)
                           throws Exception
Throws:
Exception

initializeConsumer

protected void initializeConsumer(String aBrokerURI)
                           throws Exception
Create a JMS Consumer on a temporary queue. Service replies will be handled by this consumer.

Parameters:
aBrokerURI -
Throws:
Exception

initializeConsumer

protected void initializeConsumer(String aBrokerURI,
                                  javax.jms.Connection connection)
                           throws Exception
Specified by:
initializeConsumer in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
Exception

initialize

public void initialize(Map anApplicationContext)
                throws ResourceInitializationException
Initialize the uima ee client. Takes initialization parameters from the anApplicationContext map.

Specified by:
initialize in interface UimaAsynchronousEngine
Specified by:
initialize in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Parameters:
anApplicationContext - - configuration containing UIMA EE Service Broker URI, service queue name, timeout value, reply window size, and CAS Pool size.
Throws:
ResourceInitializationException

deploy

public String deploy(String aDeploymentDescriptor,
                     Map anApplicationContext)
              throws Exception
First generates a Spring context from a given deploy descriptor and than deploys the context into a Spring Container.

Specified by:
deploy in interface UimaAsynchronousEngine
Parameters:
aDeploymentDescriptor - - deployment descriptor to generate Spring Context from
anApplicationContext - - a Map containing properties required by dd2spring
Returns:
- a unique spring container id
Throws:
Exception - - if there was a problem deploying the container or UIMA AS services.

deploy

public String deploy(String[] aDeploymentDescriptorList,
                     Map anApplicationContext)
              throws Exception
Description copied from interface: UimaAsynchronousEngine
Deploys a single UIMA AS container and all services defined in provided deployment descriptors. Each deployment descriptor contains an assembly of related UIMA AS services. This method is synchronous and will block until all UIMA AS services are completely deployed and initialized. If there is a problem deploying any of the UIMA AS services the container is destroyed and exception thrown.

Specified by:
deploy in interface UimaAsynchronousEngine
Specified by:
deploy in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Parameters:
aDeploymentDescriptorList - - a list of deployment descriptors to deploy in a container.
anApplicationContext - - initialization parameters needed to configure the client and services
Returns:
- the id of the container in which the UIMA AS services were deployed
Throws:
Exception - - if there was a problem deploying the container or UIMA AS services.

undeploy

public void undeploy()
              throws Exception
Throws:
Exception

undeploy

public void undeploy(String aSpringContainerId)
              throws Exception
Description copied from interface: UimaAsynchronousEngine
Undeploys specified UIMA AS container and all services running within it. Each UIMA AS container has a unique id assigned to it during the deploy phase. This method is synchronous and will block until the container (and all services contained within it) is destroyed.

Specified by:
undeploy in interface UimaAsynchronousEngine
Parameters:
aSpringContainerId - - an id of the container to be destroyed.
Throws:
Exception

undeploy

public void undeploy(String aSpringContainerId,
                     int stop_level)
              throws Exception
Undeploys Spring container with a given container Id. All deployed Spring containers are registered in the local registry under a unique id.

Specified by:
undeploy in interface UimaAsynchronousEngine
Parameters:
aSpringContainerId - - an id of the container to be destroyed.
Throws:
Exception

deploySpringContainer

protected String deploySpringContainer(String[] springContextFiles)
                                throws ResourceInitializationException
Deploys provided context files ( and beans) in a new Spring container.

Specified by:
deploySpringContainer in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
ResourceInitializationException

waitForServiceNotification

protected void waitForServiceNotification()
                                   throws Exception
Throws:
Exception

deployEmbeddedBroker

protected void deployEmbeddedBroker()
                             throws Exception
Throws:
Exception

main

public static void main(String[] args)

setReleaseCASMessage

public void setReleaseCASMessage(javax.jms.TextMessage msg,
                                 String aCasReferenceId)
                          throws Exception
Overrides:
setReleaseCASMessage in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
Exception

notifyOnInitializationFailure

public void notifyOnInitializationFailure(Exception e)
Specified by:
notifyOnInitializationFailure in interface org.apache.uima.aae.controller.ControllerCallbackListener

notifyOnInitializationSuccess

public void notifyOnInitializationSuccess()
Specified by:
notifyOnInitializationSuccess in interface org.apache.uima.aae.controller.ControllerCallbackListener

notifyOnInitializationFailure

public void notifyOnInitializationFailure(org.apache.uima.aae.controller.AnalysisEngineController aController,
                                          Exception e)
Specified by:
notifyOnInitializationFailure in interface org.apache.uima.aae.controller.ControllerCallbackListener

notifyOnInitializationSuccess

public void notifyOnInitializationSuccess(org.apache.uima.aae.controller.AnalysisEngineController aController)
Specified by:
notifyOnInitializationSuccess in interface org.apache.uima.aae.controller.ControllerCallbackListener

notifyOnTermination

public void notifyOnTermination(String aServiceName)
Specified by:
notifyOnTermination in interface org.apache.uima.aae.controller.ControllerCallbackListener

notifyOnTermination

public void notifyOnTermination(String aServiceName,
                                String aCasReferenceId,
                                Exception cause)

getMessageProducer

protected javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
                                                throws Exception
Overrides:
getMessageProducer in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
Throws:
Exception

stopProducingCases

public void stopProducingCases()
Request Uima AS client to initiate sending Stop requests to a service for all outstanding CASes awaiting reply.

Specified by:
stopProducingCases in interface UimaAsynchronousEngine

stopProducingCases

public void stopProducingCases(String aCasReferenceId)
Request Uima AS client to initiate sending Stop request to a service for a given CAS id If the service is a Cas Multiplier, it will stop producing new CASes, will wait until all child CASes finish and finally returns the input CAS.

Specified by:
stopProducingCases in interface UimaAsynchronousEngine

getDispatcher

protected org.apache.uima.adapter.jms.client.MessageSender getDispatcher()
Specified by:
getDispatcher in class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl

notifyOnReconnecting

public void notifyOnReconnecting(String aMessage)
Specified by:
notifyOnReconnecting in interface org.apache.uima.aae.controller.ControllerCallbackListener

notifyOnReconnectionSuccess

public void notifyOnReconnectionSuccess()
Specified by:
notifyOnReconnectionSuccess in interface org.apache.uima.aae.controller.ControllerCallbackListener


Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved.