[jboss-svn-commits] JBL Code SVN: r10287 - in labs/jbossesb/workspace/rearch2/core/src: main/java/org/jboss/internal/soa/esb/api/remoting and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 16 18:11:26 EDT 2007
Author: mark.little at jboss.com
Date: 2007-03-16 18:11:26 -0400 (Fri, 16 Mar 2007)
New Revision: 10287
Added:
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/TwoWaySenderImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/TwoWaySenderPluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverPluginImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/TwoWaySender.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpClient.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpService.java
Removed:
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/spi/TwoWayReceiverImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.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
Modified:
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/message/format/MessageFactoryImpl.java
labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/xml/marshal/MarshalUnmarshalManager.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/SenderFactory.java
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/spi/ReceiverFactory.java
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/TcpClient.java
labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpService.java
Log:
Deleted: 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/TwoWaySenderImpl.java 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/TwoWaySenderImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -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.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();
- }
-}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/SenderPluginImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -30,4 +30,9 @@
{
return new SenderImpl();
}
+
+ public boolean isTwoWay ()
+ {
+ return false;
+ }
}
Copied: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/TwoWaySenderImpl.java (from rev 10135, 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/TwoWaySenderImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/TwoWaySenderImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,105 @@
+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.TwoWaySender;
+import org.jboss.soa.esb.message.Message;
+
+public class TwoWaySenderImpl implements TwoWaySender
+{
+ 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 send (Message msg) throws ProtocolNotSupportedException
+ {
+ throw new ProtocolNotSupportedException();
+ }
+
+ 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/TwoWaySenderPluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/TwoWaySenderPluginImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/api/remoting/TwoWaySenderPluginImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,38 @@
+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 TwoWaySenderPluginImpl implements SenderPlugin
+{
+ public Sender create ()
+ {
+ return new TwoWaySenderImpl();
+ }
+
+ public boolean isTwoWay ()
+ {
+ return true;
+ }
+}
Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/MessageFactoryImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/MessageFactoryImpl.java 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/MessageFactoryImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -74,7 +74,7 @@
try
{
String pluginName = properties.getProperty(attrName);
- Class c = Class.forName(pluginName);
+ Class c = Thread.currentThread().getContextClassLoader().loadClass(pluginName);
MessagePlugin thePlugin = (MessagePlugin) c.newInstance();
messageFormats.put(thePlugin.getType(), thePlugin);
Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/xml/marshal/MarshalUnmarshalManager.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/xml/marshal/MarshalUnmarshalManager.java 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/message/format/xml/marshal/MarshalUnmarshalManager.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -72,7 +72,7 @@
try
{
String pluginName = properties.getProperty(attrName);
- Class c = Class.forName(pluginName);
+ Class c = Thread.currentThread().getContextClassLoader().loadClass(pluginName);
MarshalUnmarshalPlugin thePlugin = (MarshalUnmarshalPlugin) c.newInstance();
_plugins.put(thePlugin.type(), thePlugin);
Deleted: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/TwoWayReceiverImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -1,159 +0,0 @@
-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;
- }
-
-}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/ReceiverPluginImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -51,4 +51,10 @@
return null;
}
}
+
+ public boolean isTwoWay ()
+ {
+ return false;
+ }
+
}
Copied: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverImpl.java (from rev 10135, 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/TwoWayReceiverImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,154 @@
+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 TwoWayReceiverImpl implements Receiver
+{
+
+ public TwoWayReceiverImpl (String locatorURI, Service 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 (Service 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 Service _worker;
+ }
+
+}
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverPluginImpl.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverPluginImpl.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/internal/soa/esb/spi/remoting/TwoWayReceiverPluginImpl.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,57 @@
+package org.jboss.internal.soa.esb.spi.remoting;
+
+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 TwoWayReceiverPluginImpl 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 TwoWayReceiverImpl(epr.getAddr().getAddress()+REMOTING_DATATYPE, svc);
+ }
+ catch (Exception ex)
+ {
+ // TODO exceptions!!
+
+ return null;
+ }
+ }
+
+ public boolean isTwoWay ()
+ {
+ return true;
+ }
+}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/SenderFactory.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -5,8 +5,8 @@
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.internal.soa.esb.api.remoting.TwoWaySenderPluginImpl;
import org.jboss.soa.esb.ProtocolNotSupportedException;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.api.conf.SenderPlugin;
@@ -52,7 +52,8 @@
public class SenderFactory
{
- public static final String PLUGIN_NAME = "org.jboss.soa.esb.api.clientPlugin";
+ public static final String ONEWAY_PLUGIN_NAME = "org.jboss.soa.esb.api.onewayClientPlugin";
+ public static final String TWOWAY_PLUGIN_NAME = "org.jboss.soa.esb.api.twowayClientPlugin";
/**
* @return the factory singleton.
@@ -79,7 +80,7 @@
try
{
URI where = new URI(address.getAddr().getAddress());
- SenderPlugin sender = _plugins.get(where.getScheme());
+ SenderPlugin sender = _oneWayPlugins.get(where.getScheme());
return sender.create();
}
@@ -89,6 +90,31 @@
}
}
+ public TwoWaySender getTwoWaySender (EPR address) throws ProtocolNotSupportedException
+ {
+ if (address == null)
+ throw new IllegalArgumentException();
+
+ try
+ {
+ URI where = new URI(address.getAddr().getAddress());
+ SenderPlugin sender = _oneWayPlugins.get(where.getScheme());
+
+ if (sender.isTwoWay())
+ return (TwoWaySender) sender.create();
+ else
+ throw new ProtocolNotSupportedException();
+ }
+ catch (ProtocolNotSupportedException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new ProtocolNotSupportedException();
+ }
+ }
+
/**
* Add the client API implementation to the factory.
*
@@ -101,19 +127,20 @@
if ((protocol == null) || (plugin == null))
throw new IllegalArgumentException();
- _plugins.put(protocol, plugin);
+ _oneWayPlugins.put(protocol, plugin);
}
private SenderFactory ()
{
}
- private static Hashtable<String, SenderPlugin> _plugins;
+ private static Hashtable<String, SenderPlugin> _oneWayPlugins;
+ private static Hashtable<String, SenderPlugin> _twoWayPlugins;
private static final SenderFactory _instance = new SenderFactory();
static
{
- SenderFactory._plugins = new Hashtable<String, SenderPlugin>();
+ SenderFactory._oneWayPlugins = new Hashtable<String, SenderPlugin>();
try
{
@@ -132,19 +159,33 @@
* Find properties with the right attribute name.
*/
- if (key.startsWith(SenderFactory.PLUGIN_NAME))
+ if (key.startsWith(SenderFactory.ONEWAY_PLUGIN_NAME))
{
/*
* Strip off the attribute name to get the protocol.
*/
- String protocol = key.substring(PLUGIN_NAME.length());
+ String protocol = key.substring(ONEWAY_PLUGIN_NAME.length());
String pluginClassName = (String) props.get(key);
+ Class pluginClass = Thread.currentThread().getContextClassLoader().loadClass(pluginClassName);
+ SenderPlugin plugin = (SenderPlugin) pluginClass.newInstance();
+ SenderFactory._oneWayPlugins.put(protocol, plugin);
+ }
+
+ if (key.startsWith(SenderFactory.TWOWAY_PLUGIN_NAME))
+ {
+ /*
+ * Strip off the attribute name to get the protocol.
+ */
+
+ String protocol = key.substring(TWOWAY_PLUGIN_NAME.length());
+ String pluginClassName = (String) props.get(key);
+
Class pluginClass = Class.forName(pluginClassName);
SenderPlugin plugin = (SenderPlugin) pluginClass.newInstance();
- SenderFactory._plugins.put(protocol, plugin);
+ SenderFactory._twoWayPlugins.put(protocol, plugin);
}
}
@@ -152,8 +193,10 @@
* Add the default implementations.
*/
- SenderFactory._plugins.put(Protocols.TCP, new SenderPluginImpl());
- SenderFactory._plugins.put(Protocols.HTTP, new SenderPluginImpl());
+ SenderFactory._oneWayPlugins.put(Protocols.TCP, new SenderPluginImpl());
+ SenderFactory._oneWayPlugins.put(Protocols.HTTP, new SenderPluginImpl());
+ SenderFactory._oneWayPlugins.put(Protocols.TCP, new TwoWaySenderPluginImpl());
+ SenderFactory._oneWayPlugins.put(Protocols.HTTP, new TwoWaySenderPluginImpl());
}
}
catch (Throwable ex)
Added: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/TwoWaySender.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/TwoWaySender.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/TwoWaySender.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,42 @@
+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
+ */
+
+import org.jboss.soa.esb.ProtocolNotSupportedException;
+import org.jboss.soa.esb.SendFailedException;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * An interface for implementations that do truly synchronous request/response interactions.
+ * Not sure if we should promote this as it breaks loose coupling.
+ *
+ * Inherit Sender characteristics so that implementations can layer RPC on top
+ * of one-way messaging if necessary.
+ *
+ * @author marklittle
+ */
+
+public interface TwoWaySender extends Sender
+{
+ public Message invoke (Message msg) throws ProtocolNotSupportedException,
+ SendFailedException;
+}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/api/conf/SenderPlugin.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -27,4 +27,5 @@
public interface SenderPlugin
{
public Sender create ();
+ public boolean isTwoWay ();
}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/ReceiverFactory.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -5,13 +5,10 @@
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.internal.soa.esb.spi.remoting.TwoWayReceiverPluginImpl;
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;
@@ -55,7 +52,8 @@
public class ReceiverFactory
{
- public static final String PLUGIN_NAME = "org.jboss.soa.esb.api.servicePlugin";
+ public static final String ONEWAY_PLUGIN_NAME = "org.jboss.soa.esb.api.onewayServicePlugin";
+ public static final String TWOWAY_PLUGIN_NAME = "org.jboss.soa.esb.api.twowayServicePlugin";
/**
* @return the factory singleton.
@@ -85,7 +83,7 @@
try
{
URI where = new URI(address.getAddr().getAddress());
- ReceiverPlugin plugin = _plugins.get(where.getScheme());
+ ReceiverPlugin plugin = _onewayPlugins.get(where.getScheme());
return plugin.create(address, svc);
}
@@ -95,6 +93,30 @@
}
}
+ public Receiver getTwoWayReceiver (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 = _twowayPlugins.get(where.getScheme());
+
+ if (plugin.isTwoWay())
+ return plugin.create(address, svc);
+ else
+ throw new ProtocolNotSupportedException();
+ }
+ catch (Exception ex)
+ {
+ throw new ProtocolNotSupportedException();
+ }
+ }
+
/**
* Add the service API implementation to the factory.
*
@@ -107,19 +129,22 @@
if ((protocol == null) || (plugin == null))
throw new IllegalArgumentException();
- _plugins.put(protocol, plugin);
+ _onewayPlugins.put(protocol, plugin);
}
private ReceiverFactory ()
{
}
- private static Hashtable<String, ReceiverPlugin> _plugins;
+ private static Hashtable<String, ReceiverPlugin> _onewayPlugins;
+ private static Hashtable<String, ReceiverPlugin> _twowayPlugins;
+
private static final ReceiverFactory _instance = new ReceiverFactory();
static
{
- ReceiverFactory._plugins = new Hashtable<String, ReceiverPlugin>();
+ ReceiverFactory._onewayPlugins = new Hashtable<String, ReceiverPlugin>();
+ ReceiverFactory._twowayPlugins = new Hashtable<String, ReceiverPlugin>();
try
{
@@ -146,19 +171,32 @@
* Find properties with the right attribute name.
*/
- if (key.startsWith(SenderFactory.PLUGIN_NAME))
+ if (key.startsWith(ReceiverFactory.ONEWAY_PLUGIN_NAME))
{
/*
* Strip off the attribute name to get the protocol.
*/
- String protocol = key.substring(PLUGIN_NAME.length());
+ String protocol = key.substring(ONEWAY_PLUGIN_NAME.length());
String pluginClassName = (String) props.get(key);
+ Class pluginClass = Thread.currentThread().getContextClassLoader().loadClass(pluginClassName);
+ ReceiverPlugin plugin = (ReceiverPlugin) pluginClass.newInstance();
- Class pluginClass = Class.forName(pluginClassName);
+ ReceiverFactory._onewayPlugins.put(protocol, plugin);
+ }
+
+ if (key.startsWith(ReceiverFactory.TWOWAY_PLUGIN_NAME))
+ {
+ /*
+ * Strip off the attribute name to get the protocol.
+ */
+
+ String protocol = key.substring(TWOWAY_PLUGIN_NAME.length());
+ String pluginClassName = (String) props.get(key);
+ Class pluginClass = Thread.currentThread().getContextClassLoader().loadClass(pluginClassName);
ReceiverPlugin plugin = (ReceiverPlugin) pluginClass.newInstance();
- ReceiverFactory._plugins.put(protocol, plugin);
+ ReceiverFactory._twowayPlugins.put(protocol, plugin);
}
}
@@ -166,8 +204,10 @@
* Add the default implementations.
*/
- ReceiverFactory._plugins.put(Protocols.TCP, new ReceiverPluginImpl());
- ReceiverFactory._plugins.put(Protocols.HTTP, new ReceiverPluginImpl());
+ ReceiverFactory._onewayPlugins.put(Protocols.TCP, new ReceiverPluginImpl());
+ ReceiverFactory._onewayPlugins.put(Protocols.HTTP, new ReceiverPluginImpl());
+ ReceiverFactory._twowayPlugins.put(Protocols.TCP, new TwoWayReceiverPluginImpl());
+ ReceiverFactory._twowayPlugins.put(Protocols.HTTP, new TwoWayReceiverPluginImpl());
}
}
catch (Throwable ex)
Deleted: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/Service.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -1,36 +0,0 @@
-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/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-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,38 @@
+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.
+ */
+
+// should this be the basis for Dispatcher?
+
+public interface Service
+{
+ // TODO add exceptions
+
+ public Message doWork (Message msg);
+}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/spi/conf/ReceiverPlugin.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -29,4 +29,6 @@
public interface ReceiverPlugin
{
public Receiver create (EPR epr, Service svc);
+
+ public boolean isTwoWay ();
}
Deleted: 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-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpClient.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -1,140 +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.TwoWaySenderImpl;
-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 TwoWayTcpClient
-{
- public static void main (String[] args) throws Exception
- {
- URI destination = new URI("socket://localhost:5555");
-
- 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.
- */
-
- TwoWaySenderImpl httpClientPlugin = new TwoWaySenderImpl();
-
- /*
- * 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));
-
- /*
- * Send the message payload.
- */
-
- try
- {
- Message response = httpClientPlugin.invoke(msg);
-
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-
- factory.setNamespaceAware(true);
-
- Document doc = factory.newDocumentBuilder().newDocument();
- ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl) response).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 response message: "+sWriter.toString());
- }
- catch (Throwable ex)
- {
- }
- }
- 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/TwoWayTcpService.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpService.java 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/TwoWayTcpService.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -1,126 +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.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;
-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 TwoWayTcpService
-{
- public static class Worker implements TwoWayReceiverImpl.Worker
- {
- public Message 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)
- {
- }
-
- /*
- * How do we get the implicit ReplyTo address?
- */
-
- Message response = MessageFactory.getInstance().getMessage();
- Body payload = response.getBody();
-
- String message = "Echo echo echo echo";
-
- payload.addBytes(message.getBytes());
-
- return response;
- }
- }
-
- public static void main (String[] args) throws Exception
- {
- URI listener = new URI("socket://localhost:5555/?datatype=xml");
- //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
- {
- /*
- * Now create a binding to the right aspect of the ESB.
- */
-
- TwoWayReceiverImpl tcpServicePlugin = new TwoWayReceiverImpl(listener.toString(), new TwoWayTcpService.Worker());
-
- 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/oneway/TcpClient.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpClient.java 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpClient.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -45,7 +45,7 @@
{
public static class Worker implements Service
{
- public void doWork (Message msg)
+ public Message doWork (Message msg)
{
try
{
@@ -67,6 +67,8 @@
catch (Throwable ex)
{
}
+
+ return null;
}
}
Modified: 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 2007-03-16 22:03:53 UTC (rev 10286)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/oneway/TcpService.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -45,7 +45,7 @@
{
public static class Worker implements Service
{
- public void doWork (Message msg)
+ public Message doWork (Message msg)
{
try
{
@@ -89,6 +89,8 @@
{
ex.printStackTrace();
}
+
+ return null;
}
}
Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpClient.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpClient.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpClient.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,141 @@
+package org.jboss.soa.esb.remoting.twoway;
+
+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.SenderFactory;
+import org.jboss.soa.esb.api.TwoWaySender;
+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 TcpClient
+{
+ public static void main (String[] args) throws Exception
+ {
+ URI destination = new URI("socket://localhost:5555");
+
+ 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.
+ */
+
+ TwoWaySender httpClientPlugin = SenderFactory.getInstance().getTwoWaySender(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));
+
+ /*
+ * Send the message payload.
+ */
+
+ try
+ {
+ Message response = httpClientPlugin.invoke(msg);
+
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ Document doc = factory.newDocumentBuilder().newDocument();
+ ((org.jboss.internal.soa.esb.message.format.xml.MessageImpl) response).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 response message: "+sWriter.toString());
+ }
+ catch (Throwable ex)
+ {
+ }
+ }
+ 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/twoway/TcpService.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpService.java (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/remoting/twoway/TcpService.java 2007-03-16 22:11:26 UTC (rev 10287)
@@ -0,0 +1,126 @@
+package org.jboss.soa.esb.remoting.twoway;
+
+import java.io.StringWriter;
+import java.net.URI;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+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.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 Message 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)
+ {
+ }
+
+ /*
+ * How do we get the implicit ReplyTo address?
+ */
+
+ Message response = MessageFactory.getInstance().getMessage();
+ Body payload = response.getBody();
+
+ String message = "Echo echo echo echo";
+
+ payload.addBytes(message.getBytes());
+
+ return response;
+ }
+ }
+
+ public static void main (String[] args) throws Exception
+ {
+ //URI listener = new URI("socket://localhost:5555/?datatype=xml");
+ 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
+ {
+ /*
+ * Now create a binding to the right aspect of the ESB.
+ */
+
+ Receiver tcpServicePlugin = ReceiverFactory.getInstance().getTwoWayReceiver(new EPR(listener), new TcpService.Worker());
+
+ tcpServicePlugin.listen();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list