Author: schor
Date: Wed May 15 21:29:58 2013
New Revision: 1483100

URL: http://svn.apache.org/r1483100
Log:
[UIMA-2791] Prepare for compressed binary serialization; comment out dead code 
related (mostly) to xcas 

Modified:
    
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java
    
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
    
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
    
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
    
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java
    
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/UimaMessageValidator.java

Modified: 
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java?rev=1483100&r1=1483099&r2=1483100&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java
 Wed May 15 21:29:58 2013
@@ -444,8 +444,9 @@ public class JmsInputChannel implements 
           return "Metadata";
         case AsynchAEMessage.Exception:
           return "Exception";
-        case AsynchAEMessage.XCASPayload:
-          return "XCASPayload";
+          // 5/2013 xcas not used
+//        case AsynchAEMessage.XCASPayload:
+//          return "XCASPayload";
         case AsynchAEMessage.None:
           return "None";
       }

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java?rev=1483100&r1=1483099&r2=1483100&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
 Wed May 15 21:29:58 2013
@@ -40,7 +40,7 @@ import org.apache.uima.aae.monitor.stati
 import org.apache.uima.aae.monitor.statistics.DelegateStats;
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.Marker;
-import org.apache.uima.cas.impl.OutOfTypeSystemData;
+import org.apache.uima.cas.impl.BinaryCasSerDes6.ReuseInfo;
 import org.apache.uima.cas.impl.XmiSerializationSharedData;
 import org.apache.uima.util.Level;
 
@@ -50,7 +50,7 @@ public class InProcessCache implements I
         */
   private static final long serialVersionUID = 1L;
 
-  private static final Class CLASS_NAME = InProcessCache.class;
+  private static final Class<InProcessCache> CLASS_NAME = InProcessCache.class;
 
   public static final int NotifyWhenRegistering = 1;
 
@@ -274,13 +274,14 @@ public class InProcessCache implements I
 
   }
 
-  public void removeCas(String aCasReferenceId) {
-    if (!cache.containsKey(aCasReferenceId)) {
-      return;
-    }
-    CacheEntry casRefEntry = getEntry(aCasReferenceId);
-    casRefEntry.deleteCAS();
-  }
+  // never called 5/2013
+//  public void removeCas(String aCasReferenceId) {
+//    if (!cache.containsKey(aCasReferenceId)) {
+//      return;
+//    }
+//    CacheEntry casRefEntry = getEntry(aCasReferenceId);
+//    casRefEntry.deleteCAS();
+//  }
 
   public synchronized CacheEntry[] getCacheEntriesForEndpoint(String 
anEndpointName) {
     CacheEntry[] entries;
@@ -349,13 +350,15 @@ public class InProcessCache implements I
     return casRefEntry.getMessageAccessor();
   }
 
-  public OutOfTypeSystemData getOutOfTypeSystemData(String aCasReferenceId) {
-    if (!cache.containsKey(aCasReferenceId)) {
-      return null;
-    }
-    CacheEntry casRefEntry = getEntry(aCasReferenceId);
-    return casRefEntry.getOtsd();
-  }
+
+  // not used 5/2013
+//  public OutOfTypeSystemData getOutOfTypeSystemData(String aCasReferenceId) {
+//    if (!cache.containsKey(aCasReferenceId)) {
+//      return null;
+//    }
+//    CacheEntry casRefEntry = getEntry(aCasReferenceId);
+//    return casRefEntry.getOtsd();
+//  }
 
   private synchronized CacheEntry getEntry(String aCasReferenceId) {
     if (!cache.containsKey(aCasReferenceId)) {
@@ -405,27 +408,29 @@ public class InProcessCache implements I
     return true;
   }
 
-  public CacheEntry register(CAS aCAS, MessageContext aMessageContext, 
OutOfTypeSystemData otsd)
+  public CacheEntry register(CAS aCAS, MessageContext aMessageContext /*, 
OutOfTypeSystemData otsd*/)
           throws AsynchAEException {
-    return register(aCAS, aMessageContext, otsd, idGenerator.nextId());
+    return register(aCAS, aMessageContext, /*otsd, */ idGenerator.nextId());
   }
 
-  public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
-          XmiSerializationSharedData sharedData) throws AsynchAEException {
-    return register(aCAS, aMessageContext, sharedData, idGenerator.nextId());
-  }
+  // not used 5/2013
+//  public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
+//          XmiSerializationSharedData sharedData) throws AsynchAEException {
+//    return register(aCAS, aMessageContext, sharedData, idGenerator.nextId());
+//  }
 
-  public CacheEntry register(CAS aCAS, MessageContext aMessageContext, 
OutOfTypeSystemData otsd,
+  public CacheEntry register(CAS aCAS, MessageContext aMessageContext, /* 
OutOfTypeSystemData otsd,*/
           String aCasReferenceId) throws AsynchAEException {
     return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, 
aCasReferenceId,
-            aMessageContext, otsd));
+            aMessageContext /*, otsd*/));
   }
 
-  public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
-          XmiSerializationSharedData sharedData, String aCasReferenceId) 
throws AsynchAEException {
-    return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, 
aCasReferenceId,
-            aMessageContext, sharedData));
-  }
+  // not used 5/2013
+//  public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
+//          XmiSerializationSharedData sharedData, String aCasReferenceId) 
throws AsynchAEException {
+//    return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, 
aCasReferenceId,
+//            aMessageContext, sharedData));
+//  }
 
   public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
           XmiSerializationSharedData sharedData, String aCasReferenceId, 
Marker marker,
@@ -433,6 +438,13 @@ public class InProcessCache implements I
     return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, 
aCasReferenceId,
             aMessageContext, sharedData, marker, acceptsDeltaCas));
   }
+  
+  public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
+      ReuseInfo compress6ReuseInfo, String aCasReferenceId, Marker marker, 
boolean acceptsDeltaCas)
+      throws AsynchAEException {
+    return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, 
aCasReferenceId,
+        aMessageContext, compress6ReuseInfo, marker, acceptsDeltaCas));
+  }
 
   private synchronized CacheEntry registerCacheEntry(String aCasReferenceId, 
CacheEntry entry) {
     cache.put(aCasReferenceId, entry);
@@ -513,8 +525,8 @@ public class InProcessCache implements I
 
     private MessageContext messageAccessor;
 
-    private OutOfTypeSystemData otsd = null;
-
+//    private OutOfTypeSystemData otsd = null;
+    
     private String serializedCas;
 
     private String casProducerKey;
@@ -531,6 +543,8 @@ public class InProcessCache implements I
 
     private XmiSerializationSharedData deserSharedData;
 
+    private ReuseInfo compress6ReuseInfo;
+
     private String aggregateProducingTheCas;
 
     private long timeWaitingForCAS = 0;
@@ -587,23 +601,32 @@ public class InProcessCache implements I
     public void setThreadCompletionSemaphore(Semaphore 
threadCompletionSemaphore) {
       this.threadCompletionSemaphore = threadCompletionSemaphore;
     }
+    // never called 5/2013  was for XCAS
+//    protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
+//            OutOfTypeSystemData aotsd) {
+//      this(aCas, aCasReferenceId, aMessageAccessor);
+//      messageAccessor = aMessageAccessor;
+//    }
+
+    // never called 5/2013  
+//    protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
+//            XmiSerializationSharedData sdata) {
+//      this(aCas, aCasReferenceId, aMessageAccessor);
+//      deserSharedData = sdata;
+//    }
 
     protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
-            OutOfTypeSystemData aotsd) {
-      this(aCas, aCasReferenceId, aMessageAccessor);
-      messageAccessor = aMessageAccessor;
-    }
-
-    protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
-            XmiSerializationSharedData sdata) {
+            XmiSerializationSharedData sdata, Marker aMarker, boolean 
acceptsDeltaCas) {
       this(aCas, aCasReferenceId, aMessageAccessor);
       deserSharedData = sdata;
+      this.marker = aMarker;
+      this.acceptsDeltaCas = acceptsDeltaCas;
     }
 
     protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
-            XmiSerializationSharedData sdata, Marker aMarker, boolean 
acceptsDeltaCas) {
+        ReuseInfo compress6ReuseInfo, Marker aMarker, boolean acceptsDeltaCas) 
{
       this(aCas, aCasReferenceId, aMessageAccessor);
-      deserSharedData = sdata;
+      this.compress6ReuseInfo = compress6ReuseInfo;
       this.marker = aMarker;
       this.acceptsDeltaCas = acceptsDeltaCas;
     }
@@ -716,23 +739,25 @@ public class InProcessCache implements I
       }
     }
 
-    protected void deleteCAS() {
-      cas = null;
-      otsd = null;
-    }
+    // never called 5/2013
+//    protected void deleteCAS() {
+//      cas = null;
+////      otsd = null;
+//      compress6ReuseInfo = null;
+//    }
 
     public CAS getCas() {
       return cas;
     }
 
-    protected void setCas(CAS aCAS, OutOfTypeSystemData aotsd) {
-      cas = aCAS;
-      otsd = aotsd;
-    }
-
-    protected void setCas(CAS aCAS) {
-      cas = aCAS;
-    }
+//    protected void setCas(CAS aCAS, OutOfTypeSystemData aotsd) {
+//      cas = aCAS;
+//      otsd = aotsd;
+//    }
+
+//    protected void setCas(CAS aCAS) {
+//      cas = aCAS;
+//    }
 
     protected void setSerializedCas(String aSerializedCas) {
       serializedCas = aSerializedCas;
@@ -746,9 +771,10 @@ public class InProcessCache implements I
       return messageAccessor;
     }
 
-    public OutOfTypeSystemData getOtsd() {
-      return otsd;
-    }
+    // not used 5/2013
+//    public OutOfTypeSystemData getOtsd() {
+//      return otsd;
+//    }
 
     public int getHighWaterMark() {
       return highWaterMark;
@@ -774,6 +800,14 @@ public class InProcessCache implements I
     public void setXmiSerializationData(XmiSerializationSharedData 
anXmiSerializationData) {
       deserSharedData = anXmiSerializationData;
     }
+    
+    public ReuseInfo getCompress6ReuseInfo() {
+      return compress6ReuseInfo;
+    }
+    
+    public void setCompress6ReuseInfo(ReuseInfo compress6ReuseInfo) {
+      this.compress6ReuseInfo = compress6ReuseInfo;
+    }
 
     public String getCasProducerAggregateName() {
       return aggregateProducingTheCas;

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java?rev=1483100&r1=1483099&r2=1483100&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
 Wed May 15 21:29:58 2013
@@ -713,10 +713,10 @@ public class PrimitiveAnalysisEngineCont
             return;
           }
         }
-        OutOfTypeSystemData otsd = 
getInProcessCache().getOutOfTypeSystemData(aCasReferenceId);
+//        OutOfTypeSystemData otsd = 
getInProcessCache().getOutOfTypeSystemData(aCasReferenceId);
         MessageContext mContext = getInProcessCache()
                 .getMessageAccessorByReference(aCasReferenceId);
-        CacheEntry newEntry = getInProcessCache().register(casProduced, 
mContext, otsd);
+        CacheEntry newEntry = getInProcessCache().register(casProduced, 
mContext /*, otsd*/);
         // if this Cas Multiplier is not Top Level service, add new Cas Id to 
the private
         // cache of the parent aggregate controller. The Aggregate needs to 
know about
         // all CASes it has in play that were generated from the input CAS.

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java?rev=1483100&r1=1483099&r2=1483100&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
 Wed May 15 21:29:58 2013
@@ -767,129 +767,129 @@ public class ProcessRequestHandler_impl 
     }
 
   }
-
-  private void handleProcessRequestWithXCAS(MessageContext aMessageContext)
-          throws AsynchAEException {
-
-    try {
-      // Get the CAS Reference Id of the input CAS
-      String casReferenceId = getCasReferenceId(aMessageContext);
-      String inputCasReferenceId = casReferenceId;
-      // This is only used when handling CASes produced by CAS Multiplier
-      String newCASProducedBy = null;
-
-      if (aMessageContext.propertyExists(AsynchAEMessage.CasSequence)) {
-        // This CAS came in from the CAS Multiplier. Treat it differently than 
the
-        // input CAS. First, in case the Aggregate needs to send this CAS to 
the
-        // client, retrieve the client destination by looking up the client 
endpoint
-        // using input CAS reference id. CASes generated by the CAS multiplier 
will have
-        // the same Cas Reference id.
-        Endpoint replyToEndpoint = 
getController().getInProcessCache().getCacheEntryForCAS(
-                casReferenceId).getMessageOrigin();
-
-        //     
-        if (getController() instanceof AggregateAnalysisEngineController) {
-          newCASProducedBy = ((AggregateAnalysisEngineController) 
getController())
-                  .lookUpDelegateKey(replyToEndpoint.getEndpoint());
-        }
-        // MessageContext contains endpoint set by the CAS Multiplier service. 
Overwrite
-        // this with the endpoint of the client who sent the input CAS. In 
case this
-        // aggregate is configured to send new CASes to the client we know 
where to send them.
-        
aMessageContext.getEndpoint().setEndpoint(replyToEndpoint.getEndpoint());
-        
aMessageContext.getEndpoint().setServerURI(replyToEndpoint.getServerURI());
-        inputCasReferenceId = String.valueOf(casReferenceId);
-        // Set this to null so that the new CAS gets its own Cas Reference Id 
below
-        casReferenceId = null;
-      }
-
-      long arrivalTime = System.nanoTime();
-      getController().saveTime(arrivalTime, casReferenceId, 
getController().getName());// aMessageContext.getEndpointName());
-
-      // To prevent processing multiple messages with the same CasReferenceId, 
check the CAS cache
-      // to see if the message with a given CasReferenceId is already being 
processed. It is, the
-      // message contains the same request possibly issued by the caller due 
to timeout. Also this
-      // mechanism helps with dealing with scenario when this service is not 
up when the client
-      // sends
-      // request. The client can keep re-sending the same request until its 
timeout thresholds are
-      // exceeded. By that time, there may be multiple messages in this 
service queue with the same
-      // CasReferenceId. When the service finally comes back up, it will have 
multiple messages in
-      // its queue possibly from the same client. Only the first message for 
any given
-      // CasReferenceId
-      // should be processed.
-      if (casReferenceId == null
-              || 
!getController().getInProcessCache().entryExists(casReferenceId)) {
-        String xmi = aMessageContext.getStringMessage();
-
-        // *****************************************************************
-        // ***** NO XMI In Message. Kick this back to sender with exception
-        // *****************************************************************
-        if (xmi == null) {
-          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
-            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),
-                    "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                    "UIMAEE_message_has_no_cargo__INFO",
-                    new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
-          }
-          getController().getOutputChannel().sendReply(
-                  new InvalidMessageException("No XMI data in message"), 
casReferenceId, null,
-                  aMessageContext.getEndpoint(), AsynchAEMessage.Process);
-          // Dont process this empty message
-          return;
-        }
-
-        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
-          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, 
CLASS_NAME.getName(),
-                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                  "UIMAEE_request_cas__FINE",
-                  new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
-        }
-        CAS cas = getController().getCasManagerWrapper().getNewCas();
-
-        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
-          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, 
CLASS_NAME.getName(),
-                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                  "UIMAEE_request_cas_granted__FINE",
-                  new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
-        }
-        
-        UimaSerializer uimaSerializer = 
SerializerCache.lookupSerializerByThreadId();
-
-        XmiSerializationSharedData deserSharedData = new 
XmiSerializationSharedData();
-        uimaSerializer.deserializeCasFromXmi(xmi, cas, deserSharedData, true, 
-1);
-
-        if (casReferenceId == null) {
-          CacheEntry entry = getController().getInProcessCache().register(cas, 
aMessageContext,
-                  deserSharedData);
-          casReferenceId = entry.getCasReferenceId();
-        } else {
-          if (getController() instanceof PrimitiveAnalysisEngineController) {
-            getController().getInProcessCache().register(cas, aMessageContext, 
deserSharedData,
-                    casReferenceId);
-          }
-        }
-        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
-          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, 
CLASS_NAME.getName(),
-                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                  "UIMAEE_deserialized_cas_ready_to_process_FINE",
-                  new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
-        }
-        cacheProcessCommandInClientEndpoint();
-        invokeProcess(cas, inputCasReferenceId, casReferenceId, 
aMessageContext, newCASProducedBy);
-      } else {
-        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
-          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),
-                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                  "UIMAEE_duplicate_request__INFO", new Object[] { 
casReferenceId });
-        }
-      }
-
-    } catch (AsynchAEException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new AsynchAEException(e);
-    }
-
-  }
+ // commented out 5/2013  xcas not used as a uima-as serialization form
+//  private void handleProcessRequestWithXCAS(MessageContext aMessageContext)
+//          throws AsynchAEException {
+//
+//    try {
+//      // Get the CAS Reference Id of the input CAS
+//      String casReferenceId = getCasReferenceId(aMessageContext);
+//      String inputCasReferenceId = casReferenceId;
+//      // This is only used when handling CASes produced by CAS Multiplier
+//      String newCASProducedBy = null;
+//
+//      if (aMessageContext.propertyExists(AsynchAEMessage.CasSequence)) {
+//        // This CAS came in from the CAS Multiplier. Treat it differently 
than the
+//        // input CAS. First, in case the Aggregate needs to send this CAS to 
the
+//        // client, retrieve the client destination by looking up the client 
endpoint
+//        // using input CAS reference id. CASes generated by the CAS 
multiplier will have
+//        // the same Cas Reference id.
+//        Endpoint replyToEndpoint = 
getController().getInProcessCache().getCacheEntryForCAS(
+//                casReferenceId).getMessageOrigin();
+//
+//        //   
+//        if (getController() instanceof AggregateAnalysisEngineController) {
+//          newCASProducedBy = ((AggregateAnalysisEngineController) 
getController())
+//                  .lookUpDelegateKey(replyToEndpoint.getEndpoint());
+//        }
+//        // MessageContext contains endpoint set by the CAS Multiplier 
service. Overwrite
+//        // this with the endpoint of the client who sent the input CAS. In 
case this
+//        // aggregate is configured to send new CASes to the client we know 
where to send them.
+//        
aMessageContext.getEndpoint().setEndpoint(replyToEndpoint.getEndpoint());
+//        
aMessageContext.getEndpoint().setServerURI(replyToEndpoint.getServerURI());
+//        inputCasReferenceId = String.valueOf(casReferenceId);
+//        // Set this to null so that the new CAS gets its own Cas Reference 
Id below
+//        casReferenceId = null;
+//      }
+//
+//      long arrivalTime = System.nanoTime();
+//      getController().saveTime(arrivalTime, casReferenceId, 
getController().getName());// aMessageContext.getEndpointName());
+//
+//      // To prevent processing multiple messages with the same 
CasReferenceId, check the CAS cache
+//      // to see if the message with a given CasReferenceId is already being 
processed. It is, the
+//      // message contains the same request possibly issued by the caller due 
to timeout. Also this
+//      // mechanism helps with dealing with scenario when this service is not 
up when the client
+//      // sends
+//      // request. The client can keep re-sending the same request until its 
timeout thresholds are
+//      // exceeded. By that time, there may be multiple messages in this 
service queue with the same
+//      // CasReferenceId. When the service finally comes back up, it will 
have multiple messages in
+//      // its queue possibly from the same client. Only the first message for 
any given
+//      // CasReferenceId
+//      // should be processed.
+//      if (casReferenceId == null
+//              || 
!getController().getInProcessCache().entryExists(casReferenceId)) {
+//        String xmi = aMessageContext.getStringMessage();
+//
+//        // *****************************************************************
+//        // ***** NO XMI In Message. Kick this back to sender with exception
+//        // *****************************************************************
+//        if (xmi == null) {
+//          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+//            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),
+//                    "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+//                    "UIMAEE_message_has_no_cargo__INFO",
+//                    new Object[] { 
aMessageContext.getEndpoint().getEndpoint() });
+//          }
+//          getController().getOutputChannel().sendReply(
+//                  new InvalidMessageException("No XMI data in message"), 
casReferenceId, null,
+//                  aMessageContext.getEndpoint(), AsynchAEMessage.Process);
+//          // Dont process this empty message
+//          return;
+//        }
+//
+//        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
+//          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, 
CLASS_NAME.getName(),
+//                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+//                  "UIMAEE_request_cas__FINE",
+//                  new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
+//        }
+//        CAS cas = getController().getCasManagerWrapper().getNewCas();
+//
+//        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
+//          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, 
CLASS_NAME.getName(),
+//                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+//                  "UIMAEE_request_cas_granted__FINE",
+//                  new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
+//        }
+//        
+//        UimaSerializer uimaSerializer = 
SerializerCache.lookupSerializerByThreadId();
+//
+//        XmiSerializationSharedData deserSharedData = new 
XmiSerializationSharedData();
+//        uimaSerializer.deserializeCasFromXmi(xmi, cas, deserSharedData, 
true, -1);
+//
+//        if (casReferenceId == null) {
+//          CacheEntry entry = 
getController().getInProcessCache().register(cas, aMessageContext,
+//                  deserSharedData);
+//          casReferenceId = entry.getCasReferenceId();
+//        } else {
+//          if (getController() instanceof PrimitiveAnalysisEngineController) {
+//            getController().getInProcessCache().register(cas, 
aMessageContext, deserSharedData,
+//                    casReferenceId);
+//          }
+//        }
+//        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
+//          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, 
CLASS_NAME.getName(),
+//                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+//                  "UIMAEE_deserialized_cas_ready_to_process_FINE",
+//                  new Object[] { aMessageContext.getEndpoint().getEndpoint() 
});
+//        }
+//        cacheProcessCommandInClientEndpoint();
+//        invokeProcess(cas, inputCasReferenceId, casReferenceId, 
aMessageContext, newCASProducedBy);
+//      } else {
+//        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+//          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),
+//                  "handleProcessRequestWithXCAS", 
UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+//                  "UIMAEE_duplicate_request__INFO", new Object[] { 
casReferenceId });
+//        }
+//      }
+//
+//    } catch (AsynchAEException e) {
+//      throw e;
+//    } catch (Exception e) {
+//      throw new AsynchAEException(e);
+//    }
+//
+//  }
 
   private void cacheProcessCommandInClientEndpoint() {
     Endpoint clientEndpoint = getController().getClientEndpoint();
@@ -1015,13 +1015,15 @@ public class ProcessRequestHandler_impl 
             return; // Invalid message. Nothing to do
           }
           handleProcessRequestFromRemoteClient(messageContext);
-        } else if (AsynchAEMessage.XCASPayload == payload) {
-          // Fetch id of the CAS from the message.
-          if (getCasReferenceId(messageContext) == null) {
-            return; // Invalid message. Nothing to do
-          }
-          handleProcessRequestWithXCAS(messageContext);
-        } else if (AsynchAEMessage.None == payload
+        } 
+//          else if (AsynchAEMessage.XCASPayload == payload) {
+//          // Fetch id of the CAS from the message.
+//          if (getCasReferenceId(messageContext) == null) {
+//            return; // Invalid message. Nothing to do
+//          }
+//          handleProcessRequestWithXCAS(messageContext);
+//        } 
+          else if (AsynchAEMessage.None == payload
                 && AsynchAEMessage.CollectionProcessComplete == command) {
           handleCollectionProcessCompleteRequest(messageContext);
         } else if (AsynchAEMessage.None == payload && 
AsynchAEMessage.ReleaseCAS == command) {

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java?rev=1483100&r1=1483099&r2=1483100&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java
 Wed May 15 21:29:58 2013
@@ -36,9 +36,10 @@ public interface AsynchAEMessage {
 
   public static final String MessageFrom = "MessageFrom";
 
-  public static final String XCASREFId = "XCASRefId";
+  // 5/2013 xcas not used as a serialization form
+//  public static final String XCASREFId = "XCASRefId";
 
-  public static final String XCas = "XCas";
+//  public static final String XCas = "XCas";
 
   public static final String AEMetadata = "Metadata";
 
@@ -86,7 +87,8 @@ public interface AsynchAEMessage {
 
   public static final int Exception = 1003;
 
-  public static final int XCASPayload = 1004;
+  // 5/2013 xcas not used as a serialization form
+//  public static final int XCASPayload = 1004;
 
   public static final int None = 1005;
 

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/UimaMessageValidator.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/UimaMessageValidator.java?rev=1483100&r1=1483099&r2=1483100&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/UimaMessageValidator.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/message/UimaMessageValidator.java
 Wed May 15 21:29:58 2013
@@ -276,8 +276,9 @@ public class UimaMessageValidator {
           return "Metadata";
         case AsynchAEMessage.Exception:
           return "Exception";
-        case AsynchAEMessage.XCASPayload:
-          return "XCASPayload";
+          // 5/2013 xcas not used
+//        case AsynchAEMessage.XCASPayload:
+//          return "XCASPayload";
         case AsynchAEMessage.None:
           return "None";
       }


Reply via email to