You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2013/07/30 15:55:30 UTC

svn commit: r1508442 - in /uima/uima-as/trunk: uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsBaseCallbackListener.java uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java

Author: cwiklik
Date: Tue Jul 30 13:55:29 2013
New Revision: 1508442

URL: http://svn.apache.org/r1508442
Log:
UIMA-3098 added new client callback onBeforeProcessMeta

Modified:
    uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsBaseCallbackListener.java
    uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java

Modified: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsBaseCallbackListener.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsBaseCallbackListener.java?rev=1508442&r1=1508441&r2=1508442&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsBaseCallbackListener.java (original)
+++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsBaseCallbackListener.java Tue Jul 30 13:55:29 2013
@@ -49,6 +49,17 @@ public abstract class UimaAsBaseCallback
     // to be overridden
   }
   /**
+   * Called by Uima AS client API before GetMeta processing begins at the remote
+   * UIMA AS service
+   * 
+   * @param nodeIP - Node IP where GetMeta request is handled
+   * @param pid - Remote Service PID where GetMeta request is handled. The
+   *     has the following syntax: <PID:THREADID>
+   */
+  public void onBeforeProcessMeta(String nodeIP, String pid) {
+    // to be overridden
+  }
+  /**
    * The callback used to inform the application that the initialization request has completed. On
    * success aStatus will be null; on failure use the EntityProcessStatus class to get the details.
    * 

Modified: uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java?rev=1508442&r1=1508441&r2=1508442&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java (original)
+++ uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java Tue Jul 30 13:55:29 2013
@@ -337,6 +337,20 @@ public abstract class BaseUIMAAsynchrono
     }
   }
 
+  public void onBeforeProcessMeta(String nodeIP, String pid) {
+	  for (int i = 0; listeners != null && i < listeners.size(); i++) {
+		  UimaAsBaseCallbackListener statCL = (UimaAsBaseCallbackListener) listeners
+				  .get(i);
+		  try {
+			  statCL.onBeforeProcessMeta(nodeIP, pid);
+		  } catch (Throwable t) {
+			  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING,
+					  getClass().getName(), "onBeforeProcessMeta",
+					  UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+					  "UIMAEE_exception__WARNING", t);
+		  }
+	  }
+  }
   public synchronized void setCollectionReader(CollectionReader aCollectionReader)
           throws ResourceInitializationException {
     if (initialized) {
@@ -1324,34 +1338,22 @@ public abstract class BaseUIMAAsynchrono
    	      }
     	} else {
     		
-    		String nodeIP = message.getStringProperty(AsynchAEMessage.ServerIP);
-    	      String pid = message.getStringProperty(AsynchAEMessage.UimaASProcessPID);
-    	      if ( pid != null && nodeIP != null ) {
-        	      UimaASProcessStatus status = new UimaASProcessStatusImpl(new ProcessTrace_impl(),null,
-        	              casReferenceId);
-        	      // notify client that the last request (GetMeta or CPC) has been received by a service.
-        	      onBeforeProcessCAS(status,nodeIP, pid);
-    	      }
+    		
+    		ClientRequest requestToCache = (ClientRequest) clientCache.get(uniqueIdentifier);
+    		if ( requestToCache != null && requestToCache.isMetaRequest()) {
+        	  String nodeIP = message.getStringProperty(AsynchAEMessage.ServerIP);
+      	      String pid = message.getStringProperty(AsynchAEMessage.UimaASProcessPID);
+      	      if ( pid != null && nodeIP != null ) {
+          	     UimaASProcessStatus status = new UimaASProcessStatusImpl(new ProcessTrace_impl(),null,
+          	              casReferenceId);
+          	      // notify client that the last request (GetMeta ) has been received by a service.
+          	     onBeforeProcessMeta(nodeIP, pid);
+      	      }
+    			
+    		}
     		
     	}
-  /*      
-        List<DelegateEntry> outstandingCasList = serviceDelegate.getDelegateCasesPendingReply();
-        for (DelegateEntry entry : outstandingCasList) {
-          if (entry.getCasReferenceId().equals(casReferenceId)) {
-            // The Cas is still being processed
-            //ClientRequest casCachedRequest = (ClientRequest) clientCache.get(casReferenceId);
-            if (casCachedRequest != null) {
-              casCachedRequest.setFreeCasNotificationQueue(message.getJMSReplyTo());
-            }
-            return;
-          }
-        }
-   */
-//      }
-//      if ( casReferenceId != null && getCache().containsKey(casReferenceId) ) {
-//        //ClientRequest casCachedRequest = (ClientRequest) clientCache.get(casReferenceId);
-//        casCachedRequest.setHostIpProcessingCAS(message.getStringProperty(AsynchAEMessage.ServerIP));
-//      }
+
     } catch( Exception e) {
       UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
               "handleServiceInfo", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,