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 2009/01/23 22:31:41 UTC

svn commit: r737196 - in /incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main: java/org/apache/uima/aae/handler/input/MetadataResponseHandler_impl.java java/org/apache/uima/aae/message/AsynchAEMessage.java resources/uimaee_messages.properties

Author: cwiklik
Date: Fri Jan 23 13:31:40 2009
New Revision: 737196

URL: http://svn.apache.org/viewvc?rev=737196&view=rev
Log:
UIMA-1271 Fixes client API serialization for GetMeta. Adds new parameter in reply msg advertising service binary serialization support

Added:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java   (with props)
Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/MetadataResponseHandler_impl.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/resources/uimaee_messages.properties

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/MetadataResponseHandler_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/MetadataResponseHandler_impl.java?rev=737196&r1=737195&r2=737196&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/MetadataResponseHandler_impl.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/MetadataResponseHandler_impl.java Fri Jan 23 13:31:40 2009
@@ -22,6 +22,7 @@
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.aae.UIMAEE_Constants;
 import org.apache.uima.aae.controller.AggregateAnalysisEngineController;
+import org.apache.uima.aae.controller.Endpoint;
 import org.apache.uima.aae.delegate.Delegate;
 import org.apache.uima.aae.error.AsynchAEException;
 import org.apache.uima.aae.handler.HandlerBase;
@@ -61,8 +62,28 @@
 					if (getController() instanceof AggregateAnalysisEngineController)
 					{
             String fromEndpoint = ((MessageContext)anObjectToHandle).getMessageStringProperty(AsynchAEMessage.MessageFrom);
+            
             String delegateKey =
               ((AggregateAnalysisEngineController)getController()).lookUpDelegateKey(fromEndpoint);
+
+            //  Some delegates may not include supported serialization. If thats the case
+            //  assume XMI as a default serialization for such delegate. Also, check 
+            //  delegate configuration (provided in the deployment descriptor) and 
+            //  make sure that it matches "xmi". If the configuration says "binary" there 
+            //  is a mis-configuration which we handle by overriding the endpoint setting using
+            //  "xmi" as a value for serialization strategy.
+            if ( !((MessageContext)anObjectToHandle).propertyExists(AsynchAEMessage.Serialization)) {
+              Endpoint masterEndpoint = 
+                ((AggregateAnalysisEngineController)getController()).lookUpEndpoint(delegateKey, false);
+              if ( masterEndpoint.getSerializer().equals("binary") ) {
+                System.out.println("\n\t***** WARNING: Delegate:"+delegateKey+" Doesn't Support Binary Serialization. Aggregate:"+getController().getComponentName()+" Defaulting to XMI Serialization For This Delegate\n");
+                //  Override configured serialization
+                masterEndpoint.setSerializer("xmi");
+                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
+                        "handle", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                        "UIMAEE_override_serialization__WARNING", new Object[] { getController().getComponentName(), delegateKey });
+              }
+            }
             Delegate delegate = ((AggregateAnalysisEngineController)getController()).lookupDelegate(delegateKey);
             if ( delegate.getEndpoint().isRemote() ) {
               delegate.cancelDelegateTimer();
@@ -123,6 +144,7 @@
 			}
 			catch( Exception e)
 			{
+			  e.printStackTrace();
 			  getController().notifyListenersWithInitializationStatus(e);
 				getController().getErrorHandlerChain().handle(e, HandlerBase.populateErrorContext( (MessageContext)anObjectToHandle ), getController());			
 			}

Added: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java?rev=737196&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java (added)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java Fri Jan 23 13:31:40 2009
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.aae.message;
+
+
+public interface AsynchAEMessage
+{
+	public static final String TotalTimeSpentInAnalytic = "TimeInAnalytic";
+	public static final String TimeInService = "TimeInService";
+	public static final String Endpoint = "Endpoint";
+	public static final String DelegateStats = "DelegateStats";
+	public static final String RequestFailed = "RequestFailed";
+	
+	public static final String CasReference = "CasReference";
+	public static final String InputCasReference = "InputCasReference";
+	public static final String MessageFrom = "MessageFrom";
+	public static final String XCASREFId = "XCASRefId";
+	public static final String XCas = "XCas";
+	public static final String AEMetadata = "Metadata";
+	public static final String CasSequence = "CasSequence";
+	public static final String ReplyToEndpoint = "ReplyToEndpoint";
+	public static final String EndpointServer = "EndpointServer";
+	public static final String ServerIP = "ServerIP";
+	public static final String RemoveEndpoint = "RemoveEndpoint";
+	public static final String Aborted = "Aborted";
+
+	public static final String TimeToSerializeCAS = "TimeToSerializeCAS";
+	public static final String TimeToDeserializeCAS = "TimeToDeserializeCAS";
+	public static final String TimeWaitingForCAS  = "TimeWaitingForCAS";
+	public static final String TimeInProcessCAS  = "TimeInProcessCAS";
+	public static final String IdleTime  = "IdleTime";
+	public static final String CAS  = "CAS";
+	public static final String Cargo = "Cargo";
+	public static final String SkipSubordinateCountUpdate = "SkipSubordinateCountUpdate";
+	
+	
+	public static final String Payload = "Payload";
+	public static final int XMIPayload = 1000;
+	public static final int CASRefID = 1001;
+	public static final int Metadata = 1002;
+	public static final int Exception= 1003;
+	public static final int XCASPayload = 1004;
+	public static final int None = 1005;
+	public static final int BinaryPayload = 1006;
+	
+
+	
+	public static final String Command = "Command";
+	public static final int Process = 2000;
+	public static final int GetMeta = 2001;
+	public static final int CollectionProcessComplete = 2002;
+	public static final int Terminate = 2003;
+	public static final int ACK = 2004;
+	public static final int ReleaseCAS = 2005;
+  public static final int Stop = 2006;
+  public static final int Ping = 2007;
+	
+	
+	public static final String MessageType = "MessageType";
+	public static final int Request = 3000;
+	public static final int Response = 3001;
+	
+	public static final String AcceptsDeltaCas = "AcceptsDeltaCas";
+  public static final String SentDeltaCas = "SentDeltaCas";
+  
+  public static final String Serialization = "Serialization";
+  public static final int XmiSerialization = 4000;
+  public static final int BinarySerialization = 4001;
+}

Propchange: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/message/AsynchAEMessage.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/resources/uimaee_messages.properties
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/resources/uimaee_messages.properties?rev=737196&r1=737195&r2=737196&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/resources/uimaee_messages.properties (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/resources/uimaee_messages.properties Fri Jan 23 13:31:40 2009
@@ -199,4 +199,5 @@
 UIMAEE_aggregate_rcvd_ping_reply__FINE = Controller: {0} Received Ping Message (GetMeta) Reply From Delegate: {1}.
 UIMAEE_dump_cas_pending_dispatch__FINE = Controller: {0} Cas Id: {1} Pending Dispatch To Delegate: {2}
 UIMAEE_dump_cas_pending_reply__FINE = Controller: {0} Cas Id: {1} Pending Reply From Delegate: {2}
-UIMAEE_force_cas_timeout__INFO = Controller: {0} Disabled Delegate: {1}. Forcing Timeout Of CAS: {2} Found In : {3}  
\ No newline at end of file
+UIMAEE_force_cas_timeout__INFO = Controller: {0} Disabled Delegate: {1}. Forcing Timeout Of CAS: {2} Found In : {3}  
+UIMAEE_override_serialization__WARNING = \n\t***** WARNING: Controller: {0} Overriding Delegate: {1} Serialization. Binary Serialization Not Supported. Defaulting to xmi\n  
\ No newline at end of file