[jboss-svn-commits] JBL Code SVN: r12089 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/soa/esb/listeners/config and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue May 22 20:27:45 EDT 2007


Author: bill.burke at jboss.com
Date: 2007-05-22 20:27:44 -0400 (Tue, 22 May 2007)
New Revision: 12089

Added:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java
Modified:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
Log:
added <jca-gateway> element

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ServiceInvoker.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -90,7 +90,6 @@
          Courier courier = CourierFactory.getCourier(current);
          try
          {
-            System.out.println("Trying EPR: " + current);
             if (courier.deliver(message))
             {
                bSent = true;

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -108,12 +108,15 @@
 
             return controller;
          }
+         else
+         {
+            throw new IllegalStateException("ESB file had validation errors.");
+
+         }
       }
       catch (Exception e)
       {
          throw new RuntimeException(e);
       }
-
-      return null;
    }
 }

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -102,8 +102,8 @@
 		// Of course we could do the following reflectively if we really want to - TODO perhaps!!
 		if(listener instanceof JmsListener) {
 			listenerConfigTree = JmsListenerMapper.map(root, (JmsListener)listener, model);
-		} else if(listener instanceof FsListener) {
-			listenerConfigTree = FsListenerMapper.map(root, (FsListener)listener, model);
+      } else if(listener instanceof FsListener) {
+         listenerConfigTree = FsListenerMapper.map(root, (FsListener)listener, model);
 		} else if (listener instanceof FtpListener) {
 			listenerConfigTree = FtpListenerMapper.map(root, (FtpListener)listener, model);
 		} else if (listener instanceof SqlListener) {

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -39,6 +39,7 @@
 import org.jboss.soa.esb.listeners.config.mappers.JmsListenerMapper;
 import org.jboss.soa.esb.listeners.config.mappers.SqlListenerMapper;
 import org.jboss.soa.esb.listeners.config.mappers.UntypedListenerMapper;
+import org.jboss.soa.esb.listeners.config.mappers.JcaGatewayMapper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -99,6 +100,8 @@
 			JmsListenerMapper.map(root, (JmsListener)gateway, model);
 		} else if (gateway instanceof FsListener){
 			FsListenerMapper.map(root, (FsListener)gateway, model);
+      } else if(gateway instanceof JcaGatewayDocument.JcaGateway) {
+         JcaGatewayMapper.map(root, (JcaGatewayDocument.JcaGateway)gateway, model);
 		} else if (gateway instanceof FtpListener) {
 			FtpListenerMapper.map(root, (FtpListener)gateway, model);
 		} else if (gateway instanceof SqlListener) {

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -287,8 +287,12 @@
 			
 			throw new IllegalStateException("No Provider instance found for the supplied Bus config instance.  This should not be possible if the Bus instance was provided by this configuration.  Where has this Bus instance come from?");
 		}
-		
-		/**
+      private boolean isGateway(Listener listener)
+      {
+         return listener.getIsGateway() || (listener instanceof JcaGatewayDocument.JcaGateway);
+      }
+
+      /**
 		 * Get the list of ESB Listeners based on their Gateway flag.
 		 * @return The list of ESB Aware or Gateway Listeners from the configuration.
          * @param isGateway Is the listener a gateway or ESB aware listener.
@@ -300,7 +304,7 @@
 
                 for(Service service : services) {
 					for(Listener listener : service.getListeners().getListenerList()) {
-						if(listener.getIsGateway() == isGateway) {
+						if(isGateway(listener) == isGateway) {
 							gateways.add(listener);
 						}
 					}

Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JcaGatewayMapper.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.listeners.config.mappers;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.config.Generator;
+import org.jboss.soa.esb.listeners.config.JcaGatewayDocument.JcaGateway;
+import org.jboss.soa.esb.listeners.config.ServiceDocument;
+import org.jboss.soa.esb.listeners.jca.JcaInflowGateway;
+import org.w3c.dom.Element;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JcaGatewayMapper
+{
+   public static Element map(Element root, JcaGateway gateway, Generator.XMLBeansModel model) throws ConfigurationException
+   {
+      Element listenerNode = YADOMUtil.addElement(root, gateway.getName());
+      gateway.setIsGateway(true);
+
+      ServiceDocument.Service service = model.getService(gateway);
+      listenerNode.setAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG, service.getDescription());	
+      listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, service.getCategory());
+      listenerNode.setAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG, service.getName());
+
+      listenerNode.setAttribute("adapter", gateway.getAdapter());
+      listenerNode.setAttribute("endpointClass", gateway.getEndpointClass());
+      listenerNode.setAttribute("messagingType", gateway.getMessagingType());
+      listenerNode.setAttribute("jcaBridge", gateway.getJcaBridge());
+
+      MapperUtil.mapProperties(gateway.getPropertyList(), listenerNode);
+      listenerNode.setAttribute("gatewayClass", JcaInflowGateway.class.getName());
+      Element activationConfig = YADOMUtil.addElement(listenerNode, "activation-config");
+      MapperUtil.serialize(gateway.getActivationConfig(), activationConfig);
+
+
+      YADOMUtil.removeEmptyAttributes(listenerNode);
+      return listenerNode;
+   }
+}

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JcaInflowGateway.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -63,10 +63,10 @@
             ListenerTagNames.TARGET_SERVICE_NAME_TAG, null);
 
       ConfigTree spec = config.getFirstChild("activation-config");
-      for (ConfigTree configProperty : spec.getChildren("activation-config-property"))
+      for (ConfigTree configProperty : spec.getChildren("property"))
       {
-         String name = configProperty.getFirstTextChild("activation-config-property-name").trim();
-         String value = configProperty.getFirstTextChild("activation-config-property-value").trim();
+         String name = configProperty.getAttribute("name");
+         String value = configProperty.getAttribute("value");
          activationSpec.put(name, value);
       }
 
@@ -228,7 +228,7 @@
       invoker.start();
       bean.setServiceInvoker(invoker);
       bridge.activate();
-      
+
    }
 
 

Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/jca/JmsEndpoint.java	2007-05-23 00:27:44 UTC (rev 12089)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.listeners.jca;
+
+import org.jboss.soa.esb.listeners.ServiceInvoker;
+import org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents;
+
+import javax.jms.MessageListener;
+import javax.jms.Message;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JmsEndpoint implements InflowGateway, MessageListener
+{
+   private ServiceInvoker service;
+   private PackageJmsMessageContents transformer = new PackageJmsMessageContents();
+
+   public void setServiceInvoker(ServiceInvoker invoker)
+   {
+      this.service = invoker;
+   }
+
+   public void onMessage(Message message)
+   {
+      try
+      {
+         org.jboss.soa.esb.message.Message esbMessage = transformer.process(message);
+         service.postMessage(esbMessage);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}

Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2007-05-22 22:35:44 UTC (rev 12088)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2007-05-23 00:27:44 UTC (rev 12089)
@@ -230,6 +230,37 @@
    </xsd:complexType>
    <xsd:element name="listener" type="jesb:listener"/>
 
+   <!-- JCA Types -->
+   <xsd:element name="activation-config">
+      <xsd:annotation>
+         <xsd:documentation xml:lang="en">Activation configuration for jca bus or listener.</xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element ref="jesb:property" maxOccurs="unbounded" minOccurs="1"/>
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
+   <xsd:element name="jca-gateway" substitutionGroup="jesb:listener">
+      <xsd:annotation>
+         <xsd:documentation xml:lang="en">A specific gateway using JCA inflow.</xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexType>
+         <xsd:complexContent>
+            <xsd:extension base="jesb:listener">
+               <xsd:sequence>
+                  <xsd:element ref="jesb:activation-config" minOccurs="0" maxOccurs="1"/>
+               </xsd:sequence>
+               <xsd:attribute name="adapter" use="required" type="xsd:string"/>
+               <xsd:attribute name="endpointClass" use="required" type="xsd:string"/>
+               <xsd:attribute name="messagingType" use="optional" type="xsd:string"/>
+               <xsd:attribute name="jcaBridge" use="optional" type="xsd:string"/>
+               <xsd:attribute name="transacted" use="optional" type="xsd:string"/>
+            </xsd:extension>
+         </xsd:complexContent>
+      </xsd:complexType>
+   </xsd:element>
+
    <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
       JMS Type Implementations.
    88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->




More information about the jboss-svn-commits mailing list