Author: richard.opalka(a)jboss.com
Date: 2007-11-20 11:44:29 -0500 (Tue, 20 Nov 2007)
New Revision: 5078
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties
Log:
adding support for addressable clients + creating backports server (first prototype)
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -23,6 +23,7 @@
// $Id$
+import java.net.URI;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.HashSet;
@@ -39,6 +40,7 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceException;
+import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
import javax.xml.ws.handler.Handler;
@@ -103,19 +105,19 @@
// WS-RM locking utility
private final Lock wsrmLock = new ReentrantLock();
// WS-RM sequence associated with the proxy
- private RMSequence wsrmSequence;
+ private RMSequenceImpl wsrmSequence;
public final Lock getWSRMLock()
{
return this.wsrmLock;
}
- public final void setWSRMSequence(RMSequence wsrmSequence)
+ public final void setWSRMSequence(RMSequenceImpl wsrmSequence)
{
this.wsrmSequence = wsrmSequence;
}
- public final RMSequence getWSRMSequence()
+ public final RMSequenceImpl getWSRMSequence()
{
return this.wsrmSequence;
}
@@ -277,6 +279,13 @@
{
if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false)
{
+ if (this.wsrmSequence.getBackPort() != null)
+ {
+ // rewrite ReplyTo to use client addressable back port
+ Map<String, Object> requestContext =
getBindingProvider().getRequestContext();
+ AddressingProperties addressingProps =
(AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+
addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.wsrmSequence.getBackPort()));
+ }
Map<String, Object> rmRequestContext = new HashMap<String,
Object>();
QName sequenceQName = Provider.get().getConstants().getSequenceQName();
rmRequestContext.put(RMConstant.OPERATION_QNAME, sequenceQName);
@@ -475,7 +484,7 @@
// WS-RM support //
///////////////////
@SuppressWarnings("unchecked")
- public RMSequence createSequence() throws RMException
+ public RMSequence createSequence(boolean addressableClient) throws RMException
{
this.getWSRMLock().lock();
try
@@ -488,7 +497,18 @@
// set up addressing data
String address = getEndpointMetaData().getEndpointAddress();
String action = RMConstant.CREATE_SEQUENCE_WSA_ACTION;
- AddressingProperties addressingProps =
AddressingClientUtil.createAnonymousProps(action, address);
+ URI backPort = null;
+ AddressingProperties addressingProps = null;
+ if (addressableClient)
+ {
+ backPort = new
URI("http://localhost:8888/packports/1234567890-1234567890/1234567890-1234567890");
// TODO: use generator
+ addressingProps = AddressingClientUtil.createDefaultProps(action,
address);
+
addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(backPort));
+ }
+ else
+ {
+ addressingProps = AddressingClientUtil.createAnonymousProps(action,
address);
+ }
Map requestContext = getBindingProvider().getRequestContext();
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
addressingProps);
// set up wsrm request context
@@ -501,7 +521,7 @@
// read WSRM sequence id from response context
Map rmResponseContext =
(Map)getBindingProvider().getResponseContext().get(RMConstant.RESPONSE_CONTEXT);
String id =
((CreateSequenceResponse)((List)rmResponseContext.get(RMConstant.DATA)).get(0)).getIdentifier();
- return this.wsrmSequence = new RMSequenceImpl(this, id);
+ return this.wsrmSequence = new RMSequenceImpl(this, id, backPort);
}
catch (Exception e)
{
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -21,13 +21,11 @@
*/
package org.jboss.ws.extensions.wsrm;
-import static org.jboss.ws.extensions.wsrm.RMConstant.INVOCATION_CONTEXT;
-import static org.jboss.ws.extensions.wsrm.RMConstant.ONE_WAY_OPERATION;
-import static org.jboss.ws.extensions.wsrm.RMConstant.REMOTING_CONFIGURATION_CONTEXT;
-import static org.jboss.ws.extensions.wsrm.RMConstant.REMOTING_INVOCATION_CONTEXT;
-import static org.jboss.ws.extensions.wsrm.RMConstant.TARGET_ADDRESS;
+import static org.jboss.ws.extensions.wsrm.RMConstant.*;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
@@ -35,6 +33,10 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
import org.jboss.ws.core.MessageTrace;
+import org.jboss.ws.extensions.wsrm.backchannel.RMBackPortsServer;
+import org.jboss.ws.extensions.wsrm.spi.Provider;
+import org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.Serializable;
/**
* Represents request that goes to the RM channel
@@ -72,7 +74,15 @@
client.setMarshaller(RMMarshaller.getInstance());
- boolean oneWay =
(Boolean)rmRequest.getMetadata().getContext(RMConstant.INVOCATION_CONTEXT).get(ONE_WAY_OPERATION);
+ URI backPort = RMHelper.getBackPortURI(rmRequest);
+ System.out.println("[WS-RM] backport URI is: " + backPort);
+
+ if (backPort != null)
+ {
+ RMBackPortsServer backPortsServer =
RMBackPortsServer.getInstance(backPort.getScheme(), backPort.getHost(),
backPort.getPort());
+ //backPortsServer.registerCallback(backPort.getPath(), this);
+ }
+ boolean oneWay = RMHelper.isOneWayOperation(rmRequest);
if (!oneWay)
client.setUnMarshaller(RMUnMarshaller.getInstance());
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -5,6 +5,7 @@
import java.util.List;
import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingBuilder;
import org.jboss.ws.extensions.wsrm.spi.Constants;
import org.jboss.ws.extensions.wsrm.spi.Provider;
@@ -27,10 +28,13 @@
public static final String DATA = PREFIX + ".data";
// WS-Addressing related actions
public static final String CREATE_SEQUENCE_WSA_ACTION;
+ public static final String CLOSE_SEQUENCE_WSA_ACTION;
public static final String TERMINATE_SEQUENCE_WSA_ACTION;
public static final List<QName> PROTOCOL_OPERATION_QNAMES;
+ public static final String WSA_ANONYMOUS_URI =
AddressingBuilder.getAddressingBuilder().newAddressingConstants().getAnonymousURI();
+
static
{
LinkedList<QName> temp = new LinkedList<QName>();
@@ -46,6 +50,7 @@
temp.add(constants.getTerminateSequenceResponseQName());
PROTOCOL_OPERATION_QNAMES = Collections.unmodifiableList(temp);
CREATE_SEQUENCE_WSA_ACTION = Provider.get().getConstants().getNamespaceURI() +
"/CreateSequence";
+ CLOSE_SEQUENCE_WSA_ACTION = Provider.get().getConstants().getNamespaceURI() +
"/CloseSequence";
TERMINATE_SEQUENCE_WSA_ACTION = Provider.get().getConstants().getNamespaceURI() +
"/TerminateSequence";
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java 2007-11-20
15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -1,9 +1,19 @@
package org.jboss.ws.extensions.wsrm;
+import static org.jboss.ws.extensions.wsrm.RMConstant.*;
+
+import java.net.URI;
+import java.util.List;
import java.util.Map;
+import org.jboss.logging.Logger;
+import org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.Serializable;
+
public final class RMHelper
{
+ private static final Logger log = Logger.getLogger(RMHelper.class);
+
private RMHelper()
{
// no instances
@@ -11,6 +21,38 @@
public static boolean isRMMessage(Map<String, Object> ctx)
{
- return (ctx != null) && (ctx.containsKey(RMConstant.DATA));
+ return (ctx != null) && (ctx.containsKey(RMConstant.REQUEST_CONTEXT));
}
+
+ public static URI getBackPortURI(RMMessage rmRequest)
+ {
+ Map<String, Object> invocationCtx = (Map<String,
Object>)rmRequest.getMetadata().getContext(INVOCATION_CONTEXT);
+ Map<String, Object> wsrmRequestCtx = (Map<String,
Object>)invocationCtx.get(REQUEST_CONTEXT);
+ List<Serializable> wsrmMessages =
(List<Serializable>)wsrmRequestCtx.get(DATA);
+ URI retVal = null;
+ if (wsrmMessages.get(0) instanceof CreateSequence)
+ {
+ CreateSequence cs = (CreateSequence)wsrmMessages.get(0);
+ try
+ {
+ retVal = RMConstant.WSA_ANONYMOUS_URI.equals(cs.getAcksTo()) ? null : new
URI(cs.getAcksTo());;
+ }
+ catch (Exception e)
+ {
+ log.warn(e.getMessage(), e);
+ }
+ }
+ else
+ {
+ retVal =
((RMSequenceImpl)wsrmRequestCtx.get(SEQUENCE_REFERENCE)).getBackPort();
+ }
+
+ return retVal;
+ }
+
+ public static boolean isOneWayOperation(RMMessage rmRequest)
+ {
+ return
(Boolean)rmRequest.getMetadata().getContext(RMConstant.INVOCATION_CONTEXT).get(ONE_WAY_OPERATION);
+ }
+
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.extensions.wsrm;
+import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -29,6 +30,7 @@
import java.util.concurrent.locks.ReentrantLock;
import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
@@ -50,6 +52,7 @@
public final class RMSequenceImpl implements RMSequence
{
private final String id;
+ private final URI backPort;
private final ClientImpl client;
// object states variables
private boolean terminated = false;
@@ -57,12 +60,18 @@
private AtomicLong messageNumber = new AtomicLong();
private final Lock objectLock = new ReentrantLock();
- public RMSequenceImpl(ClientImpl client, String id)
+ public RMSequenceImpl(ClientImpl client, String id, URI backPort)
{
super();
this.client = client;
this.id = id;
+ this.backPort = backPort;
}
+
+ public final URI getBackPort()
+ {
+ return this.backPort;
+ }
public final long newMessageNumber()
{
@@ -133,7 +142,16 @@
// set up addressing properties
String address = client.getEndpointMetaData().getEndpointAddress();
String action = RMConstant.TERMINATE_SEQUENCE_WSA_ACTION;
- AddressingProperties props =
AddressingClientUtil.createAnonymousProps(action, address);
+ AddressingProperties props = null;
+ if (this.client.getWSRMSequence().getBackPort() != null)
+ {
+ props = AddressingClientUtil.createDefaultProps(action, address);
+
props.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.client.getWSRMSequence().getBackPort()));
+ }
+ else
+ {
+ props = AddressingClientUtil.createAnonymousProps(action, address);
+ }
// prepare WS-RM request context
QName terminateSequenceQN =
Provider.get().getConstants().getTerminateSequenceQName();
Map rmRequestContext = new HashMap();
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.backchannel;
+
+import javax.management.MBeanServer;
+
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.coyote.RequestMap;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+
+/**
+ * TODO: Add comment
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Nov 20, 2007
+ */
+public final class RMBackPortsInvocationHandler implements ServerInvocationHandler
+{
+ public RMBackPortsInvocationHandler()
+ {
+
+ }
+
+ public void addListener(InvokerCallbackHandler arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object invoke(InvocationRequest arg0) throws Throwable
+ {
+ RequestMap rm = (RequestMap)arg0.getRequestPayload();
+ System.out.println("... locator ..." + arg0.getLocator());
+ System.out.println("... subsystem ..." + arg0.getSubsystem());
+ System.out.println("... parameter ..." + arg0.getParameter());
+ System.out.println("... parameter ..." +
arg0.getParameter().getClass().getName());
+ System.out.println("... method ..." +
rm.get(HTTPMetadataConstants.METHODTYPE));
+ System.out.println("... path ..." + rm.get(HTTPMetadataConstants.PATH));
+ System.out.println("return ..." + arg0.getReturnPayload());
+ return null;
+ }
+
+ public void removeListener(InvokerCallbackHandler arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setInvoker(ServerInvoker arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMBeanServer(MBeanServer arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.backchannel;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.ws.extensions.wsrm.client_api.RMException;
+
+/**
+ * Back ports server used by addressable clients
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Nov 20, 2007
+ */
+public final class RMBackPortsServer implements Runnable
+{
+ private static final Logger LOG = Logger.getLogger(RMBackPortsServer.class);
+ private static final Lock CLASS_LOCK = new ReentrantLock();
+ private static final long WAIT_PERIOD = 100;
+ private static RMBackPortsServer INSTANCE;
+
+ private final Object instanceLock = new Object();
+ private final Connector connector;
+ private final String scheme;
+ private final String host;
+ private final int port;
+ private boolean started;
+ private boolean stopped;
+ private boolean terminated;
+
+ private RMBackPortsServer(String scheme, String host, int port)
+ throws RMException
+ {
+ super();
+ this.scheme = scheme;
+ this.host = host;
+ this.port = port;
+ try
+ {
+ InvokerLocator il = new InvokerLocator(this.scheme + "://" + this.host
+ ":" + this.port);
+ connector = new Connector();
+ connector.setInvokerLocator(il.getLocatorURI());
+ connector.create();
+
+ RMBackPortsInvocationHandler handler = new RMBackPortsInvocationHandler();
+ connector.addInvocationHandler("wsrmBackPortsHandler", handler);
+ connector.start();
+ LOG.debug("WS-RM Backports Server started on: " +
il.getLocatorURI());
+ }
+ catch (Exception e)
+ {
+ LOG.warn(e.getMessage(), e);
+ throw new RMException(e.getMessage(), e);
+ }
+ }
+
+ public final String getScheme()
+ {
+ return this.scheme;
+ }
+
+ public final String getHost()
+ {
+ return this.host;
+ }
+
+ public final int getPort()
+ {
+ return this.port;
+ }
+
+ public final void run()
+ {
+ synchronized (this.instanceLock)
+ {
+ if (this.started)
+ return;
+
+ this.started = true;
+
+ while (this.stopped == false)
+ {
+ try
+ {
+ this.instanceLock.wait(WAIT_PERIOD);
+ LOG.debug("serving requests");
+ }
+ catch (InterruptedException ie)
+ {
+ LOG.warn(ie.getMessage(), ie);
+ }
+ }
+ try
+ {
+ connector.stop();
+ }
+ finally
+ {
+ LOG.debug("terminated");
+ this.terminated = true;
+ }
+ }
+ }
+
+ public final void terminate()
+ {
+ synchronized (this.instanceLock)
+ {
+ if (this.stopped == true)
+ return;
+
+ this.stopped = true;
+ LOG.debug("termination forced");
+ while (this.terminated == false)
+ {
+ try
+ {
+ LOG.debug("waiting for termination");
+ this.instanceLock.wait(WAIT_PERIOD);
+ }
+ catch (InterruptedException ie)
+ {
+ LOG.warn(ie.getMessage(), ie);
+ }
+ }
+ }
+ }
+
+ /**
+ * Starts back ports server on the background if method is called for the first time
+ * @param scheme protocol
+ * @param host hostname
+ * @param port port
+ * @return WS-RM back ports server
+ * @throws RMException
+ */
+ public static RMBackPortsServer getInstance(String scheme, String host, int port)
+ throws RMException
+ {
+ CLASS_LOCK.lock();
+ try
+ {
+ if (INSTANCE == null)
+ {
+ INSTANCE = new RMBackPortsServer(scheme, host, (port == -1) ? 80 : port);
+ // forking back ports server
+ Thread t = new Thread(INSTANCE);
+ t.setDaemon(true);
+ t.start();
+ // registering shutdown hook
+ final RMBackPortsServer server = INSTANCE;
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ public void run()
+ {
+ server.terminate();
+ }
+ }, "RMBackPortsServerShutdownHook"));
+ }
+ else
+ {
+ boolean schemeEquals = INSTANCE.getScheme().equals(scheme);
+ boolean hostEquals = INSTANCE.getHost().equals(host);
+ boolean portEquals = INSTANCE.getPort() == ((port == -1) ? 80 : port);
+ if ((schemeEquals == false) || (hostEquals == false) || (portEquals ==
false))
+ throw new IllegalArgumentException();
+ }
+ return INSTANCE;
+ }
+ finally
+ {
+ CLASS_LOCK.unlock();
+ }
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -30,5 +30,11 @@
*/
public interface RMProvider
{
- RMSequence createSequence() throws RMException;
+ /**
+ * Creates new WS-RM sequence
+ * @param addressableClient
+ * @return created sequence
+ * @throws RMException
+ */
+ RMSequence createSequence(boolean addressableClient) throws RMException;
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -25,11 +25,11 @@
public interface RMSequence
{
+ String getId() throws RMException;
void discard() throws RMException;
boolean isDiscarded() throws RMException;
void terminate() throws RMException;
boolean isTerminated() throws RMException;
- String getId() throws RMException;
boolean isCompleted() throws RMException;
boolean isCompleted(int timeAmount, TimeUnit timeUnit) throws RMException;
}
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -54,6 +54,7 @@
private String targetNS = "http://wsrm.jaxws.ws.test.jboss.org/";
private OneWayServiceIface proxy;
private final boolean emulatorOn =
Boolean.parseBoolean((String)props.get("emulator"));
+ private final boolean addressable =
Boolean.parseBoolean((String)props.get("addressable"));
private final String serviceURL = "http://" + getServerHost() +
":" + props.getProperty("port") +
props.getProperty("path");
static
@@ -96,7 +97,7 @@
if (emulatorOn)
{
RMProvider wsrmProvider = (RMProvider)proxy;
- sequence = wsrmProvider.createSequence();
+ sequence = wsrmProvider.createSequence(addressable);
System.out.println("Created sequence with id=" + sequence.getId());
}
setAddrProps(proxy, "http://useless/action1", serviceURL);
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java 2007-11-20
16:44:29 UTC (rev 5078)
@@ -33,7 +33,6 @@
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
-import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
@@ -62,6 +61,7 @@
private boolean asyncHandlerCalled;
private ReqResServiceIface proxy;
private final boolean emulatorOn =
Boolean.parseBoolean((String)props.get("emulator"));
+ private final boolean addressable =
Boolean.parseBoolean((String)props.get("addressable"));
static
{
@@ -179,7 +179,7 @@
if (emulatorOn)
{
RMProvider wsrmProvider = (RMProvider)proxyObject;
- sequence = wsrmProvider.createSequence();
+ sequence = wsrmProvider.createSequence(addressable);
System.out.println("Created sequence with id=" + sequence.getId());
}
setAddrProps(proxy, "http://useless/action", serviceURL);
Modified:
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties
===================================================================
---
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties 2007-11-20
16:44:29 UTC (rev 5078)
@@ -4,3 +4,4 @@
#archives=jaxws-wsrm.war, jaxws-wsrm-client.jar
archives=jaxws-wsrm-one-way-emulator.war, jaxws-wsrm-client.jar
emulator=true
+addressable=true
\ No newline at end of file
Modified:
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties
===================================================================
---
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties 2007-11-20
15:55:19 UTC (rev 5077)
+++
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties 2007-11-20
16:44:29 UTC (rev 5078)
@@ -3,4 +3,5 @@
path=/jaxws-wsrm-req-res-emulator/ReqResService
#archives=jaxws-wsrm.war, jaxws-wsrm-client.jar
archives=jaxws-wsrm-req-res-emulator.war, jaxws-wsrm-client.jar
-emulator=true
\ No newline at end of file
+emulator=true
+addressable=true
\ No newline at end of file