org.apache.uima.aae.controller
Class UimacppServiceController

java.lang.Object
  extended by org.apache.uima.aae.controller.AnalysisEngineControllerAdapter
      extended by org.apache.uima.aae.controller.UimacppServiceController
All Implemented Interfaces:
AnalysisEngineController, ControllerLifecycle, org.springframework.beans.factory.DisposableBean

public class UimacppServiceController
extends AnalysisEngineControllerAdapter
implements ControllerLifecycle, org.springframework.beans.factory.DisposableBean

This bean functions as a proxy for a Uima C++ service. It starts the Uima C++ service given a UIMA descriptor, the input queue name, and environment settings required for the specific annotator and the Uima C++ runtime. On start up a socket connection is established between this instance of the proxy and the service. This connection is used for routing log message from the C++ service to the UIMA framework logger and to allow the proxy to send JMX and administrative requests such as shutdown.


Field Summary
protected  UimacppServiceManagement mbean
           
protected  java.net.ServerSocket server
           
protected  java.lang.Process uimacppProcess
           
 
Fields inherited from interface org.apache.uima.aae.controller.AnalysisEngineController
AEInstanceCount, CasPoolSize
 
Constructor Summary
UimacppServiceController(org.apache.uima.util.Logger uimaLogger, java.lang.String aeDescriptorFileName, java.lang.String queueName, java.lang.String mqHostName, int mqPort, java.lang.String mqChannel, java.lang.String mqQueueMgr, int numInstances, java.util.Map<java.lang.String,java.lang.String> envVarMap, int processCasErrorThreshhold, int processCasErrorWindow, boolean terminateOnCPCError, JmxManagement jmxManagement)
           
UimacppServiceController(org.apache.uima.util.Logger uimaLogger, java.lang.String aeDescriptorFileName, java.lang.String queueName, java.lang.String mqHostName, int mqPort, java.lang.String mqChannel, java.lang.String mqQueueMgr, int numInstances, java.util.Map<java.lang.String,java.lang.String> envVarMap, int processCasErrorThreshhold, int processCasErrorWindow, boolean terminateOnCPCError, JmxManagement jmxManagement, int initialFsHeapSize)
          Configure and start a Uima C++ service that connects to an WebSphereMQ queue broker.
UimacppServiceController(java.lang.String aeDescriptorFileName, java.lang.String queueName, java.lang.String brokerURL, int numInstances, int prefetchSize, java.util.Map<java.lang.String,java.lang.String> envVarMap, int processCasErrorThreshhold, int processCasErrorWindow, boolean terminateOnCPCError)
           
UimacppServiceController(java.lang.String aeDescriptorFileName, java.lang.String queueName, java.lang.String brokerURL, int numInstances, int prefetchSize, java.util.Map<java.lang.String,java.lang.String> envVarMap, int processCasErrorThreshhold, int processCasErrorWindow, boolean terminateOnCPCError, int initialFsHeapSize)
          Configure and start a Uima C++ service that connects to an ActiveMQ queue broker.
 
Method Summary
 void addControllerCallbackListener(ControllerCallbackListener aListener)
          Register one or more listeners through which the controller can send notification of events.
 void destroy()
          Runs when spring undeploys this bean.
 void dumpState(java.lang.StringBuffer buffer, java.lang.String lbl1)
           
 java.util.ArrayList<ControllerCallbackListener> getCallbackListeners()
           
 java.lang.String getKey()
           
 java.lang.String getStatistics()
           
protected  void handleConnection(java.net.Socket inSock)
           
 boolean isStopped()
          Returns true if the AnalysisEngineController has been (or is in the process of) shutdown.
static void main(java.lang.String[] args)
          test
 void quiesceAndStop()
           
 void removeControllerCallbackListener(ControllerCallbackListener aListener)
          Removes named application listener.
 void resetStatistics()
           
 void setStopped()
          Called to set the state of the AnalysisEngineController to STOPPED.
 void shutdown()
          Shuts down the UIMA C++ service process.
 void terminate()
          Runs when UIMA EE client API undeploys this service.
 
Methods inherited from class org.apache.uima.aae.controller.AnalysisEngineControllerAdapter
addAbortedCasReferenceId, addEndpointToDoNotProcessList, addInputChannel, addServiceInfo, addTimeSnapshot, beginProcess, cacheClientEndpoint, changeState, collectionProcessComplete, dropCAS, dropCAS, dropStats, endProcess, evictExpiredEntries, forceTimeoutOnPendingCases, getAnalysisTime, getCasManagerWrapper, getCasStatistics, getChildUimaContext, getClientEndpoint, getComponentName, getControllerLatch, getCpuTime, getDeadClientMap, getErrorHandlerChain, getEventListener, getIdleTime, getIdleTimeBetweenProcessCalls, getIndex, getInProcessCache, getInputChannel, getInputChannel, getJmxContext, getJMXDomain, getLocalCache, getManagementInterface, getMonitor, getName, getOutputChannel, getParentController, getReplyInputChannel, getReplyTime, getServiceEndpointName, getServiceErrors, getServiceInfo, getServicePerformance, getState, getStats, getTime, getTimeSnapshot, getTransport, getTransport, getUimaEEAdminContext, getUimaMessageListener, handleDelegateLifeCycleEvent, incrementDeserializationTime, incrementSerializationTime, initialize, initializeVMTransport, isAwaitingCacheCallbackNotification, isCasMultiplier, isEndpointOnDontProcessList, isPrimitive, isTopLevelComponent, notifyListenersWithInitializationStatus, onInitialize, process, process, process, registerVmQueueWithJMX, releaseNextCas, saveReplyTime, saveTime, sendMetadata, setCasManager, setDeployDescriptor, setInputChannel, setOutputChannel, setUimaEEAdminContext, stop, takeAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected java.net.ServerSocket server

uimacppProcess

protected java.lang.Process uimacppProcess

mbean

protected UimacppServiceManagement mbean
Constructor Detail

UimacppServiceController

public UimacppServiceController(java.lang.String aeDescriptorFileName,
                                java.lang.String queueName,
                                java.lang.String brokerURL,
                                int numInstances,
                                int prefetchSize,
                                java.util.Map<java.lang.String,java.lang.String> envVarMap,
                                int processCasErrorThreshhold,
                                int processCasErrorWindow,
                                boolean terminateOnCPCError,
                                int initialFsHeapSize)
                         throws org.apache.uima.resource.ResourceInitializationException
Configure and start a Uima C++ service that connects to an ActiveMQ queue broker. This class initializes the process environment and starts a process to deploy the C++ service. Communication via sockets is established between this Controller and the C++ service through which logging, JMX and administrative messages are transmitted.

Parameters:
aeDescriptorFileName - - UIMA analysis engine descriptor file.
queueName - - input queue name
brokerURL - - queue broker URL
numInstances - - number of instance of AEs to start in the service.
prefetchSize - - number of message to prefetch
envVarMap - - enviroment variables to be set. These settings are valid only for the new process in which C++ service will run.
Throws:
org.apache.uima.UIMAException
org.apache.uima.resource.ResourceInitializationException

UimacppServiceController

public UimacppServiceController(java.lang.String aeDescriptorFileName,
                                java.lang.String queueName,
                                java.lang.String brokerURL,
                                int numInstances,
                                int prefetchSize,
                                java.util.Map<java.lang.String,java.lang.String> envVarMap,
                                int processCasErrorThreshhold,
                                int processCasErrorWindow,
                                boolean terminateOnCPCError)
                         throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException

UimacppServiceController

public UimacppServiceController(org.apache.uima.util.Logger uimaLogger,
                                java.lang.String aeDescriptorFileName,
                                java.lang.String queueName,
                                java.lang.String mqHostName,
                                int mqPort,
                                java.lang.String mqChannel,
                                java.lang.String mqQueueMgr,
                                int numInstances,
                                java.util.Map<java.lang.String,java.lang.String> envVarMap,
                                int processCasErrorThreshhold,
                                int processCasErrorWindow,
                                boolean terminateOnCPCError,
                                JmxManagement jmxManagement,
                                int initialFsHeapSize)
                         throws org.apache.uima.resource.ResourceInitializationException
Configure and start a Uima C++ service that connects to an WebSphereMQ queue broker. This class initializes the process environment and starts a process to deploy the C++ service. Communication via sockets is established between this Controller and the C++ service through which logging, JMX and administrative messages are transmitted.

Parameters:
uimaLogger -
aeDescriptorFileName -
mqQueueName -
mqHostName -
mqPort -
mqChannel -
mqQueueMgr -
numInstances -
envVarMap -
processCasErrorThreshhold -
processCasErrorWindow -
terminateOnCPCError -
mBeanServer -
Throws:
org.apache.uima.resource.ResourceInitializationException

UimacppServiceController

public UimacppServiceController(org.apache.uima.util.Logger uimaLogger,
                                java.lang.String aeDescriptorFileName,
                                java.lang.String queueName,
                                java.lang.String mqHostName,
                                int mqPort,
                                java.lang.String mqChannel,
                                java.lang.String mqQueueMgr,
                                int numInstances,
                                java.util.Map<java.lang.String,java.lang.String> envVarMap,
                                int processCasErrorThreshhold,
                                int processCasErrorWindow,
                                boolean terminateOnCPCError,
                                JmxManagement jmxManagement)
                         throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException
Method Detail

shutdown

public void shutdown()
              throws java.io.IOException,
                     java.lang.InterruptedException
Shuts down the UIMA C++ service process.

Parameters:
force - - force or allow service to shutdown gracefully.
Throws:
java.io.IOException
java.lang.InterruptedException

getStatistics

public java.lang.String getStatistics()
                               throws java.io.IOException
Throws:
java.io.IOException

resetStatistics

public void resetStatistics()
                     throws java.io.IOException
Throws:
java.io.IOException

handleConnection

protected void handleConnection(java.net.Socket inSock)
                         throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
test

Parameters:
args -

terminate

public void terminate()
Runs when UIMA EE client API undeploys this service.

Specified by:
terminate in interface ControllerLifecycle
Overrides:
terminate in class AnalysisEngineControllerAdapter

destroy

public void destroy()
Runs when spring undeploys this bean.

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean

addControllerCallbackListener

public void addControllerCallbackListener(ControllerCallbackListener aListener)
Description copied from interface: ControllerLifecycle
Register one or more listeners through which the controller can send notification of events.

Specified by:
addControllerCallbackListener in interface ControllerLifecycle
Overrides:
addControllerCallbackListener in class AnalysisEngineControllerAdapter
Parameters:
aListener - - application listener object to register

removeControllerCallbackListener

public void removeControllerCallbackListener(ControllerCallbackListener aListener)
Description copied from interface: ControllerLifecycle
Removes named application listener.

Specified by:
removeControllerCallbackListener in interface ControllerLifecycle
Overrides:
removeControllerCallbackListener in class AnalysisEngineControllerAdapter
Parameters:
aListener - - application listener to remove

quiesceAndStop

public void quiesceAndStop()
Specified by:
quiesceAndStop in interface AnalysisEngineController
Specified by:
quiesceAndStop in class AnalysisEngineControllerAdapter

isStopped

public boolean isStopped()
Description copied from interface: AnalysisEngineController
Returns true if the AnalysisEngineController has been (or is in the process of) shutdown.

Specified by:
isStopped in interface AnalysisEngineController
Overrides:
isStopped in class AnalysisEngineControllerAdapter
Returns:
- true if stopped

setStopped

public void setStopped()
Description copied from interface: AnalysisEngineController
Called to set the state of the AnalysisEngineController to STOPPED. This method does not stop input or output channels.

Specified by:
setStopped in interface AnalysisEngineController
Overrides:
setStopped in class AnalysisEngineControllerAdapter

getCallbackListeners

public java.util.ArrayList<ControllerCallbackListener> getCallbackListeners()

getKey

public java.lang.String getKey()
Specified by:
getKey in interface AnalysisEngineController

dumpState

public void dumpState(java.lang.StringBuffer buffer,
                      java.lang.String lbl1)
Specified by:
dumpState in interface AnalysisEngineController


Copyright © 2011. All Rights Reserved.