Class BaseUIMAAsynchronousEngine_impl
- java.lang.Object
-
- org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
-
- org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngine_impl
-
- All Implemented Interfaces:
javax.jms.MessageListener,UimaAsynchronousEngine,ControllerCallbackListener
public class BaseUIMAAsynchronousEngine_impl extends BaseUIMAAsynchronousEngineCommon_impl implements UimaAsynchronousEngine, javax.jms.MessageListener, ControllerCallbackListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
BaseUIMAAsynchronousEngineCommon_impl.ClientRequest, BaseUIMAAsynchronousEngineCommon_impl.ClientState, BaseUIMAAsynchronousEngineCommon_impl.SharedConnection, BaseUIMAAsynchronousEngineCommon_impl.ThreadMonitor, BaseUIMAAsynchronousEngineCommon_impl.UimaASShutdownHook
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.naming.InitialContextjndiContextprotected static java.util.concurrent.SemaphoresharedConnectionSemaphore-
Fields inherited from class org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl
abort, asynchManager, 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, sharedConnection, shutdownHookThread, springContainerRegistry, state, threadMonitorMap, totalCasRequestsSentBetweenCpCs, uniqueIdentifier
-
Fields inherited from interface org.apache.uima.aae.client.UimaAsynchronousEngine
ApplicationContext, ApplicationName, CasPoolSize, CpcTimeout, DD2SpringXsltFilePath, Endpoint, GetMetaTimeout, ReplyWindow, SaxonClasspath, SerializationStrategy, ServerUri, ShadowCasPoolSize, SharedConnection, Timeout, UimaEeDebug
-
-
Constructor Summary
Constructors Constructor Description BaseUIMAAsynchronousEngine_impl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanup()Called at the end of collectionProcessingComplete - WAS closes receiving thread hereprotected javax.jms.BytesMessagecreateBytesMessage()protected voidcreateSharedConnection(java.lang.String aBrokerURI)protected javax.jms.TextMessagecreateTextMessage()java.lang.Stringdeploy(java.lang.String[] aDeploymentDescriptorList, java.util.Map anApplicationContext)Deploys a single UIMA AS container and all services defined in provided deployment descriptors.java.lang.Stringdeploy(java.lang.String aDeploymentDescriptor, java.util.Map anApplicationContext)First generates a Spring context from a given deploy descriptor and than deploys the context into a Spring Container.protected voiddeployEmbeddedBroker()protected java.lang.StringdeploySpringContainer(java.lang.String[] springContextFiles)Deploys provided context files ( and beans) in a new Spring container.protected MessageSendergetDispatcher()java.lang.StringgetEndPointName()Return a name of the queue to which the JMS Producer is connected to.protected javax.jms.MessageProducergetMessageProducer(javax.jms.Destination destination)protected javax.jms.SessiongetSession(java.lang.String aBrokerURI)protected javax.jms.SessiongetSession(javax.jms.Connection aConnection)voidinitialize(java.util.Map anApplicationContext)Initialize the uima ee client.protected voidinitializeConsumer(java.lang.String aBrokerURI)Create a JMS Consumer on a temporary queue.protected voidinitializeConsumer(java.lang.String aBrokerURI, javax.jms.Connection connection)protected voidinitializeProducer(java.lang.String aBrokerURI, java.lang.String aQueueName)protected voidinitializeProducer(java.lang.String aBrokerURI, java.lang.String aQueueName, javax.jms.Connection aConnection)protected javax.jms.MessageProducerlookupProducerForEndpoint(Endpoint anEndpoint)static voidmain(java.lang.String[] args)voidnotifyOnInitializationFailure(java.lang.Exception e)voidnotifyOnInitializationFailure(AnalysisEngineController aController, java.lang.Exception e)voidnotifyOnInitializationSuccess()voidnotifyOnInitializationSuccess(AnalysisEngineController aController)voidnotifyOnReconnecting(java.lang.String aMessage)voidnotifyOnReconnectionSuccess()voidnotifyOnTermination(java.lang.String aServiceName)voidnotifyOnTermination(java.lang.String aServiceName, java.lang.String aCasReferenceId, java.lang.Exception cause)protected voidsetCASMessage(java.lang.String aCasReferenceId, byte[] aSerializedCAS, javax.jms.Message msg)protected voidsetCASMessage(java.lang.String aCasReferenceId, java.lang.String aSerializedCAS, javax.jms.Message msg)protected voidsetCASMessage(java.lang.String aCasReferenceId, org.apache.uima.cas.CAS aCAS, javax.jms.Message msg)Initialize JMS Message with properties relevant to Process CAS request.protected voidsetCommonProperties(java.lang.String aCasReferenceId, javax.jms.Message msg, java.lang.String aSerializationStrategy)voidsetCPCMessage(javax.jms.Message msg)protected voidsetMetaRequestMessage(javax.jms.Message msg)voidsetReleaseCASMessage(javax.jms.TextMessage msg, java.lang.String aCasReferenceId)voidstop()Stops the asynchronous client.voidstopProducingCases()Request Uima AS client to initiate sending Stop requests to a service for all outstanding CASes awaiting reply.voidstopProducingCases(java.lang.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.voidundeploy()voidundeploy(java.lang.String aSpringContainerId)Undeploys specified UIMA AS container and all services running within it.voidundeploy(java.lang.String aSpringContainerId, int stop_level)Undeploys Spring container with a given container Id.protected voidwaitForServiceNotification()-
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, getCache, getCAS, getMetaData, getPerformanceReport, getSerializationStrategy, handleCollectionProcessCompleteReply, handleException, handleException, handleException, handleMetadataReply, handleNonProcessException, handleProcessReply, handleServiceInfo, notifyListeners, notifyOnTimout, onBeforeMessageSend, onException, onMessage, onProducerInitialized, process, recoverSharedConnectionIfClosed, removeFromCache, removeStatusCallbackListener, reset, sendAndReceiveCAS, sendAndReceiveCAS, sendCAS, sendMetaRequest, serializeCAS, serializeCAS, 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, sendCAS, setCollectionReader
-
-
-
-
Method Detail
-
createTextMessage
protected javax.jms.TextMessage createTextMessage() throws org.apache.uima.resource.ResourceInitializationException- Specified by:
createTextMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceInitializationException
-
createBytesMessage
protected javax.jms.BytesMessage createBytesMessage() throws org.apache.uima.resource.ResourceInitializationException- Specified by:
createBytesMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceInitializationException
-
cleanup
protected void cleanup() throws java.lang.ExceptionCalled at the end of collectionProcessingComplete - WAS closes receiving thread here- Specified by:
cleanupin classBaseUIMAAsynchronousEngineCommon_impl- Throws:
java.lang.Exception
-
getEndPointName
public java.lang.String getEndPointName() throws org.apache.uima.resource.ResourceProcessExceptionReturn a name of the queue to which the JMS Producer is connected to.- Specified by:
getEndPointNamein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceProcessException
-
setMetaRequestMessage
protected void setMetaRequestMessage(javax.jms.Message msg) throws java.lang.Exception- Specified by:
setMetaRequestMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
java.lang.Exception
-
setCASMessage
protected void setCASMessage(java.lang.String aCasReferenceId, org.apache.uima.cas.CAS aCAS, javax.jms.Message msg) throws org.apache.uima.resource.ResourceProcessExceptionInitialize JMS Message with properties relevant to Process CAS request.- Specified by:
setCASMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceProcessException
-
setCASMessage
protected void setCASMessage(java.lang.String aCasReferenceId, java.lang.String aSerializedCAS, javax.jms.Message msg) throws org.apache.uima.resource.ResourceProcessException- Specified by:
setCASMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceProcessException
-
setCASMessage
protected void setCASMessage(java.lang.String aCasReferenceId, byte[] aSerializedCAS, javax.jms.Message msg) throws org.apache.uima.resource.ResourceProcessException- Specified by:
setCASMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceProcessException
-
setCommonProperties
protected void setCommonProperties(java.lang.String aCasReferenceId, javax.jms.Message msg, java.lang.String aSerializationStrategy) throws org.apache.uima.resource.ResourceProcessException- Throws:
org.apache.uima.resource.ResourceProcessException
-
stop
public void stop()
Description copied from interface:UimaAsynchronousEngineStops the asynchronous client. Cleans up resources, drops connection to UIMA AS service queue and stops listening on a response queue.- Specified by:
stopin interfaceUimaAsynchronousEngine
-
setCPCMessage
public void setCPCMessage(javax.jms.Message msg) throws java.lang.Exception- Specified by:
setCPCMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
java.lang.Exception
-
createSharedConnection
protected void createSharedConnection(java.lang.String aBrokerURI) throws java.lang.Exception- Throws:
java.lang.Exception
-
getSession
protected javax.jms.Session getSession(java.lang.String aBrokerURI) throws java.lang.Exception- Throws:
java.lang.Exception
-
getSession
protected javax.jms.Session getSession(javax.jms.Connection aConnection) throws java.lang.Exception- Throws:
java.lang.Exception
-
lookupProducerForEndpoint
protected javax.jms.MessageProducer lookupProducerForEndpoint(Endpoint anEndpoint) throws java.lang.Exception
- Throws:
java.lang.Exception
-
initializeProducer
protected void initializeProducer(java.lang.String aBrokerURI, java.lang.String aQueueName) throws java.lang.Exception- Throws:
java.lang.Exception
-
initializeProducer
protected void initializeProducer(java.lang.String aBrokerURI, java.lang.String aQueueName, javax.jms.Connection aConnection) throws java.lang.Exception- Throws:
java.lang.Exception
-
initializeConsumer
protected void initializeConsumer(java.lang.String aBrokerURI) throws java.lang.ExceptionCreate a JMS Consumer on a temporary queue. Service replies will be handled by this consumer.- Parameters:
aBrokerURI-- Throws:
java.lang.Exception
-
initializeConsumer
protected void initializeConsumer(java.lang.String aBrokerURI, javax.jms.Connection connection) throws java.lang.Exception- Specified by:
initializeConsumerin classBaseUIMAAsynchronousEngineCommon_impl- Throws:
java.lang.Exception
-
initialize
public void initialize(java.util.Map anApplicationContext) throws org.apache.uima.resource.ResourceInitializationExceptionInitialize the uima ee client. Takes initialization parameters from theanApplicationContextmap.- Specified by:
initializein interfaceUimaAsynchronousEngine- Specified by:
initializein classBaseUIMAAsynchronousEngineCommon_impl- Parameters:
anApplicationContext- - configuration containing UIMA EE Service Broker URI, service queue name, timeout value, reply window size, and CAS Pool size.- Throws:
org.apache.uima.resource.ResourceInitializationException
-
deploy
public java.lang.String deploy(java.lang.String aDeploymentDescriptor, java.util.Map anApplicationContext) throws java.lang.ExceptionFirst generates a Spring context from a given deploy descriptor and than deploys the context into a Spring Container.- Specified by:
deployin interfaceUimaAsynchronousEngine- Parameters:
aDeploymentDescriptor- - deployment descriptor to generate Spring Context fromanApplicationContext- - a Map containing properties required by dd2spring- Returns:
- - a unique spring container id
- Throws:
java.lang.Exception- - if there was a problem deploying the container or UIMA AS services.
-
deploy
public java.lang.String deploy(java.lang.String[] aDeploymentDescriptorList, java.util.Map anApplicationContext) throws java.lang.ExceptionDescription copied from interface:UimaAsynchronousEngineDeploys 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:
deployin interfaceUimaAsynchronousEngine- Specified by:
deployin classBaseUIMAAsynchronousEngineCommon_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:
java.lang.Exception- - if there was a problem deploying the container or UIMA AS services.
-
undeploy
public void undeploy() throws java.lang.Exception- Throws:
java.lang.Exception
-
undeploy
public void undeploy(java.lang.String aSpringContainerId) throws java.lang.ExceptionDescription copied from interface:UimaAsynchronousEngineUndeploys 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:
undeployin interfaceUimaAsynchronousEngine- Parameters:
aSpringContainerId- - an id of the container to be destroyed.- Throws:
java.lang.Exception
-
undeploy
public void undeploy(java.lang.String aSpringContainerId, int stop_level) throws java.lang.ExceptionUndeploys Spring container with a given container Id. All deployed Spring containers are registered in the local registry under a unique id.- Specified by:
undeployin interfaceUimaAsynchronousEngine- Parameters:
aSpringContainerId- - an id of the container to be destroyed.- Throws:
java.lang.Exception
-
deploySpringContainer
protected java.lang.String deploySpringContainer(java.lang.String[] springContextFiles) throws org.apache.uima.resource.ResourceInitializationExceptionDeploys provided context files ( and beans) in a new Spring container.- Specified by:
deploySpringContainerin classBaseUIMAAsynchronousEngineCommon_impl- Throws:
org.apache.uima.resource.ResourceInitializationException
-
waitForServiceNotification
protected void waitForServiceNotification() throws java.lang.Exception- Throws:
java.lang.Exception
-
deployEmbeddedBroker
protected void deployEmbeddedBroker() throws java.lang.Exception- Throws:
java.lang.Exception
-
main
public static void main(java.lang.String[] args)
-
setReleaseCASMessage
public void setReleaseCASMessage(javax.jms.TextMessage msg, java.lang.String aCasReferenceId) throws java.lang.Exception- Overrides:
setReleaseCASMessagein classBaseUIMAAsynchronousEngineCommon_impl- Throws:
java.lang.Exception
-
notifyOnInitializationFailure
public void notifyOnInitializationFailure(java.lang.Exception e)
- Specified by:
notifyOnInitializationFailurein interfaceControllerCallbackListener
-
notifyOnInitializationSuccess
public void notifyOnInitializationSuccess()
- Specified by:
notifyOnInitializationSuccessin interfaceControllerCallbackListener
-
notifyOnInitializationFailure
public void notifyOnInitializationFailure(AnalysisEngineController aController, java.lang.Exception e)
- Specified by:
notifyOnInitializationFailurein interfaceControllerCallbackListener
-
notifyOnInitializationSuccess
public void notifyOnInitializationSuccess(AnalysisEngineController aController)
- Specified by:
notifyOnInitializationSuccessin interfaceControllerCallbackListener
-
notifyOnTermination
public void notifyOnTermination(java.lang.String aServiceName)
- Specified by:
notifyOnTerminationin interfaceControllerCallbackListener
-
notifyOnTermination
public void notifyOnTermination(java.lang.String aServiceName, java.lang.String aCasReferenceId, java.lang.Exception cause)
-
getMessageProducer
protected javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination) throws java.lang.Exception- Overrides:
getMessageProducerin classBaseUIMAAsynchronousEngineCommon_impl- Throws:
java.lang.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:
stopProducingCasesin interfaceUimaAsynchronousEngine
-
stopProducingCases
public void stopProducingCases(java.lang.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:
stopProducingCasesin interfaceUimaAsynchronousEngine
-
getDispatcher
protected MessageSender getDispatcher()
- Specified by:
getDispatcherin classBaseUIMAAsynchronousEngineCommon_impl
-
notifyOnReconnecting
public void notifyOnReconnecting(java.lang.String aMessage)
- Specified by:
notifyOnReconnectingin interfaceControllerCallbackListener
-
notifyOnReconnectionSuccess
public void notifyOnReconnectionSuccess()
- Specified by:
notifyOnReconnectionSuccessin interfaceControllerCallbackListener
-
-