Author: richard.opalka(a)jboss.com
Date: 2009-09-29 08:53:37 -0400 (Tue, 29 Sep 2009)
New Revision: 10790
Added:
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyInvocationHandlerFactory.java
Modified:
stack/native/branches/ropalka/modules/core/pom.xml
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServer.java
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfig.java
Log:
[JBWS-2674][JBWS-2754] implementing prototype (WIP)
Added:
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
===================================================================
---
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory
(rev 0)
+++
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.deployment.DeploymentModelFactory 2009-09-29
12:53:37 UTC (rev 10790)
@@ -0,0 +1 @@
+org.jboss.wsf.framework.deployment.ArchiveDeploymentModelFactory
\ No newline at end of file
Added:
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
===================================================================
---
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory
(rev 0)
+++
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.invocation.InvocationHandlerFactory 2009-09-29
12:53:37 UTC (rev 10790)
@@ -0,0 +1 @@
+org.jboss.ws.core.jaxws.spi.http.NettyInvocationHandlerFactory
\ No newline at end of file
Modified: stack/native/branches/ropalka/modules/core/pom.xml
===================================================================
--- stack/native/branches/ropalka/modules/core/pom.xml 2009-09-29 12:51:58 UTC (rev
10789)
+++ stack/native/branches/ropalka/modules/core/pom.xml 2009-09-29 12:53:37 UTC (rev
10790)
@@ -27,6 +27,10 @@
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-framework</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
<artifactId>jbossws-spi</artifactId>
</dependency>
<dependency>
Modified:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServer.java
===================================================================
---
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServer.java 2009-09-29
12:51:58 UTC (rev 10789)
+++
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServer.java 2009-09-29
12:53:37 UTC (rev 10790)
@@ -21,14 +21,28 @@
*/
package org.jboss.ws.core.jaxws.spi.http;
+import java.util.LinkedList;
+import java.util.List;
+
import javax.xml.ws.Endpoint;
+import org.jboss.wsf.common.ResourceLoaderAdapter;
+import org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl;
+import org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.http.HttpContext;
import org.jboss.wsf.spi.http.HttpContextFactory;
import org.jboss.wsf.spi.http.HttpServer;
+import org.jboss.wsf.stack.jbws.EagerInitializeDeploymentAspect;
+import org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect;
+import org.jboss.wsf.stack.jbws.ServiceEndpointInvokerDeploymentAspect;
+import org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect;
/**
* TODO: javadoc
@@ -43,7 +57,18 @@
private static final SPIProvider SPI_PROVIDER =
SPIProviderResolver.getInstance().getProvider();
/** JBossWS Http Context factory. */
private static final HttpContextFactory HTTP_CONTEXT_FACTORY =
NettyHttpServer.SPI_PROVIDER.getSPI(HttpContextFactory.class);
+ /** Deployment model factory. */
+ private final DeploymentModelFactory deploymentModelFactory;
+
+ public NettyHttpServer()
+ {
+ super();
+ // deployment factory
+ final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ this.deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+ }
+
public HttpContext createContext(final String contextRoot)
{
return NettyHttpServer.HTTP_CONTEXT_FACTORY.newHttpContext(this, contextRoot);
@@ -54,14 +79,56 @@
throw new UnsupportedOperationException();
}
- public void publish(HttpContext context, Endpoint endpoint)
+ public void publish(HttpContext context, Endpoint ep)
{
- throw new UnsupportedOperationException();
+ Class<?> endpointClass = this.getEndpointClass(ep);
+ String contextRoot = context.getContextRoot();
+ ClassLoader loader = endpointClass.getClassLoader();
+ // TODO: should we use archive deployment - see META-INF/services ???
+ final ArchiveDeployment dep = (ArchiveDeployment)
this.deploymentModelFactory.newDeployment(contextRoot, loader);
+ final org.jboss.wsf.spi.deployment.Endpoint endpoint =
this.deploymentModelFactory.newEndpoint(endpointClass.getName());
+ endpoint.setShortName("jaxws-dynamic-endpoint");
+ dep.getService().addEndpoint(endpoint);
+ dep.setRootFile(new ResourceLoaderAdapter(loader));
+ dep.setRuntimeClassLoader(loader);
+ dep.setType(DeploymentType.JAXWS_JSE);
+ dep.getService().setContextRoot(contextRoot);
+
+ DeploymentAspectManagerImpl daManager = new DeploymentAspectManagerImpl();
+ daManager.setDeploymentAspects(getDeploymentAspects());
+ daManager.deploy(dep);
+
+ throw new UnsupportedOperationException("TODO: continue in
implementation");
}
+
+ private List<DeploymentAspect> getDeploymentAspects()
+ {
+ List<DeploymentAspect> retVal = new LinkedList<DeploymentAspect>();
+
+ retVal.add(new EndpointHandlerDeploymentAspect());
+ retVal.add(new UnifiedMetaDataDeploymentAspect());
+ retVal.add(new ServiceEndpointInvokerDeploymentAspect());
+ retVal.add(new PublishContractDeploymentAspect());
+ retVal.add(new EagerInitializeDeploymentAspect());
+
+ return retVal;
+ }
public void start()
{
// does nothing
}
+ /**
+ * Returns implementor class associated with endpoint.
+ *
+ * @param endpoint to get implementor class from
+ * @return implementor class
+ */
+ private Class<?> getEndpointClass(final Endpoint endpoint)
+ {
+ final Object implementor = endpoint.getImplementor();
+ return implementor instanceof Class<?> ? (Class<?>) implementor :
implementor.getClass();
+ }
+
}
Modified:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfig.java
===================================================================
---
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfig.java 2009-09-29
12:51:58 UTC (rev 10789)
+++
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfig.java 2009-09-29
12:53:37 UTC (rev 10790)
@@ -92,7 +92,7 @@
public boolean isModifySOAPAddress()
{
- throw new UnsupportedOperationException();
+ return true;
}
public void setModifySOAPAddress(boolean flag)
Added:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyInvocationHandlerFactory.java
===================================================================
---
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyInvocationHandlerFactory.java
(rev 0)
+++
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyInvocationHandlerFactory.java 2009-09-29
12:53:37 UTC (rev 10790)
@@ -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.ws.core.jaxws.spi.http;
+
+import org.jboss.wsf.common.invocation.InvocationHandlerJAXWS;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.InvocationHandlerFactory;
+import org.jboss.wsf.spi.invocation.InvocationType;
+
+/**
+ * TODO: javadoc
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class NettyInvocationHandlerFactory extends InvocationHandlerFactory
+{
+
+ @Override
+ public InvocationHandler newInvocationHandler(InvocationType type)
+ {
+ InvocationHandler handler = null;
+
+ switch (type)
+ {
+ case JAXWS_JSE :
+ handler = new InvocationHandlerJAXWS();
+ break;
+ default :
+ throw new IllegalArgumentException("Unable to resolve
spi.invocation.InvocationHandler for type " + type);
+ }
+
+ return handler;
+ }
+
+}