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/09/02 17:27:05 UTC

svn commit: r810567 [3/3] - in /incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms: ./ client/ message/ service/

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/ClientServiceDelegate.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/ClientServiceDelegate.java?rev=810567&r1=810566&r2=810567&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/ClientServiceDelegate.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/ClientServiceDelegate.java Wed Sep  2 15:27:04 2009
@@ -35,30 +35,39 @@
   private static final Class CLASS_NAME = ClientServiceDelegate.class;
 
   private BaseUIMAAsynchronousEngineCommon_impl clientUimaAsEngine;
+
   private String applicationName = "UimaAsClient";
+
   private volatile boolean usesSynchronousAPI;
+
   private Destination freeCasDestination = null;
-  
-  public ClientServiceDelegate(String serviceName, String anApplicationName,  BaseUIMAAsynchronousEngineCommon_impl engine ) {
+
+  public ClientServiceDelegate(String serviceName, String anApplicationName,
+          BaseUIMAAsynchronousEngineCommon_impl engine) {
     super.delegateKey = serviceName;
     clientUimaAsEngine = engine;
-    if ( anApplicationName != null && anApplicationName.trim().length() > 0 ) {
+    if (anApplicationName != null && anApplicationName.trim().length() > 0) {
       applicationName = anApplicationName;
     }
   }
+
   public boolean isSynchronousAPI() {
     return usesSynchronousAPI;
   }
+
   public void setSynchronousAPI() {
-    this.usesSynchronousAPI = true;;
+    this.usesSynchronousAPI = true;
+    ;
   }
 
   public Destination getFreeCasDestination() {
     return freeCasDestination;
   }
+
   public void setFreeCasDestination(Destination freeCasDestination) {
     this.freeCasDestination = freeCasDestination;
   }
+
   public String getComponentName() {
     return applicationName;
   }
@@ -67,82 +76,92 @@
     String casReferenceId = null;
     CAS cas = null;
     ClientRequest cachedRequest = null;
-    if ( !clientUimaAsEngine.running ) {
+    if (!clientUimaAsEngine.running) {
       cancelDelegateTimer();
       return;
     }
-    int command = ((Integer)errorContext.get(AsynchAEMessage.Command)).intValue();
+    int command = ((Integer) errorContext.get(AsynchAEMessage.Command)).intValue();
     try {
-      if ( e instanceof MessageTimeoutException) {
+      if (e instanceof MessageTimeoutException) {
         cancelDelegateTimer();
-        switch( command ) {
+        switch (command) {
           case AsynchAEMessage.Process:
-            casReferenceId = (String)errorContext.get(AsynchAEMessage.CasReference);
-            if ( casReferenceId != null ) {
-              cachedRequest =(ClientRequest)clientUimaAsEngine.clientCache.get(casReferenceId);
-              if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE) &&
-                      getEndpoint() != null )  {
-                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_process_timeout_INFO", new Object[] { getEndpoint().getEndpoint() });
-              }        
+            casReferenceId = (String) errorContext.get(AsynchAEMessage.CasReference);
+            if (casReferenceId != null) {
+              cachedRequest = (ClientRequest) clientUimaAsEngine.clientCache.get(casReferenceId);
+              if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)
+                      && getEndpoint() != null) {
+                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(),
+                        "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                        "UIMAJMS_process_timeout_INFO",
+                        new Object[] { getEndpoint().getEndpoint() });
+              }
               if (cachedRequest != null && cachedRequest.isRemote()) {
                 cas = cachedRequest.getCAS();
               }
               boolean isPingTimeout = false;
-              if ( errorContext.containsKey(AsynchAEMessage.ErrorCause)) {
-                isPingTimeout =  
-                  AsynchAEMessage.PingTimeout == 
-                    (Integer)errorContext.get(AsynchAEMessage.ErrorCause);
+              if (errorContext.containsKey(AsynchAEMessage.ErrorCause)) {
+                isPingTimeout = AsynchAEMessage.PingTimeout == (Integer) errorContext
+                        .get(AsynchAEMessage.ErrorCause);
               }
-              if ( isPingTimeout && isAwaitingPingReply() ) {
+              if (isPingTimeout && isAwaitingPingReply()) {
                 System.out.println(">>>>> Client Ping Timedout");
-                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(), "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_client_ping_timed_out__WARNING",
-                        new Object[] { getKey() });
-                
-                clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(), BaseUIMAAsynchronousEngineCommon_impl.PingTimeout, casReferenceId);
+                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
+                        "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+                        "UIMAJMS_client_ping_timed_out__WARNING", new Object[] { getKey() });
+
+                clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
+                        BaseUIMAAsynchronousEngineCommon_impl.PingTimeout, casReferenceId);
               } else {
                 if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
-                  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_client_process_timedout__INFO",
+                  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
+                          "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+                          "UIMAJMS_client_process_timedout__INFO",
                           new Object[] { getGetMetaTimeout() });
                 }
                 System.out.println(">>>>> Client Process Timed out. Notifying Listeners");
-                clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(), BaseUIMAAsynchronousEngineCommon_impl.ProcessTimeout, casReferenceId);
+                clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
+                        BaseUIMAAsynchronousEngineCommon_impl.ProcessTimeout, casReferenceId);
               }
             }
             clientUimaAsEngine.clientSideJmxStats.incrementProcessTimeoutErrorCount();
             break;
-            
+
           case AsynchAEMessage.GetMeta:
-               if ( isAwaitingPingReply() ) {
-                 System.out.println(">>>>> Client Ping Timedout");
-                 clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(), BaseUIMAAsynchronousEngineCommon_impl.PingTimeout, casReferenceId);
-               } else {
-                 //  Notifies Listeners and removes ClientRequest instance from the client cache
-                 clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(), BaseUIMAAsynchronousEngineCommon_impl.MetadataTimeout, casReferenceId);
-                 clientUimaAsEngine.clientSideJmxStats.incrementMetaTimeoutErrorCount();
-               }
-               if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
-                 UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_meta_timeout_INFO",
-                   new Object[] { getKey() });
-               }
-               System.out.println("Stopping Uima AS Client API. Service Not Responding To a Ping.");
-               clientUimaAsEngine.stop();
+            if (isAwaitingPingReply()) {
+              System.out.println(">>>>> Client Ping Timedout");
+              clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
+                      BaseUIMAAsynchronousEngineCommon_impl.PingTimeout, casReferenceId);
+            } else {
+              // Notifies Listeners and removes ClientRequest instance from the client cache
+              clientUimaAsEngine.notifyOnTimout(cas, clientUimaAsEngine.getEndPointName(),
+                      BaseUIMAAsynchronousEngineCommon_impl.MetadataTimeout, casReferenceId);
+              clientUimaAsEngine.clientSideJmxStats.incrementMetaTimeoutErrorCount();
+            }
+            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
+                      "handleError", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+                      "UIMAJMS_meta_timeout_INFO", new Object[] { getKey() });
+            }
+            System.out.println("Stopping Uima AS Client API. Service Not Responding To a Ping.");
+            clientUimaAsEngine.stop();
             break;
-              
+
           case AsynchAEMessage.CollectionProcessComplete:
-            
+
             break;
         }
       }
-    }
-    catch (Exception ex) {
+    } catch (Exception ex) {
       ex.printStackTrace();
       if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
-        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", new Object[] { ex });
-      }        
+        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
+                "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                "UIMAEE_exception__WARNING", new Object[] { ex });
+      }
     }
-    //  Dont release the CAS if synchronous API was used
-    if (cas != null && !cachedRequest.isSynchronousInvocation())
-    {
+    // Dont release the CAS if synchronous API was used
+    if (cas != null && !cachedRequest.isSynchronousInvocation()) {
       cas.release();
     }
   }

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/MessageSender.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/MessageSender.java?rev=810567&r1=810566&r2=810567&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/MessageSender.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/MessageSender.java Wed Sep  2 15:27:04 2009
@@ -26,17 +26,17 @@
 
 public interface MessageSender {
 
-	public MessageProducer getMessageProducer();
+  public MessageProducer getMessageProducer();
 
-	public Exception getReasonForFailure();
+  public Exception getReasonForFailure();
 
-	public boolean failed();
+  public boolean failed();
 
-	public TextMessage createTextMessage() throws Exception;
+  public TextMessage createTextMessage() throws Exception;
 
-	public void doStop();
-	
-	public MessageProducer getMessageProducer(Destination destination) throws Exception;
+  public void doStop();
+
+  public MessageProducer getMessageProducer(Destination destination) throws Exception;
 
   public BytesMessage createBytesMessage() throws Exception;
 }

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/JmsMessageContext.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/JmsMessageContext.java?rev=810567&r1=810566&r2=810567&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/JmsMessageContext.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/JmsMessageContext.java Wed Sep  2 15:27:04 2009
@@ -36,234 +36,184 @@
 import org.apache.uima.adapter.jms.JmsConstants;
 import org.apache.uima.util.Level;
 
-public class JmsMessageContext implements MessageContext
-{
-	private static final Class CLASS_NAME = JmsMessageContext.class;
-
-	private Message message;
-	private Endpoint endpoint;
-	private long messageArrivalTime = 0L;
-	private String endpointName;
-	
-	public JmsMessageContext()
-	{
-		endpoint = new Endpoint_impl();
-		
-	}
-
-	public JmsMessageContext(Message aMessage, String anEndpointName) throws AsynchAEException
-	{
-		this();
-		endpointName = anEndpointName;
-		message = aMessage;
-		try
-		{
-		  if ( aMessage instanceof BytesMessage )
-		  {
-		    endpoint.setSerializer("binary");
-		  } else if ( aMessage instanceof TextMessage ) {
+public class JmsMessageContext implements MessageContext {
+  private static final Class CLASS_NAME = JmsMessageContext.class;
+
+  private Message message;
+
+  private Endpoint endpoint;
+
+  private long messageArrivalTime = 0L;
+
+  private String endpointName;
+
+  public JmsMessageContext() {
+    endpoint = new Endpoint_impl();
+
+  }
+
+  public JmsMessageContext(Message aMessage, String anEndpointName) throws AsynchAEException {
+    this();
+    endpointName = anEndpointName;
+    message = aMessage;
+    try {
+      if (aMessage instanceof BytesMessage) {
+        endpoint.setSerializer("binary");
+      } else if (aMessage instanceof TextMessage) {
         endpoint.setSerializer("xmi");
-		  }
-		    
-			String msgFrom = (String)aMessage.getStringProperty(AsynchAEMessage.MessageFrom); 
-			if ( msgFrom != null )
-			{
-				endpoint.setEndpoint( msgFrom);
-			}
-			if ( aMessage.getJMSReplyTo() != null )
-			{
-				endpoint.setDestination(aMessage.getJMSReplyTo());
-			}
-			if ( aMessage.propertyExists(UIMAMessage.ServerURI) )
-			{
-				String selectedServerURI = chooseServerURI(aMessage.getStringProperty(UIMAMessage.ServerURI));
-				endpoint.setServerURI(selectedServerURI);
-				endpoint.setRemote(endpoint.getServerURI().startsWith("vm")==false);
-			}
-			//	Check if the client attached a special property that needs to be echoed back.
-			//	This enables the client to match the reply with the endpoint.
-			if ( aMessage.propertyExists(AsynchAEMessage.EndpointServer))
-			{
-				endpoint.setRemote(true);
-				endpoint.setEndpointServer(aMessage.getStringProperty(AsynchAEMessage.EndpointServer));
-			}
-		
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-	public String getEndpointName()
-	{
-		return endpointName;
-	}
-
-	private String chooseServerURI( String aServerURIList)
-	{
-		String serverURI = aServerURIList;
-		
-		if( serverURI.indexOf(',') > 0 )
-		{
-			StringTokenizer st = new StringTokenizer(serverURI, ",");
-			
-			while( st.hasMoreTokens())
-			{
-				String token = st.nextToken().trim();
-				if ( token.startsWith("tcp") )
-				{
-					//	Normally this is the server URI for a java service.
-					serverURI = token;
-					break;
-				}
-				else if ( token.startsWith("http"))
-				{
-					//	http will only be in the list of uri's if the service is bahind the firewall.
-					//	If present, this service needs to respond with http protocol as well.
-					serverURI = token;
-					break;  // dont need to analyze this further. Will respond via http
-				}
-			}
-		}
-		
-		return serverURI;
-	}
-	public boolean propertyExists(String aKey) throws AsynchAEException
-	{
-		try
-		{
-			return message.propertyExists(aKey);
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-	public Endpoint getEndpoint()
-	{
-		return endpoint;
-	}
-    public Object getRawMessage()
-    {
-    	return message;
-    }
-	public void setMessageArrivalTime( long anArrivalTime )
-	{
-		messageArrivalTime = anArrivalTime;
-	}
-	public long getMessageArrivalTime()
-	{
-		return messageArrivalTime;
-	}
-    public byte[] getByteMessage() throws AsynchAEException
-	{
-		try
-		{
-			if ( message instanceof BytesMessage)
-			{
-				long payloadSize = ((BytesMessage) message).getBodyLength();
-				byte[] payloadByteArray = new byte[(int)payloadSize];
-				((BytesMessage) message).readBytes(payloadByteArray);
-				return payloadByteArray;
-			}
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-		return new byte[0];
-	}
-
-	public int getMessageIntProperty(String aMessagePropertyName) throws AsynchAEException
-	{
-		try
-		{
-			return message.getIntProperty(aMessagePropertyName);
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-	public long getMessageLongProperty( String aMessagePropertyName ) throws AsynchAEException
-	{
-		try
-		{
-			return message.getLongProperty(aMessagePropertyName);
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-
-	public Object getMessageObjectProperty(String aMessagePropertyName) throws AsynchAEException
-	{
-		try
-		{
-			return message.getObjectProperty(aMessagePropertyName);
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-	public String getMessageStringProperty(String aMessagePropertyName) throws AsynchAEException
-	{
-		try
-		{
-			return message.getStringProperty(aMessagePropertyName);
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-	
-	public boolean getMessageBooleanProperty(String aMessagePropertyName) throws AsynchAEException
-	{
-		try
-		{
-			return message.getBooleanProperty(aMessagePropertyName);
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-	}
-	
-	
-
-	public Object getObjectMessage() throws AsynchAEException
-	{
-		try
-		{
-			if ( message instanceof ObjectMessage)
-			{
-				return ((ObjectMessage)message).getObject();
-			}
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-		return null;
-	}
-
-	public String getStringMessage() throws AsynchAEException
-	{
-		try
-		{
-			if ( message instanceof TextMessage )
-			{
-				return ((TextMessage)message).getText();
-			}
-		}
-		catch( Exception e)
-		{
-			throw new AsynchAEException(e);
-		}
-		return null;
-	}
+      }
+
+      String msgFrom = (String) aMessage.getStringProperty(AsynchAEMessage.MessageFrom);
+      if (msgFrom != null) {
+        endpoint.setEndpoint(msgFrom);
+      }
+      if (aMessage.getJMSReplyTo() != null) {
+        endpoint.setDestination(aMessage.getJMSReplyTo());
+      }
+      if (aMessage.propertyExists(UIMAMessage.ServerURI)) {
+        String selectedServerURI = chooseServerURI(aMessage
+                .getStringProperty(UIMAMessage.ServerURI));
+        endpoint.setServerURI(selectedServerURI);
+        endpoint.setRemote(endpoint.getServerURI().startsWith("vm") == false);
+      }
+      // Check if the client attached a special property that needs to be echoed back.
+      // This enables the client to match the reply with the endpoint.
+      if (aMessage.propertyExists(AsynchAEMessage.EndpointServer)) {
+        endpoint.setRemote(true);
+        endpoint.setEndpointServer(aMessage.getStringProperty(AsynchAEMessage.EndpointServer));
+      }
+
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public String getEndpointName() {
+    return endpointName;
+  }
+
+  private String chooseServerURI(String aServerURIList) {
+    String serverURI = aServerURIList;
+
+    if (serverURI.indexOf(',') > 0) {
+      StringTokenizer st = new StringTokenizer(serverURI, ",");
+
+      while (st.hasMoreTokens()) {
+        String token = st.nextToken().trim();
+        if (token.startsWith("tcp")) {
+          // Normally this is the server URI for a java service.
+          serverURI = token;
+          break;
+        } else if (token.startsWith("http")) {
+          // http will only be in the list of uri's if the service is bahind the firewall.
+          // If present, this service needs to respond with http protocol as well.
+          serverURI = token;
+          break; // dont need to analyze this further. Will respond via http
+        }
+      }
+    }
+
+    return serverURI;
+  }
+
+  public boolean propertyExists(String aKey) throws AsynchAEException {
+    try {
+      return message.propertyExists(aKey);
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public Endpoint getEndpoint() {
+    return endpoint;
+  }
+
+  public Object getRawMessage() {
+    return message;
+  }
+
+  public void setMessageArrivalTime(long anArrivalTime) {
+    messageArrivalTime = anArrivalTime;
+  }
+
+  public long getMessageArrivalTime() {
+    return messageArrivalTime;
+  }
+
+  public byte[] getByteMessage() throws AsynchAEException {
+    try {
+      if (message instanceof BytesMessage) {
+        long payloadSize = ((BytesMessage) message).getBodyLength();
+        byte[] payloadByteArray = new byte[(int) payloadSize];
+        ((BytesMessage) message).readBytes(payloadByteArray);
+        return payloadByteArray;
+      }
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+    return new byte[0];
+  }
+
+  public int getMessageIntProperty(String aMessagePropertyName) throws AsynchAEException {
+    try {
+      return message.getIntProperty(aMessagePropertyName);
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public long getMessageLongProperty(String aMessagePropertyName) throws AsynchAEException {
+    try {
+      return message.getLongProperty(aMessagePropertyName);
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public Object getMessageObjectProperty(String aMessagePropertyName) throws AsynchAEException {
+    try {
+      return message.getObjectProperty(aMessagePropertyName);
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public String getMessageStringProperty(String aMessagePropertyName) throws AsynchAEException {
+    try {
+      return message.getStringProperty(aMessagePropertyName);
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public boolean getMessageBooleanProperty(String aMessagePropertyName) throws AsynchAEException {
+    try {
+      return message.getBooleanProperty(aMessagePropertyName);
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+  }
+
+  public Object getObjectMessage() throws AsynchAEException {
+    try {
+      if (message instanceof ObjectMessage) {
+        return ((ObjectMessage) message).getObject();
+      }
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+    return null;
+  }
+
+  public String getStringMessage() throws AsynchAEException {
+    try {
+      if (message instanceof TextMessage) {
+        return ((TextMessage) message).getText();
+      }
+    } catch (Exception e) {
+      throw new AsynchAEException(e);
+    }
+    return null;
+  }
 
 }

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/PendingMessage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/PendingMessage.java?rev=810567&r1=810566&r2=810567&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/PendingMessage.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/message/PendingMessage.java Wed Sep  2 15:27:04 2009
@@ -21,14 +21,13 @@
 import java.util.HashMap;
 
 public class PendingMessage extends HashMap {
-	private int messageType;
-	
-	public PendingMessage(int aMessageType)
-	{
-		messageType = aMessageType;
-	}
+  private int messageType;
 
-	public int getMessageType() {
-		return messageType;
-	}
+  public PendingMessage(int aMessageType) {
+    messageType = aMessageType;
+  }
+
+  public int getMessageType() {
+    return messageType;
+  }
 }

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/service/Dd2spring.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/service/Dd2spring.java?rev=810567&r1=810566&r2=810567&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/service/Dd2spring.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/service/Dd2spring.java Wed Sep  2 15:27:04 2009
@@ -35,64 +35,71 @@
 
 public class Dd2spring {
 
-	private static final Class [] mainArg = new Class [] {String[].class};
-	private static final Class THIS_CLASS = Dd2spring.class;
-	private ClassLoader saxonClassLoader;
-	
-	/**
-	 * Test driver  arg = path_to_source,  path_to_xslt, path_to_saxon_jar, uima-as-debug flag
-	 * @param args
-	 */
-	public static void main(String[] args) {
+  private static final Class[] mainArg = new Class[] { String[].class };
+
+  private static final Class THIS_CLASS = Dd2spring.class;
+
+  private ClassLoader saxonClassLoader;
+
+  /**
+   * Test driver arg = path_to_source, path_to_xslt, path_to_saxon_jar, uima-as-debug flag
+   * 
+   * @param args
+   */
+  public static void main(String[] args) {
     new Dd2spring().convertDd2Spring(args[0], args[1], args[2], args[3]);
-	}
-	
-	public File convertDd2Spring(String ddFilePath,
-			String dd2SpringXsltFilePath,
-			String saxonClasspath,
-			String uimaAsDebug) {
-
-		URL urlForSaxonClassPath;
-		try {
-			urlForSaxonClassPath = new URL(saxonClasspath);
-		} catch (MalformedURLException e) {
-			e.printStackTrace();
-			UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMA_dd2spring_Cannot_convert_saxon_classpath_to_a_URL_SEVERE",
-          new Object[] {saxonClasspath});
-			return null;
-		}
-
-		File tempFile;
-		try {
-			tempFile = File.createTempFile("UIMAdd2springOutput", ".xml");
-		} catch (IOException e) {
-			e.printStackTrace();
-			UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMA_dd2spring_cant_create_temp_output_file_SEVERE");
-			return null;
-		}
-
-		convertDd2Spring(tempFile, ddFilePath, dd2SpringXsltFilePath, urlForSaxonClassPath);
-		
-		// delete the file when terminating if
-		//   a) uimaAsDebug is not specified (is null) or
-		//   b) uimaAsDebug is specified, but is ""
-		if (null == uimaAsDebug || uimaAsDebug.equals("")) {
-		  tempFile.deleteOnExit();
-		}
-		  
-		return tempFile;		
-	}
-/**
- * 
- * @param ddFilePath file path to UIMA Deployment Descriptor - passed to saxon
- * @param dd2SpringXsltFilePath file path to dd2spring.xslt transformation file - passed to saxon
- * @param saxonClasspathURL classpath for saxon8.jar
- * @return temp file with generated Spring from dd2spring transform
- */	
+  }
+
+  public File convertDd2Spring(String ddFilePath, String dd2SpringXsltFilePath,
+          String saxonClasspath, String uimaAsDebug) {
+
+    URL urlForSaxonClassPath;
+    try {
+      urlForSaxonClassPath = new URL(saxonClasspath);
+    } catch (MalformedURLException e) {
+      e.printStackTrace();
+      UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_Cannot_convert_saxon_classpath_to_a_URL_SEVERE",
+              new Object[] { saxonClasspath });
+      return null;
+    }
+
+    File tempFile;
+    try {
+      tempFile = File.createTempFile("UIMAdd2springOutput", ".xml");
+    } catch (IOException e) {
+      e.printStackTrace();
+      UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_cant_create_temp_output_file_SEVERE");
+      return null;
+    }
+
+    convertDd2Spring(tempFile, ddFilePath, dd2SpringXsltFilePath, urlForSaxonClassPath);
+
+    // delete the file when terminating if
+    // a) uimaAsDebug is not specified (is null) or
+    // b) uimaAsDebug is specified, but is ""
+    if (null == uimaAsDebug || uimaAsDebug.equals("")) {
+      tempFile.deleteOnExit();
+    }
+
+    return tempFile;
+  }
+
+  /**
+   * 
+   * @param ddFilePath
+   *          file path to UIMA Deployment Descriptor - passed to saxon
+   * @param dd2SpringXsltFilePath
+   *          file path to dd2spring.xslt transformation file - passed to saxon
+   * @param saxonClasspathURL
+   *          classpath for saxon8.jar
+   * @return temp file with generated Spring from dd2spring transform
+   */
   public void convertDd2Spring(File tempFile, String ddFilePath, String dd2SpringXsltFilePath,
-      URL saxonClasspathURL) {
+          URL saxonClasspathURL) {
 
     if (null == saxonClassLoader) {
       URL[] classLoaderUrls = new URL[] { saxonClasspathURL };
@@ -106,11 +113,12 @@
     try {
       mainStartClass = Class.forName("net.sf.saxon.Transform", true, saxonClassLoader);
     } catch (ClassNotFoundException e) {
-      System.err.println("Error - can't load Saxon jar from " + saxonClasspathURL + " for dd2spring transformation.");
+      System.err.println("Error - can't load Saxon jar from " + saxonClasspathURL
+              + " for dd2spring transformation.");
       e.printStackTrace();
       UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-          "UIMA_dd2spring_saxon_missing_SEVERE");
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_saxon_missing_SEVERE");
       return;
     }
 
@@ -118,16 +126,15 @@
     // -l -s deployment_descriptor} -o output_file_path dd2spring.xsl_file_path
 
     List<String> argsForSaxon = new ArrayList<String>();
-    argsForSaxon.add("-l");         // turn on line numbers
-    argsForSaxon.add("-s");         // source file
-    argsForSaxon.add(ddFilePath);   //   source file
-    argsForSaxon.add("-o");         // output file
-    argsForSaxon.add(tempFile.getAbsolutePath());   // output file
+    argsForSaxon.add("-l"); // turn on line numbers
+    argsForSaxon.add("-s"); // source file
+    argsForSaxon.add(ddFilePath); // source file
+    argsForSaxon.add("-o"); // output file
+    argsForSaxon.add(tempFile.getAbsolutePath()); // output file
     argsForSaxon.add(dd2SpringXsltFilePath); // xslt transform to apply
-    
-    
+
     if (null != System.getProperty("uima-as.dd2spring.noTempQueues")) {
-      argsForSaxon.add("noTempQueues=true");  // disable generate of temp queues (for testing)
+      argsForSaxon.add("noTempQueues=true"); // disable generate of temp queues (for testing)
     }
 
     Method mainMethod = null;
@@ -136,35 +143,36 @@
     } catch (SecurityException e) {
       e.printStackTrace();
       UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-          "UIMA_dd2spring_security_exception_calling_saxon");
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_security_exception_calling_saxon");
       return;
     } catch (NoSuchMethodException e) {
       e.printStackTrace();
       UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-          "UIMA_dd2spring_internal_error_calling_saxon");
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_internal_error_calling_saxon");
       return;
     }
     try {
-      mainMethod.invoke(null, new Object[] { argsForSaxon.toArray(new String [argsForSaxon.size()])});
+      mainMethod.invoke(null,
+              new Object[] { argsForSaxon.toArray(new String[argsForSaxon.size()]) });
     } catch (IllegalArgumentException e) {
       e.printStackTrace();
       UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-          "UIMA_dd2spring_internal_error_calling_saxon");
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_internal_error_calling_saxon");
       return;
     } catch (IllegalAccessException e) {
       e.printStackTrace();
       UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-          "UIMA_dd2spring_internal_error_calling_saxon");
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_internal_error_calling_saxon");
       return;
     } catch (InvocationTargetException e) {
       e.printStackTrace();
       UIMAFramework.getLogger(THIS_CLASS).logrb(Level.CONFIG, THIS_CLASS.getName(),
-          "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-          "UIMA_dd2spring_internal_error_calling_saxon");
+              "convertDD2Spring", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+              "UIMA_dd2spring_internal_error_calling_saxon");
       return;
     }