[jboss-svn-commits] JBL Code SVN: r10135 - in labs/jbossesb/workspace/rearch2/core: src/main/java/org/jboss/internal/soa/esb and 15 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Mar 12 17:34:44 EDT 2007
Author: mark.little at jboss.com
Date: 2007-03-12 17:34:43 -0400 (Mon, 12 Mar 2007)
New Revision: 10135
Added:
labs/jbossesb/workspace/rearch2/core/conf/jbossesb-properties.xml
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWaySenderImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderPluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/TwoWayReceiverImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverPluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/Sender.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/SenderFactory.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/conf/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/conf/SenderPlugin.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Protocols.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Receiver.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/ReceiverFactory.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/conf/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/conf/ReceiverPlugin.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpClient.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpService.java
Removed:
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ClientPluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ServicePluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayClientPluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayServicePluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/formant/
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/App.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPlugin.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPluginFactory.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePlugin.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePluginFactory.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpClient.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpService.java
Modified:
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/PortReference.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/ModulePropertyManager.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpClient.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpService.java
Log:
Added: labs/jbossesb/workspace/rearch2/core/conf/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/rearch2/core/conf/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/conf/jbossesb-properties.xml 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.context.factory" value="org.jnp.interfaces.NamingContextFactory"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI" value="org.apache.juddi.registry.local.InquiryService#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI" value="org.apache.juddi.registry.local.PublishService#publish"/>
+ <property name="org.jboss.soa.esb.registry.implementationClass" value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass" value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password" value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass" value="org.apache.ws.scout.transport.LocalTransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ <property name="org.jboss.soa.esb.ftp.localdir" value="/tmp"/>
+ <property name="org.jboss.soa.esb.ftp.remotedir" value="/tmp"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ClientPluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ClientPluginImpl.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ClientPluginImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,97 +0,0 @@
-package org.jboss.internal.soa.esb.api;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-import org.jboss.internal.soa.esb.message.format.xml.MessageImpl;
-import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
-import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.soa.esb.ProtocolNotSupportedException;
-import org.jboss.soa.esb.SendFailedException;
-import org.jboss.soa.esb.api.ClientPlugin;
-import org.jboss.soa.esb.message.Message;
-
-public class ClientPluginImpl implements ClientPlugin
-{
- private static final String DATA_TYPE = "/?datatype=xml";
-
- public ClientPluginImpl()
- {
- MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(),
- UnMarshalPlugin.getInstance());
- }
-
- /**
- * Start to assemble the ESBCore message that we will then pass down into
- * the Dispatcher hierarchy.
- */
-
- public void send(Message msg) throws ProtocolNotSupportedException,
- SendFailedException
- {
- if (msg == null)
- throw new IllegalArgumentException("message is null!");
-
- try
- {
- String locatorUri = msg.getHeader().getCall().getTo().getAddr().getAddress();
-
- if (msg instanceof MessageImpl)
- locatorUri = locatorUri + DATA_TYPE;
-
- InvokerLocator locator = new InvokerLocator(locatorUri);
-
- System.out.println("Calling remoting server with locator uri of: "
- + locatorUri);
-
- Client remotingClient = new Client(locator);
- remotingClient.connect();
-
- remotingClient.invokeOneway(msg);
-
- remotingClient.disconnect();
- }
- catch (Throwable ex)
- {
- ex.printStackTrace();
-
- throw new SendFailedException(ex);
- }
- }
-
- public void sendAsync(Message msg) throws ProtocolNotSupportedException
- {
- throw new ProtocolNotSupportedException();
- }
-
- /*
- * public void sendAsync (EPR addr, Body msg, Callback cb) throws
- * ProtocolNotSupportedException { throw new
- * ProtocolNotSupportedException(); }
- */
- public void sendReliable(Message msg) throws ProtocolNotSupportedException
- {
- throw new ProtocolNotSupportedException();
- }
-}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ServicePluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ServicePluginImpl.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/ServicePluginImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,151 +0,0 @@
-package org.jboss.internal.soa.esb.api;
-
-import javax.management.MBeanServer;
-
-import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
-import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.api.ServicePlugin;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public class ServicePluginImpl implements ServicePlugin
-{
- public interface Receiver
- {
- public void receive (Message msg);
- }
-
- public ServicePluginImpl (String locatorURI, Receiver receiver) throws Exception
- {
- MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(), UnMarshalPlugin.getInstance());
-
- InvokerLocator locator = new InvokerLocator(locatorURI);
- System.out.println("Starting remoting server with locator uri of: "
- + locatorURI);
- Connector connector = new Connector(locator);
- // creates all the connector's needed resources, such as the server
- // invoker
- connector.create();
-
- // create the handler to receive the invocation request from the client
- // for processing
- RosettaInvocationHandler invocationHandler = new RosettaInvocationHandler(receiver);
- // first parameter is sub-system name. can be any String value.
- connector.addInvocationHandler("rosetta", invocationHandler);
-
- // start with a new non daemon thread so
- // server will wait for request and not exit
- connector.start();
- }
-
- public void listen ()
- {
- for (;;);
- }
-
- /**
- * Simple invocation handler implementation. This is the code that will be
- * called with the invocation payload from the client.
- */
- public static class RosettaInvocationHandler implements
- ServerInvocationHandler
- {
- public RosettaInvocationHandler (Receiver receiver)
- {
- _receiver = receiver;
- }
-
- /**
- * called to handle a specific invocation
- *
- * @param invocation
- * @return
- * @throws Throwable
- */
- public Object invoke(InvocationRequest invocation) throws Throwable
- {
- // Print out the invocation request
- System.out.println("Invocation request is: "
- + invocation.getParameter());
-
- if (_receiver != null)
- _receiver.receive((Message) invocation.getParameter());
-
- return null;
- }
-
- /**
- * Adds a callback handler that will listen for callbacks from the
- * server invoker handler.
- *
- * @param callbackHandler
- */
- public void addListener(InvokerCallbackHandler callbackHandler)
- {
- // NO OP as do not handling callback listeners in this example
- }
-
- /**
- * Removes the callback handler that was listening for callbacks from
- * the server invoker handler.
- *
- * @param callbackHandler
- */
- public void removeListener(InvokerCallbackHandler callbackHandler)
- {
- // NO OP as do not handling callback listeners in this example
- }
-
- /**
- * set the mbean server that the handler can reference
- *
- * @param server
- */
- public void setMBeanServer(MBeanServer server)
- {
- // NO OP as do not need reference to MBeanServer for this handler
- }
-
- /**
- * set the invoker that owns this handler
- *
- * @param invoker
- */
- public void setInvoker(ServerInvoker invoker)
- {
- // NO OP as do not need reference back to the server invoker
- }
-
- private Receiver _receiver;
- }
-
-}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayClientPluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayClientPluginImpl.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayClientPluginImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,99 +0,0 @@
-package org.jboss.internal.soa.esb.api;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-import org.jboss.internal.soa.esb.message.format.xml.MessageImpl;
-import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
-import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.soa.esb.ProtocolNotSupportedException;
-import org.jboss.soa.esb.SendFailedException;
-import org.jboss.soa.esb.api.ClientPlugin;
-import org.jboss.soa.esb.message.Message;
-
-public class TwoWayClientPluginImpl //implements ClientPlugin
-{
- private static final String DATA_TYPE = "/?datatype=xml";
-
- public TwoWayClientPluginImpl()
- {
- MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(),
- UnMarshalPlugin.getInstance());
- }
-
- /**
- * Start to assemble the ESBCore message that we will then pass down into
- * the Dispatcher hierarchy.
- */
-
- public Message invoke (Message msg) throws ProtocolNotSupportedException,
- SendFailedException
- {
- if (msg == null)
- throw new IllegalArgumentException("message is null!");
-
- try
- {
- String locatorUri = msg.getHeader().getCall().getTo().getAddr().getAddress();
-
- if (msg instanceof MessageImpl)
- locatorUri = locatorUri + DATA_TYPE;
-
- InvokerLocator locator = new InvokerLocator(locatorUri);
-
- System.out.println("Calling remoting server with locator uri of: "
- + locatorUri);
-
- Client remotingClient = new Client(locator);
- remotingClient.connect();
-
- Object response = remotingClient.invoke(msg);
-
- remotingClient.disconnect();
-
- return (Message) response;
- }
- catch (Throwable ex)
- {
- ex.printStackTrace();
-
- throw new SendFailedException(ex);
- }
- }
-
- public void sendAsync(Message msg) throws ProtocolNotSupportedException
- {
- throw new ProtocolNotSupportedException();
- }
-
- /*
- * public void sendAsync (EPR addr, Body msg, Callback cb) throws
- * ProtocolNotSupportedException { throw new
- * ProtocolNotSupportedException(); }
- */
- public void sendReliable(Message msg) throws ProtocolNotSupportedException
- {
- throw new ProtocolNotSupportedException();
- }
-}
Copied: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWaySenderImpl.java (from rev 9743, labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayClientPluginImpl.java)
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWaySenderImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWaySenderImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,99 @@
+package org.jboss.internal.soa.esb.api;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+import org.jboss.internal.soa.esb.message.format.xml.MessageImpl;
+import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
+import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.soa.esb.ProtocolNotSupportedException;
+import org.jboss.soa.esb.SendFailedException;
+import org.jboss.soa.esb.api.Sender;
+import org.jboss.soa.esb.message.Message;
+
+public class TwoWaySenderImpl
+{
+ private static final String DATA_TYPE = "/?datatype=xml";
+
+ public TwoWaySenderImpl()
+ {
+ MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(),
+ UnMarshalPlugin.getInstance());
+ }
+
+ /**
+ * Start to assemble the ESBCore message that we will then pass down into
+ * the Dispatcher hierarchy.
+ */
+
+ public Message invoke (Message msg) throws ProtocolNotSupportedException,
+ SendFailedException
+ {
+ if (msg == null)
+ throw new IllegalArgumentException("message is null!");
+
+ try
+ {
+ String locatorUri = msg.getHeader().getCall().getTo().getAddr().getAddress();
+
+ if (msg instanceof MessageImpl)
+ locatorUri = locatorUri + DATA_TYPE;
+
+ InvokerLocator locator = new InvokerLocator(locatorUri);
+
+ System.out.println("Calling remoting server with locator uri of: "
+ + locatorUri);
+
+ Client remotingClient = new Client(locator);
+ remotingClient.connect();
+
+ Object response = remotingClient.invoke(msg);
+
+ remotingClient.disconnect();
+
+ return (Message) response;
+ }
+ catch (Throwable ex)
+ {
+ ex.printStackTrace();
+
+ throw new SendFailedException(ex);
+ }
+ }
+
+ public void sendAsync(Message msg) throws ProtocolNotSupportedException
+ {
+ throw new ProtocolNotSupportedException();
+ }
+
+ /*
+ * public void sendAsync (EPR addr, Body msg, Callback cb) throws
+ * ProtocolNotSupportedException { throw new
+ * ProtocolNotSupportedException(); }
+ */
+ public void sendReliable(Message msg) throws ProtocolNotSupportedException
+ {
+ throw new ProtocolNotSupportedException();
+ }
+}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayServicePluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayServicePluginImpl.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWayServicePluginImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,159 +0,0 @@
-package org.jboss.internal.soa.esb.api;
-
-import javax.management.MBeanServer;
-
-import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
-import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.remoting.transport.Connector;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.api.ServicePlugin;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public class TwoWayServicePluginImpl //implements ServicePlugin
-{
- public interface Worker
- {
- public Message doWork (Message msg);
- }
-
- public TwoWayServicePluginImpl (String locatorURI, Worker work) throws Exception
- {
- if ((locatorURI == null) || (work == null))
- throw new IllegalArgumentException();
-
- MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(), UnMarshalPlugin.getInstance());
-
- InvokerLocator locator = new InvokerLocator(locatorURI);
- System.out.println("Starting remoting server with locator uri of: "
- + locatorURI);
- Connector connector = new Connector(locator);
- // creates all the connector's needed resources, such as the server
- // invoker
- connector.create();
-
- // create the handler to receive the invocation request from the client
- // for processing
- RosettaInvocationHandler invocationHandler = new RosettaInvocationHandler(work);
- // first parameter is sub-system name. can be any String value.
- connector.addInvocationHandler("rosetta", invocationHandler);
-
- // start with a new non daemon thread so
- // server will wait for request and not exit
- connector.start();
- }
-
- public void listen ()
- {
- while (!_terminate)
- {
- }
- }
-
- private boolean _terminate = false;
-
- /**
- * Simple invocation handler implementation. This is the code that will be
- * called with the invocation payload from the client.
- */
-
- public static class RosettaInvocationHandler implements
- ServerInvocationHandler
- {
- public RosettaInvocationHandler (Worker work)
- {
- _worker = work;
- }
-
- /**
- * called to handle a specific invocation
- *
- * @param invocation
- * @return
- * @throws Throwable
- */
-
- public Object invoke(InvocationRequest invocation) throws Throwable
- {
- Message msg = (Message) invocation.getParameter();
-
- // could check msg to see if it's for the service (e.g., shutdown).
-
- Message response = _worker.doWork(msg);
-
- return response;
- }
-
- /**
- * Adds a callback handler that will listen for callbacks from the
- * server invoker handler.
- *
- * @param callbackHandler
- */
- public void addListener(InvokerCallbackHandler callbackHandler)
- {
- // NO OP as do not handling callback listeners in this example
- }
-
- /**
- * Removes the callback handler that was listening for callbacks from
- * the server invoker handler.
- *
- * @param callbackHandler
- */
- public void removeListener(InvokerCallbackHandler callbackHandler)
- {
- // NO OP as do not handling callback listeners in this example
- }
-
- /**
- * set the mbean server that the handler can reference
- *
- * @param server
- */
- public void setMBeanServer(MBeanServer server)
- {
- // NO OP as do not need reference to MBeanServer for this handler
- }
-
- /**
- * set the invoker that owns this handler
- *
- * @param invoker
- */
- public void setInvoker(ServerInvoker invoker)
- {
- // NO OP as do not need reference back to the server invoker
- }
-
- private Worker _worker;
- }
-
-}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,97 @@
+package org.jboss.internal.soa.esb.api.remoting;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+import org.jboss.internal.soa.esb.message.format.xml.MessageImpl;
+import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
+import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.soa.esb.ProtocolNotSupportedException;
+import org.jboss.soa.esb.SendFailedException;
+import org.jboss.soa.esb.api.Sender;
+import org.jboss.soa.esb.message.Message;
+
+public class SenderImpl implements Sender
+{
+ private static final String DATA_TYPE = "/?datatype=xml";
+
+ public SenderImpl()
+ {
+ MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(),
+ UnMarshalPlugin.getInstance());
+ }
+
+ /**
+ * Start to assemble the ESBCore message that we will then pass down into
+ * the Dispatcher hierarchy.
+ */
+
+ public void send(Message msg) throws ProtocolNotSupportedException,
+ SendFailedException
+ {
+ if (msg == null)
+ throw new IllegalArgumentException("message is null!");
+
+ try
+ {
+ String locatorUri = msg.getHeader().getCall().getTo().getAddr().getAddress();
+
+ if (msg instanceof MessageImpl)
+ locatorUri = locatorUri + DATA_TYPE;
+
+ InvokerLocator locator = new InvokerLocator(locatorUri);
+
+ System.out.println("Calling remoting server with locator uri of: "
+ + locatorUri);
+
+ Client remotingClient = new Client(locator);
+ remotingClient.connect();
+
+ remotingClient.invokeOneway(msg);
+
+ remotingClient.disconnect();
+ }
+ catch (Throwable ex)
+ {
+ ex.printStackTrace();
+
+ throw new SendFailedException(ex);
+ }
+ }
+
+ public void sendAsync(Message msg) throws ProtocolNotSupportedException
+ {
+ throw new ProtocolNotSupportedException();
+ }
+
+ /*
+ * public void sendAsync (EPR addr, Body msg, Callback cb) throws
+ * ProtocolNotSupportedException { throw new
+ * ProtocolNotSupportedException(); }
+ */
+ public void sendReliable(Message msg) throws ProtocolNotSupportedException
+ {
+ throw new ProtocolNotSupportedException();
+ }
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderPluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderPluginImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderPluginImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,33 @@
+package org.jboss.internal.soa.esb.api.remoting;
+
+import org.jboss.soa.esb.api.Sender;
+import org.jboss.soa.esb.api.conf.SenderPlugin;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public class SenderPluginImpl implements SenderPlugin
+{
+ public Sender create ()
+ {
+ return new SenderImpl();
+ }
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/TwoWayReceiverImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/TwoWayReceiverImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/TwoWayReceiverImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,159 @@
+package org.jboss.internal.soa.esb.spi;
+
+import javax.management.MBeanServer;
+
+import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
+import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.spi.Receiver;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public class TwoWayReceiverImpl
+{
+ public interface Worker
+ {
+ public Message doWork (Message msg);
+ }
+
+ public TwoWayReceiverImpl (String locatorURI, Worker work) throws Exception
+ {
+ if ((locatorURI == null) || (work == null))
+ throw new IllegalArgumentException();
+
+ MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(), UnMarshalPlugin.getInstance());
+
+ InvokerLocator locator = new InvokerLocator(locatorURI);
+ System.out.println("Starting remoting server with locator uri of: "
+ + locatorURI);
+ Connector connector = new Connector(locator);
+ // creates all the connector's needed resources, such as the server
+ // invoker
+ connector.create();
+
+ // create the handler to receive the invocation request from the client
+ // for processing
+ RosettaInvocationHandler invocationHandler = new RosettaInvocationHandler(work);
+ // first parameter is sub-system name. can be any String value.
+ connector.addInvocationHandler("rosetta", invocationHandler);
+
+ // start with a new non daemon thread so
+ // server will wait for request and not exit
+ connector.start();
+ }
+
+ public void listen ()
+ {
+ while (!_terminate)
+ {
+ }
+ }
+
+ private boolean _terminate = false;
+
+ /**
+ * Simple invocation handler implementation. This is the code that will be
+ * called with the invocation payload from the client.
+ */
+
+ public static class RosettaInvocationHandler implements
+ ServerInvocationHandler
+ {
+ public RosettaInvocationHandler (Worker work)
+ {
+ _worker = work;
+ }
+
+ /**
+ * called to handle a specific invocation
+ *
+ * @param invocation
+ * @return
+ * @throws Throwable
+ */
+
+ public Object invoke(InvocationRequest invocation) throws Throwable
+ {
+ Message msg = (Message) invocation.getParameter();
+
+ // could check msg to see if it's for the service (e.g., shutdown).
+
+ Message response = _worker.doWork(msg);
+
+ return response;
+ }
+
+ /**
+ * Adds a callback handler that will listen for callbacks from the
+ * server invoker handler.
+ *
+ * @param callbackHandler
+ */
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ // NO OP as do not handling callback listeners in this example
+ }
+
+ /**
+ * Removes the callback handler that was listening for callbacks from
+ * the server invoker handler.
+ *
+ * @param callbackHandler
+ */
+ public void removeListener(InvokerCallbackHandler callbackHandler)
+ {
+ // NO OP as do not handling callback listeners in this example
+ }
+
+ /**
+ * set the mbean server that the handler can reference
+ *
+ * @param server
+ */
+ public void setMBeanServer(MBeanServer server)
+ {
+ // NO OP as do not need reference to MBeanServer for this handler
+ }
+
+ /**
+ * set the invoker that owns this handler
+ *
+ * @param invoker
+ */
+ public void setInvoker(ServerInvoker invoker)
+ {
+ // NO OP as do not need reference back to the server invoker
+ }
+
+ private Worker _worker;
+ }
+
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,146 @@
+package org.jboss.internal.soa.esb.spi.remoting;
+
+import javax.management.MBeanServer;
+
+import org.jboss.internal.soa.esb.message.format.xml.remoting.MarshalPlugin;
+import org.jboss.internal.soa.esb.message.format.xml.remoting.UnMarshalPlugin;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.spi.Receiver;
+import org.jboss.soa.esb.spi.Service;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public class ReceiverImpl implements Receiver
+{
+
+ public ReceiverImpl (String locatorURI, Service receiver) throws Exception
+ {
+ MarshalFactory.addMarshaller("xml", MarshalPlugin.getInstance(), UnMarshalPlugin.getInstance());
+
+ InvokerLocator locator = new InvokerLocator(locatorURI);
+ System.out.println("Starting remoting server with locator uri of: "
+ + locatorURI);
+ Connector connector = new Connector(locator);
+ // creates all the connector's needed resources, such as the server
+ // invoker
+ connector.create();
+
+ // create the handler to receive the invocation request from the client
+ // for processing
+ RosettaInvocationHandler invocationHandler = new RosettaInvocationHandler(receiver);
+ // first parameter is sub-system name. can be any String value.
+ connector.addInvocationHandler("rosetta", invocationHandler);
+
+ // start with a new non daemon thread so
+ // server will wait for request and not exit
+ connector.start();
+ }
+
+ public void listen ()
+ {
+ for (;;);
+ }
+
+ /**
+ * Simple invocation handler implementation. This is the code that will be
+ * called with the invocation payload from the client.
+ */
+ public static class RosettaInvocationHandler implements
+ ServerInvocationHandler
+ {
+ public RosettaInvocationHandler (Service svc)
+ {
+ _service = svc;
+ }
+
+ /**
+ * called to handle a specific invocation
+ *
+ * @param invocation
+ * @return
+ * @throws Throwable
+ */
+ public Object invoke(InvocationRequest invocation) throws Throwable
+ {
+ // Print out the invocation request
+ System.out.println("Invocation request is: "
+ + invocation.getParameter());
+
+ if (_service != null)
+ _service.doWork((Message) invocation.getParameter());
+
+ return null;
+ }
+
+ /**
+ * Adds a callback handler that will listen for callbacks from the
+ * server invoker handler.
+ *
+ * @param callbackHandler
+ */
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ // NO OP as do not handling callback listeners in this example
+ }
+
+ /**
+ * Removes the callback handler that was listening for callbacks from
+ * the server invoker handler.
+ *
+ * @param callbackHandler
+ */
+ public void removeListener(InvokerCallbackHandler callbackHandler)
+ {
+ // NO OP as do not handling callback listeners in this example
+ }
+
+ /**
+ * set the mbean server that the handler can reference
+ *
+ * @param server
+ */
+ public void setMBeanServer(MBeanServer server)
+ {
+ // NO OP as do not need reference to MBeanServer for this handler
+ }
+
+ /**
+ * set the invoker that owns this handler
+ *
+ * @param invoker
+ */
+ public void setInvoker(ServerInvoker invoker)
+ {
+ // NO OP as do not need reference back to the server invoker
+ }
+
+ private Service _service;
+ }
+
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverPluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverPluginImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverPluginImpl.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,54 @@
+package org.jboss.internal.soa.esb.spi.remoting;
+
+import java.net.URI;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.spi.Receiver;
+import org.jboss.soa.esb.spi.Service;
+import org.jboss.soa.esb.spi.conf.ReceiverPlugin;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public class ReceiverPluginImpl implements ReceiverPlugin
+{
+ public static final String REMOTING_DATATYPE = "/?datatype=xml";
+
+ public Receiver create (EPR epr, Service svc)
+ {
+ if (epr == null)
+ throw new IllegalArgumentException();
+
+ if (svc == null)
+ throw new IllegalArgumentException();
+
+ try
+ {
+ return new ReceiverImpl(epr.getAddr().getAddress()+REMOTING_DATATYPE, svc);
+ }
+ catch (Exception ex)
+ {
+ // TODO exceptions!!
+
+ return null;
+ }
+ }
+}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/App.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/App.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/App.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,17 +0,0 @@
-package org.jboss.soa.esb;
-
-import com.arjuna.common.util.exceptions.LoadPropertiesException;
-
-// import org.jboss.soa.esb.common.ModulePropertyManager;
-
-/**
- * Hello world!
- *
- */
-public class App
-{
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
- }
-}
Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/PortReference.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/PortReference.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/PortReference.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -42,6 +42,10 @@
* An instance of a PortReference represents a single element in WS-A.
*/
+/*
+ * This needs a proper copy constructor, as do all of the EPRs.
+ */
+
public class PortReference
{
public PortReference()
Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -455,12 +455,35 @@
return getAddr().getExtensionValue(TIMESTAMP_COLUMN_TAG);
}
+ public final void setPostDelete (String postDelete) throws URISyntaxException
+ {
+ if (postDelete == null)
+ throw new IllegalArgumentException();
+
+ if (postDeleteSet)
+ throw new IllegalStateException("Post delete already set.");
+
+ getAddr().addExtension(POST_DEL_TAG, postDelete);
+ postDeleteSet = true;
+ }
public final String getPostDelete() throws URISyntaxException
{
return getAddr().getExtensionValue(POST_DEL_TAG);
}
+ public final void setErrorDelete (String errorDelete) throws URISyntaxException
+ {
+ if (errorDelete == null)
+ throw new IllegalArgumentException();
+
+ if (errorDeleteSet)
+ throw new IllegalStateException("Error delete already set.");
+
+ getAddr().addExtension(ERROR_DEL_TAG, errorDelete);
+ errorDeleteSet = true;
+ }
+
public final String getErrorDelete() throws URISyntaxException
{
return getAddr().getExtensionValue(ERROR_DEL_TAG);
@@ -480,6 +503,8 @@
private boolean statusSet = false;
private boolean dataSet = false;
private boolean timestampSet = false;
+ private boolean postDeleteSet = false;
+ private boolean errorDeleteSet = false;
private static URI _type;
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPlugin.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPlugin.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,35 +0,0 @@
-package org.jboss.soa.esb.api;
-
-import org.jboss.soa.esb.ProtocolNotSupportedException;
-import org.jboss.soa.esb.SendFailedException;
-import org.jboss.soa.esb.message.Message;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-
-public interface ClientPlugin
-{
- public void send (Message msg) throws ProtocolNotSupportedException, SendFailedException;
- public void sendAsync (Message msg) throws ProtocolNotSupportedException, SendFailedException;
-// public void sendAsync (EPR addr, Body msg, Callback cb) throws ProtocolNotSupportedException, SendFailedException;
- public void sendReliable (Message msg) throws ProtocolNotSupportedException, SendFailedException;
-}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPluginFactory.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPluginFactory.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPluginFactory.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,27 +0,0 @@
-package org.jboss.soa.esb.api;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public interface ClientPluginFactory
-{
- public ClientPlugin getPlugin ();
-}
Copied: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/Sender.java (from rev 9740, labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ClientPlugin.java)
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/Sender.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/Sender.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,34 @@
+package org.jboss.soa.esb.api;
+
+import org.jboss.soa.esb.ProtocolNotSupportedException;
+import org.jboss.soa.esb.SendFailedException;
+import org.jboss.soa.esb.message.Message;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public interface Sender
+{
+ public void send (Message msg) throws ProtocolNotSupportedException, SendFailedException;
+ public void sendAsync (Message msg) throws ProtocolNotSupportedException, SendFailedException;
+// public void sendAsync (EPR addr, Body msg, Callback cb) throws ProtocolNotSupportedException, SendFailedException;
+ public void sendReliable (Message msg) throws ProtocolNotSupportedException, SendFailedException;
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/SenderFactory.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/SenderFactory.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/SenderFactory.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,164 @@
+package org.jboss.soa.esb.api;
+
+import java.net.URI;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import org.jboss.internal.soa.esb.api.remoting.SenderImpl;
+import org.jboss.internal.soa.esb.api.remoting.SenderPluginImpl;
+import org.jboss.soa.esb.ProtocolNotSupportedException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.api.conf.SenderPlugin;
+import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.common.Protocols;
+
+import com.arjuna.common.util.propertyservice.PropertyManager;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Plugins can be added to the factory programmatically or via the configuration file.
+ * If through configuration, then properties must be of the form:
+ *
+ * org.jboss.soa.esb.api.clientPlugin<protocol>=<class>
+ *
+ * where <protocol> is the protocol that the plugin supports and <class> is the class of
+ * the plugin. If a plugin can support multiple protocols, then it needs to be mentioned
+ * in the configuration file once per protocol. For example:
+ *
+ * org.jboss.soa.esb.api.clientPluginTCP=MyPlugin
+ * org.jboss.soa.esb.api.clientPluginHTTP=MyPlugin
+ */
+
+public class SenderFactory
+{
+ public static final String PLUGIN_NAME = "org.jboss.soa.esb.api.clientPlugin";
+
+ /**
+ * @return the factory singleton.
+ */
+
+ public static SenderFactory getInstance ()
+ {
+ return _instance;
+ }
+
+ /**
+ * Get the client API implementation that can deal with the specified
+ * transport protocol.
+ *
+ * @param protocol the transport protocol.
+ * @return the client API implementation.
+ */
+
+ public Sender getSender (EPR address) throws ProtocolNotSupportedException
+ {
+ if (address == null)
+ throw new IllegalArgumentException();
+
+ try
+ {
+ URI where = new URI(address.getAddr().getAddress());
+ SenderPlugin sender = _plugins.get(where.getScheme());
+
+ return sender.create();
+ }
+ catch (Exception ex)
+ {
+ throw new ProtocolNotSupportedException();
+ }
+ }
+
+ /**
+ * Add the client API implementation to the factory.
+ *
+ * @param protocol the protocol the implementation can support.
+ * @param plugin the implementation.
+ */
+
+ public void addSender (String protocol, SenderPlugin plugin)
+ {
+ if ((protocol == null) || (plugin == null))
+ throw new IllegalArgumentException();
+
+ _plugins.put(protocol, plugin);
+ }
+
+ private SenderFactory ()
+ {
+ }
+
+ private static Hashtable<String, SenderPlugin> _plugins;
+ private static final SenderFactory _instance = new SenderFactory();
+
+ static
+ {
+ SenderFactory._plugins = new Hashtable<String, SenderPlugin>();
+
+ try
+ {
+ PropertyManager pm = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CLIENT_PLUGIN_MODULE);
+ Properties props = pm.getProperties();
+
+ if (!props.isEmpty())
+ {
+ Enumeration keys = props.elements();
+
+ while (keys.hasMoreElements())
+ {
+ String key = (String) keys.nextElement();
+
+ /*
+ * Find properties with the right attribute name.
+ */
+
+ if (key.startsWith(SenderFactory.PLUGIN_NAME))
+ {
+ /*
+ * Strip off the attribute name to get the protocol.
+ */
+
+ String protocol = key.substring(PLUGIN_NAME.length());
+ String pluginClassName = (String) props.get(key);
+
+ Class pluginClass = Class.forName(pluginClassName);
+ SenderPlugin plugin = (SenderPlugin) pluginClass.newInstance();
+
+ SenderFactory._plugins.put(protocol, plugin);
+ }
+ }
+
+ /*
+ * Add the default implementations.
+ */
+
+ SenderFactory._plugins.put(Protocols.TCP, new SenderPluginImpl());
+ SenderFactory._plugins.put(Protocols.HTTP, new SenderPluginImpl());
+ }
+ }
+ catch (Throwable ex)
+ {
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePlugin.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePlugin.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,29 +0,0 @@
-package org.jboss.soa.esb.api;
-
-import org.jboss.soa.esb.message.Message;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public interface ServicePlugin
-{
- //public Message receive ();
-}
Deleted: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePluginFactory.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePluginFactory.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/ServicePluginFactory.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,27 +0,0 @@
-package org.jboss.soa.esb.api;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public interface ServicePluginFactory
-{
- public ServicePlugin getPlugin ();
-}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/conf/SenderPlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/conf/SenderPlugin.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/conf/SenderPlugin.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,30 @@
+package org.jboss.soa.esb.api.conf;
+
+import org.jboss.soa.esb.api.Sender;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+
+public interface SenderPlugin
+{
+ public Sender create ();
+}
Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Environment.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Environment.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -22,6 +22,13 @@
package org.jboss.soa.esb.common;
+/**
+ * A convenience class so we have all configurable options in
+ * one place.
+ *
+ * @author marklittle
+ */
+
public class Environment
{
public static final String PROPERTIES_FILE = "org.jboss.soa.esb.propertyFile";
Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/ModulePropertyManager.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/ModulePropertyManager.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/ModulePropertyManager.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -94,6 +94,10 @@
public static final String DBSTORE_MODULE = "dbstore";
public static final String ROUTER_MODULE = "messagerouting";
+
+ public static final String CLIENT_PLUGIN_MODULE = "clientplugin";
+
+ public static final String SERVICE_PLUGIN_MODULE = "serviceplugin";
/**
* Get the property manager responsible for the module component in the
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Protocols.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Protocols.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/common/Protocols.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,33 @@
+package org.jboss.soa.esb.common;
+
+/*
+ * 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.
+ */
+
+public abstract class Protocols
+{
+ public static final String TCP = "socket";
+ public static final String JMS = "jms";
+ public static final String HTTP = "http";
+ public static final String EMAIL = "email";
+ public static final String FTP = "ftp";
+ public static final String DB = "db";
+}
\ No newline at end of file
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Receiver.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Receiver.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Receiver.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,27 @@
+package org.jboss.soa.esb.spi;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public interface Receiver
+{
+ public void listen ();
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/ReceiverFactory.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/ReceiverFactory.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/ReceiverFactory.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,179 @@
+package org.jboss.soa.esb.spi;
+
+import java.net.URI;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import org.jboss.internal.soa.esb.api.remoting.SenderImpl;
+import org.jboss.internal.soa.esb.spi.remoting.ReceiverImpl;
+import org.jboss.internal.soa.esb.spi.remoting.ReceiverPluginImpl;
+import org.jboss.soa.esb.ProtocolNotSupportedException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.api.Sender;
+import org.jboss.soa.esb.api.SenderFactory;
+import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.common.Protocols;
+import org.jboss.soa.esb.spi.conf.ReceiverPlugin;
+
+import com.arjuna.common.util.propertyservice.PropertyManager;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Plugins can be added to the factory programmatically or via the configuration file.
+ * If through configuration, then properties must be of the form:
+ *
+ * org.jboss.soa.esb.api.servicePlugin<protocol>=<class>
+ *
+ * where <protocol> is the protocol that the plugin supports and <class> is the class of
+ * the plugin. If a plugin can support multiple protocols, then it needs to be mentioned
+ * in the configuration file once per protocol. For example:
+ *
+ * org.jboss.soa.esb.api.servicePluginTCP=MyPlugin
+ * org.jboss.soa.esb.api.servicePluginHTTP=MyPlugin
+ */
+
+public class ReceiverFactory
+{
+ public static final String PLUGIN_NAME = "org.jboss.soa.esb.api.servicePlugin";
+
+ /**
+ * @return the factory singleton.
+ */
+
+ public static ReceiverFactory getInstance ()
+ {
+ return _instance;
+ }
+
+ /**
+ * Get the client API implementation that can deal with the specified
+ * transport protocol.
+ *
+ * @param protocol the transport protocol.
+ * @return the client API implementation.
+ */
+
+ public Receiver getReceiver (EPR address, Service svc) throws ProtocolNotSupportedException
+ {
+ if (address == null)
+ throw new IllegalArgumentException();
+
+ if (svc == null)
+ throw new IllegalArgumentException();
+
+ try
+ {
+ URI where = new URI(address.getAddr().getAddress());
+ ReceiverPlugin plugin = _plugins.get(where.getScheme());
+
+ return plugin.create(address, svc);
+ }
+ catch (Exception ex)
+ {
+ throw new ProtocolNotSupportedException();
+ }
+ }
+
+ /**
+ * Add the service API implementation to the factory.
+ *
+ * @param protocol the protocol the implementation can support.
+ * @param plugin the implementation.
+ */
+
+ public void addReceiver (String protocol, ReceiverPlugin plugin)
+ {
+ if ((protocol == null) || (plugin == null))
+ throw new IllegalArgumentException();
+
+ _plugins.put(protocol, plugin);
+ }
+
+ private ReceiverFactory ()
+ {
+ }
+
+ private static Hashtable<String, ReceiverPlugin> _plugins;
+ private static final ReceiverFactory _instance = new ReceiverFactory();
+
+ static
+ {
+ ReceiverFactory._plugins = new Hashtable<String, ReceiverPlugin>();
+
+ try
+ {
+ /*
+ * This assumes a singleton arrangement, i.e., the one instance of a given
+ * implementation can be used to serve multiple threads in the same process
+ * concurrently. That may not always be the case. Therefore, we need to add
+ * a configurable option (maybe implements cloneable?) so that new instances
+ * are used per interaction.
+ */
+
+ PropertyManager pm = ModulePropertyManager.getPropertyManager(ModulePropertyManager.SERVICE_PLUGIN_MODULE);
+ Properties props = pm.getProperties();
+
+ if (!props.isEmpty())
+ {
+ Enumeration keys = props.elements();
+
+ while (keys.hasMoreElements())
+ {
+ String key = (String) keys.nextElement();
+
+ /*
+ * Find properties with the right attribute name.
+ */
+
+ if (key.startsWith(SenderFactory.PLUGIN_NAME))
+ {
+ /*
+ * Strip off the attribute name to get the protocol.
+ */
+
+ String protocol = key.substring(PLUGIN_NAME.length());
+ String pluginClassName = (String) props.get(key);
+
+ Class pluginClass = Class.forName(pluginClassName);
+ ReceiverPlugin plugin = (ReceiverPlugin) pluginClass.newInstance();
+
+ ReceiverFactory._plugins.put(protocol, plugin);
+ }
+ }
+
+ /*
+ * Add the default implementations.
+ */
+
+ ReceiverFactory._plugins.put(Protocols.TCP, new ReceiverPluginImpl());
+ ReceiverFactory._plugins.put(Protocols.HTTP, new ReceiverPluginImpl());
+ }
+ }
+ catch (Throwable ex)
+ {
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+}
+
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,36 @@
+package org.jboss.soa.esb.spi;
+
+import org.jboss.soa.esb.message.Message;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Implementations of this interface are called by the receiver to deal
+ * with the message.
+ */
+
+public interface Service
+{
+ // TODO add exceptions
+
+ public void doWork (Message msg);
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/conf/ReceiverPlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/conf/ReceiverPlugin.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/conf/ReceiverPlugin.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,32 @@
+package org.jboss.soa.esb.spi.conf;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.spi.Receiver;
+import org.jboss.soa.esb.spi.Service;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+
+public interface ReceiverPlugin
+{
+ public Receiver create (EPR epr, Service svc);
+}
Deleted: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpClient.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpClient.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpClient.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,153 +0,0 @@
-package org.jboss.soa.esb.remoting;
-
-import java.io.StringWriter;
-import java.net.URI;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.internal.soa.esb.api.ClientPluginImpl;
-import org.jboss.internal.soa.esb.api.ServicePluginImpl;
-import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.w3c.dom.Document;
-
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public class OneWayTcpClient
-{
- public static class Receiver implements ServicePluginImpl.Receiver
- {
- public void receive (Message msg)
- {
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-
- factory.setNamespaceAware(true);
-
- Document doc = factory.newDocumentBuilder().newDocument();
- ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl) msg).toXML(doc);
- StringWriter sWriter = new StringWriter();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- XMLSerializer xmlS = new XMLSerializer(sWriter, format);
- xmlS.asDOMSerializer();
- xmlS.serialize(doc);
-
- System.err.println("Received one-way response message: "+sWriter.toString());
- }
- catch (Throwable ex)
- {
- }
- }
- }
-
- public static void main (String[] args) throws Exception
- {
- URI destination = new URI("socket://localhost:5555");
- URI response = new URI("socket://localhost:8080");
-
- for (int i = 0; i < args.length; i++)
- {
- if (args[i].equals("-url"))
- {
- try
- {
- destination = new URI(args[i+1]);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
-
- System.exit(0);
- }
- }
- if (args[i].equals("-help"))
- {
- System.err.println("Usage: -url <url> [-help]");
- System.exit(0);
- }
- }
-
- if (destination == null)
- {
- System.err.println("Error - no destination URL specified!");
-
- System.exit(0);
- }
-
- /*
- * Most (or all) of the following would be automated via interactions with other
- * services, such as a registry/repository.
- */
-
- /*
- * Create a reference to the endpoint service we want to talk to.
- */
-
- EPR epr = new EPR(destination);
-
- /*
- * Now create a binding to the right aspect of the ESB.
- */
-
- ClientPluginImpl tcpClientPlugin = new ClientPluginImpl();
-
- /*
- * Create the message payload.
- */
-
- Message msg = MessageFactory.getInstance().getMessage();
- Body payload = msg.getBody();
-
- String message = "Hello World";
-
- payload.addBytes(message.getBytes());
-
- msg.getHeader().setCall(new Call(epr));
- msg.getHeader().getCall().setReplyTo(new EPR(response));
-
- /*
- * Send the message payload.
- */
-
- try
- {
- ServicePluginImpl tcpServicePlugin = new ServicePluginImpl(response.toString()+"/?datatype=xml", new Receiver());
-
- tcpClientPlugin.send(msg);
-
- tcpServicePlugin.listen();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpService.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpService.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/OneWayTcpService.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -1,133 +0,0 @@
-package org.jboss.soa.esb.remoting;
-
-import java.io.StringWriter;
-import java.net.URI;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.internal.soa.esb.api.ClientPluginImpl;
-import org.jboss.internal.soa.esb.api.ServicePluginImpl;
-import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.w3c.dom.Document;
-
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
-
-/*
- * 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,
- * @author mark.little at jboss.com
- */
-
-public class OneWayTcpService
-{
- public static class Receiver implements ServicePluginImpl.Receiver
- {
- public void receive (Message msg)
- {
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-
- factory.setNamespaceAware(true);
-
- Document doc = factory.newDocumentBuilder().newDocument();
- ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl) msg).toXML(doc);
- StringWriter sWriter = new StringWriter();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- XMLSerializer xmlS = new XMLSerializer(sWriter, format);
- xmlS.asDOMSerializer();
- xmlS.serialize(doc);
-
- System.err.println("Received request message: "+sWriter.toString());
- }
- catch (Throwable ex)
- {
- }
-
- ClientPluginImpl tcpClientPlugin = new ClientPluginImpl();
-
- Message response = MessageFactory.getInstance().getMessage();
- response.getHeader().setCall(new Call(msg.getHeader().getCall().getReplyTo()));
-
- Body payload = response.getBody();
-
- String message = "Echo echo echo echo";
-
- payload.addBytes(message.getBytes());
-
- try
- {
- tcpClientPlugin.send(response);
-
- System.err.println("Sent response to "+response.getHeader().getCall().getTo());
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
-
- public static void main (String[] args) throws Exception
- {
- URI listener = new URI("socket://localhost:5555/?datatype=xml");
-
- for (int i = 0; i < args.length; i++)
- {
- if (args[i].equals("-url"))
- {
- try
- {
- listener = new URI(args[i+1]);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
-
- System.exit(0);
- }
- }
- if (args[i].equals("-help"))
- {
- System.err.println("Usage: -url <url> [-help]");
- System.exit(0);
- }
- }
-
- try
- {
- /*
- * Now create a binding to the right aspect of the ESB.
- */
-
- ServicePluginImpl tcpServicePlugin = new ServicePluginImpl(listener.toString(), new Receiver());
-
- tcpServicePlugin.listen();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
Modified: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpClient.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpClient.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpClient.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -5,7 +5,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
-import org.jboss.internal.soa.esb.api.TwoWayClientPluginImpl;
+import org.jboss.internal.soa.esb.api.TwoWaySenderImpl;
import org.jboss.soa.esb.addressing.Call;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.message.Body;
@@ -87,7 +87,7 @@
* Now create a binding to the right aspect of the ESB.
*/
- TwoWayClientPluginImpl httpClientPlugin = new TwoWayClientPluginImpl();
+ TwoWaySenderImpl httpClientPlugin = new TwoWaySenderImpl();
/*
* Create the message payload.
Modified: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpService.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpService.java 2007-03-12 21:33:43 UTC (rev 10134)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpService.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -5,8 +5,8 @@
import javax.xml.parsers.DocumentBuilderFactory;
-import org.jboss.internal.soa.esb.api.ServicePluginImpl;
-import org.jboss.internal.soa.esb.api.TwoWayServicePluginImpl;
+import org.jboss.internal.soa.esb.spi.TwoWayReceiverImpl;
+import org.jboss.internal.soa.esb.spi.remoting.ReceiverImpl;
import org.jboss.soa.esb.addressing.Call;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.message.Body;
@@ -40,7 +40,7 @@
public class TwoWayTcpService
{
- public static class Worker implements TwoWayServicePluginImpl.Worker
+ public static class Worker implements TwoWayReceiverImpl.Worker
{
public Message doWork (Message msg)
{
@@ -113,7 +113,7 @@
* Now create a binding to the right aspect of the ESB.
*/
- TwoWayServicePluginImpl tcpServicePlugin = new TwoWayServicePluginImpl(listener.toString(), new TwoWayTcpService.Worker());
+ TwoWayReceiverImpl tcpServicePlugin = new TwoWayReceiverImpl(listener.toString(), new TwoWayTcpService.Worker());
tcpServicePlugin.listen();
}
Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpClient.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpClient.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpClient.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,156 @@
+package org.jboss.soa.esb.remoting.oneway;
+
+import java.io.StringWriter;
+import java.net.URI;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.api.Sender;
+import org.jboss.soa.esb.api.SenderFactory;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.spi.Receiver;
+import org.jboss.soa.esb.spi.ReceiverFactory;
+import org.jboss.soa.esb.spi.Service;
+import org.w3c.dom.Document;
+
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public class TcpClient
+{
+ public static class Worker implements Service
+ {
+ public void doWork (Message msg)
+ {
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ Document doc = factory.newDocumentBuilder().newDocument();
+ ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl) msg).toXML(doc);
+ StringWriter sWriter = new StringWriter();
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ XMLSerializer xmlS = new XMLSerializer(sWriter, format);
+ xmlS.asDOMSerializer();
+ xmlS.serialize(doc);
+
+ System.err.println("Received one-way response message: "+sWriter.toString());
+ }
+ catch (Throwable ex)
+ {
+ }
+ }
+ }
+
+ public static void main (String[] args) throws Exception
+ {
+ URI destination = new URI("socket://localhost:5555");
+ URI response = new URI("socket://localhost:8080");
+
+ for (int i = 0; i < args.length; i++)
+ {
+ if (args[i].equals("-url"))
+ {
+ try
+ {
+ destination = new URI(args[i+1]);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ System.exit(0);
+ }
+ }
+ if (args[i].equals("-help"))
+ {
+ System.err.println("Usage: -url <url> [-help]");
+ System.exit(0);
+ }
+ }
+
+ if (destination == null)
+ {
+ System.err.println("Error - no destination URL specified!");
+
+ System.exit(0);
+ }
+
+ /*
+ * Most (or all) of the following would be automated via interactions with other
+ * services, such as a registry/repository.
+ */
+
+ /*
+ * Create a reference to the endpoint service we want to talk to.
+ */
+
+ EPR epr = new EPR(destination);
+
+ /*
+ * Now create a binding to the right aspect of the ESB.
+ */
+
+ Sender tcpClientPlugin = SenderFactory.getInstance().getSender(epr);
+
+ /*
+ * Create the message payload.
+ */
+
+ Message msg = MessageFactory.getInstance().getMessage();
+ Body payload = msg.getBody();
+
+ String message = "Hello World";
+
+ payload.addBytes(message.getBytes());
+
+ msg.getHeader().setCall(new Call(epr));
+ msg.getHeader().getCall().setReplyTo(new EPR(response));
+
+ /*
+ * Send the message payload.
+ */
+
+ try
+ {
+ Receiver tcpServicePlugin = ReceiverFactory.getInstance().getReceiver(new EPR(response), new Worker());
+
+ tcpClientPlugin.send(msg);
+
+ tcpServicePlugin.listen();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpService.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpService.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpService.java 2007-03-12 21:34:43 UTC (rev 10135)
@@ -0,0 +1,139 @@
+package org.jboss.soa.esb.remoting.oneway;
+
+import java.io.StringWriter;
+import java.net.URI;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.api.Sender;
+import org.jboss.soa.esb.api.SenderFactory;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.spi.Receiver;
+import org.jboss.soa.esb.spi.ReceiverFactory;
+import org.jboss.soa.esb.spi.Service;
+import org.w3c.dom.Document;
+
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
+/*
+ * 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,
+ * @author mark.little at jboss.com
+ */
+
+public class TcpService
+{
+ public static class Worker implements Service
+ {
+ public void doWork (Message msg)
+ {
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ Document doc = factory.newDocumentBuilder().newDocument();
+ ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl) msg).toXML(doc);
+ StringWriter sWriter = new StringWriter();
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ XMLSerializer xmlS = new XMLSerializer(sWriter, format);
+ xmlS.asDOMSerializer();
+ xmlS.serialize(doc);
+
+ System.err.println("Received request message: "+sWriter.toString());
+ }
+ catch (Throwable ex)
+ {
+ }
+
+ try
+ {
+ Sender tcpClientPlugin = SenderFactory.getInstance().getSender(msg.getHeader().getCall().getReplyTo());
+
+ Message response = MessageFactory.getInstance().getMessage();
+ response.getHeader().setCall(new Call(msg.getHeader().getCall().getReplyTo()));
+
+ Body payload = response.getBody();
+
+ String message = "Echo echo echo echo";
+
+ payload.addBytes(message.getBytes());
+
+ tcpClientPlugin.send(response);
+
+ System.err.println("Sent response to "+response.getHeader().getCall().getTo());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public static void main (String[] args) throws Exception
+ {
+ URI listener = new URI("socket://localhost:5555");
+
+ for (int i = 0; i < args.length; i++)
+ {
+ if (args[i].equals("-url"))
+ {
+ try
+ {
+ listener = new URI(args[i+1]);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ System.exit(0);
+ }
+ }
+ if (args[i].equals("-help"))
+ {
+ System.err.println("Usage: -url <url> [-help]");
+ System.exit(0);
+ }
+ }
+
+ try
+ {
+ EPR epr = new EPR(listener);
+
+ /*
+ * Now create a binding to the right aspect of the ESB.
+ */
+
+ Receiver tcpServicePlugin = ReceiverFactory.getInstance().getReceiver(epr, new Worker());
+
+ tcpServicePlugin.listen();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list