[jboss-svn-commits] JBL Code SVN: r10694 - in labs/jbossesb/trunk/product: core/listeners and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Apr 2 11:38:20 EDT 2007


Author: tfennelly
Date: 2007-04-02 11:38:19 -0400 (Mon, 02 Apr 2007)
New Revision: 10694

Added:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
Modified:
   labs/jbossesb/trunk/product/build.xml
   labs/jbossesb/trunk/product/core/listeners/build.xml
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
Log:
Added JBoss Remoting configs

Modified: labs/jbossesb/trunk/product/build.xml
===================================================================
--- labs/jbossesb/trunk/product/build.xml	2007-04-02 15:14:37 UTC (rev 10693)
+++ labs/jbossesb/trunk/product/build.xml	2007-04-02 15:38:19 UTC (rev 10694)
@@ -93,7 +93,7 @@
 	</macrodef>
 
 	<target name="generate-config-model">
-		<ant dir="core/listeners" target="generate-config-model-1.0"/>
+		<ant dir="core/listeners" target="generate-config-model"/>
 	</target>
 	
 	<!-- Initialisation -->

Modified: labs/jbossesb/trunk/product/core/listeners/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/build.xml	2007-04-02 15:14:37 UTC (rev 10693)
+++ labs/jbossesb/trunk/product/core/listeners/build.xml	2007-04-02 15:38:19 UTC (rev 10694)
@@ -45,7 +45,7 @@
 		<delete dir="${org.jboss.esb.listeners.classes.dir}"/>
     </target>
 	
-	<target name="generate-config-model-1.0.1" depends="org.jboss.esb.listeners.prepare">
+	<target name="generate-config-model" depends="org.jboss.esb.listeners.prepare">
 			<taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="xbeans-classpath" />
 			<delete dir="${gendir}" /><mkdir dir="${gendir}" />
 			
@@ -76,7 +76,7 @@
         <ant inheritAll="true" dir="tests" target="org.jboss.esb.listeners.tests.compile"/>
     </target>
 	
-    <target name="org.jboss.esb.listeners.internal.compile" depends="generate-config-model-1.0.1"
+    <target name="org.jboss.esb.listeners.internal.compile" depends="generate-config-model"
         description="Compile all classes">
 
         <javac

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-04-02 15:14:37 UTC (rev 10693)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2007-04-02 15:38:19 UTC (rev 10694)
@@ -30,11 +30,8 @@
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
 import org.jboss.soa.esb.listeners.config.JmsListenerDocument.JmsListener;
 import org.jboss.soa.esb.listeners.config.SqlListenerDocument.SqlListener;
-import org.jboss.soa.esb.listeners.config.mappers.FsListenerMapper;
-import org.jboss.soa.esb.listeners.config.mappers.FtpListenerMapper;
-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.JbrListenerDocument.JbrListener;
+import org.jboss.soa.esb.listeners.config.mappers.*;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -100,7 +97,9 @@
 			FtpListenerMapper.map(root, (FtpListener)gateway, model);
 		} else if (gateway instanceof SqlListener) {
 			SqlListenerMapper.map(root, (SqlListener)gateway, model);
-		} else {
+        } else if (gateway instanceof JbrListener) {
+            JbrListenerMapper.map(root, (JbrListener)gateway, model);
+        } else {
 			UntypedListenerMapper.map(root, gateway, model);
 		}
 	}

Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java	2007-04-02 15:38:19 UTC (rev 10694)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config.mappers;
+
+import org.w3c.dom.Element;
+import org.jboss.soa.esb.listeners.config.JbrListenerDocument.JbrListener;
+import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
+import org.jboss.soa.esb.listeners.config.JbrBusDocument.JbrBus;
+import org.jboss.soa.esb.listeners.config.JbrProviderDocument.JbrProvider;
+import org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.ConfigurationException;
+
+/**
+ * JBoss Remoting listener mapper.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JbrListenerMapper {
+
+    /**
+     * Perform the mapping.
+     * @param root The "ConfigTree" configuration root node.
+     * @param listener JBoss Remoting listener config.
+     * @param model The configuration model from which the mapping is being performed.
+     * @return The ConfigTree listener configuration node.
+     * @throws org.jboss.soa.esb.ConfigurationException Invalid listener configuration.
+     */
+    public static Element map(Element root, JbrListener listener, XMLBeansModel model) throws ConfigurationException {
+        Element listenerNode = YADOMUtil.addElement(root, listener.getName());
+        JbrBus bus;
+        JbrProvider provider;
+
+        try {
+            bus = (JbrBus) model.getBus(listener.getBusidref());
+        } catch (ClassCastException e) {
+            throw new ConfigurationException("Invalid busid reference [" + listener.getBusidref() + "] on listener [" + listener.getName() + "].  A <jbr-listener> must reference a <jbr-bus>.");
+        }
+        try {
+            provider = (JbrProvider) model.getProvider(bus);
+        } catch (ClassCastException e) {
+            throw new ConfigurationException("Invalid bus config [" + listener.getBusidref() + "].  Should be contained within a <jbr-provider> instance.  Unexpected exception - this should have caused a validation error!");
+        }
+
+        // Map the standard listener attributes - common across all listener types...
+        MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
+        // Map the <property> elements targeted at the listener - from the listener itself.
+        MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);
+
+        if(listener.getIsGateway()) {
+            String host = provider.getHost();
+
+            listenerNode.setAttribute("gatewayClass", JBossRemotingGatewayListener.class.getName());
+            if(host != null) {
+                listenerNode.setAttribute(JBossRemotingGatewayListener.JBR_SERVER_HOST, host);
+            }
+            listenerNode.setAttribute(JBossRemotingGatewayListener.JBR_SERVER_PROTOCOL, provider.getProtocol().toString());
+            listenerNode.setAttribute(JBossRemotingGatewayListener.JBR_SERVER_PORT, Integer.toString(bus.getPort()));
+        } else {
+            throw new ConfigurationException("Invalid <jbr-listener> config [" + listener.getName() + "].  <jbr-listener> is currently only supported as a gateway listener.");
+        }
+
+        return listenerNode;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/JbrListenerMapper.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml	2007-04-02 15:14:37 UTC (rev 10693)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml	2007-04-02 15:38:19 UTC (rev 10694)
@@ -27,7 +27,9 @@
 			</sql-bus>
 		</sql-provider>
 
-		<provider name="JBossAS">
+        
+
+        <provider name="JBossAS">
 			<property name="my-generic-provider" value="my-generic-provider#someattribvalue" />
 			
 			<bus busid="my-generic-bus">

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-04-02 15:14:37 UTC (rev 10693)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2007-04-02 15:38:19 UTC (rev 10694)
@@ -539,4 +539,63 @@
 			</xsd:complexContent>
 		</xsd:complexType>
 	</xsd:element>
+
+
+    <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+    JBoss Remoting Type Implementations.
+    88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+    <xsd:element name="jbr-bus" substitutionGroup="jesb:bus">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">JBoss Remoting Bus</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:bus">
+                    <xsd:attribute name="port" use="required" type="xsd:int">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">JBoss Remoting Server listen port.</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:attribute>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+    <xsd:element name="jbr-provider" substitutionGroup="jesb:provider">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">JBoss Remoting Provider.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:provider">
+                    <xsd:attribute name="protocol" use="required">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">Jboss Remoting Listener/Server protocol.</xsd:documentation>
+                        </xsd:annotation>
+                        <xsd:simpleType>
+                            <xsd:restriction base = "xsd:NMTOKEN">
+                                <xsd:enumeration value = "http"/>
+                                <xsd:enumeration value = "socket"/>
+                            </xsd:restriction>
+                        </xsd:simpleType>
+                    </xsd:attribute>
+                    <xsd:attribute name="host" type="xsd:string">
+                        <xsd:annotation>
+                            <xsd:documentation xml:lang="en">JBoss Remoting Server bind address.  When not specified, defaults to InetAddress.getLocalHost().getHostName().</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:attribute>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+    <xsd:element name="jbr-listener" substitutionGroup="jesb:listener">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">JBoss Remoting Listener.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="jesb:listener"/>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
 </xsd:schema>
\ No newline at end of file




More information about the jboss-svn-commits mailing list