[jboss-svn-commits] JBL Code SVN: r25030 - in labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss: internal/soa/esb/couriers and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Jan 31 09:03:52 EST 2009


Author: mark.little at jboss.com
Date: 2009-01-31 09:03:51 -0500 (Sat, 31 Jan 2009)
New Revision: 25030

Modified:
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java
Log:


Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java	2009-01-31 03:48:55 UTC (rev 25029)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java	2009-01-31 14:03:51 UTC (rev 25030)
@@ -148,38 +148,7 @@
 			throw new UnmarshalException("Unable to parse EPR XML.", xmlse);
 		}
 	}
-
-	/**
-	 * All ESB-aware EPRs are of derived types and not the base type.
-	 * 
-	 * @param epr the epr to check.
-	 * @return <code>true</code> if the EPR is for a gateway, <code>false</code>
-	 * otherwise.
-	 */
 	
-	public static final boolean gatewayEPR (EPR epr)
-	{
-	    try
-	    {
-        	    if (epr.getClass().getMethod("type", (Class) null) == null)
-        	    {
-        	        /*
-        	         * Only derived types have the type method. So if
-        	         * the method isn't present, this is a vanilla EPR
-        	         * so a gateway.
-        	         */
-        	        
-        	        return true;
-        	    }
-        	    else
-        	        return false;
-	    }
-	    catch (final Exception ex)
-	    {
-	        return false;
-	    }
-	}
-	
 	private final static void setSpecificEPR(EPR epr)
 	{
 		String eprType = null;

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java	2009-01-31 03:48:55 UTC (rev 25029)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java	2009-01-31 14:03:51 UTC (rev 25030)
@@ -107,7 +107,8 @@
 				repsonseMessage = Util.deserialize(serial);
 			}
 
-		} catch (Exception e) {
+		} catch (final Exception e) {
+		    logger.error("HttpCourier.deliver caught exception.", e);
 			logger.error("Failed to get response message :[ " + message + "]");
 			return false;
 		} finally {

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2009-01-31 03:48:55 UTC (rev 25029)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2009-01-31 14:03:51 UTC (rev 25030)
@@ -111,7 +111,7 @@
     /**
      * Class logger.
      */
-    private static Logger logger = Logger.getLogger(ServiceInvoker.class);
+    private static java.util.logging.Logger logger = Logger.getLogger(ServiceInvoker.class);
     /**
      * The target service.
      */
@@ -336,79 +336,66 @@
             EPR epr;
             // Iterate over all the EPRs in the list until delivered
             while ((epr = loadBalancer.chooseEPR(serviceClusterInfo)) != null) {
-                if (!EPRHelper.gatewayEPR(epr))
+                try
                 {
-                	try
-                	{
-                	    final Subject subject = Subject.getSubject(AccessController.getContext());
-                	    if (subject != null)
-                	    {
-                	        logger.info("Subject in ServiceInvoker " + subject);
-                            try
-                            {
-                    			byte[] encrypted = PrivateCryptoUtil.INSTANCE.encrypt(new SecurityContext(subject));
-                        	    message.getContext().setContext(SecurityService.CONTEXT, encrypted);
+                    final Subject subject = Subject.getSubject(AccessController.getContext());
+                    if (subject != null)
+                    {
+                        logger.info("Subject in ServiceInvoker " + subject);
+                        try
+                        {
+                            byte[] encrypted = PrivateCryptoUtil.INSTANCE.encrypt(new SecurityContext(subject));
+                            message.getContext().setContext(SecurityService.CONTEXT, encrypted);
+                        }
+                        catch (final SecurityServiceException e)
+                        {
+                            logger.error("Could not encrypt the security conext. Will not be added to the outgoing message", e);
+                        }
+                    }
+
+                    replyMessage = eprInvoker.attemptDelivery(message, epr);
+                    if (replyMessage != null) {
+                        if(eprInvoker.synchronous) {
+                            // remove the security context so that it is not exposed to the action pipeline.
+                            replyMessage.getContext().removeContext(SecurityService.CONTEXT);
+
+                            if (Type.isFaultMessage(replyMessage)) {
+                                Factory.createExceptionFromFault(replyMessage) ;
                             }
-                            catch (final SecurityServiceException e)
-                            {
-                                logger.error("Could not encrypt the security conext. Will not be added to the outgoing message", e);
-                            }
-                	    }
-    
-    	                replyMessage = eprInvoker.attemptDelivery(message, epr);
-    	                if (replyMessage != null) {
-                            if(eprInvoker.synchronous) {
-                                // remove the security context so that it is not exposed to the action pipeline.
-                                replyMessage.getContext().removeContext(SecurityService.CONTEXT);
-    
-                                if (Type.isFaultMessage(replyMessage)) {
-                                    Factory.createExceptionFromFault(replyMessage) ;
-                                }
-    
-                                // We've delivered it, we're done!
-                                return replyMessage;
-                            } else {
-                                // It was an async delivery.  The replyMessage was just an indicator that
-                                // the delivery succeeded.  Return null...
-                                return null;
-                            }
+
+                            // We've delivered it, we're done!
+                            return replyMessage;
                         } else {
-    	                    logger.info("Unresponsive EPR: " + epr+" for message: "+message.getHeader());
-    
-    	                    serviceClusterInfo.removeDeadEPR(epr);
-    
-    	                    /*
-    	                     * So far we've only removed the EPR from the cache. Should we
-    	                     * also remove it from the registry?
-    	                     */
-    
-    	                    if (removeDeadEprs)
-    	                    	RegistryUtil.unregister(service.getCategory(), service.getName(), epr);
-    
-    	                    /*
-    	                     * If the message property is set to fail immediately, or the global property is set,
-    	                     * then don't do retries even if there are other EPRs in the list.
-    	                     */
-    
-    	                    if (("true".equals(message.getProperties().getProperty(Environment.EXCEPTION_ON_DELIVERY_FAILURE, "false")) || exceptionOnDeliveryFailure))
-    	                	throw new MessageDeliverException("Failed to deliver message ["+message.getHeader()+"] to Service [" + service + "].  Told not to retry.");
-    	                }
-                	}
-                	catch (MalformedEPRException ex)  // so we can differentiate failure modes, since returning null is limiting
-                	{
-                		logger.debug("Invalid EPR for service (probably ESB-unaware): ignoring for message: "+message.getHeader());
-    
-                		serviceClusterInfo.removeDeadEPR(epr);
-    
-                		/*
-                		 * DO NOT remove from the registry - it is not dead!!
-                		 */
-                	}
+                            // It was an async delivery.  The replyMessage was just an indicator that
+                            // the delivery succeeded.  Return null...
+                            return null;
+                        }
+                    } else {
+                        logger.info("Unresponsive EPR: " + epr+" for message: "+message.getHeader());
+
+                        serviceClusterInfo.removeDeadEPR(epr);
+
+                        /*
+                         * So far we've only removed the EPR from the cache. Should we
+                         * also remove it from the registry?
+                         */
+
+                        if (removeDeadEprs)
+                            RegistryUtil.unregister(service.getCategory(), service.getName(), epr);
+
+                        /*
+                         * If the message property is set to fail immediately, or the global property is set,
+                         * then don't do retries even if there are other EPRs in the list.
+                         */
+
+                        if (("true".equals(message.getProperties().getProperty(Environment.EXCEPTION_ON_DELIVERY_FAILURE, "false")) || exceptionOnDeliveryFailure))
+                            throw new MessageDeliverException("Failed to deliver message ["+message.getHeader()+"] to Service [" + service + "].  Told not to retry.");
+                    }
                 }
-                else
+                catch (MalformedEPRException ex)  // so we can differentiate failure modes, since returning null is limiting
                 {
-                    logger.debug("Bad EPR for service (probably ESB-unaware): ignoring for message: "+message.getHeader());
-                    
+                    logger.debug("Invalid EPR for service (probably ESB-unaware): ignoring for message: "+message.getHeader());
+
                     serviceClusterInfo.removeDeadEPR(epr);
 
                     /*
@@ -461,7 +448,7 @@
         try {
             return DefaultReplyTo.getReplyTo(toEpr);
         } catch (CourierException e) {
-            throw new ConfigurationException("Bad configuration. Unable to support synchronous reply on 'to' address " + toEpr, e);
+            throw new ConfigurationException("Unsupported EPR type for synchronous reply on 'to' address " + toEpr, e);
         } catch (MalformedEPRException e) {
             throw new ConfigurationException("Bad configuration. Unable to support synchronous reply on 'to' address " + toEpr, e);
         }

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java	2009-01-31 03:48:55 UTC (rev 25029)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java	2009-01-31 14:03:51 UTC (rev 25030)
@@ -341,7 +341,7 @@
      */
     private void registerEndpoint() throws ConfigurationException, RegistryException {
     	try {
-			endpointReference = new EPR(new URI(protocol + "://"+ host + ":" + port + this.httpContext));
+			endpointReference = new HTTPEpr(new URI(protocol + "://"+ host + ":" + port + this.httpContext));
 		} catch (Exception e) {
 			throw new RegistryException("Tomcat gateway listener registration failed", e);
 		}
@@ -361,9 +361,9 @@
         }
     }
     
-	/**Stop tomcat server. It will destory the generated tomcat connector or host . 
+	/**Stop tomcat server. It will destroy the generated tomcat connector or host . 
 	 * Before do it , it will check if the reference count for it is zero .When there 
-	 * is no tomcat listner uses the generated host or connector, it will destory it 
+	 * is no tomcat listener uses the generated host or connector, it will destroy it 
 	 * @throws Exception For errors during stop tomcat connector or host
 	 */
     @SuppressWarnings("unchecked")




More information about the jboss-svn-commits mailing list