JBossWS SVN: r10249 - stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-06-29 06:05:41 -0400 (Mon, 29 Jun 2009)
New Revision: 10249
Added:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/NettyClient.java
Modified:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
Log:
Refactoring, new NettyClient
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-29 09:43:28 UTC (rev 10248)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-29 10:05:41 UTC (rev 10249)
@@ -22,51 +22,19 @@
package org.jboss.ws.core.client;
import java.io.IOException;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.concurrent.Executors;
-import javax.xml.rpc.Stub;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
-import javax.xml.ws.BindingProvider;
import javax.xml.ws.addressing.EndpointReference;
import org.jboss.logging.Logger;
-import org.jboss.netty.bootstrap.ClientBootstrap;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBufferOutputStream;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFactory;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
-import org.jboss.netty.handler.codec.http.DefaultHttpChunk;
-import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
-import org.jboss.netty.handler.codec.http.HttpChunk;
-import org.jboss.netty.handler.codec.http.HttpHeaders;
-import org.jboss.netty.handler.codec.http.HttpMessage;
-import org.jboss.netty.handler.codec.http.HttpMethod;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpVersion;
-import org.jboss.security.Base64Encoder;
-import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.MessageTrace;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.WSTimeoutException;
-import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extensions.wsrm.transport.RMChannel;
import org.jboss.ws.extensions.wsrm.transport.RMTransportHelper;
-import org.jboss.ws.feature.FastInfosetFeature;
-import org.jboss.ws.metadata.config.CommonConfig;
-import org.jboss.ws.metadata.config.EndpointProperty;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
* SOAPConnection implementation.
@@ -78,6 +46,7 @@
*
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ * @author alessio.soldano(a)jboss.com
*
* @since 02-Feb-2005
*/
@@ -86,7 +55,7 @@
// provide logging
private static Logger log = Logger.getLogger(HTTPRemotingConnection.class);
- private static final int DEFAULT_CHUNK_SIZE = 1024;
+// private static final int DEFAULT_CHUNK_SIZE = 1024;
// private Map<String, Object> clientConfig = new HashMap<String, Object>();
@@ -116,7 +85,7 @@
// }
private boolean closed;
- private Integer chunkSize = new Integer(DEFAULT_CHUNK_SIZE);
+ private Integer chunkSize;
private static final RMChannel RM_CHANNEL = RMChannel.getInstance();
@@ -163,7 +132,6 @@
if (closed)
throw new IOException("Connection is already closed");
- Long timeout = null;
String targetAddress;
Map<String, Object> callProps = new HashMap<String, Object>();
@@ -172,12 +140,6 @@
EndpointInfo epInfo = (EndpointInfo)endpoint;
targetAddress = epInfo.getTargetAddress();
callProps = epInfo.getProperties();
-
- if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
- {
- timeout = new Long(callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT).toString());
- }
-
}
else if (endpoint instanceof EndpointReference)
{
@@ -189,285 +151,42 @@
targetAddress = endpoint.toString();
}
- //Netty client
- UnMarshaller unmarshaller = getUnmarshaller();
-
- ChannelFactory factory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
- // ChannelFactory factory = new NioClientSocketChannelFactory(clientExecutor, clientExecutor);
-
- ClientBootstrap bootstrap = new ClientBootstrap(factory);
- WSClientPipelineFactory channelPipelineFactory = new WSClientPipelineFactory();
- WSResponseHandler responseHandler = null;
- if (!oneway || maintainSession)
- {
- responseHandler = new WSResponseHandler(unmarshaller);
- channelPipelineFactory.setResponseHandler(responseHandler);
- }
- bootstrap.setPipelineFactory(channelPipelineFactory);
-
if (RMTransportHelper.isRMMessage(callProps))
{
- // try
- // {
- // RMMetadata rmMetadata = new RMMetadata(null, targetAddress, marshaller, unmarshaller, callProps, metadata, null); //TODO!! remoting version, client config, etc.
- // return RM_CHANNEL.send(reqMessage, rmMetadata);
- // }
- // catch (Throwable t)
- // {
- // IOException io = new IOException();
- // io.initCause(t);
- // throw io;
- // }
+// try
+// {
+// RMMetadata rmMetadata = new RMMetadata(null, targetAddress, marshaller, unmarshaller, callProps, metadata, null); //TODO!! remoting version, client config, etc.
+// return RM_CHANNEL.send(reqMessage, rmMetadata);
+// }
+// catch (Throwable t)
+// {
+// IOException io = new IOException();
+// io.initCause(t);
+// throw io;
+// }
return null; //TODO!!!
}
else
{
- Channel channel = null;
- try
+ NettyClient client = new NettyClient(getMarshaller(), getUnmarshaller());
+ if (chunkSize != null)
{
- //Start the connection attempt
- URL target;
- try
- {
- target = new URL(targetAddress);
- }
- catch (MalformedURLException e)
- {
- throw new RuntimeException("Invalid address: " + targetAddress, e);
- }
- ChannelFuture future = bootstrap.connect(getSocketAddress(target));
-
- //Wait until the connection attempt succeeds or fails
- awaitUninterruptibly(future, timeout);
- if (!future.isSuccess())
- {
- IOException io = new IOException("Could not connect to " + target.getHost());
- io.initCause(future.getCause());
- factory.releaseExternalResources();
- throw io;
- }
- channel = future.getChannel();
-
- //Trace the outgoing message
- MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
-
- //Send the HTTP request
- HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage != null ? HttpMethod.POST : HttpMethod.GET, targetAddress);
- request.addHeader(HttpHeaders.Names.HOST, target.getHost());
- request.addHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
- Map<String, Object> additionalHeaders = new HashMap<String, Object>();
- populateHeaders(reqMessage, additionalHeaders);
- setAdditionalHeaders(request, additionalHeaders);
- setActualChunkedLength(request);
- setAuthorization(request, callProps);
-
- writeRequest(channel, request, reqMessage);
-
- if (oneway && !maintainSession)
- {
- //No need to wait for the connection to be closed
- return null;
- }
- //Wait for the server to close the connection
- ChannelFuture closeFuture = channel.getCloseFuture();
- awaitUninterruptibly(closeFuture, timeout);
- if (responseHandler.getError() != null)
- {
- throw responseHandler.getError();
- }
- MessageAbstraction resMessage = null;
- Map<String, Object> resHeaders = null;
- if (!oneway)
- {
- //Get the response
- resMessage = responseHandler.getResponseMessage();
- resHeaders = responseHandler.getResponseHeaders();
- }
- //Update props with response headers (required to maintain session using cookies)
- callProps.clear();
- if (resHeaders != null)
- {
- callProps.putAll(resHeaders);
- }
-
- //Trace the incoming response message
- MessageTrace.traceMessage("Incoming Response Message", resMessage);
- return resMessage;
+ client.setChunkSize(chunkSize);
}
- catch (IOException ioe)
- {
- throw ioe;
- }
- catch (WSTimeoutException toe)
- {
- throw toe;
- }
- catch (Throwable t)
- {
- IOException io = new IOException("Could not transmit message");
- io.initCause(t);
- throw io;
- }
- finally
- {
- if (channel != null)
- {
- channel.close();
- }
- //Shut down executor threads to exit
- factory.releaseExternalResources();
- }
+
+ Map<String, Object> additionalHeaders = new HashMap<String, Object>();
+ populateHeaders(reqMessage, additionalHeaders);
+ //Trace the outgoing message
+ MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
+ MessageAbstraction resMessage = (MessageAbstraction)client.invoke(reqMessage, targetAddress, !oneway || maintainSession, additionalHeaders, callProps);
+ //Trace the incoming response message
+ MessageTrace.traceMessage("Incoming Response Message", resMessage);
+ return resMessage;
}
}
- private InetSocketAddress getSocketAddress(URL target)
- {
- int port = target.getPort();
- if (port < 0)
- {
- //use default port
- String protocol = target.getProtocol();
- if ("http".equalsIgnoreCase(protocol))
- {
- port = 80;
- }
- else if ("https".equalsIgnoreCase(protocol))
- {
- port = 443;
- }
- }
- return new InetSocketAddress(target.getHost(), port);
- }
- private void writeRequest(Channel channel, HttpRequest request, MessageAbstraction reqMessage) throws IOException
- {
- if (reqMessage == null)
- {
- channel.write(request);
- }
- else
- {
- ChannelBuffer content = ChannelBuffers.dynamicBuffer();
- OutputStream os = new ChannelBufferOutputStream(content);
- getMarshaller().write(reqMessage, os);
-
- int cs = chunkSize;
- if (cs > 0) //chunked encoding
- {
- request.addHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
- //write headers
- channel.write(request);
- //write content chunks
- int size = content.readableBytes();
- int cur = 0;
- while (cur < size)
- {
- int to = Math.min(cur + cs, size);
- HttpChunk chunk = new DefaultHttpChunk(content.slice(cur, to - cur));
- channel.write(chunk);
- cur = to;
- }
- //write last chunk
- channel.write(HttpChunk.LAST_CHUNK);
- }
- else
- {
- request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(content.readableBytes()));
- request.setContent(content);
- channel.write(request);
- }
- }
- }
- /**
- * Utility method for awaiting with or without timeout (timeout == null or <=0 implies not timeout)
- *
- * @param future
- * @param timeout
- * @throws WSTimeoutException
- */
- private static void awaitUninterruptibly(ChannelFuture future, Long timeout) throws WSTimeoutException
- {
- if (timeout != null && timeout.longValue() > 0)
- {
- boolean bool = future.awaitUninterruptibly(timeout);
- if (!bool)
- {
- throw new WSTimeoutException("Timeout after: " + timeout + "ms", timeout);
- }
- }
- else
- {
- future.awaitUninterruptibly();
- }
- }
-
- protected void setActualChunkedLength(HttpRequest message)
- {
- if (HttpMethod.POST.equals(message.getMethod()))
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- //We always use chunked transfer encoding
-// int chunkSizeValue = (chunkSize != null ? chunkSize : 1024);
- // Overwrite, through endpoint config
- if (msgContext != null)
- {
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- CommonConfig config = epMetaData.getConfig();
-
- String sizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
- if (sizeValue != null)
- chunkSize = Integer.valueOf(sizeValue);
- if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
- chunkSize = 0;
- }
- }
- }
-
- protected void setAuthorization(HttpMessage message, Map callProps) throws IOException
- {
- //Get authentication type, default to BASIC authetication
- String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- if (authType == null)
- authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
- String username = (String)callProps.get(Stub.USERNAME_PROPERTY);
- String password = (String)callProps.get(Stub.PASSWORD_PROPERTY);
- if (username == null || password == null)
- {
- username = (String)callProps.get(BindingProvider.USERNAME_PROPERTY);
- password = (String)callProps.get(BindingProvider.PASSWORD_PROPERTY);
- }
- if (username != null && password != null)
- {
- if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- {
- message.addHeader(HttpHeaders.Names.AUTHORIZATION, getBasicAuthHeader(username, password));
- }
- }
- }
-
- private static String getBasicAuthHeader(String username, String password) throws IOException
- {
- return "Basic " + Base64Encoder.encode(username + ":" + password);
- }
-
- protected void setAdditionalHeaders(HttpMessage message, Map<String, Object> headers)
- {
- for (String key : headers.keySet())
- {
- try
- {
- String header = (String)headers.get(key);
- message.addHeader(key, header.replaceAll("[\r\n\f]", " "));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
- }
-
protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
{
if (reqMessage != null)
Added: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/NettyClient.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/NettyClient.java (rev 0)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/NettyClient.java 2009-06-29 10:05:41 UTC (rev 10249)
@@ -0,0 +1,442 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core.client;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import javax.xml.rpc.Stub;
+import javax.xml.ws.BindingProvider;
+
+import org.jboss.netty.bootstrap.ClientBootstrap;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferOutputStream;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
+import org.jboss.netty.handler.codec.http.DefaultHttpChunk;
+import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
+import org.jboss.netty.handler.codec.http.HttpChunk;
+import org.jboss.netty.handler.codec.http.HttpHeaders;
+import org.jboss.netty.handler.codec.http.HttpMessage;
+import org.jboss.netty.handler.codec.http.HttpMethod;
+import org.jboss.netty.handler.codec.http.HttpRequest;
+import org.jboss.netty.handler.codec.http.HttpVersion;
+import org.jboss.security.Base64Encoder;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.StubExt;
+import org.jboss.ws.core.WSTimeoutException;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.feature.FastInfosetFeature;
+import org.jboss.ws.metadata.config.CommonConfig;
+import org.jboss.ws.metadata.config.EndpointProperty;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+/**
+ * A http client using Netty
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 29-Jun-2009
+ *
+ */
+public class NettyClient
+{
+ private Marshaller marshaller;
+ private UnMarshaller unmarshaller;
+ private Long timeout;
+ private static final int DEFAULT_CHUNK_SIZE = 1024;
+ //We always use chunked transfer encoding unless explicitely disabled by user
+ private Integer chunkSize = new Integer(DEFAULT_CHUNK_SIZE);
+ private Executor bossExecutor;
+ private Executor workerExecutor;
+
+ /**
+ * Construct a Netty client with the provided marshaller/unmarshaller.
+ *
+ * @param marshaller
+ * @param unmarshaller
+ */
+ public NettyClient(Marshaller marshaller, UnMarshaller unmarshaller)
+ {
+ this.marshaller = marshaller;
+ this.unmarshaller = unmarshaller;
+ this.bossExecutor = Executors.newCachedThreadPool();
+ this.workerExecutor = Executors.newCachedThreadPool();
+ }
+
+ /**
+ * Construct a Netty client with the provided marshaller/unmarshaller and executors.
+ *
+ * @param marshaller
+ * @param unmarshaller
+ * @param bossExecutor
+ * @param workerExecutor
+ */
+ public NettyClient(Marshaller marshaller, UnMarshaller unmarshaller, Executor bossExecutor, Executor workerExecutor)
+ {
+ this.marshaller = marshaller;
+ this.unmarshaller = unmarshaller;
+ this.bossExecutor = bossExecutor;
+ this.workerExecutor = workerExecutor;
+ }
+
+ /**
+ * Performs the invocation; a HTTP GET is performed when the reqMessage is null, otherwise a HTTP POST is performed.
+ *
+ * @param reqMessage The request message
+ * @param targetAddress The target address
+ * @param waitForResponse A boolean saying if the method should wait for the results before returning. Waiting is required for two-ways invocations
+ * and when maintaining sessions using cookies.
+ * @param additionalHeaders Additional http headers to be added to the request
+ * @param callProps
+ * @return
+ * @throws IOException
+ */
+ public Object invoke(Object reqMessage, String targetAddress, boolean waitForResponse, Map<String, Object> additionalHeaders, Map<String, Object> callProps)
+ throws IOException
+ {
+ ChannelFactory factory = new NioClientSocketChannelFactory(bossExecutor, workerExecutor);
+
+ ClientBootstrap bootstrap = new ClientBootstrap(factory);
+ WSClientPipelineFactory channelPipelineFactory = new WSClientPipelineFactory();
+ WSResponseHandler responseHandler = null;
+ if (waitForResponse)
+ {
+ responseHandler = new WSResponseHandler(unmarshaller);
+ channelPipelineFactory.setResponseHandler(responseHandler);
+ }
+ bootstrap.setPipelineFactory(channelPipelineFactory);
+
+ Channel channel = null;
+ try
+ {
+ setActualTimeout(callProps);
+ //Start the connection attempt
+ URL target;
+ try
+ {
+ target = new URL(targetAddress);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException("Invalid address: " + targetAddress, e);
+ }
+ ChannelFuture future = bootstrap.connect(getSocketAddress(target));
+
+ //Wait until the connection attempt succeeds or fails
+ awaitUninterruptibly(future, timeout);
+ if (!future.isSuccess())
+ {
+ IOException io = new IOException("Could not connect to " + target.getHost());
+ io.initCause(future.getCause());
+ factory.releaseExternalResources();
+ throw io;
+ }
+ channel = future.getChannel();
+
+ //Send the HTTP request
+ HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage != null ? HttpMethod.POST : HttpMethod.GET, targetAddress);
+ request.addHeader(HttpHeaders.Names.HOST, target.getHost());
+ request.addHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
+ setAdditionalHeaders(request, additionalHeaders);
+ setActualChunkedLength(request);
+ setAuthorization(request, callProps);
+
+ writeRequest(channel, request, reqMessage);
+
+ if (!waitForResponse)
+ {
+ //No need to wait for the connection to be closed
+ return null;
+ }
+ //Wait for the server to close the connection
+ ChannelFuture closeFuture = channel.getCloseFuture();
+ awaitUninterruptibly(closeFuture, timeout);
+ if (responseHandler.getError() != null)
+ {
+ throw responseHandler.getError();
+ }
+ Object resMessage = null;
+ Map<String, Object> resHeaders = null;
+ //Get the response
+ resMessage = responseHandler.getResponseMessage();
+ resHeaders = responseHandler.getResponseHeaders();
+ //Update props with response headers (required to maintain session using cookies)
+ callProps.clear();
+ if (resHeaders != null)
+ {
+ callProps.putAll(resHeaders);
+ }
+
+ return resMessage;
+ }
+ catch (IOException ioe)
+ {
+ throw ioe;
+ }
+ catch (WSTimeoutException toe)
+ {
+ throw toe;
+ }
+ catch (Throwable t)
+ {
+ IOException io = new IOException("Could not transmit message");
+ io.initCause(t);
+ throw io;
+ }
+ finally
+ {
+ if (channel != null)
+ {
+ channel.close();
+ }
+ //Shut down executor threads to exit
+ factory.releaseExternalResources();
+ }
+ }
+
+ private InetSocketAddress getSocketAddress(URL target)
+ {
+ int port = target.getPort();
+ if (port < 0)
+ {
+ //use default port
+ String protocol = target.getProtocol();
+ if ("http".equalsIgnoreCase(protocol))
+ {
+ port = 80;
+ }
+ else if ("https".equalsIgnoreCase(protocol))
+ {
+ port = 443;
+ }
+ }
+ return new InetSocketAddress(target.getHost(), port);
+ }
+
+ private void writeRequest(Channel channel, HttpRequest request, Object reqMessage) throws IOException
+ {
+ if (reqMessage == null)
+ {
+ channel.write(request);
+ }
+ else
+ {
+ ChannelBuffer content = ChannelBuffers.dynamicBuffer();
+ OutputStream os = new ChannelBufferOutputStream(content);
+ marshaller.write(reqMessage, os);
+
+ int cs = chunkSize;
+ if (cs > 0) //chunked encoding
+ {
+ os.flush();
+ request.addHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
+ //write headers
+ channel.write(request);
+ //write content chunks
+ int size = content.readableBytes();
+ int cur = 0;
+ while (cur < size)
+ {
+ int to = Math.min(cur + cs, size);
+ HttpChunk chunk = new DefaultHttpChunk(content.slice(cur, to - cur));
+ channel.write(chunk);
+ cur = to;
+ }
+ //write last chunk
+ channel.write(HttpChunk.LAST_CHUNK);
+ }
+ else
+ {
+ request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(content.readableBytes()));
+ request.setContent(content);
+ channel.write(request);
+ }
+ }
+ }
+
+ /**
+ * Utility method for awaiting with or without timeout (timeout == null or <=0 implies not timeout)
+ *
+ * @param future
+ * @param timeout
+ * @throws WSTimeoutException
+ */
+ private static void awaitUninterruptibly(ChannelFuture future, Long timeout) throws WSTimeoutException
+ {
+ if (timeout != null && timeout.longValue() > 0)
+ {
+ boolean bool = future.awaitUninterruptibly(timeout);
+ if (!bool)
+ {
+ throw new WSTimeoutException("Timeout after: " + timeout + "ms", timeout);
+ }
+ }
+ else
+ {
+ future.awaitUninterruptibly();
+ }
+ }
+
+ /**
+ * Set the actual chunk size according to the endpoint config overwrite and/or configured features.
+ *
+ * @param message
+ */
+ protected void setActualChunkedLength(HttpRequest message)
+ {
+ if (HttpMethod.POST.equals(message.getMethod()))
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ //Overwrite, through endpoint config
+ if (msgContext != null)
+ {
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ CommonConfig config = epMetaData.getConfig();
+
+ String sizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
+ if (sizeValue != null)
+ chunkSize = Integer.valueOf(sizeValue);
+ if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
+ chunkSize = 0;
+ }
+ }
+ }
+
+ /**
+ * Set the actual timeout according to specified caller properties
+ *
+ * @param callProps
+ */
+ protected void setActualTimeout(Map<String, Object> callProps)
+ {
+ if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
+ {
+ timeout = new Long(callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT).toString());
+ }
+ }
+
+ /**
+ * Set the required headers in the Netty's HttpMessage to allow for proper authorization.
+ *
+ * @param message
+ * @param callProps
+ * @throws IOException
+ */
+ protected void setAuthorization(HttpMessage message, Map<String, Object> callProps) throws IOException
+ {
+ //Get authentication type, default to BASIC authetication
+ String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ if (authType == null)
+ authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+ String username = (String)callProps.get(Stub.USERNAME_PROPERTY);
+ String password = (String)callProps.get(Stub.PASSWORD_PROPERTY);
+ if (username == null || password == null)
+ {
+ username = (String)callProps.get(BindingProvider.USERNAME_PROPERTY);
+ password = (String)callProps.get(BindingProvider.PASSWORD_PROPERTY);
+ }
+ if (username != null && password != null)
+ {
+ if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ {
+ message.addHeader(HttpHeaders.Names.AUTHORIZATION, getBasicAuthHeader(username, password));
+ }
+ }
+ }
+
+ private static String getBasicAuthHeader(String username, String password) throws IOException
+ {
+ return "Basic " + Base64Encoder.encode(username + ":" + password);
+ }
+
+ /**
+ * Copy the provided additional headers to the Netty's HttpMessage.
+ *
+ * @param message
+ * @param headers
+ */
+ protected void setAdditionalHeaders(HttpMessage message, Map<String, Object> headers)
+ {
+ for (String key : headers.keySet())
+ {
+ try
+ {
+ String header = (String)headers.get(key);
+ message.addHeader(key, header.replaceAll("[\r\n\f]", " "));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Set the Netty boss executor
+ *
+ * @param bossExecutor
+ */
+ public void setBossExecutor(Executor bossExecutor)
+ {
+ this.bossExecutor = bossExecutor;
+ }
+
+ /**
+ * Set the Netty worker executor
+ *
+ * @param workerExecutor
+ */
+ public void setWorkerExecutor(Executor workerExecutor)
+ {
+ this.workerExecutor = workerExecutor;
+ }
+
+ /**
+ *
+ * @return The current chunk size
+ */
+ public Integer getChunkSize()
+ {
+ return chunkSize;
+ }
+
+ /**
+ * Set the chunk size for chunked transfer encoding.
+ * The default chunk size is 1024 bytes.
+ *
+ * @param chunkSize
+ */
+ public void setChunkSize(Integer chunkSize)
+ {
+ this.chunkSize = chunkSize;
+ }
+}
Property changes on: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/NettyClient.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java 2009-06-29 09:43:28 UTC (rev 10248)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java 2009-06-29 10:05:41 UTC (rev 10249)
@@ -31,7 +31,6 @@
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.handler.codec.http.HttpResponse;
-import org.jboss.ws.core.MessageAbstraction;
/**
* A Netty channel upstream handler that receives MessageEvent
@@ -45,7 +44,7 @@
public class WSResponseHandler extends SimpleChannelUpstreamHandler
{
private UnMarshaller unmarshaller;
- private MessageAbstraction responseMessage;
+ private Object responseMessage;
private Map<String, Object> responseHeaders;
private Throwable error;
@@ -72,7 +71,7 @@
}
ChannelBuffer content = response.getContent();
- this.responseMessage = (MessageAbstraction)unmarshaller.read(content.readable() ? new ChannelBufferInputStream(content) : null, responseHeaders);
+ this.responseMessage = unmarshaller.read(content.readable() ? new ChannelBufferInputStream(content) : null, responseHeaders);
}
catch (Throwable t)
{
@@ -91,7 +90,7 @@
this.responseHeaders = new HashMap<String, Object>();
}
- public MessageAbstraction getResponseMessage()
+ public Object getResponseMessage()
{
return this.responseMessage;
}
14 years, 10 months
JBossWS SVN: r10248 - framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-06-29 05:43:28 -0400 (Mon, 29 Jun 2009)
New Revision: 10248
Modified:
framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java
framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/VirtualHostDeploymentAspect.java
Log:
[JBWS-2332][JBWS-2382] refactoring (WIP)
Modified: framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java
===================================================================
--- framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java 2009-06-29 09:41:06 UTC (rev 10247)
+++ framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java 2009-06-29 09:43:28 UTC (rev 10248)
@@ -193,6 +193,6 @@
{
String name = aspect.getClass().getName();
name = name.substring(name.lastIndexOf(".") + 1);
- log.debug(name + ":" + method);
+ log.debug("[" + this.name + "]" + name + ":" + method);
}
}
Modified: framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/VirtualHostDeploymentAspect.java
===================================================================
--- framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/VirtualHostDeploymentAspect.java 2009-06-29 09:41:06 UTC (rev 10247)
+++ framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/deployment/VirtualHostDeploymentAspect.java 2009-06-29 09:43:28 UTC (rev 10248)
@@ -28,6 +28,7 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
/**
* A deployer that assigns the virtual hosts to the service
@@ -41,12 +42,14 @@
@Override
public void create(Deployment dep)
{
- String[] virtualHosts = dep.getService().getVirtualHosts();
- if (virtualHosts == null)
+ if ( DeploymentType.JAXWS_EJB3.equals(dep.getType()))
{
- dep.getService().setVirtualHosts(getExplicitVirtualHosts(dep));
+ String[] virtualHosts = dep.getService().getVirtualHosts();
+ if (virtualHosts == null)
+ {
+ dep.getService().setVirtualHosts(getExplicitVirtualHosts(dep));
+ }
}
-
}
protected String[] getExplicitVirtualHosts(Deployment dep)
14 years, 10 months
JBossWS SVN: r10247 - in container/jboss50/branches/ropalka-jboss510/src/main: java/org/jboss/wsf/container/jboss50/transport and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-06-29 05:41:06 -0400 (Mon, 29 Jun 2009)
New Revision: 10247
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
Log:
[JBWS-2332][JBWS-2382] refactoring (WIP)
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java 2009-06-29 08:12:19 UTC (rev 10246)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java 2009-06-29 09:41:06 UTC (rev 10247)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployment.tomcat;
-
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-
-/**
- * A deployer that modifies the web.xml meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class ModifyWebMetaDataDeploymentAspect extends DeploymentAspect
-{
- private WebMetaDataModifier webMetaDataModifier;
-
- public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
- {
- this.webMetaDataModifier = webMetaDataModifier;
- }
-
- @Override
- public void create(Deployment dep)
- {
- try
- {
- webMetaDataModifier.modifyMetaData(dep);
- }
- catch (Exception ex)
- {
- WSFDeploymentException.rethrow(ex);
- }
- }
-}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java 2009-06-29 08:12:19 UTC (rev 10246)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppGeneratorDeploymentAspect.java 2009-06-29 09:41:06 UTC (rev 10247)
@@ -42,6 +42,7 @@
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
@@ -71,22 +72,18 @@
@Override
public void create(Deployment dep)
{
- String typeStr = dep.getType().toString();
- if (typeStr.endsWith("EJB21"))
+ final DeploymentType deploymentType = dep.getType();
+
+ if (DeploymentType.JAXRPC_EJB21.equals(deploymentType))
{
JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB21);
dep.addAttachment(JBossWebMetaData.class, jbwmd);
}
- else if (typeStr.endsWith("EJB3"))
+ else if (DeploymentType.JAXWS_EJB3.equals(deploymentType))
{
JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, securityHandlerEJB3);
dep.addAttachment(JBossWebMetaData.class, jbwmd);
}
- else
- {
- JBossWebMetaData jbwmd = generatWebDeployment((ArchiveDeployment)dep, null);
- dep.addAttachment(JBossWebMetaData.class, jbwmd);
- }
}
protected JBossWebMetaData generatWebDeployment(ArchiveDeployment dep, SecurityHandler securityHandler)
Modified: container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-06-29 08:12:19 UTC (rev 10246)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-06-29 09:41:06 UTC (rev 10247)
@@ -254,12 +254,6 @@
<property name="provides">RegisteredEndpoint</property>
</bean>
- <bean name="WSModifyWebMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.tomcat.ModifyWebMetaDataDeploymentAspect">
- <property name="requires">ContextProperties, StackDescriptor</property>
- <property name="provides">WebMetaData</property>
- <property name="webMetaDataModifier"><inject bean="WSWebMetaDataModifier"/></property>
- </bean>
-
<bean name="WSRuntimeLoaderDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.RuntimeLoaderDeploymentAspect">
<property name="requires">ContainerMetaData</property>
<property name="provides">RuntimeLoader</property>
@@ -271,7 +265,8 @@
</bean>
<bean name="WSWebAppDeploymentAspect" class="org.jboss.wsf.container.jboss50.transport.WebAppDeploymentAspect">
- <property name="requires">WebMetaData, ContextProperties</property>
+ <property name="requires">WebMetaData, ContextProperties, StackDescriptor</property>
+ <property name="provides">WebMetaData</property>
<property name="webMetaDataModifier"><inject bean="WSWebMetaDataModifier"/></property>
</bean>
@@ -296,6 +291,7 @@
<property name="aspects">
<set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
<inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSVirtualHostDeploymentAspect"/>
<inject bean="WSInjectionMetaDataDeploymentAspect"/>
<inject bean="WSContextRootDeploymentAspect"/>
<inject bean="WSEndpointAddressDeploymentAspect"/>
@@ -303,8 +299,9 @@
<inject bean="WSEndpointMetricsDeploymentAspect"/>
<inject bean="WSEndpointNameDeploymentAspect"/>
<inject bean="WSEndpointRegistryDeploymentAspect"/>
- <inject bean="WSModifyWebMetaDataDeploymentAspect"/>
<inject bean="WSURLPatternDeploymentAspect"/>
+ <inject bean="WSWebAppDeploymentAspect"/>
+ <inject bean="WSWebAppGeneratorDeploymentAspect"/>
</set>
</property>
</bean>
14 years, 10 months
JBossWS SVN: r10246 - container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-06-29 04:12:19 -0400 (Mon, 29 Jun 2009)
New Revision: 10246
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java
Log:
[JBWS-2332][JBWS-2382] refactoring (WIP)
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -21,23 +21,24 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.*;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
/**
* An abstract web service deployer.
*
* @author Thomas.Diesler(a)jboss.org
* @author Heiko.Braun(a)jboss.com
- *
- * @since 25-Apr-2007
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
public abstract class AbstractDeployerHook implements DeployerHook
{
- // provide logging
+
protected final Logger log = Logger.getLogger(getClass());
private DeploymentAspectManager deploymentAspectManager;
@@ -61,15 +62,38 @@
return deploymentAspectManager;
}
- /** Return true if this deployment should be ignored
- */
- public boolean ignoreDeployment(DeploymentUnit unit)
+ public void deploy( final DeploymentUnit unit ) throws DeploymentException
{
- String name = unit.getName();
- return (name.startsWith("jboss:id=") && name.indexOf("service=jacc") > 0);
+ if ( this.isWebServiceDeployment( unit ) )
+ {
+ log.debug( "deploy: " + unit.getName() );
+ final Deployment dep = this.getDeployment( unit );
+ unit.addAttachment( Deployment.class, dep );
+ this.getDeploymentAspectManager().deploy( dep );
+ }
}
- /** Get the deployment type this deployer can handle
- */
+ public void undeploy( final DeploymentUnit unit )
+ {
+ final Deployment dep = this.getDeployment( unit );
+ if ( dep != null )
+ {
+ log.debug( "undeploy: " + unit.getName() );
+ this.getDeploymentAspectManager().undeploy( dep );
+ }
+ }
+
+ private boolean isWebServiceDeployment( final DeploymentUnit unit )
+ {
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ return this.getDeploymentType().equals( deploymentType );
+ }
+
+ private Deployment getDeployment( final DeploymentUnit unit )
+ {
+ return this.isWebServiceDeployment( unit ) ? unit.getAttachment( Deployment.class ) : null;
+ }
+
public abstract Deployment.DeploymentType getDeploymentType();
+
}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-
-/**
- * An abstract web service deployer.
- *
- * deploy(unit)
- * if(isWebServiceDeployment)
- * dep = createDeployment(unit)
- * deploy(dep)
- *
- * undeploy(unit)
- * dep = getDeployment(unit)
- * undeploy(dep)
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class ArchiveDeployerHook extends AbstractDeployerHook
-{
-
- public void deploy(DeploymentUnit unit) throws DeploymentException
- {
- if (ignoreDeployment(unit))
- return;
-
- if (isWebServiceDeployment(unit))
- {
- log.debug("deploy: " + unit.getName());
- Deployment dep = getDeployment(unit);
- unit.addAttachment(Deployment.class, dep);
- getDeploymentAspectManager().deploy(dep);
- }
- }
-
- public void undeploy(DeploymentUnit unit)
- {
- if (ignoreDeployment(unit))
- return;
-
- Deployment dep = getDeployment(unit);
- if (dep != null)
- {
- log.debug("undeploy: " + unit.getName());
- getDeploymentAspectManager().undeploy(dep);
- }
- }
-
- /** Depending on the type of deployment, this method should return true
- * if the deployment contains web service endpoints.
- */
- public boolean isWebServiceDeployment(DeploymentUnit unit)
- {
- final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
- return this.getDeploymentType().equals( deploymentType );
- }
-
- /** Get the Deployment for a given DeploymentUnit
- */
- public Deployment getDeployment(DeploymentUnit unit)
- {
- Deployment dep = unit.getAttachment(Deployment.class);
- return (dep != null && dep.getType() == getDeploymentType() ? dep : null);
- }
-
-}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -29,7 +29,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
-public class JAXRPCDeployerHookEJB21 extends ArchiveDeployerHook
+public class JAXRPCDeployerHookEJB21 extends AbstractDeployerHook
{
/**
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPostJSE.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -29,7 +29,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
-public class JAXRPCDeployerHookPostJSE extends ArchiveDeployerHook
+public class JAXRPCDeployerHookPostJSE extends AbstractDeployerHook
{
/**
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -29,7 +29,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
-public class JAXRPCDeployerHookPreJSE extends ArchiveDeployerHook
+public class JAXRPCDeployerHookPreJSE extends AbstractDeployerHook
{
/**
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -29,7 +29,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
-public class JAXWSDeployerHookEJB3 extends ArchiveDeployerHook
+public class JAXWSDeployerHookEJB3 extends AbstractDeployerHook
{
/**
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPostJSE.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -29,7 +29,7 @@
* @author Heiko.Braun(a)jboss.com
* @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
-public class JAXWSDeployerHookPostJSE extends ArchiveDeployerHook
+public class JAXWSDeployerHookPostJSE extends AbstractDeployerHook
{
/**
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java 2009-06-26 16:31:41 UTC (rev 10245)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java 2009-06-29 08:12:19 UTC (rev 10246)
@@ -29,7 +29,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
*/
-public class JAXWSDeployerHookPreJSE extends ArchiveDeployerHook
+public class JAXWSDeployerHookPreJSE extends AbstractDeployerHook
{
/**
14 years, 10 months
JBossWS SVN: r10245 - stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-06-26 12:31:41 -0400 (Fri, 26 Jun 2009)
New Revision: 10245
Modified:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
Log:
Chunks handling
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 15:14:57 UTC (rev 10244)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 16:31:41 UTC (rev 10245)
@@ -85,6 +85,8 @@
{
// provide logging
private static Logger log = Logger.getLogger(HTTPRemotingConnection.class);
+
+ private static final int DEFAULT_CHUNK_SIZE = 1024;
// private Map<String, Object> clientConfig = new HashMap<String, Object>();
@@ -114,7 +116,7 @@
// }
private boolean closed;
- private Integer chunkedLength;
+ private Integer chunkSize = new Integer(DEFAULT_CHUNK_SIZE);
private static final RMChannel RM_CHANNEL = RMChannel.getInstance();
@@ -133,14 +135,14 @@
this.closed = closed;
}
- public Integer getChunkedLength()
+ public Integer getChunkSize()
{
- return chunkedLength;
+ return chunkSize;
}
- public void setChunkedLength(Integer chunkedLength)
+ public void setChunkSize(Integer chunkSize)
{
- this.chunkedLength = chunkedLength;
+ this.chunkSize = chunkSize;
}
public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
@@ -348,19 +350,29 @@
ChannelBuffer content = ChannelBuffers.dynamicBuffer();
OutputStream os = new ChannelBufferOutputStream(content);
getMarshaller().write(reqMessage, os);
- if (request.isChunked())
+
+ int cs = chunkSize;
+ if (cs > 0) //chunked encoding
{
- //TODO!! handle chunks here...
+ request.addHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
+ //write headers
channel.write(request);
-
- HttpChunk chunk = new DefaultHttpChunk(content);
- channel.write(chunk);
-
+ //write content chunks
+ int size = content.readableBytes();
+ int cur = 0;
+ while (cur < size)
+ {
+ int to = Math.min(cur + cs, size);
+ HttpChunk chunk = new DefaultHttpChunk(content.slice(cur, to - cur));
+ channel.write(chunk);
+ cur = to;
+ }
+ //write last chunk
channel.write(HttpChunk.LAST_CHUNK);
}
else
{
- request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(content.writerIndex()));
+ request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(content.readableBytes()));
request.setContent(content);
channel.write(request);
}
@@ -396,7 +408,7 @@
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
//We always use chunked transfer encoding
- int chunkSizeValue = (chunkedLength != null ? chunkedLength : 1024);
+// int chunkSizeValue = (chunkSize != null ? chunkSize : 1024);
// Overwrite, through endpoint config
if (msgContext != null)
{
@@ -405,14 +417,10 @@
String sizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
if (sizeValue != null)
- chunkSizeValue = Integer.valueOf(sizeValue);
+ chunkSize = Integer.valueOf(sizeValue);
if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
- chunkSizeValue = 0;
+ chunkSize = 0;
}
- if (chunkSizeValue > 0)
- {
- message.addHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
- }
}
}
14 years, 10 months
JBossWS SVN: r10244 - stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-06-26 11:14:57 -0400 (Fri, 26 Jun 2009)
New Revision: 10244
Modified:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
Log:
Clean up
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 14:51:47 UTC (rev 10243)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 15:14:57 UTC (rev 10244)
@@ -120,10 +120,7 @@
public HTTPRemotingConnection()
{
- // // HTTPClientInvoker connect sends gratuitous POST
- // // http://jira.jboss.com/jira/browse/JBWS-711
- // clientConfig.put(Client.ENABLE_LEASE, false);
- // clientConfig.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "true");
+
}
public boolean isClosed()
@@ -158,7 +155,6 @@
*/
public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway, boolean maintainSession) throws IOException
{
-// System.out.println("Entro...");
if (endpoint == null)
throw new IllegalArgumentException("Given endpoint cannot be null");
@@ -192,7 +188,6 @@
}
//Netty client
- // Map<String, Object> metadata = getMetadata(reqMessage, callProps);
UnMarshaller unmarshaller = getUnmarshaller();
ChannelFactory factory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
@@ -228,15 +223,11 @@
Channel channel = null;
try
{
-// System.out.println(new Date() + " Inizio connection attempt...");
//Start the connection attempt
URL target;
try
{
- System.out.println("targetAddress: "+targetAddress);
target = new URL(targetAddress);
- System.out.println("target.getHost: "+target.getHost());
- System.out.println("target.getPort: "+target.getPort());
}
catch (MalformedURLException e)
{
@@ -270,7 +261,6 @@
writeRequest(channel, request, reqMessage);
-// System.out.println("oneway=" + oneway + " maintainSession=" + maintainSession);
if (oneway && !maintainSession)
{
//No need to wait for the connection to be closed
@@ -300,12 +290,10 @@
//Trace the incoming response message
MessageTrace.traceMessage("Incoming Response Message", resMessage);
-// System.out.println(new Date() + " Fatto.");
return resMessage;
}
catch (IOException ioe)
{
- ioe.printStackTrace();
throw ioe;
}
catch (WSTimeoutException toe)
@@ -314,21 +302,18 @@
}
catch (Throwable t)
{
- t.printStackTrace();
IOException io = new IOException("Could not transmit message");
io.initCause(t);
throw io;
}
finally
{
-// System.out.println("Mi preparo a rilasciare...");
if (channel != null)
{
channel.close();
}
//Shut down executor threads to exit
factory.releaseExternalResources();
-// System.out.println("Rilasciato");
}
}
}
@@ -391,7 +376,6 @@
*/
private static void awaitUninterruptibly(ChannelFuture future, Long timeout) throws WSTimeoutException
{
-// System.out.println(new Date() + " Inizio attesa...");
if (timeout != null && timeout.longValue() > 0)
{
boolean bool = future.awaitUninterruptibly(timeout);
@@ -404,7 +388,6 @@
{
future.awaitUninterruptibly();
}
-// System.out.println(new Date() + " Fine attesa.");
}
protected void setActualChunkedLength(HttpRequest message)
@@ -477,99 +460,6 @@
}
}
- // private Map<String, Object> createRemotingMetaData(MessageAbstraction reqMessage, Map callProps)
- // {
- // CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- //
- // Map<String, Object> metadata = new HashMap<String, Object>();
- //
- // // We need to unmarshall faults (HTTP 500)
- // // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
- // metadata.put("NoThrowOnError", "true");
- //
- // if (reqMessage != null)
- // {
- // populateHeaders(reqMessage, metadata);
- //
- // // Enable chunked encoding. This is the default size.
- // int chunkSizeValue = (chunkedLength != null ? chunkedLength : 1024);
- //
- // // Overwrite, through endpoint config
- // if (msgContext != null)
- // {
- // EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- // CommonConfig config = epMetaData.getConfig();
- //
- // String sizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
- // if (sizeValue != null)
- // chunkSizeValue = Integer.valueOf(sizeValue);
- //
- // if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
- // chunkSizeValue = 0;
- // }
- //
- // if (chunkSizeValue > 0)
- // {
- // clientConfig.put("chunkedLength", String.valueOf(chunkSizeValue));
- // }
- // else
- // {
- // clientConfig.remove("chunkedLength");
- // }
- // }
- // else
- // {
- // metadata.put("TYPE", "GET");
- // }
- //
- // if (callProps != null)
- // {
- // Iterator it = callProps.entrySet().iterator();
- //
- // // Get authentication type, default to BASIC authetication
- // String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- // if (authType == null)
- // authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
- //
- // while (it.hasNext())
- // {
- // Map.Entry entry = (Map.Entry)it.next();
- // String key = (String)entry.getKey();
- // Object val = entry.getValue();
- //
- // // pass properties to remoting meta data
- // if (metadataMap.containsKey(key))
- // {
- // String remotingKey = metadataMap.get(key);
- // if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
- // {
- // if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- // {
- // metadata.put(remotingKey, val);
- // }
- // else
- // {
- // log.warn("Ignore '" + key + "' with auth typy: " + authType);
- // }
- // }
- // else
- // {
- // metadata.put(remotingKey, val);
- // }
- // }
- //
- // // pass properties to remoting client config
- // if (configMap.containsKey(key))
- // {
- // String remotingKey = configMap.get(key);
- // clientConfig.put(remotingKey, val);
- // }
- // }
- // }
- //
- // return metadata;
- // }
-
protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
{
if (reqMessage != null)
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java 2009-06-26 14:51:47 UTC (rev 10243)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java 2009-06-26 15:14:57 UTC (rev 10244)
@@ -21,7 +21,6 @@
*/
package org.jboss.ws.core.client;
-import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -61,7 +60,6 @@
{
try
{
-// System.out.println(new Date() + " Message received");
reset();
HttpResponse response = (HttpResponse)e.getMessage();
@@ -74,9 +72,7 @@
}
ChannelBuffer content = response.getContent();
-// System.out.println(new Date() + " Unmarshall...");
this.responseMessage = (MessageAbstraction)unmarshaller.read(content.readable() ? new ChannelBufferInputStream(content) : null, responseHeaders);
-// System.out.println(new Date() + " Esco da message received...");
}
catch (Throwable t)
{
14 years, 10 months
JBossWS SVN: r10243 - in stack/native/branches/netty/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-06-26 10:51:47 -0400 (Fri, 26 Jun 2009)
New Revision: 10243
Modified:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java
Log:
default port number
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 14:18:13 UTC (rev 10242)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 14:51:47 UTC (rev 10243)
@@ -24,9 +24,8 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Date;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -231,19 +230,19 @@
{
// System.out.println(new Date() + " Inizio connection attempt...");
//Start the connection attempt
- URI target;
+ URL target;
try
{
System.out.println("targetAddress: "+targetAddress);
- target = new URI(targetAddress);
+ target = new URL(targetAddress);
System.out.println("target.getHost: "+target.getHost());
System.out.println("target.getPort: "+target.getPort());
}
- catch (URISyntaxException e)
+ catch (MalformedURLException e)
{
throw new RuntimeException("Invalid address: " + targetAddress, e);
}
- ChannelFuture future = bootstrap.connect(new InetSocketAddress(target.getHost(), target.getPort()));
+ ChannelFuture future = bootstrap.connect(getSocketAddress(target));
//Wait until the connection attempt succeeds or fails
awaitUninterruptibly(future, timeout);
@@ -260,7 +259,7 @@
MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
//Send the HTTP request
- HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage != null ? HttpMethod.POST : HttpMethod.GET, target.toASCIIString());
+ HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage != null ? HttpMethod.POST : HttpMethod.GET, targetAddress);
request.addHeader(HttpHeaders.Names.HOST, target.getHost());
request.addHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
Map<String, Object> additionalHeaders = new HashMap<String, Object>();
@@ -334,6 +333,25 @@
}
}
+ private InetSocketAddress getSocketAddress(URL target)
+ {
+ int port = target.getPort();
+ if (port < 0)
+ {
+ //use default port
+ String protocol = target.getProtocol();
+ if ("http".equalsIgnoreCase(protocol))
+ {
+ port = 80;
+ }
+ else if ("https".equalsIgnoreCase(protocol))
+ {
+ port = 443;
+ }
+ }
+ return new InetSocketAddress(target.getHost(), port);
+ }
+
private void writeRequest(Channel channel, HttpRequest request, MessageAbstraction reqMessage) throws IOException
{
if (reqMessage == null)
Modified: stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java
===================================================================
--- stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java 2009-06-26 14:18:13 UTC (rev 10242)
+++ stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java 2009-06-26 14:51:47 UTC (rev 10243)
@@ -114,7 +114,6 @@
assertNotNull(subscriptionTicket.getExpires());
assertTrue(subscriptionTicket.getExpires().getTime() > System.currentTimeMillis());
assertNotNull(subscriptionTicket.getSubscriptionManager());
- zzzz();
}
/**
@@ -136,7 +135,6 @@
{
// ignore expected exception
}
- zzzz();
}
public void testExceedsMaxLeaseTime() throws Exception
@@ -151,7 +149,6 @@
{
// ignore expected exception
}
- zzzz();
}
/**
@@ -178,7 +175,6 @@
{
// ignore expected exception
}
- zzzz();
}
public void testDispatch() throws Exception
@@ -191,7 +187,6 @@
Element payload = DOMUtils.parse(eventString);
subscriptionManager.dispatch(eventSourceNS, payload);
- zzzz();
}
public void testXPathFilter() throws Exception
@@ -203,14 +198,5 @@
Element event = DOMUtils.parse(eventString);
subscriptionManager.dispatch(eventSourceNS, event);
- zzzz();
}
-
- private void zzzz() {
- try
- {
- Thread.currentThread().sleep(30000);
- }
- catch (Exception e) {}
- }
}
14 years, 10 months
JBossWS SVN: r10242 - in stack/native/branches/netty: modules/client and 11 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-06-26 10:18:13 -0400 (Fri, 26 Jun 2009)
New Revision: 10242
Added:
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/Marshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/UnMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSClientPipelineFactory.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
Modified:
stack/native/branches/netty/modules/client/pom.xml
stack/native/branches/netty/modules/core/pom.xml
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/FastInfosetConnectionHTTP.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageUnMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/FastInfosetMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshaller.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshallerHTTP.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMessageAssembler.java
stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java
stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.bat
stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.sh
stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.bat
stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.sh
stack/native/branches/netty/modules/resources/src/main/resources/resources/default-deploy.conf
stack/native/branches/netty/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java
stack/native/branches/netty/pom.xml
stack/native/branches/netty/src/main/scripts/assembly-deploy-artifacts.xml
Log:
Netty client, first cut. This is really a WIP, RM completely disabled, correct chunks handling still to do, SSL / HTTPS not supported yet, further major refactoring required
Modified: stack/native/branches/netty/modules/client/pom.xml
===================================================================
--- stack/native/branches/netty/modules/client/pom.xml 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/client/pom.xml 2009-06-26 14:18:13 UTC (rev 10242)
@@ -49,7 +49,7 @@
<configuration>
<archive>
<manifestEntries>
- <Class-Path>jbossws-spi.jar jbossws-common.jar jbossws-framework.jar jbossws-native-core.jar jbossws-native-jaxrpc.jar jbossws-native-jaxws.jar jbossws-native-jaxws-ext.jar jbossws-native-saaj.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-remoting.jar jboss-xml-binding.jar policy.jar stax-api.jar wsdl4j.jar</Class-Path>
+ <Class-Path>jbossws-spi.jar jbossws-common.jar jbossws-framework.jar jbossws-native-core.jar jbossws-native-jaxrpc.jar jbossws-native-jaxws.jar jbossws-native-jaxws-ext.jar jbossws-native-saaj.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-remoting.jar jboss-xml-binding.jar netty.jar policy.jar stax-api.jar wsdl4j.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Modified: stack/native/branches/netty/modules/core/pom.xml
===================================================================
--- stack/native/branches/netty/modules/core/pom.xml 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/pom.xml 2009-06-26 14:18:13 UTC (rev 10242)
@@ -149,6 +149,10 @@
<artifactId>jboss-remoting</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+ <dependency>
<groupId>wscommons-policy</groupId>
<artifactId>policy</artifactId>
</dependency>
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -333,11 +333,12 @@
Map<String, Object> callProps = new HashMap<String, Object>(getRequestContext());
EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps);
- if (shouldMaintainSession())
+ boolean maintainSession = shouldMaintainSession();
+ if (maintainSession)
addSessionInfo(reqMessage, callProps);
RemoteConnection remoteConnection = new RemoteConnectionFactory().getRemoteConnection(epInfo);
- MessageAbstraction resMessage = remoteConnection.invoke(reqMessage, epInfo, oneway);
+ MessageAbstraction resMessage = remoteConnection.invoke(reqMessage, epInfo, oneway, maintainSession);
if (shouldMaintainSession())
saveSessionInfo(callProps, getRequestContext());
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/FastInfosetConnectionHTTP.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/FastInfosetConnectionHTTP.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/FastInfosetConnectionHTTP.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -25,8 +25,6 @@
import javax.xml.soap.MimeHeaders;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.soap.FastInfosetMarshaller;
import org.jboss.ws.core.soap.FastInfosetUnMarshaller;
@@ -53,10 +51,12 @@
@Override
protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
{
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_FASTINFOSET);
- mimeHeaders.addHeader(MimeConstants.ACCEPT, MimeConstants.TYPE_FASTINFOSET);
-
+ if (reqMessage != null)
+ {
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_FASTINFOSET);
+ mimeHeaders.addHeader(MimeConstants.ACCEPT, MimeConstants.TYPE_FASTINFOSET);
+ }
super.populateHeaders(reqMessage, metadata);
}
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -21,8 +21,6 @@
*/
package org.jboss.ws.core.client;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.jaxws.binding.HTTPMessageMarshaller;
import org.jboss.ws.core.jaxws.binding.HTTPMessageUnMarshaller;
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -22,14 +22,15 @@
package org.jboss.ws.core.client;
import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.MalformedURLException;
-import java.net.SocketTimeoutException;
-import java.net.URL;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.Properties;
+import java.util.concurrent.Executors;
import javax.xml.rpc.Stub;
import javax.xml.soap.MimeHeader;
@@ -38,13 +39,23 @@
import javax.xml.ws.addressing.EndpointReference;
import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.Version;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.remoting.transport.http.HTTPClientInvoker;
+import org.jboss.netty.bootstrap.ClientBootstrap;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferOutputStream;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
+import org.jboss.netty.handler.codec.http.DefaultHttpChunk;
+import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
+import org.jboss.netty.handler.codec.http.HttpChunk;
+import org.jboss.netty.handler.codec.http.HttpHeaders;
+import org.jboss.netty.handler.codec.http.HttpMessage;
+import org.jboss.netty.handler.codec.http.HttpMethod;
+import org.jboss.netty.handler.codec.http.HttpRequest;
+import org.jboss.netty.handler.codec.http.HttpVersion;
+import org.jboss.security.Base64Encoder;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.MessageTrace;
@@ -52,7 +63,6 @@
import org.jboss.ws.core.WSTimeoutException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extensions.wsrm.transport.RMChannel;
-import org.jboss.ws.extensions.wsrm.transport.RMMetadata;
import org.jboss.ws.extensions.wsrm.transport.RMTransportHelper;
import org.jboss.ws.feature.FastInfosetFeature;
import org.jboss.ws.metadata.config.CommonConfig;
@@ -77,32 +87,32 @@
// provide logging
private static Logger log = Logger.getLogger(HTTPRemotingConnection.class);
- private Map<String, Object> clientConfig = new HashMap<String, Object>();
+ // private Map<String, Object> clientConfig = new HashMap<String, Object>();
- private static Map<String, String> metadataMap = new HashMap<String, String>();
- static
- {
- metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
- metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
- }
- private static Map<String, String> configMap = new HashMap<String, String>();
- static
- {
- configMap.put(StubExt.PROPERTY_KEY_ALIAS, "org.jboss.remoting.keyAlias");
- configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore");
- configMap.put(StubExt.PROPERTY_KEY_STORE_ALGORITHM, "org.jboss.remoting.keyStoreAlgorithm");
- configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword");
- configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType");
- configMap.put(StubExt.PROPERTY_SOCKET_FACTORY, "socketFactoryClassName");
- configMap.put(StubExt.PROPERTY_SSL_PROTOCOL, "org.jboss.remoting.sslProtocol");
- configMap.put(StubExt.PROPERTY_SSL_PROVIDER_NAME, "org.jboss.remoting.sslProviderName");
- configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_ALGORITHM, "org.jboss.remoting.truststoreAlgorithm");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType");
- }
+ // private static Map<String, String> metadataMap = new HashMap<String, String>();
+ // static
+ // {
+ // metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
+ // metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
+ // metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username");
+ // metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password");
+ // }
+ // private static Map<String, String> configMap = new HashMap<String, String>();
+ // static
+ // {
+ // configMap.put(StubExt.PROPERTY_KEY_ALIAS, "org.jboss.remoting.keyAlias");
+ // configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore");
+ // configMap.put(StubExt.PROPERTY_KEY_STORE_ALGORITHM, "org.jboss.remoting.keyStoreAlgorithm");
+ // configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword");
+ // configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType");
+ // configMap.put(StubExt.PROPERTY_SOCKET_FACTORY, "socketFactoryClassName");
+ // configMap.put(StubExt.PROPERTY_SSL_PROTOCOL, "org.jboss.remoting.sslProtocol");
+ // configMap.put(StubExt.PROPERTY_SSL_PROVIDER_NAME, "org.jboss.remoting.sslProviderName");
+ // configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore");
+ // configMap.put(StubExt.PROPERTY_TRUST_STORE_ALGORITHM, "org.jboss.remoting.truststoreAlgorithm");
+ // configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword");
+ // configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType");
+ // }
private boolean closed;
private Integer chunkedLength;
@@ -111,10 +121,10 @@
public HTTPRemotingConnection()
{
- // HTTPClientInvoker connect sends gratuitous POST
- // http://jira.jboss.com/jira/browse/JBWS-711
- clientConfig.put(Client.ENABLE_LEASE, false);
- clientConfig.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "true");
+ // // HTTPClientInvoker connect sends gratuitous POST
+ // // http://jira.jboss.com/jira/browse/JBWS-711
+ // clientConfig.put(Client.ENABLE_LEASE, false);
+ // clientConfig.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "true");
}
public boolean isClosed()
@@ -137,20 +147,26 @@
this.chunkedLength = chunkedLength;
}
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ {
+ return this.invoke(reqMessage, endpoint, oneway, true);
+ }
+
/**
* Sends the given message to the specified endpoint.
*
* A null reqMessage signifies a HTTP GET request.
*/
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway, boolean maintainSession) throws IOException
{
+// System.out.println("Entro...");
if (endpoint == null)
throw new IllegalArgumentException("Given endpoint cannot be null");
if (closed)
throw new IOException("Connection is already closed");
- Object timeout = null;
+ Long timeout = null;
String targetAddress;
Map<String, Object> callProps = new HashMap<String, Object>();
@@ -162,8 +178,7 @@
if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
{
- timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
- targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString());
+ timeout = new Long(callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT).toString());
}
}
@@ -177,254 +192,400 @@
targetAddress = endpoint.toString();
}
- // setup remoting client
- Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
- Marshaller marshaller = getMarshaller();
+ //Netty client
+ // Map<String, Object> metadata = getMetadata(reqMessage, callProps);
UnMarshaller unmarshaller = getUnmarshaller();
- InvokerLocator locator = null;
- try
- {
- // Get the invoker from Remoting for a given endpoint address
- log.debug("Get locator for: " + endpoint);
- /**
- * [JBWS-1704] The Use Of Remoting Causes An Additional 'datatype' Parameter To Be Sent On All Requests
- *
- * An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer.
- * In that case the new invoker does not inherit the marshaller/unmarshaller from the disconnected invoker.
- * We therefore explicitly specify the invoker locator datatype and register the SOAP marshaller/unmarshaller
- * with the MarshalFactory.
- *
- * This applies to remoting-1.4.5 and less
- */
- String version = getRemotingVersion();
- if (version.startsWith("1.4"))
- {
- targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "JBossWSMessage");
- MarshalFactory.addMarshaller("JBossWSMessage", marshaller, unmarshaller);
- }
+ ChannelFactory factory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
+ // ChannelFactory factory = new NioClientSocketChannelFactory(clientExecutor, clientExecutor);
- locator = new InvokerLocator(targetAddress);
- }
- catch (MalformedURLException e)
+ ClientBootstrap bootstrap = new ClientBootstrap(factory);
+ WSClientPipelineFactory channelPipelineFactory = new WSClientPipelineFactory();
+ WSResponseHandler responseHandler = null;
+ if (!oneway || maintainSession)
{
- throw new IllegalArgumentException("Malformed endpoint address", e);
+ responseHandler = new WSResponseHandler(unmarshaller);
+ channelPipelineFactory.setResponseHandler(responseHandler);
}
+ bootstrap.setPipelineFactory(channelPipelineFactory);
- try
+ if (RMTransportHelper.isRMMessage(callProps))
{
- if (RMTransportHelper.isRMMessage(callProps))
+ // try
+ // {
+ // RMMetadata rmMetadata = new RMMetadata(null, targetAddress, marshaller, unmarshaller, callProps, metadata, null); //TODO!! remoting version, client config, etc.
+ // return RM_CHANNEL.send(reqMessage, rmMetadata);
+ // }
+ // catch (Throwable t)
+ // {
+ // IOException io = new IOException();
+ // io.initCause(t);
+ // throw io;
+ // }
+ return null; //TODO!!!
+ }
+ else
+ {
+ Channel channel = null;
+ try
{
- RMMetadata rmMetadata = new RMMetadata(getRemotingVersion(), targetAddress, marshaller, unmarshaller, callProps, metadata, clientConfig);
- return RM_CHANNEL.send(reqMessage, rmMetadata);
- }
- else
- {
- Client client = new Client(locator, "jbossws", clientConfig);
- client.connect();
+// System.out.println(new Date() + " Inizio connection attempt...");
+ //Start the connection attempt
+ URI target;
+ try
+ {
+ System.out.println("targetAddress: "+targetAddress);
+ target = new URI(targetAddress);
+ System.out.println("target.getHost: "+target.getHost());
+ System.out.println("target.getPort: "+target.getPort());
+ }
+ catch (URISyntaxException e)
+ {
+ throw new RuntimeException("Invalid address: " + targetAddress, e);
+ }
+ ChannelFuture future = bootstrap.connect(new InetSocketAddress(target.getHost(), target.getPort()));
- client.setMarshaller(marshaller);
+ //Wait until the connection attempt succeeds or fails
+ awaitUninterruptibly(future, timeout);
+ if (!future.isSuccess())
+ {
+ IOException io = new IOException("Could not connect to " + target.getHost());
+ io.initCause(future.getCause());
+ factory.releaseExternalResources();
+ throw io;
+ }
+ channel = future.getChannel();
- client.setUnMarshaller(unmarshaller);
+ //Trace the outgoing message
+ MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
- if (log.isDebugEnabled())
- log.debug("Remoting metadata: " + metadata);
+ //Send the HTTP request
+ HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, reqMessage != null ? HttpMethod.POST : HttpMethod.GET, target.toASCIIString());
+ request.addHeader(HttpHeaders.Names.HOST, target.getHost());
+ request.addHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
+ Map<String, Object> additionalHeaders = new HashMap<String, Object>();
+ populateHeaders(reqMessage, additionalHeaders);
+ setAdditionalHeaders(request, additionalHeaders);
+ setActualChunkedLength(request);
+ setAuthorization(request, callProps);
- // debug the outgoing message
- MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
+ writeRequest(channel, request, reqMessage);
+// System.out.println("oneway=" + oneway + " maintainSession=" + maintainSession);
+ if (oneway && !maintainSession)
+ {
+ //No need to wait for the connection to be closed
+ return null;
+ }
+ //Wait for the server to close the connection
+ ChannelFuture closeFuture = channel.getCloseFuture();
+ awaitUninterruptibly(closeFuture, timeout);
+ if (responseHandler.getError() != null)
+ {
+ throw responseHandler.getError();
+ }
MessageAbstraction resMessage = null;
-
- if (oneway == true)
+ Map<String, Object> resHeaders = null;
+ if (!oneway)
{
- client.invokeOneway(reqMessage, metadata, false);
+ //Get the response
+ resMessage = responseHandler.getResponseMessage();
+ resHeaders = responseHandler.getResponseHeaders();
}
- else
+ //Update props with response headers (required to maintain session using cookies)
+ callProps.clear();
+ if (resHeaders != null)
{
- resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata);
+ callProps.putAll(resHeaders);
}
- // Disconnect the remoting client
- client.disconnect();
-
- callProps.clear();
- callProps.putAll(metadata);
-
- // trace the incomming response message
+ //Trace the incoming response message
MessageTrace.traceMessage("Incoming Response Message", resMessage);
-
+// System.out.println(new Date() + " Fatto.");
return resMessage;
}
+ catch (IOException ioe)
+ {
+ ioe.printStackTrace();
+ throw ioe;
+ }
+ catch (WSTimeoutException toe)
+ {
+ throw toe;
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ IOException io = new IOException("Could not transmit message");
+ io.initCause(t);
+ throw io;
+ }
+ finally
+ {
+// System.out.println("Mi preparo a rilasciare...");
+ if (channel != null)
+ {
+ channel.close();
+ }
+ //Shut down executor threads to exit
+ factory.releaseExternalResources();
+// System.out.println("Rilasciato");
+ }
}
- catch (Throwable th)
+ }
+
+ private void writeRequest(Channel channel, HttpRequest request, MessageAbstraction reqMessage) throws IOException
+ {
+ if (reqMessage == null)
{
- if (timeout != null && (th.getCause() instanceof SocketTimeoutException))
+ channel.write(request);
+ }
+ else
+ {
+ ChannelBuffer content = ChannelBuffers.dynamicBuffer();
+ OutputStream os = new ChannelBufferOutputStream(content);
+ getMarshaller().write(reqMessage, os);
+ if (request.isChunked())
{
- throw new WSTimeoutException("Timeout after: " + timeout + "ms", new Long(timeout.toString()));
+ //TODO!! handle chunks here...
+ channel.write(request);
+
+ HttpChunk chunk = new DefaultHttpChunk(content);
+ channel.write(chunk);
+
+ channel.write(HttpChunk.LAST_CHUNK);
}
-
- IOException io = new IOException("Could not transmit message");
- io.initCause(th);
- throw io;
+ else
+ {
+ request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(content.writerIndex()));
+ request.setContent(content);
+ channel.write(request);
+ }
}
}
- private String addURLParameter(String urlStr, String key, String value) throws MalformedURLException
+ /**
+ * Utility method for awaiting with or without timeout (timeout == null or <=0 implies not timeout)
+ *
+ * @param future
+ * @param timeout
+ * @throws WSTimeoutException
+ */
+ private static void awaitUninterruptibly(ChannelFuture future, Long timeout) throws WSTimeoutException
{
- URL url = new URL(urlStr);
- urlStr += (url.getQuery() == null ? "?" : "&") + key + "=" + value;
- return urlStr;
- }
-
- private String getRemotingVersion()
- {
- String version = null;
- try
+// System.out.println(new Date() + " Inizio attesa...");
+ if (timeout != null && timeout.longValue() > 0)
{
- // Access the constant dynamically, otherwise it will be the compile time value
- Field field = Version.class.getDeclaredField("VERSION");
- version = (String)field.get(null);
+ boolean bool = future.awaitUninterruptibly(timeout);
+ if (!bool)
+ {
+ throw new WSTimeoutException("Timeout after: " + timeout + "ms", timeout);
+ }
}
- catch (Exception ex)
+ else
{
- throw new RuntimeException("Cannot obtain remoting version", ex);
+ future.awaitUninterruptibly();
}
-
- if (version == null)
- {
- URL codeURL = Version.class.getProtectionDomain().getCodeSource().getLocation();
- throw new RuntimeException("Cannot obtain remoting version from: " + codeURL);
- }
- return version;
+// System.out.println(new Date() + " Fine attesa.");
}
- private Map<String, Object> createRemotingMetaData(MessageAbstraction reqMessage, Map callProps)
+ protected void setActualChunkedLength(HttpRequest message)
{
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- Map<String, Object> metadata = new HashMap<String, Object>();
-
- // We need to unmarshall faults (HTTP 500)
- // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
- metadata.put("NoThrowOnError", "true");
-
- if (reqMessage != null)
+ if (HttpMethod.POST.equals(message.getMethod()))
{
- populateHeaders(reqMessage, metadata);
-
- // Enable chunked encoding. This is the default size.
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ //We always use chunked transfer encoding
int chunkSizeValue = (chunkedLength != null ? chunkedLength : 1024);
-
// Overwrite, through endpoint config
if (msgContext != null)
{
EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
CommonConfig config = epMetaData.getConfig();
-
+
String sizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
if (sizeValue != null)
chunkSizeValue = Integer.valueOf(sizeValue);
-
if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
chunkSizeValue = 0;
}
-
if (chunkSizeValue > 0)
{
- clientConfig.put("chunkedLength", String.valueOf(chunkSizeValue));
+ message.addHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
}
- else
- {
- clientConfig.remove("chunkedLength");
- }
}
- else
+ }
+
+ protected void setAuthorization(HttpMessage message, Map callProps) throws IOException
+ {
+ //Get authentication type, default to BASIC authetication
+ String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ if (authType == null)
+ authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+ String username = (String)callProps.get(Stub.USERNAME_PROPERTY);
+ String password = (String)callProps.get(Stub.PASSWORD_PROPERTY);
+ if (username == null || password == null)
{
- metadata.put("TYPE", "GET");
+ username = (String)callProps.get(BindingProvider.USERNAME_PROPERTY);
+ password = (String)callProps.get(BindingProvider.PASSWORD_PROPERTY);
}
-
- if (callProps != null)
+ if (username != null && password != null)
{
- Iterator it = callProps.entrySet().iterator();
+ if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ {
+ message.addHeader(HttpHeaders.Names.AUTHORIZATION, getBasicAuthHeader(username, password));
+ }
+ }
+ }
- // Get authentication type, default to BASIC authetication
- String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- if (authType == null)
- authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+ private static String getBasicAuthHeader(String username, String password) throws IOException
+ {
+ return "Basic " + Base64Encoder.encode(username + ":" + password);
+ }
- while (it.hasNext())
+ protected void setAdditionalHeaders(HttpMessage message, Map<String, Object> headers)
+ {
+ for (String key : headers.keySet())
+ {
+ try
{
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
-
- // pass properties to remoting meta data
- if (metadataMap.containsKey(key))
- {
- String remotingKey = metadataMap.get(key);
- if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
- {
- if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- {
- metadata.put(remotingKey, val);
- }
- else
- {
- log.warn("Ignore '" + key + "' with auth typy: " + authType);
- }
- }
- else
- {
- metadata.put(remotingKey, val);
- }
- }
-
- // pass properties to remoting client config
- if (configMap.containsKey(key))
- {
- String remotingKey = configMap.get(key);
- clientConfig.put(remotingKey, val);
- }
+ String header = (String)headers.get(key);
+ message.addHeader(key, header.replaceAll("[\r\n\f]", " "));
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
}
-
- return metadata;
}
+ // private Map<String, Object> createRemotingMetaData(MessageAbstraction reqMessage, Map callProps)
+ // {
+ // CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ //
+ // Map<String, Object> metadata = new HashMap<String, Object>();
+ //
+ // // We need to unmarshall faults (HTTP 500)
+ // // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
+ // metadata.put("NoThrowOnError", "true");
+ //
+ // if (reqMessage != null)
+ // {
+ // populateHeaders(reqMessage, metadata);
+ //
+ // // Enable chunked encoding. This is the default size.
+ // int chunkSizeValue = (chunkedLength != null ? chunkedLength : 1024);
+ //
+ // // Overwrite, through endpoint config
+ // if (msgContext != null)
+ // {
+ // EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ // CommonConfig config = epMetaData.getConfig();
+ //
+ // String sizeValue = config.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
+ // if (sizeValue != null)
+ // chunkSizeValue = Integer.valueOf(sizeValue);
+ //
+ // if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
+ // chunkSizeValue = 0;
+ // }
+ //
+ // if (chunkSizeValue > 0)
+ // {
+ // clientConfig.put("chunkedLength", String.valueOf(chunkSizeValue));
+ // }
+ // else
+ // {
+ // clientConfig.remove("chunkedLength");
+ // }
+ // }
+ // else
+ // {
+ // metadata.put("TYPE", "GET");
+ // }
+ //
+ // if (callProps != null)
+ // {
+ // Iterator it = callProps.entrySet().iterator();
+ //
+ // // Get authentication type, default to BASIC authetication
+ // String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ // if (authType == null)
+ // authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+ //
+ // while (it.hasNext())
+ // {
+ // Map.Entry entry = (Map.Entry)it.next();
+ // String key = (String)entry.getKey();
+ // Object val = entry.getValue();
+ //
+ // // pass properties to remoting meta data
+ // if (metadataMap.containsKey(key))
+ // {
+ // String remotingKey = metadataMap.get(key);
+ // if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey))
+ // {
+ // if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ // {
+ // metadata.put(remotingKey, val);
+ // }
+ // else
+ // {
+ // log.warn("Ignore '" + key + "' with auth typy: " + authType);
+ // }
+ // }
+ // else
+ // {
+ // metadata.put(remotingKey, val);
+ // }
+ // }
+ //
+ // // pass properties to remoting client config
+ // if (configMap.containsKey(key))
+ // {
+ // String remotingKey = configMap.get(key);
+ // clientConfig.put(remotingKey, val);
+ // }
+ // }
+ // }
+ //
+ // return metadata;
+ // }
+
protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
{
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
-
- Properties props = new Properties();
- metadata.put("HEADER", props);
-
- Iterator i = mimeHeaders.getAllHeaders();
- while (i.hasNext())
+ if (reqMessage != null)
{
- MimeHeader header = (MimeHeader)i.next();
- String currentValue = props.getProperty(header.getName());
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- /*
- * Coalesce multiple headers into one
- *
- * From HTTP/1.1 RFC 2616:
- *
- * Multiple message-header fields with the same field-name MAY be
- * present in a message if and only if the entire field-value for that
- * header field is defined as a comma-separated list [i.e., #(values)].
- * It MUST be possible to combine the multiple header fields into one
- * "field-name: field-value" pair, without changing the semantics of
- * the message, by appending each subsequent field-value to the first,
- * each separated by a comma.
- */
- if (currentValue != null)
+ Iterator i = mimeHeaders.getAllHeaders();
+ while (i.hasNext())
{
- props.put(header.getName(), currentValue + "," + header.getValue());
+ MimeHeader header = (MimeHeader)i.next();
+ Object currentValue = metadata.get(header.getName());
+
+ /*
+ * Coalesce multiple headers into one
+ *
+ * From HTTP/1.1 RFC 2616:
+ *
+ * Multiple message-header fields with the same field-name MAY be
+ * present in a message if and only if the entire field-value for that
+ * header field is defined as a comma-separated list [i.e., #(values)].
+ * It MUST be possible to combine the multiple header fields into one
+ * "field-name: field-value" pair, without changing the semantics of
+ * the message, by appending each subsequent field-value to the first,
+ * each separated by a comma.
+ */
+ if (currentValue != null)
+ {
+ metadata.put(header.getName(), currentValue + "," + header.getValue());
+ }
+ else
+ {
+ metadata.put(header.getName(), header.getValue());
+ }
}
- else
- {
- props.put(header.getName(), header.getValue());
- }
}
}
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -26,8 +26,6 @@
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConstants;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxws.binding.JsonMessageMarshaller;
import org.jboss.ws.core.jaxws.binding.JsonMessageUnMarshaller;
@@ -55,9 +53,11 @@
protected void populateHeaders(MessageAbstraction reqMessage, Map<String, Object> metadata)
{
// TODO: fix the content-type
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, SOAPConstants.SOAP_1_1_CONTENT_TYPE);
-
+ if (reqMessage != null)
+ {
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, SOAPConstants.SOAP_1_1_CONTENT_TYPE);
+ }
super.populateHeaders(reqMessage, metadata);
}
}
Added: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/Marshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/Marshaller.java (rev 0)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/Marshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core.client;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Interface that all data marshallers must implements.
+ * Requires them to take Java data objects and convert
+ * primitive java data types (i.e. byte[]) and write
+ * to output provided.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 24-Jun-2009
+ *
+ */
+public interface Marshaller
+{
+ /**
+ * Marshaller will need to take the dataObject and convert
+ * into primitive java data types and write to the
+ * given output.
+ *
+ * @param dataObject Object to be writen to output
+ * @param output The data output to write the object
+ * data to.
+ */
+ public void write(Object dataObject, OutputStream output) throws IOException;
+}
Property changes on: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/Marshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -23,8 +23,6 @@
import java.io.IOException;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
@@ -39,6 +37,8 @@
Marshaller getMarshaller();
UnMarshaller getUnmarshaller();
+
+ MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException;
- MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException;
+ MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway, boolean maintainSession) throws IOException;
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -23,14 +23,11 @@
import java.io.IOException;
import java.util.Map;
-import java.util.Properties;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP;
@@ -55,7 +52,8 @@
return new SOAPMessageMarshaller();
}
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
+ @Override
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway, boolean maintainSession) throws IOException
{
try
{
@@ -68,7 +66,7 @@
if (reqMessage != null && soapMessage.saveRequired())
soapMessage.saveChanges();
- return super.invoke(reqMessage, endpoint, oneway);
+ return super.invoke(reqMessage, endpoint, oneway, maintainSession);
}
catch (SOAPException ex)
{
@@ -82,33 +80,33 @@
{
super.populateHeaders(reqMessage, metadata);
- Properties props = (Properties)metadata.get("HEADER");
+ if (reqMessage != null)
+ {
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String[] action = mimeHeaders.getHeader("SOAPAction");
+ if (action != null && action.length > 0)
+ {
+ String soapAction = action[0];
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String[] action = mimeHeaders.getHeader("SOAPAction");
- if (action != null && action.length > 0)
- {
- String soapAction = action[0];
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
+ if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
+ soapAction = "\"" + soapAction + "\"";
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
- if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false)
- soapAction = "\"" + soapAction + "\"";
-
- props.put("SOAPAction", soapAction);
+ metadata.put("SOAPAction", soapAction);
+ }
+ else
+ {
+ metadata.put("SOAPAction", "\"\"");
+ }
}
- else
- {
- props.put("SOAPAction", "\"\"");
- }
-
}
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -41,8 +41,6 @@
import javax.naming.InitialContext;
import javax.xml.ws.addressing.EndpointReference;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
@@ -66,9 +64,14 @@
{
return new SOAPMessageMarshaller();
}
-
+
public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException
{
+ return this.invoke(reqMessage, endpoint, oneway, true);
+ }
+
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway, boolean maintainSession) throws IOException
+ {
if (endpoint == null)
throw new IllegalArgumentException("Given endpoint cannot be null");
Added: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/UnMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/UnMarshaller.java (rev 0)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/UnMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+/**
+ * Takes a marshalled byte array and converts to a Java data object.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 24-Jun-2009
+ *
+ */
+public interface UnMarshaller
+{
+ /**
+ * Will read from the inputstream and convert contents to java Object.
+ *
+ * @param inputStream stream to read data from to do conversion.
+ * @param metadata can be any transport specific metadata (such as headers from http transport).
+ * This can be null, depending on if transport supports metadata.
+ *
+ * @return
+ * @throws IOException all specific i/o exceptions need to be thrown as this.
+ */
+ Object read(InputStream inputStream, Map<String, Object> metadata) throws IOException;
+}
Property changes on: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/UnMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSClientPipelineFactory.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSClientPipelineFactory.java (rev 0)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSClientPipelineFactory.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core.client;
+
+import static org.jboss.netty.channel.Channels.pipeline;
+
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
+import org.jboss.netty.handler.codec.http.HttpRequestEncoder;
+import org.jboss.netty.handler.codec.http.HttpResponseDecoder;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 24-Jun-2009
+ *
+ */
+public class WSClientPipelineFactory implements ChannelPipelineFactory
+{
+ private static final int MAX_CONTENT_SIZE = 1073741824;
+ private ChannelHandler responseHandler;
+ private ChannelHandler sshHandler;
+
+ public ChannelPipeline getPipeline() throws Exception
+ {
+ // Create a default pipeline implementation.
+ ChannelPipeline pipeline = pipeline();
+ pipeline.addLast("decoder", new HttpResponseDecoder());
+ // Uncomment the following line if you don't want to handle HttpChunks.
+ pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_CONTENT_SIZE));
+ pipeline.addLast("encoder", new HttpRequestEncoder());
+ if (responseHandler != null)
+ {
+ pipeline.addLast("handler", responseHandler);
+ }
+ return pipeline;
+ }
+
+ public ChannelHandler getResponseHandler()
+ {
+ return responseHandler;
+ }
+
+ public void setResponseHandler(ChannelHandler responseHandler)
+ {
+ this.responseHandler = responseHandler;
+ }
+
+ public ChannelHandler getSshHandler()
+ {
+ return sshHandler;
+ }
+
+ public void setSshHandler(ChannelHandler sshHandler)
+ {
+ this.sshHandler = sshHandler;
+ }
+
+
+}
Property changes on: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSClientPipelineFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java (rev 0)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core.client;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferInputStream;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.handler.codec.http.HttpResponse;
+import org.jboss.ws.core.MessageAbstraction;
+
+/**
+ * A Netty channel upstream handler that receives MessageEvent
+ * and extract the JBossWS message using the provided unmarshaller.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 24-Jun-2009
+ *
+ */
+@ChannelPipelineCoverage("one")
+public class WSResponseHandler extends SimpleChannelUpstreamHandler
+{
+ private UnMarshaller unmarshaller;
+ private MessageAbstraction responseMessage;
+ private Map<String, Object> responseHeaders;
+ private Throwable error;
+
+ public WSResponseHandler(UnMarshaller unmarshaller)
+ {
+ super();
+ this.unmarshaller = unmarshaller;
+ }
+
+ @Override
+ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
+ {
+ try
+ {
+// System.out.println(new Date() + " Message received");
+ reset();
+ HttpResponse response = (HttpResponse)e.getMessage();
+
+ //TODO!! fix constants
+ responseHeaders.put("ResponseCode", response.getStatus().getCode());
+ responseHeaders.put("ResponseCodeMessage", response.getStatus().getReasonPhrase());
+ for (String headerName : response.getHeaderNames())
+ {
+ responseHeaders.put(headerName, response.getHeaders(headerName));
+ }
+
+ ChannelBuffer content = response.getContent();
+// System.out.println(new Date() + " Unmarshall...");
+ this.responseMessage = (MessageAbstraction)unmarshaller.read(content.readable() ? new ChannelBufferInputStream(content) : null, responseHeaders);
+// System.out.println(new Date() + " Esco da message received...");
+ }
+ catch (Throwable t)
+ {
+ this.error = t;
+ }
+ finally
+ {
+ e.getChannel().close();
+ }
+ }
+
+ private void reset()
+ {
+ this.error = null;
+ this.responseMessage = null;
+ this.responseHeaders = new HashMap<String, Object>();
+ }
+
+ public MessageAbstraction getResponseMessage()
+ {
+ return this.responseMessage;
+ }
+
+ public Map<String, Object> getResponseHeaders()
+ {
+ return responseHeaders;
+ }
+
+ public Throwable getError()
+ {
+ return error;
+ }
+}
\ No newline at end of file
Property changes on: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/client/WSResponseHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -25,15 +25,14 @@
import java.io.OutputStream;
import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
-import org.jboss.remoting.marshal.Marshaller;
import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.client.Marshaller;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Element;
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 25-Nov-2004
*/
public class HTTPMessageMarshaller implements Marshaller
@@ -52,12 +51,6 @@
*/
public void write(Object dataObject, OutputStream output) throws IOException
{
- if (dataObject instanceof InvocationRequest)
- dataObject = ((InvocationRequest)dataObject).getParameter();
-
- if (dataObject instanceof OnewayInvocation)
- dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
-
if ((dataObject instanceof HTTPMessageImpl) == false)
throw new IllegalArgumentException("Not a HTTPMessage: " + dataObject);
@@ -72,9 +65,4 @@
new DOMWriter(output).print(root);
}
-
- public Marshaller cloneMarshaller() throws CloneNotSupportedException
- {
- return new HTTPMessageMarshaller();
- }
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -32,10 +31,9 @@
import javax.xml.soap.MimeHeaders;
import org.jboss.logging.Logger;
-import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.remoting.transport.http.HTTPMetadataConstants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.client.UnMarshaller;
/**
* @author Thomas.Diesler(a)jboss.org
@@ -46,7 +44,7 @@
// Provide logging
private static Logger log = Logger.getLogger(HTTPMessageUnMarshaller.class);
- private static List validResponseCodes = new ArrayList();
+ private static List<Integer> validResponseCodes = new ArrayList<Integer>();
static
{
validResponseCodes.add(HttpServletResponse.SC_OK);
@@ -54,15 +52,16 @@
validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
- public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ public Object read(InputStream inputStream, Map<String, Object> metadata) throws IOException
{
if (log.isTraceEnabled())
{
log.trace("Read input stream with metadata=" + metadata);
}
- Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
- String resMessage = (String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ //TODO!!! fix constants
+ Integer resCode = (Integer)metadata.get("ResponseCode");
+ String resMessage = (String)metadata.get("ResponseCodeMessage");
if (resCode != null && validResponseCodes.contains(resCode) == false)
throw new WSException("Invalid HTTP server response [" + resCode + "] - " + resMessage);
@@ -71,37 +70,17 @@
return soapMsg;
}
- /**
- * Set the class loader to use for unmarhsalling. This may
- * be needed when need to have access to class definitions that
- * are not part of this unmarshaller's parent classloader (especially
- * when doing remote classloading).
- *
- * @param classloader
- */
- public void setClassLoader(ClassLoader classloader)
+ private MimeHeaders getMimeHeaders(Map<String, Object> metadata)
{
- //NO OP
- }
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return new HTTPMessageUnMarshaller();
- }
-
- private MimeHeaders getMimeHeaders(Map metadata)
- {
log.debug("getMimeHeaders from: " + metadata);
MimeHeaders headers = new MimeHeaders();
- Iterator i = metadata.keySet().iterator();
- while (i.hasNext())
+ for (String key : metadata.keySet())
{
- String key = (String)i.next();
Object value = metadata.get(key);
if (key != null && value instanceof List)
{
- for (Object listValue : (List)value)
+ for (Object listValue : (List<?>)value)
{
headers.addHeader(key, listValue.toString());
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -28,23 +28,18 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
-import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.client.Marshaller;
import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.extensions.json.BadgerFishDOMDocumentSerializer;
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 25-Nov-2004
*/
public class JsonMessageMarshaller implements Marshaller
{
- // Provide logging
- private static Logger log = Logger.getLogger(JsonMessageMarshaller.class);
-
/**
* Marshaller will need to take the dataObject and convert
* into primitive java data types and write to the
@@ -56,12 +51,6 @@
*/
public void write(Object dataObject, OutputStream output) throws IOException
{
- if (dataObject instanceof InvocationRequest)
- dataObject = ((InvocationRequest)dataObject).getParameter();
-
- if (dataObject instanceof OnewayInvocation)
- dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
-
// TODO: this should not be a SOAP message
if ((dataObject instanceof SOAPMessageImpl) == false)
throw new IllegalArgumentException("Not a SOAPMessageImpl: " + dataObject);
@@ -80,9 +69,4 @@
throw ioex;
}
}
-
- public Marshaller cloneMarshaller() throws CloneNotSupportedException
- {
- return new JsonMessageMarshaller();
- }
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageUnMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageUnMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/JsonMessageUnMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -23,16 +23,13 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
-import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.core.client.UnMarshaller;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.extensions.json.BadgerFishDOMDocumentParser;
import org.w3c.dom.Document;
@@ -46,7 +43,7 @@
// Provide logging
private static Logger log = Logger.getLogger(JsonMessageUnMarshaller.class);
- public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ public Object read(InputStream inputStream, Map<String, Object> metadata) throws IOException
{
if (log.isTraceEnabled())
{
@@ -69,43 +66,4 @@
throw ioex;
}
}
-
- /**
- * Set the class loader to use for unmarhsalling. This may
- * be needed when need to have access to class definitions that
- * are not part of this unmarshaller's parent classloader (especially
- * when doing remote classloading).
- *
- * @param classloader
- */
- public void setClassLoader(ClassLoader classloader)
- {
- //NO OP
- }
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return new JsonMessageUnMarshaller();
- }
-
- private MimeHeaders getMimeHeaders(Map metadata)
- {
- log.debug("getMimeHeaders from: " + metadata);
-
- MimeHeaders headers = new MimeHeaders();
- Iterator i = metadata.keySet().iterator();
- while (i.hasNext())
- {
- String key = (String)i.next();
- Object value = metadata.get(key);
- if (key != null && value instanceof List)
- {
- for (Object listValue : (List)value)
- {
- headers.addHeader(key, listValue.toString());
- }
- }
- }
- return headers;
- }
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -89,6 +89,7 @@
{
return null;
}
+ log.error("Exception while building envelope", ex);
QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
throw new CommonSOAPFaultException(faultCode, ex.getMessage());
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/FastInfosetMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/FastInfosetMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/FastInfosetMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -28,14 +28,13 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
-import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.client.Marshaller;
import com.sun.xml.fastinfoset.dom.DOMDocumentSerializer;
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 12-Mar-2008
*/
public class FastInfosetMarshaller implements Marshaller
@@ -51,12 +50,6 @@
*/
public void write(Object dataObject, OutputStream output) throws IOException
{
- if (dataObject instanceof InvocationRequest)
- dataObject = ((InvocationRequest)dataObject).getParameter();
-
- if (dataObject instanceof OnewayInvocation)
- dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
-
if ((dataObject instanceof SOAPMessage) == false)
throw new IllegalArgumentException("Not a SOAPMessage: " + dataObject);
@@ -78,9 +71,4 @@
throw ioex;
}
}
-
- public Marshaller cloneMarshaller() throws CloneNotSupportedException
- {
- return new FastInfosetMarshaller();
- }
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -27,12 +27,11 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.invocation.OnewayInvocation;
-import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.client.Marshaller;
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 25-Nov-2004
*/
public class SOAPMessageMarshaller implements Marshaller
@@ -51,21 +50,10 @@
*/
public void write(Object dataObject, OutputStream output) throws IOException
{
- if (dataObject instanceof InvocationRequest)
- dataObject = ((InvocationRequest)dataObject).getParameter();
-
- if (dataObject instanceof OnewayInvocation)
- dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
-
if ((dataObject instanceof SOAPMessage) == false)
throw new IllegalArgumentException("Not a SOAPMessage: " + dataObject);
SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
soapMessage.writeTo(output);
}
-
- public Marshaller cloneMarshaller() throws CloneNotSupportedException
- {
- return new SOAPMessageMarshaller();
- }
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshaller.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshaller.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshaller.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -29,10 +29,11 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
-import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.core.client.UnMarshaller;
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 25-Nov-2004
*/
public class SOAPMessageUnMarshaller implements UnMarshaller
@@ -40,7 +41,7 @@
// Provide logging
private static Logger log = Logger.getLogger(SOAPMessageUnMarshaller.class);
- public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ public Object read(InputStream inputStream, Map<String, Object> metadata) throws IOException
{
if (log.isTraceEnabled())
log.trace("Read input stream with metadata=" + metadata);
@@ -64,13 +65,4 @@
{
return new MessageFactoryImpl();
}
-
- public void setClassLoader(ClassLoader classloader)
- {
- }
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return new SOAPMessageUnMarshaller();
- }
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshallerHTTP.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshallerHTTP.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageUnMarshallerHTTP.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -34,12 +33,12 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
-import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.remoting.transport.http.HTTPMetadataConstants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.client.UnMarshaller;
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 25-Nov-2004
*/
public class SOAPMessageUnMarshallerHTTP implements UnMarshaller
@@ -47,7 +46,7 @@
// Provide logging
private static Logger log = Logger.getLogger(SOAPMessageUnMarshallerHTTP.class);
- private static List validResponseCodes = new ArrayList();
+ private static List<Integer> validResponseCodes = new ArrayList<Integer>();
static
{
validResponseCodes.add(HttpServletResponse.SC_OK);
@@ -56,21 +55,22 @@
validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
- public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
+ public Object read(InputStream inputStream, Map<String, Object> metadata) throws IOException
{
if (log.isTraceEnabled())
log.trace("Read input stream with metadata=" + metadata);
try
{
- Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ //TODO!!!! fix constants
+ Integer resCode = (Integer)metadata.get("ResponseCode");
if (resCode == null)
{
log.warn("No HTTP resonse code, assuming: SC_OK");
resCode = HttpServletResponse.SC_OK;
}
- String resMessage = (String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ String resMessage = (String)metadata.get("ResponseCodeMessage");
if (validResponseCodes.contains(resCode) == false)
throw new WSException("Invalid HTTP server response [" + resCode + "] - " + resMessage);
@@ -98,37 +98,17 @@
return new MessageFactoryImpl();
}
- /**
- * Set the class loader to use for unmarhsalling. This may
- * be needed when need to have access to class definitions that
- * are not part of this unmarshaller's parent classloader (especially
- * when doing remote classloading).
- *
- * @param classloader
- */
- public void setClassLoader(ClassLoader classloader)
+ private MimeHeaders getMimeHeaders(Map<String, Object> metadata)
{
- //NO OP
- }
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return new SOAPMessageUnMarshallerHTTP();
- }
-
- private MimeHeaders getMimeHeaders(Map metadata)
- {
log.debug("getMimeHeaders from: " + metadata);
MimeHeaders headers = new MimeHeaders();
- Iterator i = metadata.keySet().iterator();
- while (i.hasNext())
+ for (String key : metadata.keySet())
{
- String key = (String)i.next();
Object value = metadata.get(key);
if (key != null && value instanceof List)
{
- for (Object listValue : (List)value)
+ for (Object listValue : (List<?>)value)
{
headers.addHeader(key, listValue.toString());
}
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/core/utils/ThreadLocalAssociation.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -42,17 +42,17 @@
* SOAP message context
* @see org.jboss.ws.core.soap.MessageContextAssociation
*/
- private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc = new ThreadLocal<Stack<CommonMessageContext>>();
+ private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc = new InheritableThreadLocal<Stack<CommonMessageContext>>();
/**
* @see org.jboss.ws.extensions.security.STRTransform
*/
- private static ThreadLocal<SecurityStore> strTransformAssoc = new ThreadLocal<SecurityStore>();
+ private static ThreadLocal<SecurityStore> strTransformAssoc = new InheritableThreadLocal<SecurityStore>();
/**
* Public keys used to sign incoming message
*/
- private static ThreadLocal<List<PublicKey>> signatureKeysAssoc = new ThreadLocal<List<PublicKey>>();
+ private static ThreadLocal<List<PublicKey>> signatureKeysAssoc = new InheritableThreadLocal<List<PublicKey>>();
public static ThreadLocal<Stack<CommonMessageContext>> localMsgContextAssoc()
{
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMessageAssembler.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMessageAssembler.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMessageAssembler.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -28,9 +28,9 @@
import java.io.InputStream;
import java.util.Map;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.Marshaller;
+import org.jboss.ws.core.client.UnMarshaller;
/**
* Translates JBoss messages to RM sources and vice-versa.
Modified: stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java
===================================================================
--- stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/core/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -23,9 +23,10 @@
import java.util.Map;
import java.util.HashMap;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.ws.core.client.Marshaller;
+import org.jboss.ws.core.client.UnMarshaller;
+
/**
* RM metadata heavily used by this RM transport
*
Modified: stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.bat
===================================================================
--- stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.bat 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.bat 2009-06-26 14:18:13 UTC (rev 10242)
@@ -53,6 +53,7 @@
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/FastInfoset.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/log4j.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/mail.jar
+set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/netty.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/policy.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/stax-api.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/xmlsec.jar
Modified: stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.sh
===================================================================
--- stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.sh 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/resources/src/main/resources/bin/wsrunclient.sh 2009-06-26 14:18:13 UTC (rev 10242)
@@ -80,6 +80,7 @@
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/FastInfoset.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/log4j.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/mail.jar"
+WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/netty.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/policy.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/stax-api.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/xmlsec.jar"
Modified: stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.bat
===================================================================
--- stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.bat 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.bat 2009-06-26 14:18:13 UTC (rev 10242)
@@ -18,6 +18,7 @@
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JAVA_HOME%/lib/tools.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/activation.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/getopt.jar
+set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/netty.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/wstx.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/wsdl4j.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/jbossall-client.jar
Modified: stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.sh
===================================================================
--- stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.sh 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/resources/src/main/resources/bin/wstools.sh 2009-06-26 14:18:13 UTC (rev 10242)
@@ -48,6 +48,7 @@
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JAVA_HOME/lib/tools.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/activation.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/getopt.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/netty.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/wstx.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/wsdl4j.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossall-client.jar"
Modified: stack/native/branches/netty/modules/resources/src/main/resources/resources/default-deploy.conf
===================================================================
--- stack/native/branches/netty/modules/resources/src/main/resources/resources/default-deploy.conf 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/resources/src/main/resources/resources/default-deploy.conf 2009-06-26 14:18:13 UTC (rev 10242)
@@ -1 +1 @@
-bin/wsconsume.bat bin/wsconsume.sh bin/wsprovide.bat bin/wsprovide.sh bin/wsrunclient.bat bin/wsrunclient.sh bin/wstools.bat bin/wstools.sh client/jettison.jar client/jaxb-api.jar client/jaxb-impl.jar client/jaxb-xjc.jar client/jaxws-rt.jar client/jaxws-tools.jar client/jboss-jaxrpc.jar client/jboss-jaxws-ext.jar client/jboss-jaxws.jar client/jboss-saaj.jar client/jbossws-native-jaxrpc.jar client/jbossws-native-jaxws-ext.jar client/jbossws-native-jaxws.jar client/jbossws-native-saaj.jar client/jbossws-client.jar client/jbossws-native-client.jar client/jbossws-native-core.jar client/jbossws-common.jar client/jbossws-framework.jar client/jbossws-spi.jar client/policy.jar client/stax-ex.jar client/streambuffer.jar client/wsdl4j.jar lib/jaxb-api.jar lib/jaxb-impl.jar common/lib/jboss-jaxrpc.jar common/lib/jboss-jaxws-ext.jar common/lib/jboss-jaxws.jar common/lib/jboss-saaj.jar common/lib/jbossws-native-jaxrpc.jar common/lib/jbossws-native-jaxws-ext.jar common/lib/jbossws-native!
-jaxws.jar common/lib/jbossws-native-saaj.jar common/lib/jbossws-common.jar common/lib/jbossws-framework.jar common/lib/jbossws-spi.jar server/default/deploy/jbossws.sar server/default/deploy/juddi-service.sar server/default/deploy/jbossws-container-jboss-beans.xml server/default/deployers/jbossws.deployer/FastInfoset.jar server/default/deployers/jbossws.deployer/jboss-jaxb-intros.jar server/default/deployers/jbossws.deployer/jbossws-native-core.jar server/default/deployers/jbossws.deployer/jettison.jar server/default/deployers/jbossws.deployer/policy.jar server/default/deployers/jbossws.deployer/wsdl4j.jar server/default/deployers/jbossws.deployer/xmlsec.jar server/default/deployers/jbossws.deployer/META-INF/jbossws-container-jboss-beans.xml lib/endorsed/jbossws-native-* lib/endorsed/jaxb-api.jar
+bin/wsconsume.bat bin/wsconsume.sh bin/wsprovide.bat bin/wsprovide.sh bin/wsrunclient.bat bin/wsrunclient.sh bin/wstools.bat bin/wstools.sh client/jettison.jar client/jaxb-api.jar client/jaxb-impl.jar client/jaxb-xjc.jar client/jaxws-rt.jar client/jaxws-tools.jar client/jboss-jaxrpc.jar client/jboss-jaxws-ext.jar client/jboss-jaxws.jar client/jboss-saaj.jar client/jbossws-native-jaxrpc.jar client/jbossws-native-jaxws-ext.jar client/jbossws-native-jaxws.jar client/jbossws-native-saaj.jar client/jbossws-client.jar client/jbossws-native-client.jar client/jbossws-native-core.jar client/jbossws-common.jar client/jbossws-framework.jar client/jbossws-spi.jar client/netty.jar client/policy.jar client/stax-ex.jar client/streambuffer.jar client/wsdl4j.jar lib/jaxb-api.jar lib/jaxb-impl.jar common/lib/jboss-jaxrpc.jar common/lib/jboss-jaxws-ext.jar common/lib/jboss-jaxws.jar common/lib/jboss-saaj.jar common/lib/jbossws-native-jaxrpc.jar common/lib/jbossws-native-jaxws-ext.jar common/l!
ib/jbossws-native-jaxws.jar common/lib/jbossws-native-saaj.jar common/lib/jbossws-common.jar common/lib/jbossws-framework.jar common/lib/jbossws-spi.jar server/default/deploy/jbossws.sar server/default/deploy/juddi-service.sar server/default/deploy/jbossws-container-jboss-beans.xml server/default/deployers/jbossws.deployer/FastInfoset.jar server/default/deployers/jbossws.deployer/jboss-jaxb-intros.jar server/default/deployers/jbossws.deployer/jbossws-native-core.jar server/default/deployers/jbossws.deployer/jettison.jar server/default/deployers/jbossws.deployer/netty.jar server/default/deployers/jbossws.deployer/policy.jar server/default/deployers/jbossws.deployer/wsdl4j.jar server/default/deployers/jbossws.deployer/xmlsec.jar server/default/deployers/jbossws.deployer/META-INF/jbossws-container-jboss-beans.xml lib/endorsed/jbossws-native-* lib/endorsed/jaxb-api.jar
Modified: stack/native/branches/netty/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/native/branches/netty/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2009-06-26 14:18:13 UTC (rev 10242)
@@ -44,6 +44,7 @@
<include name="**/jbossws-native-saaj.jar"/>
<include name="**/jbossws-spi.jar"/>
<include name="**/jettison.jar"/>
+ <include name="**/netty.jar"/>
<include name="**/policy.jar"/>
<include name="**/stax-api.jar"/>
<include name="**/stax-ex.jar"/>
@@ -79,6 +80,7 @@
<include name="**/jboss-jaxb-intros.jar"/>
<include name="**/jbossws-native-core.jar"/>
<include name="**/jettison.jar"/>
+ <include name="**/netty.jar"/>
<include name="**/policy.jar"/>
<include name="**/wsdl4j.jar"/>
<include name="**/xmlsec.jar"/>
Modified: stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java
===================================================================
--- stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/wseventing/SubscriptionManagerTestCase.java 2009-06-26 14:18:13 UTC (rev 10242)
@@ -114,6 +114,7 @@
assertNotNull(subscriptionTicket.getExpires());
assertTrue(subscriptionTicket.getExpires().getTime() > System.currentTimeMillis());
assertNotNull(subscriptionTicket.getSubscriptionManager());
+ zzzz();
}
/**
@@ -135,6 +136,7 @@
{
// ignore expected exception
}
+ zzzz();
}
public void testExceedsMaxLeaseTime() throws Exception
@@ -149,6 +151,7 @@
{
// ignore expected exception
}
+ zzzz();
}
/**
@@ -175,6 +178,7 @@
{
// ignore expected exception
}
+ zzzz();
}
public void testDispatch() throws Exception
@@ -187,6 +191,7 @@
Element payload = DOMUtils.parse(eventString);
subscriptionManager.dispatch(eventSourceNS, payload);
+ zzzz();
}
public void testXPathFilter() throws Exception
@@ -198,5 +203,14 @@
Element event = DOMUtils.parse(eventString);
subscriptionManager.dispatch(eventSourceNS, event);
+ zzzz();
}
+
+ private void zzzz() {
+ try
+ {
+ Thread.currentThread().sleep(30000);
+ }
+ catch (Exception e) {}
+ }
}
Modified: stack/native/branches/netty/pom.xml
===================================================================
--- stack/native/branches/netty/pom.xml 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/pom.xml 2009-06-26 14:18:13 UTC (rev 10242)
@@ -72,6 +72,7 @@
<jboss.jaxr.version>1.2.1.GA</jboss.jaxr.version>
<apache.scout.version>0.7rc2</apache.scout.version>
<juddi.version>0.9RC4</juddi.version>
+ <netty.version>3.1.0.CR1</netty.version>
<sun.fastinfoset.version>1.2.2</sun.fastinfoset.version>
<sun.jaxws.version>2.1.3</sun.jaxws.version>
<woodstox.version>3.2.6</woodstox.version>
@@ -337,6 +338,11 @@
<artifactId>xmlsec</artifactId>
<version>${xmlsec.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>${netty.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Modified: stack/native/branches/netty/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/native/branches/netty/src/main/scripts/assembly-deploy-artifacts.xml 2009-06-26 13:23:05 UTC (rev 10241)
+++ stack/native/branches/netty/src/main/scripts/assembly-deploy-artifacts.xml 2009-06-26 14:18:13 UTC (rev 10242)
@@ -52,6 +52,7 @@
<include>com.sun.xml.stream.buffer:streambuffer:jar</include>
<include>wsdl4j:wsdl4j:jar</include>
<include>org.apache:xmlsec:jar</include>
+ <include>org.jboss.netty:netty:jar</include>
</includes>
</dependencySet>
<dependencySet>
14 years, 10 months
JBossWS SVN: r10241 - in container/jboss50/branches/ropalka-jboss510/src/main: resources/jbossws-jboss50.deployer/META-INF and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-06-26 09:23:05 -0400 (Fri, 26 Jun 2009)
New Revision: 10241
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDescriptorDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSEJBAdapterDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSTypeDeployer.java
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentTypeDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServicesMetaDataDeployer.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPostJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPreJSE.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
Log:
[JBWS-2332][JBWS-2382] refactoring (WIP)
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -21,17 +21,8 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.virtual.VirtualFile;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.*;
@@ -49,10 +40,7 @@
// provide logging
protected final Logger log = Logger.getLogger(getClass());
- private static final WSVirtualFileFilter WS_FILEFILTER = new WSVirtualFileFilter();
-
private DeploymentAspectManager deploymentAspectManager;
- private DeploymentModelFactory deploymentModelFactory;
protected String deploymentManagerName;
@@ -73,62 +61,6 @@
return deploymentAspectManager;
}
- public DeploymentModelFactory getDeploymentModelFactory()
- {
- if(null == deploymentModelFactory)
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
- }
-
- return deploymentModelFactory;
- }
-
- public ArchiveDeployment newDeployment(DeploymentUnit unit)
- {
- try
- {
- DeploymentModelFactory factory = getDeploymentModelFactory();
- ArchiveDeployment dep = (ArchiveDeployment)factory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
- List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WS_FILEFILTER); //get all wsdl and xsd files
- Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
- for (VirtualFile vf : virtualFiles)
- {
- // Adding the roots of the virtual files.
- uVirtualFiles.add(new VirtualFileAdaptor(vf.getVFS().getRoot()));
- }
- dep.setMetadataFiles(new LinkedList<UnifiedVirtualFile>(uVirtualFiles));
- }
-
- if (unit.getParent() != null)
- {
- DeploymentUnit parentUnit = unit.getParent();
- ArchiveDeployment parentDep = (ArchiveDeployment)factory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
- dep.setParent(parentDep);
- }
- return dep;
- }
- catch (Exception ex)
- {
- throw new WSFDeploymentException("Cannot load spi.deployment.Deployment class", ex);
- }
- }
-
- public Endpoint newEndpoint(String targetBean)
- {
- try
- {
- return getDeploymentModelFactory().newEndpoint(targetBean);
- }
- catch (Exception ex)
- {
- throw new WSFDeploymentException("Cannot load spi.deployment.Endpoint class", ex);
- }
- }
-
/** Return true if this deployment should be ignored
*/
public boolean ignoreDeployment(DeploymentUnit unit)
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/ArchiveDeployerHook.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -21,24 +21,10 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
-import java.net.URL;
-
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.w3c.dom.Element;
/**
* An abstract web service deployer.
@@ -67,12 +53,6 @@
{
log.debug("deploy: " + unit.getName());
Deployment dep = getDeployment(unit);
- if (dep == null)
- {
- dep = createDeployment(unit);
- dep.addAttachment(DeploymentUnit.class, unit);
- }
-
unit.addAttachment(Deployment.class, dep);
getDeploymentAspectManager().deploy(dep);
}
@@ -100,13 +80,6 @@
return this.getDeploymentType().equals( deploymentType );
}
- /** Create the Deployment for a given DeploymentUnit
- */
- public Deployment createDeployment(DeploymentUnit unit)
- {
- return unit.getAttachment(Deployment.class);
- }
-
/** Get the Deployment for a given DeploymentUnit
*/
public Deployment getDeployment(DeploymentUnit unit)
@@ -115,11 +88,4 @@
return (dep != null && dep.getType() == getDeploymentType() ? dep : null);
}
- /** Unmrashall the webservices.xml if there is one
- */
- protected WebservicesMetaData getWebservicesMetaData(DeploymentUnit unit)
- {
- return unit.getAttachment(WebservicesMetaData.class);
- }
-
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookEJB21.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -21,20 +21,7 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Service;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
/**
* A deployer hook for JAXRPC EJB21 Endpoints.
@@ -53,54 +40,4 @@
return DeploymentType.JAXRPC_EJB21;
}
- @Override
- public Deployment createDeployment(DeploymentUnit unit)
- {
- ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setRuntimeClassLoader(unit.getClassLoader());
- dep.setType(getDeploymentType());
-
- Service service = dep.getService();
-
- JBossMetaData jbmd = unit.getAttachment(JBossMetaData.class);
- if (jbmd == null)
- throw new IllegalStateException("Deployment unit does not contain application meta data");
-
- WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
- if (wsMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain webservices meta data");
-
- WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
- if (webServiceDeployment == null)
- throw new IllegalStateException("Deployment unit does not contain webServiceDeployment");
-
- // Copy the attachments
- dep.addAttachment(WebservicesMetaData.class, wsMetaData);
- dep.addAttachment(JBossMetaData.class, jbmd);
- dep.addAttachment(WebServiceDeployment.class, webServiceDeployment);
-
- for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
- {
- for (PortComponentMetaData pcmd : wsd.getPortComponents())
- {
- String ejbLink = pcmd.getEjbLink();
- if (ejbLink == null)
- throw new IllegalStateException("ejb-link cannot be null");
-
- JBossEnterpriseBeanMetaData beanMetaData = jbmd.getEnterpriseBean(ejbLink);
- if (beanMetaData == null)
- throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);
-
- String ejbClass = beanMetaData.getEjbClass();
-
- // Create the endpoint
- Endpoint ep = newEndpoint(ejbClass);
- ep.setShortName(ejbLink);
- service.addEndpoint(ep);
- }
- }
- return dep;
- }
-
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXRPCDeployerHookPreJSE.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -21,20 +21,7 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
/**
* A phase one deployer hook for JAXRPC JSE Endpoints.
@@ -53,62 +40,4 @@
return DeploymentType.JAXRPC_JSE;
}
- /**
- * Create an endpoint for every servlet-link in webservices.xml
- */
- @Override
- public Deployment createDeployment(DeploymentUnit unit)
- {
- ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setRuntimeClassLoader(null);
- dep.setType(getDeploymentType());
-
- Service service = dep.getService();
-
- JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
- if (webMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain web meta data");
-
- WebservicesMetaData wsMetaData = getWebservicesMetaData(unit);
- if (wsMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain webservices meta data");
-
- // Copy the attachments
- dep.addAttachment(WebservicesMetaData.class, wsMetaData);
- dep.addAttachment(JBossWebMetaData.class, webMetaData);
-
- for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
- {
- for (PortComponentMetaData pcmd : wsd.getPortComponents())
- {
- String servletLink = pcmd.getServletLink();
- if (servletLink == null)
- throw new IllegalStateException("servlet-link cannot be null");
-
- ServletMetaData servlet = getServletForName(webMetaData, servletLink);
- String targetBean = DeployerUtils.getTargetBean(servlet);
-
- // Create the endpoint
- Endpoint ep = newEndpoint(targetBean);
- ep.setShortName(servletLink);
- service.addEndpoint(ep);
- }
- }
-
- return dep;
- }
-
- private ServletMetaData getServletForName(JBossWebMetaData wmd, String servletLink)
- {
- for (JBossServletMetaData servlet : wmd.getServlets())
- {
- if (servletLink.equals(servlet.getName()))
- {
- return servlet;
- }
- }
- throw new IllegalStateException("Cannot find servlet for link: " + servletLink);
- }
-
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookEJB3.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -21,19 +21,7 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
-import java.util.Iterator;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Service;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
-import org.jboss.wsf.container.jboss50.invocation.InvocationHandlerEJB3;
/**
* A deployer hook for JAXWS EJB3 Endpoints.
@@ -52,46 +40,4 @@
return DeploymentType.JAXWS_EJB3;
}
- @Override
- public Deployment createDeployment(DeploymentUnit unit)
- {
- ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setRuntimeClassLoader(unit.getClassLoader());
- dep.setType(getDeploymentType());
-
- Service service = dep.getService();
-
- WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
- if (webServiceDeployment == null)
- throw new IllegalStateException("Deployment unit does not contain webServiceDeployment");
-
- // Copy the attachments
- dep.addAttachment(WebServiceDeployment.class, webServiceDeployment);
-
- Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
- while (it.hasNext())
- {
- WebServiceDeclaration container = it.next();
- if (DeployerUtils.isWebServiceBean(container))
- {
- String ejbName = container.getComponentName();
- String epBean = container.getComponentClassName();
-
- // Create the endpoint
- Endpoint ep = newEndpoint(epBean);
- ep.setShortName(ejbName);
-
- String containName = container.getContainerName();
- if(null==containName)
- throw new IllegalArgumentException("Target container name not set");
- ep.setProperty(InvocationHandlerEJB3.CONTAINER_NAME, containName);
-
- service.addEndpoint(ep);
- }
- }
-
- return dep;
- }
-
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/JAXWSDeployerHookPreJSE.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -21,18 +21,7 @@
*/
package org.jboss.wsf.container.jboss50.deployer;
-import java.util.List;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Service;
/**
* A phase one deployer hook for JAXWS JSE Endpoints.
@@ -51,35 +40,4 @@
return DeploymentType.JAXWS_JSE;
}
- @Override
- public Deployment createDeployment(DeploymentUnit unit)
- {
- ArchiveDeployment dep = newDeployment(unit);
- dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
- dep.setType(getDeploymentType());
-
- Service service = dep.getService();
-
- JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
- if (webMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain web meta data");
-
- // Copy the attachments
- dep.addAttachment(JBossWebMetaData.class, webMetaData);
-
- List<ServletMetaData> servlets = DeployerUtils.getRelevantJAXWSServlets(webMetaData, unit.getClassLoader());
- for (ServletMetaData servlet : servlets)
- {
- String servletName = servlet.getName();
- String targetBean = DeployerUtils.getTargetBean(servlet);
-
- // Create the endpoint
- Endpoint ep = newEndpoint(targetBean);
- ep.setShortName(servletName);
- service.addEndpoint(ep);
- }
-
- return dep;
- }
-
}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDeploymentDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -0,0 +1,348 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.serviceref.VirtualFileAdaptor;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.container.jboss50.invocation.InvocationHandlerEJB3;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Service;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * This deployer initializes JBossWS deployment meta data.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSDeploymentDeployer extends AbstractRealDeployer
+{
+
+ private static final WSVirtualFileFilter WS_FILEFILTER = new WSVirtualFileFilter();
+ private DeploymentModelFactory deploymentModelFactory;
+
+ /**
+ * Constructor.
+ */
+ public WSDeploymentDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput( JBossWebMetaData.class );
+ this.addInput( DeploymentType.class );
+
+ // outputs
+ this.addOutput( JBossWebMetaData.class );
+ this.addOutput( Deployment.class );
+
+ // [JBDEPLOY-201] workaround
+ this.setRelativeOrder( 2 );
+ }
+
+ @Override
+ protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ final DeploymentType deploymentType = unit.getAttachment( DeploymentType.class );
+ if ( deploymentType != null )
+ {
+ if ( DeploymentType.JAXRPC_EJB21.equals( deploymentType ) )
+ {
+ this.newJAXRPCEJB21Deployment( unit );
+ }
+ else if ( DeploymentType.JAXWS_EJB3.equals( deploymentType ) )
+ {
+ this.newJAXWSEJB3Deployment( unit );
+ }
+ else if ( DeploymentType.JAXRPC_JSE.equals( deploymentType ) )
+ {
+ this.newJAXRPCJSEDeployment( unit );
+ }
+ else if ( DeploymentType.JAXWS_JSE.equals( deploymentType ) )
+ {
+ this.newJAXWSJSEDeployment( unit );
+ }
+ }
+ }
+
+ private void newJAXRPCEJB21Deployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ dep.setType(unit.getAttachment( DeploymentType.class ));
+
+ Service service = dep.getService();
+
+ JBossMetaData jbmd = unit.getAttachment(JBossMetaData.class);
+ if (jbmd == null)
+ throw new IllegalStateException("Deployment unit does not contain application meta data");
+
+ WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain webservices meta data");
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ if (webServiceDeployment == null)
+ throw new IllegalStateException("Deployment unit does not contain webServiceDeployment");
+
+ // Copy the attachments
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.addAttachment(JBossMetaData.class, jbmd);
+ dep.addAttachment(WebServiceDeployment.class, webServiceDeployment);
+
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData pcmd : wsd.getPortComponents())
+ {
+ String ejbLink = pcmd.getEjbLink();
+ if (ejbLink == null)
+ throw new IllegalStateException("ejb-link cannot be null");
+
+ JBossEnterpriseBeanMetaData beanMetaData = jbmd.getEnterpriseBean(ejbLink);
+ if (beanMetaData == null)
+ throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);
+
+ String ejbClass = beanMetaData.getEjbClass();
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(ejbClass);
+ ep.setShortName(ejbLink);
+ service.addEndpoint(ep);
+ }
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private void newJAXWSEJB3Deployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ dep.setType(unit.getAttachment( DeploymentType.class ));
+
+ Service service = dep.getService();
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ if (webServiceDeployment == null)
+ throw new IllegalStateException("Deployment unit does not contain webServiceDeployment");
+
+ // Copy the attachments
+ dep.addAttachment(WebServiceDeployment.class, webServiceDeployment);
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (DeployerUtils.isWebServiceBean(container))
+ {
+ String ejbName = container.getComponentName();
+ String epBean = container.getComponentClassName();
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(epBean);
+ ep.setShortName(ejbName);
+
+ String containName = container.getContainerName();
+ if(null==containName)
+ throw new IllegalArgumentException("Target container name not set");
+ ep.setProperty(InvocationHandlerEJB3.CONTAINER_NAME, containName);
+
+ service.addEndpoint(ep);
+ }
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private void newJAXRPCJSEDeployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setRuntimeClassLoader(null);
+ dep.setType(unit.getAttachment( DeploymentType.class ));
+
+ Service service = dep.getService();
+
+ JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta data");
+
+ WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain webservices meta data");
+
+ // Copy the attachments
+ dep.addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.addAttachment(JBossWebMetaData.class, webMetaData);
+
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData pcmd : wsd.getPortComponents())
+ {
+ String servletLink = pcmd.getServletLink();
+ if (servletLink == null)
+ throw new IllegalStateException("servlet-link cannot be null");
+
+ ServletMetaData servlet = getServletForName(webMetaData, servletLink);
+ String targetBean = DeployerUtils.getTargetBean(servlet);
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(targetBean);
+ ep.setShortName(servletLink);
+ service.addEndpoint(ep);
+ }
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private void newJAXWSJSEDeployment( final DeploymentUnit unit )
+ {
+ ArchiveDeployment dep = newDeployment(unit);
+ dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit)unit).getRoot()));
+ dep.setType(unit.getAttachment( DeploymentType.class ));
+
+ Service service = dep.getService();
+
+ JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta data");
+
+ // Copy the attachments
+ dep.addAttachment(JBossWebMetaData.class, webMetaData);
+
+ List<ServletMetaData> servlets = DeployerUtils.getRelevantJAXWSServlets(webMetaData, unit.getClassLoader());
+ for (ServletMetaData servlet : servlets)
+ {
+ String servletName = servlet.getName();
+ String targetBean = DeployerUtils.getTargetBean(servlet);
+
+ // Create the endpoint
+ Endpoint ep = newEndpoint(targetBean);
+ ep.setShortName(servletName);
+ service.addEndpoint(ep);
+ }
+
+ dep.addAttachment(DeploymentUnit.class, unit);
+ unit.addAttachment( Deployment.class, dep );
+ }
+
+ private ServletMetaData getServletForName(JBossWebMetaData wmd, String servletLink)
+ {
+ for (JBossServletMetaData servlet : wmd.getServlets())
+ {
+ if (servletLink.equals(servlet.getName()))
+ {
+ return servlet;
+ }
+ }
+ throw new IllegalStateException("Cannot find servlet for link: " + servletLink);
+ }
+
+ private ArchiveDeployment newDeployment(DeploymentUnit unit)
+ {
+ try
+ {
+ DeploymentModelFactory factory = getDeploymentModelFactory();
+ ArchiveDeployment dep = (ArchiveDeployment)factory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
+ List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WS_FILEFILTER); //get all wsdl and xsd files
+ Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
+ for (VirtualFile vf : virtualFiles)
+ {
+ // Adding the roots of the virtual files.
+ uVirtualFiles.add(new VirtualFileAdaptor(vf.getVFS().getRoot()));
+ }
+ dep.setMetadataFiles(new LinkedList<UnifiedVirtualFile>(uVirtualFiles));
+ }
+
+ if (unit.getParent() != null)
+ {
+ DeploymentUnit parentUnit = unit.getParent();
+ ArchiveDeployment parentDep = (ArchiveDeployment)factory.newDeployment(parentUnit.getSimpleName(), parentUnit.getClassLoader());
+ dep.setParent(parentDep);
+ }
+ return dep;
+ }
+ catch (Exception ex)
+ {
+ throw new WSFDeploymentException("Cannot load spi.deployment.Deployment class", ex);
+ }
+ }
+
+ private DeploymentModelFactory getDeploymentModelFactory()
+ {
+ if(null == deploymentModelFactory)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+ }
+
+ return deploymentModelFactory;
+ }
+
+ private Endpoint newEndpoint(String targetBean)
+ {
+ try
+ {
+ return getDeploymentModelFactory().newEndpoint(targetBean);
+ }
+ catch (Exception ex)
+ {
+ throw new WSFDeploymentException("Cannot load spi.deployment.Endpoint class", ex);
+ }
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDescriptorDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDescriptorDeployer.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSDescriptorDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
+
+import org.jboss.deployers.vfs.spi.deployer.ObjectModelFactoryDeployer;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * webservices.xml deployer.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSDescriptorDeployer extends ObjectModelFactoryDeployer< WebservicesMetaData >
+{
+
+ /**
+ * Constructor.
+ */
+ public WSDescriptorDeployer()
+ {
+ super( WebservicesMetaData.class );
+ }
+
+ /**
+ * Model factory generator.
+ */
+ @Override
+ protected ObjectModelFactory getObjectModelFactory( final WebservicesMetaData root )
+ {
+ return new WebservicesFactory( null );
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSEJBAdapterDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSEJBAdapterDeployer.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSEJBAdapterDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -0,0 +1,269 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb.deployers.EjbDeployment;
+import org.jboss.ejb.deployers.MergedJBossMetaDataDeployer;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * WebServiceDeployment deployer processes EJB containers and its metadata and creates WS adapters wrapping it.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSEJBAdapterDeployer extends AbstractRealDeployer
+{
+
+ /**
+ * Constructor.
+ */
+ public WSEJBAdapterDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput( MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME );
+ this.addInput( EjbDeployment.class );
+ this.addInput( Ejb3Deployment.class );
+ this.addInput( WebservicesMetaData.class );
+
+ // outputs
+ this.addOutput( WebServiceDeployment.class );
+ }
+
+ /**
+ * Deploys WebServiceDeployment meta data.
+ */
+ @Override
+ protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ final JBossMetaData mergedMD = ( JBossMetaData )unit.getAttachment(
+ MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME
+ );
+ final Ejb3Deployment ejb3Deployment = unit.getAttachment( Ejb3Deployment.class );
+
+ if( mergedMD != null )
+ {
+ final WebServiceDeploymentAdapter wsDeploymentAdapter = new WebServiceDeploymentAdapter();
+ final Iterator< JBossEnterpriseBeanMetaData > ejbIterator = mergedMD.getEnterpriseBeans().iterator();
+
+ while( ejbIterator.hasNext() )
+ {
+ final JBossEnterpriseBeanMetaData ejbMD = ejbIterator.next();
+ final EJBContainer ejbContainer = this.getContainer( ejb3Deployment, ejbMD );
+
+ if( ejbMD.getEjbClass() != null )
+ {
+ wsDeploymentAdapter.getServiceEndpoints().add(
+ new WebServiceDeclarationAdapter( ejbMD, ejbContainer, unit.getClassLoader() )
+ );
+ }
+ else
+ {
+ log.warn( "Ingoring ejb deployment with null classname: " + ejbMD );
+ }
+ }
+
+ unit.addAttachment( WebServiceDeployment.class, wsDeploymentAdapter );
+ }
+ }
+
+ /**
+ * Returns EJB container if EJB3 deployment is detected and EJB meta data does not represent entity bean.
+ *
+ * @param ejb3Deployment EJB3 deployment meta data
+ * @param ejbMD EJB meta data
+ * @return EJB container or null if not EJB3 stateless bean
+ * @throws DeploymentException if some error occurs
+ */
+ private EJBContainer getContainer( final Ejb3Deployment ejb3Deployment, final JBossEnterpriseBeanMetaData ejbMD )
+ throws DeploymentException
+ {
+ if ( ( ejb3Deployment != null ) && ( ejbMD.isEntity() == false ) )
+ {
+ try
+ {
+ final ObjectName objName = new ObjectName( ejbMD.determineContainerName() );
+ return ( EJBContainer ) ejb3Deployment.getContainer( objName );
+ }
+ catch ( MalformedObjectNameException e )
+ {
+ throw new DeploymentException( e );
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Adopts EJB3 bean meta data to a
+ * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration}.
+ */
+ private static class WebServiceDeclarationAdapter implements WebServiceDeclaration
+ {
+
+ private final JBossEnterpriseBeanMetaData ejbMetaData;
+ private final EJBContainer ejbContainer;
+ private final ClassLoader loader;
+
+ /**
+ * Constructor.
+ *
+ * @param ejbMetaData EJB metadata
+ * @param ejbContainer EJB container
+ * @param loader class loader
+ */
+ private WebServiceDeclarationAdapter
+ (
+ final JBossEnterpriseBeanMetaData ejbMetaData,
+ final EJBContainer ejbContainer,
+ final ClassLoader loader
+ )
+ {
+ super();
+
+ this.ejbMetaData = ejbMetaData;
+ this.ejbContainer = ejbContainer;
+ this.loader = loader;
+ }
+
+ /**
+ * Returns EJB container name.
+ *
+ * @return container name
+ */
+ public String getContainerName()
+ {
+ return this.ejbMetaData.determineContainerName();
+ }
+
+ /**
+ * Returns JNDI context associated with EJB container.
+ *
+ * @return JNDI context
+ */
+ public Context getContext()
+ {
+ return this.ejbContainer.getEnc();
+ }
+
+ /**
+ * Returns EJB name.
+ *
+ * @returns name
+ */
+ public String getComponentName()
+ {
+ return this.ejbMetaData.getName();
+ }
+
+ /**
+ * Returns EJB class name.
+ *
+ * @return class name
+ */
+ public String getComponentClassName()
+ {
+ return this.ejbMetaData.getEjbClass();
+ }
+
+ /**
+ * Returns requested annotation associated with EJB container or EJB bean.
+ *
+ * @return requested annotation or null if not found
+ */
+ public < T extends Annotation > T getAnnotation( final Class<T> annotationType )
+ {
+ final boolean haveEjbContainer = this.ejbContainer != null;
+
+ if ( haveEjbContainer )
+ {
+ return this.ejbContainer.getAnnotation( annotationType );
+ }
+ else
+ {
+ final Class< ? > bean = this.getComponentClass();
+ return ( T ) bean.getAnnotation( annotationType );
+ }
+ }
+
+ /**
+ * Loads ejb class from associated loader.
+ *
+ * @return ejb class instance
+ */
+ private Class< ? > getComponentClass()
+ {
+ try
+ {
+ return this.loader.loadClass( this.getComponentClassName() );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ throw new RuntimeException( "Failed to load component class: " +
+ this.getComponentClassName() + " from loader: " + this.loader );
+ }
+ }
+
+ }
+
+ /**
+ * Adopts an EJB deployment to a
+ * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeployment}
+ */
+ private static class WebServiceDeploymentAdapter implements WebServiceDeployment
+ {
+
+ /** List of endpoints. */
+ private final List< WebServiceDeclaration > endpoints = new ArrayList< WebServiceDeclaration >();
+
+ /**
+ * Returns endpoints list.
+ *
+ * @return endpoints list
+ */
+ public List< WebServiceDeclaration > getServiceEndpoints()
+ {
+ return endpoints;
+ }
+
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSTypeDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSTypeDeployer.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WSTypeDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Detects webservice deployment type.
+ * TODO: move all isWebServiceDeployment staff here, use DeploymentVisitor?
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class WSTypeDeployer extends AbstractRealDeployer
+{
+
+ /**
+ * Constructor.
+ */
+ public WSTypeDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput( JBossWebMetaData.class );
+ this.addInput( WebservicesMetaData.class );
+ this.addInput( WebServiceDeployment.class );
+
+ // outputs
+ this.addOutput( DeploymentType.class );
+ this.addOutput( JBossWebMetaData.class );
+
+ // [JBDEPLOY-201] workaround
+ this.setRelativeOrder( 1 );
+ }
+
+ /**
+ * Detects deployment type and puts it to the deployment unit attachment.
+ */
+ @Override
+ protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
+ {
+ if ( isJAXRPCEJB21DeploymentType( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXRPC_EJB21 );
+ }
+ else if ( isJAXWSEJB3DeploymentType( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXWS_EJB3 );
+ }
+ else if ( isJAXRPCJSEDeploymentType( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXRPC_JSE );
+ }
+ else if ( isJAXWSJSEDeploymentType( unit ) )
+ {
+ unit.addAttachment( DeploymentType.class, DeploymentType.JAXWS_JSE );
+ }
+ }
+
+ private boolean isJAXRPCEJB21DeploymentType( final DeploymentUnit unit )
+ {
+ WebservicesMetaData wsMetaData = unit.getAttachment( WebservicesMetaData.class );
+ return ( wsMetaData != null ) && ( unit.getAllMetaData( JBossMetaData.class ).size() > 0 );
+ }
+
+ private boolean isJAXRPCJSEDeploymentType( final DeploymentUnit unit )
+ {
+ JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+
+ if (webMetaData == null)
+ {
+ return false;
+ }
+
+ WebservicesMetaData wsMetaData = unit.getAttachment( WebservicesMetaData.class );
+ if ( wsMetaData == null )
+ {
+ return false;
+ }
+
+ boolean isWebServiceDeployment = false;
+ try
+ {
+ List<ServletMetaData> servlets = DeployerUtils.getRelevantJAXRPCServlets(webMetaData, unit.getClassLoader());
+ isWebServiceDeployment = servlets.size() > 0;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process web deployment", ex);
+ }
+
+ return isWebServiceDeployment;
+ }
+
+ private boolean isJAXWSEJB3DeploymentType( final DeploymentUnit unit )
+ {
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ if (null == webServiceDeployment )
+ return false;
+
+ boolean isWebServiceDeployment = false;
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (DeployerUtils.isWebServiceBean(container))
+ {
+ isWebServiceDeployment = true;
+ break;
+ }
+ }
+
+ return isWebServiceDeployment;
+ }
+
+ public boolean isJAXWSJSEDeploymentType( final DeploymentUnit unit )
+ {
+ JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
+
+ if (webMetaData == null)
+ {
+ return false;
+ }
+
+ boolean isWebServiceDeployment = false;
+ try
+ {
+ List<ServletMetaData> servlets = DeployerUtils.getRelevantJAXWSServlets(webMetaData, unit.getClassLoader());
+ isWebServiceDeployment = servlets.size() > 0;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process web deployment", ex);
+ }
+
+ return isWebServiceDeployment;
+ }
+
+}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -22,7 +22,7 @@
package org.jboss.wsf.container.jboss50.deployer;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.Deployment;
/**
* This it the web service deployer for EJB. It gets
@@ -46,13 +46,13 @@
// inputs
this.addInput( JBossWebMetaData.class );
- this.addInput( DeploymentType.class );
+ this.addInput( Deployment.class );
// outputs
this.addOutput( JBossWebMetaData.class );
// [JBDEPLOY-201] workaround
- this.setRelativeOrder( 2 );
+ this.setRelativeOrder( 3 );
}
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPostJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPostJSE.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPostJSE.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -22,7 +22,7 @@
package org.jboss.wsf.container.jboss50.deployer;
import org.jboss.web.deployers.WarDeployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.Deployment;
/**
* The phase two web service deployer for JSE.
@@ -42,7 +42,7 @@
super();
// inputs
- this.addInput( DeploymentType.class );
+ this.addInput( Deployment.class );
this.addInput( WarDeployment.class );
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPreJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPreJSE.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerPreJSE.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -22,7 +22,7 @@
package org.jboss.wsf.container.jboss50.deployer;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.Deployment;
/**
* The phase one web service deployer for JSE.
@@ -43,13 +43,13 @@
// inputs
this.addInput( JBossWebMetaData.class );
- this.addInput( DeploymentType.class );
+ this.addInput( Deployment.class );
// outputs
this.addOutput( JBossWebMetaData.class );
// [JBDEPLOY-201] workaround
- this.setRelativeOrder( 3 ); // [JBDEPLOY-201] workaround
+ this.setRelativeOrder( 4 );
}
}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentDeployer.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -1,269 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.naming.Context;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.ejb.deployers.EjbDeployment;
-import org.jboss.ejb.deployers.MergedJBossMetaDataDeployer;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-
-/**
- * WebServiceDeployment deployer processes EJB containers and its metadata and creates WS adapters wrapping it.
- *
- * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
- */
-public final class WebServiceDeploymentDeployer extends AbstractRealDeployer
-{
-
- /**
- * Constructor.
- */
- public WebServiceDeploymentDeployer()
- {
- super();
-
- // inputs
- this.addInput( MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME );
- this.addInput( EjbDeployment.class );
- this.addInput( Ejb3Deployment.class );
- this.addInput( WebservicesMetaData.class );
-
- // outputs
- this.addOutput( WebServiceDeployment.class );
- }
-
- /**
- * Deploys WebServiceDeployment meta data.
- */
- @Override
- protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
- {
- final JBossMetaData mergedMD = ( JBossMetaData )unit.getAttachment(
- MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME
- );
- final Ejb3Deployment ejb3Deployment = unit.getAttachment( Ejb3Deployment.class );
-
- if( mergedMD != null )
- {
- final WebServiceDeploymentAdapter wsDeploymentAdapter = new WebServiceDeploymentAdapter();
- final Iterator< JBossEnterpriseBeanMetaData > ejbIterator = mergedMD.getEnterpriseBeans().iterator();
-
- while( ejbIterator.hasNext() )
- {
- final JBossEnterpriseBeanMetaData ejbMD = ejbIterator.next();
- final EJBContainer ejbContainer = this.getContainer( ejb3Deployment, ejbMD );
-
- if( ejbMD.getEjbClass() != null )
- {
- wsDeploymentAdapter.getServiceEndpoints().add(
- new WebServiceDeclarationAdapter( ejbMD, ejbContainer, unit.getClassLoader() )
- );
- }
- else
- {
- log.warn( "Ingoring ejb deployment with null classname: " + ejbMD );
- }
- }
-
- unit.addAttachment( WebServiceDeployment.class, wsDeploymentAdapter );
- }
- }
-
- /**
- * Returns EJB container if EJB3 deployment is detected and EJB meta data does not represent entity bean.
- *
- * @param ejb3Deployment EJB3 deployment meta data
- * @param ejbMD EJB meta data
- * @return EJB container or null if not EJB3 stateless bean
- * @throws DeploymentException if some error occurs
- */
- private EJBContainer getContainer( final Ejb3Deployment ejb3Deployment, final JBossEnterpriseBeanMetaData ejbMD )
- throws DeploymentException
- {
- if ( ( ejb3Deployment != null ) && ( ejbMD.isEntity() == false ) )
- {
- try
- {
- final ObjectName objName = new ObjectName( ejbMD.determineContainerName() );
- return ( EJBContainer ) ejb3Deployment.getContainer( objName );
- }
- catch ( MalformedObjectNameException e )
- {
- throw new DeploymentException( e );
- }
- }
-
- return null;
- }
-
- /**
- * Adopts EJB3 bean meta data to a
- * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration}.
- */
- private static class WebServiceDeclarationAdapter implements WebServiceDeclaration
- {
-
- private final JBossEnterpriseBeanMetaData ejbMetaData;
- private final EJBContainer ejbContainer;
- private final ClassLoader loader;
-
- /**
- * Constructor.
- *
- * @param ejbMetaData EJB metadata
- * @param ejbContainer EJB container
- * @param loader class loader
- */
- private WebServiceDeclarationAdapter
- (
- final JBossEnterpriseBeanMetaData ejbMetaData,
- final EJBContainer ejbContainer,
- final ClassLoader loader
- )
- {
- super();
-
- this.ejbMetaData = ejbMetaData;
- this.ejbContainer = ejbContainer;
- this.loader = loader;
- }
-
- /**
- * Returns EJB container name.
- *
- * @return container name
- */
- public String getContainerName()
- {
- return this.ejbMetaData.determineContainerName();
- }
-
- /**
- * Returns JNDI context associated with EJB container.
- *
- * @return JNDI context
- */
- public Context getContext()
- {
- return this.ejbContainer.getEnc();
- }
-
- /**
- * Returns EJB name.
- *
- * @returns name
- */
- public String getComponentName()
- {
- return this.ejbMetaData.getName();
- }
-
- /**
- * Returns EJB class name.
- *
- * @return class name
- */
- public String getComponentClassName()
- {
- return this.ejbMetaData.getEjbClass();
- }
-
- /**
- * Returns requested annotation associated with EJB container or EJB bean.
- *
- * @return requested annotation or null if not found
- */
- public < T extends Annotation > T getAnnotation( final Class<T> annotationType )
- {
- final boolean haveEjbContainer = this.ejbContainer != null;
-
- if ( haveEjbContainer )
- {
- return this.ejbContainer.getAnnotation( annotationType );
- }
- else
- {
- final Class< ? > bean = this.getComponentClass();
- return ( T ) bean.getAnnotation( annotationType );
- }
- }
-
- /**
- * Loads ejb class from associated loader.
- *
- * @return ejb class instance
- */
- private Class< ? > getComponentClass()
- {
- try
- {
- return this.loader.loadClass( this.getComponentClassName() );
- }
- catch ( ClassNotFoundException cnfe )
- {
- throw new RuntimeException( "Failed to load component class: " +
- this.getComponentClassName() + " from loader: " + this.loader );
- }
- }
-
- }
-
- /**
- * Adopts an EJB deployment to a
- * {@link org.jboss.wsf.spi.deployment.integration.WebServiceDeployment}
- */
- private static class WebServiceDeploymentAdapter implements WebServiceDeployment
- {
-
- /** List of endpoints. */
- private final List< WebServiceDeclaration > endpoints = new ArrayList< WebServiceDeclaration >();
-
- /**
- * Returns endpoints list.
- *
- * @return endpoints list
- */
- public List< WebServiceDeclaration > getServiceEndpoints()
- {
- return endpoints;
- }
-
- }
-
-}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentTypeDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentTypeDeployer.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeploymentTypeDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-
-/**
- * Detects webservice deployment type.
- * TODO: move all isWebServiceDeployment staff here, use DeploymentVisitor?
- *
- * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
- */
-public final class WebServiceDeploymentTypeDeployer extends AbstractRealDeployer
-{
-
- /**
- * Constructor.
- */
- public WebServiceDeploymentTypeDeployer()
- {
- super();
-
- // inputs
- this.addInput( JBossWebMetaData.class );
- this.addInput( WebservicesMetaData.class );
- this.addInput( WebServiceDeployment.class );
-
- // outputs
- this.addOutput( DeploymentType.class );
- this.addOutput( JBossWebMetaData.class );
-
- // [JBDEPLOY-201] workaround
- this.setRelativeOrder( 1 );
- }
-
- /**
- * Detects deployment type and puts it to the deployment unit attachment.
- */
- @Override
- protected void internalDeploy( final DeploymentUnit unit ) throws DeploymentException
- {
- if ( isJAXRPCEJB21DeploymentType( unit ) )
- {
- unit.addAttachment( DeploymentType.class, DeploymentType.JAXRPC_EJB21 );
- }
- else if ( isJAXWSEJB3DeploymentType( unit ) )
- {
- unit.addAttachment( DeploymentType.class, DeploymentType.JAXWS_EJB3 );
- }
- else if ( isJAXRPCJSEDeploymentType( unit ) )
- {
- unit.addAttachment( DeploymentType.class, DeploymentType.JAXRPC_JSE );
- }
- else if ( isJAXWSJSEDeploymentType( unit ) )
- {
- unit.addAttachment( DeploymentType.class, DeploymentType.JAXWS_JSE );
- }
- }
-
- private boolean isJAXRPCEJB21DeploymentType( final DeploymentUnit unit )
- {
- WebservicesMetaData wsMetaData = unit.getAttachment( WebservicesMetaData.class );
- return ( wsMetaData != null ) && ( unit.getAllMetaData( JBossMetaData.class ).size() > 0 );
- }
-
- private boolean isJAXRPCJSEDeploymentType( final DeploymentUnit unit )
- {
- JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
-
- if (webMetaData == null)
- {
- return false;
- }
-
- WebservicesMetaData wsMetaData = unit.getAttachment( WebservicesMetaData.class );
- if ( wsMetaData == null )
- {
- return false;
- }
-
- boolean isWebServiceDeployment = false;
- try
- {
- List<ServletMetaData> servlets = DeployerUtils.getRelevantJAXRPCServlets(webMetaData, unit.getClassLoader());
- isWebServiceDeployment = servlets.size() > 0;
- }
- catch (Exception ex)
- {
- log.error("Cannot process web deployment", ex);
- }
-
- return isWebServiceDeployment;
- }
-
- private boolean isJAXWSEJB3DeploymentType( final DeploymentUnit unit )
- {
- WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
- if (null == webServiceDeployment )
- return false;
-
- boolean isWebServiceDeployment = false;
-
- Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
- while (it.hasNext())
- {
- WebServiceDeclaration container = it.next();
- if (DeployerUtils.isWebServiceBean(container))
- {
- isWebServiceDeployment = true;
- break;
- }
- }
-
- return isWebServiceDeployment;
- }
-
- public boolean isJAXWSJSEDeploymentType( final DeploymentUnit unit )
- {
- JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
-
- if (webMetaData == null)
- {
- return false;
- }
-
- boolean isWebServiceDeployment = false;
- try
- {
- List<ServletMetaData> servlets = DeployerUtils.getRelevantJAXWSServlets(webMetaData, unit.getClassLoader());
- isWebServiceDeployment = servlets.size() > 0;
- }
- catch (Exception ex)
- {
- log.error("Cannot process web deployment", ex);
- }
-
- return isWebServiceDeployment;
- }
-
-}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServicesMetaDataDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServicesMetaDataDeployer.java 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServicesMetaDataDeployer.java 2009-06-26 13:23:05 UTC (rev 10241)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.container.jboss50.deployer;
-
-import org.jboss.deployers.vfs.spi.deployer.ObjectModelFactoryDeployer;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-
-/**
- * webservices.xml deployer.
- *
- * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
- */
-public final class WebServicesMetaDataDeployer
-extends ObjectModelFactoryDeployer< WebservicesMetaData >
-{
-
- /**
- * Constructor.
- */
- public WebServicesMetaDataDeployer()
- {
- super( WebservicesMetaData.class );
- }
-
- /**
- * Model factory generator.
- */
- @Override
- protected ObjectModelFactory getObjectModelFactory( final WebservicesMetaData root )
- {
- return new WebservicesFactory( null );
- }
-
-}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-06-26 13:14:21 UTC (rev 10240)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-06-26 13:23:05 UTC (rev 10241)
@@ -76,15 +76,17 @@
********************************************************************************************************************* -->
- <bean name="WebServicesMetaDataDeployer" class="org.jboss.wsf.container.jboss50.deployer.WebServicesMetaDataDeployer">
+ <bean name="WSDescriptorDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDescriptorDeployer">
<property name="name">webservices.xml</property>
<property name="useSchemaValidation">true</property>
</bean>
- <bean name="WebServiceDeploymentDeployer" class="org.jboss.wsf.container.jboss50.deployer.WebServiceDeploymentDeployer"/>
+ <bean name="WSEJBAdapterDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSEJBAdapterDeployer"/>
- <bean name="WebServiceDeploymentTypeDeployer" class="org.jboss.wsf.container.jboss50.deployer.WebServiceDeploymentTypeDeployer"/>
+ <bean name="WSTypeDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSTypeDeployer"/>
+ <bean name="WSDeploymentDeployer" class="org.jboss.wsf.container.jboss50.deployer.WSDeploymentDeployer"/>
+
<bean name="WebServiceDeployerEJB" class="org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB"/>
<bean name="WebServiceDeployerPreJSE" class="org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerPreJSE"/>
14 years, 10 months
JBossWS SVN: r10240 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-06-26 09:14:21 -0400 (Fri, 26 Jun 2009)
New Revision: 10240
Added:
stack/native/branches/netty/
Log:
Branching for working on removing dependency on Remoting using Netty instead
Copied: stack/native/branches/netty (from rev 10239, stack/native/trunk)
14 years, 10 months