Class BaseUIMAAsynchronousEngine_impl

    • Field Detail

      • sharedConnectionSemaphore

        protected static java.util.concurrent.Semaphore sharedConnectionSemaphore
      • jndiContext

        protected javax.naming.InitialContext jndiContext
    • Constructor Detail

      • BaseUIMAAsynchronousEngine_impl

        public BaseUIMAAsynchronousEngine_impl()
    • Method Detail

      • createTextMessage

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

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

        protected void cleanup()
                        throws java.lang.Exception
        Called at the end of collectionProcessingComplete - WAS closes receiving thread here
        Specified by:
        cleanup in class BaseUIMAAsynchronousEngineCommon_impl
        Throws:
        java.lang.Exception
      • getEndPointName

        public java.lang.String getEndPointName()
                                         throws org.apache.uima.resource.ResourceProcessException
        Return a name of the queue to which the JMS Producer is connected to.
        Specified by:
        getEndPointName in class BaseUIMAAsynchronousEngineCommon_impl
        Throws:
        org.apache.uima.resource.ResourceProcessException
      • setCASMessage

        protected void setCASMessage​(java.lang.String aCasReferenceId,
                                     org.apache.uima.cas.CAS aCAS,
                                     javax.jms.Message msg)
                              throws org.apache.uima.resource.ResourceProcessException
        Initialize JMS Message with properties relevant to Process CAS request.
        Specified by:
        setCASMessage in class BaseUIMAAsynchronousEngineCommon_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:
        setCASMessage in class BaseUIMAAsynchronousEngineCommon_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:
        setCASMessage in class BaseUIMAAsynchronousEngineCommon_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: 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
      • 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.Exception
        Create a JMS Consumer on a temporary queue. Service replies will be handled by this consumer.
        Parameters:
        aBrokerURI -
        Throws:
        java.lang.Exception
      • initialize

        public void initialize​(java.util.Map anApplicationContext)
                        throws org.apache.uima.resource.ResourceInitializationException
        Initialize the uima ee client. Takes initialization parameters from the anApplicationContext map.
        Specified by:
        initialize in interface UimaAsynchronousEngine
        Specified by:
        initialize in class BaseUIMAAsynchronousEngineCommon_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.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:
        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.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 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:
        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.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:
        java.lang.Exception
      • undeploy

        public void undeploy​(java.lang.String aSpringContainerId,
                             int stop_level)
                      throws java.lang.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:
        java.lang.Exception
      • deploySpringContainer

        protected java.lang.String deploySpringContainer​(java.lang.String[] springContextFiles)
                                                  throws org.apache.uima.resource.ResourceInitializationException
        Deploys provided context files ( and beans) in a new Spring container.
        Specified by:
        deploySpringContainer in class BaseUIMAAsynchronousEngineCommon_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)
      • notifyOnTermination

        public void notifyOnTermination​(java.lang.String aServiceName,
                                        java.lang.String aCasReferenceId,
                                        java.lang.Exception cause)
      • 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​(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:
        stopProducingCases in interface UimaAsynchronousEngine