JBossWS SVN: r10792 - framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-29 12:25:45 -0400 (Tue, 29 Sep 2009)
New Revision: 10792
Modified:
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
Log:
[JBPAPP-2824] Fixing test
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2009-09-29 15:46:46 UTC (rev 10791)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2009-09-29 16:25:45 UTC (rev 10792)
@@ -23,7 +23,9 @@
// $Id$
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.net.URI;
import java.security.Principal;
import javax.annotation.Resource;
@@ -73,7 +75,7 @@
return "fail";
// Check standard jaxws properties
- InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ Object wsdl = msgContext.get(MessageContext.WSDL_DESCRIPTION);
QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
@@ -90,7 +92,16 @@
try
{
- Element root = DOMUtils.parse(wsdlSource);
+ Element root = null;
+ if (wsdl instanceof InputSource)
+ {
+ root = DOMUtils.parse((InputSource)wsdl);
+ }
+ else if (wsdl instanceof URI)
+ {
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
new DOMWriter(System.out).setPrettyprint(true).print(root);
}
catch (IOException ex)
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2009-09-29 15:46:46 UTC (rev 10791)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2009-09-29 16:25:45 UTC (rev 10792)
@@ -23,7 +23,9 @@
// $Id: $
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.net.URI;
import java.security.Principal;
import javax.annotation.Resource;
@@ -63,7 +65,7 @@
return "fail";
// Check standard jaxws properties
- InputSource wsdlSource = (InputSource)msgContext.get(MessageContext.WSDL_DESCRIPTION);
+ Object wsdl = msgContext.get(MessageContext.WSDL_DESCRIPTION);
QName service = (QName)msgContext.get(MessageContext.WSDL_SERVICE);
QName portType = (QName)msgContext.get(MessageContext.WSDL_INTERFACE);
QName port = (QName)msgContext.get(MessageContext.WSDL_PORT);
@@ -80,7 +82,16 @@
try
{
- Element root = DOMUtils.parse(wsdlSource);
+ Element root = null;
+ if (wsdl instanceof InputSource)
+ {
+ root = DOMUtils.parse((InputSource)wsdl);
+ }
+ else if (wsdl instanceof URI)
+ {
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
new DOMWriter(System.out).setPrettyprint(true).print(root);
}
catch (IOException ex)
15 years, 2 months
JBossWS SVN: r10790 - in stack/native/branches/ropalka/modules: core and 1 other directories.
by jbossws-commits@lists.jboss.org
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;
+ }
+
+}
15 years, 2 months
JBossWS SVN: r10789 - container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-29 08:51:58 -0400 (Tue, 29 Sep 2009)
New Revision: 10789
Removed:
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandlerJSE.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java
Modified:
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java
container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java
Log:
[JBWS-2674][JBWS-2754] refactoring (WIP)
Deleted: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandler.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -1,87 +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.webservices.integration.invocation;
-
-import java.lang.reflect.Method;
-
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
-
-/**
- * Base class for all Web Service invocation handlers inside AS.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-abstract class AbstractInvocationHandler extends InvocationHandler
-{
-
- /** Logger. */
- protected final Logger log = Logger.getLogger(this.getClass());
-
- /**
- * Constructor.
- */
- protected AbstractInvocationHandler()
- {
- super();
- }
-
- /**
- * Creates invocation.
- *
- * @return invocation instance
- */
- public final Invocation createInvocation()
- {
- return new Invocation();
- }
-
- /**
- * Initialization method.
- *
- * @param endpoint endpoint
- */
- public void init(final Endpoint endpoint)
- {
- // does nothing
- }
-
- /**
- * Returns implementation method that will be used for invocation.
- *
- * @param implClass implementation endpoint class
- * @param seiMethod SEI interface method used for method finding algorithm
- * @return implementation method
- * @throws NoSuchMethodException if implementation method wasn't found
- */
- protected final Method getImplMethod(final Class<?> implClass, final Method seiMethod) throws NoSuchMethodException
- {
- final String methodName = seiMethod.getName();
- final Class<?>[] paramTypes = seiMethod.getParameterTypes();
-
- return implClass.getMethod(methodName, paramTypes);
- }
-
-}
Deleted: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandlerJSE.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandlerJSE.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/AbstractInvocationHandlerJSE.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -1,181 +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.webservices.integration.invocation;
-
-import java.lang.reflect.Method;
-
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-abstract class AbstractInvocationHandlerJSE extends AbstractInvocationHandler
-{
-
- /**
- * Constructor.
- */
- protected AbstractInvocationHandlerJSE()
- {
- super();
- }
-
- /**
- * Retrieves endpoint implementation bean that will be used in invocation process.
- *
- * This method does the following steps:
- *
- * <ul>
- * <li>tries to retrieve endpoint instance from invocation context,</li>
- * <li>if endpoint instance is not found it's created and instantiated (lazy initialization)</li>
- * <li>
- * if endpoint instance was created all subclasses will be notified about this event
- * (using {@link #onEndpointInstantiated(Endpoint, Invocation)} template method).
- * </li>
- * </ul>
- *
- * @param endpoint to lookup implementation instance for
- * @param invocation current invocation
- * @return endpoint implementation
- * @throws Exception if any error occurs
- */
- protected final Object getTargetBean(final Endpoint endpoint, final Invocation invocation) throws Exception
- {
- final InvocationContext invocationContext = invocation.getInvocationContext();
- Object targetBean = invocationContext.getTargetBean();
-
- if (targetBean == null)
- {
- try
- {
- // create endpoint instance
- final Class<?> endpointImplClass = endpoint.getTargetBeanClass();
- targetBean = endpointImplClass.newInstance();
- invocationContext.setTargetBean(targetBean);
-
- // notify subclasses
- this.onEndpointInstantiated(endpoint, invocation);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot create endpoint instance: ", ex);
- }
- }
-
- return targetBean;
- }
-
- /**
- * Invokes method on endpoint implementation.
- *
- * This method does the following steps:
- *
- * <ul>
- * <li>lookups endpoint implementation method to be invoked,</li>
- * <li>
- * notifies all subclasses about endpoint method is going to be invoked<br/>
- * (using {@link #onBeforeInvocation(Invocation)} template method),
- * </li>
- * <li>endpoint implementation method is invoked,</li>
- * <li>
- * notifies all subclasses about endpoint method invocation was completed<br/>
- * (using {@link #onAfterInvocation(Invocation)} template method).
- * </li>
- * </ul>
- *
- * @param endpoint which method is going to be invoked
- * @param invocation current invocation
- * @throws Exception if any error occurs
- */
- public final void invoke(final Endpoint endpoint, final Invocation invocation) throws Exception
- {
- try
- {
- // prepare for invocation
- final Object targetBean = this.getTargetBean(endpoint, invocation);
- final Class<?> implClass = targetBean.getClass();
- final Method seiMethod = invocation.getJavaMethod();
- final Method implMethod = this.getImplMethod(implClass, seiMethod);
- final Object[] args = invocation.getArgs();
-
- // notify subclasses
- this.onBeforeInvocation(invocation);
-
- // invoke implementation method
- final Object retObj = implMethod.invoke(targetBean, args);
-
- // set invocation result
- invocation.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- this.log.error("Method invocation failed with exception: " + e.getMessage(), e);
- // propagate exception
- this.handleInvocationException(e);
- }
- finally
- {
- // notify subclasses
- this.onAfterInvocation(invocation);
- }
- }
-
- /**
- * Template method for notifying subclasses that endpoint instance have been instantiated.
- *
- * @param endpoint instantiated endpoint
- * @param invocation current invocation
- * @throws Exception subclasses have to throw exception on any failure
- */
- protected void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation) throws Exception
- {
- // does nothing
- }
-
- /**
- * Template method for notifying subclasses that endpoint method is going to be invoked.
- *
- * @param invocation current invocation
- * @throws Exception subclasses have to throw exception on any failure
- */
- protected void onBeforeInvocation(final Invocation invocation) throws Exception
- {
- // does nothing
- }
-
- /**
- * Template method for notifying subclasses that endpoint method invocation was completed.
- *
- * @param invocation current invocation
- * @throws Exception subclasses have to throw exception on any failure
- */
- protected void onAfterInvocation(final Invocation invocation) throws Exception
- {
- // does nothing
- }
-
-}
Modified: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -39,6 +39,7 @@
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.common.integration.WSHelper;
+import org.jboss.wsf.common.invocation.AbstractInvocationHandler;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Deployment;
Modified: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -26,6 +26,7 @@
import javax.xml.ws.WebServiceException;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.common.invocation.AbstractInvocationHandler;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
Modified: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -21,6 +21,8 @@
*/
package org.jboss.webservices.integration.invocation;
+import org.jboss.wsf.common.invocation.InvocationHandlerJAXRPC;
+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;
Deleted: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -1,90 +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.webservices.integration.invocation;
-
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-
-/**
- * Handles invocations on JAXRPC endpoints.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class InvocationHandlerJAXRPC extends AbstractInvocationHandlerJSE
-{
-
- /**
- * Constructor.
- */
- InvocationHandlerJAXRPC()
- {
- super();
- }
-
- /**
- * Calls {@link javax.xml.rpc.server.ServiceLifecycle#init(Object)}
- * method on target bean if this bean implements
- * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
- *
- * @param invocation current invocation
- * @throws Exception if any error occurs
- */
- @Override
- protected void onBeforeInvocation(final Invocation invocation) throws Exception
- {
- final InvocationContext invocationContext = invocation.getInvocationContext();
- final Object targetBean = invocationContext.getTargetBean();
- final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;
-
- if (isJaxrpcLifecycleBean)
- {
- final ServletEndpointContext sepContext = invocationContext.getAttachment(ServletEndpointContext.class);
- ((ServiceLifecycle) targetBean).init(sepContext);
- }
- }
-
- /**
- * Calls {@link javax.xml.rpc.server.ServiceLifecycle#destroy()}
- * method on target bean if this bean implements
- * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
- *
- * @param invocation current invocation
- * @throws Exception if any error occurs
- */
- @Override
- protected void onAfterInvocation(final Invocation invocation) throws Exception
- {
- final InvocationContext invocationContext = invocation.getInvocationContext();
- final Object targetBean = invocationContext.getTargetBean();
- final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;
-
- if (isJaxrpcLifecycleBean)
- {
- ((ServiceLifecycle) targetBean).destroy();
- }
- }
-
-}
Deleted: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXWS.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -1,143 +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.webservices.integration.invocation;
-
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.wsf.common.injection.InjectionHelper;
-import org.jboss.wsf.common.injection.PreDestroyHolder;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.ResourceInjector;
-import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
-import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
-
-/**
- * Handles invocations on JAXWS endpoints.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class InvocationHandlerJAXWS extends AbstractInvocationHandlerJSE
-{
-
- /** WebServiceContext injector. */
- private final ResourceInjector wsContextInjector;
-
- /**
- * Constructor.
- */
- InvocationHandlerJAXWS()
- {
- super();
-
- final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- final ResourceInjectorFactory resourceInjectorFactory = spiProvider.getSPI(ResourceInjectorFactory.class);
- this.wsContextInjector = resourceInjectorFactory.newResourceInjector();
- }
-
- /**
- * Injects resources on target bean and calls post construct method.
- * Finally it registers target bean for predestroy phase.
- *
- * @param endpoint used for predestroy phase registration process
- * @param invocation current invocation
- */
- @Override
- protected void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
- {
- final InjectionsMetaData injectionsMD = endpoint.getAttachment(InjectionsMetaData.class);
- final Object targetBean = this.getTargetBean(invocation);
-
- this.log.debug("Injecting resources on JAXWS JSE endpoint: " + targetBean);
- InjectionHelper.injectResources(targetBean, injectionsMD);
- this.log.debug("Calling postConstruct method on JAXWS JSE endpoint: " + targetBean);
- InjectionHelper.callPostConstructMethod(targetBean);
-
- endpoint.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
- }
-
- /**
- * Injects webservice context on target bean.
- *
- * @param invocation current invocation
- */
- @Override
- protected void onBeforeInvocation(final Invocation invocation)
- {
- final WebServiceContext wsContext = this.getWebServiceContext(invocation);
-
- if (wsContext != null)
- {
- final Object targetBean = this.getTargetBean(invocation);
- this.wsContextInjector.inject(targetBean, wsContext);
- }
- }
-
- /**
- * Cleanups injected webservice context on target bean.
- *
- * @param invocation current invocation
- */
- @Override
- protected void onAfterInvocation(final Invocation invocation)
- {
- final WebServiceContext wsContext = this.getWebServiceContext(invocation);
-
- if (wsContext != null)
- {
- final Object targetBean = this.getTargetBean(invocation);
-
- this.wsContextInjector.inject(targetBean, null);
- }
- }
-
- /**
- * Returns WebServiceContext associated with this invocation.
- *
- * @param invocation current invocation
- * @return web service context or null if not available
- */
- private WebServiceContext getWebServiceContext(final Invocation invocation)
- {
- final InvocationContext invocationContext = invocation.getInvocationContext();
-
- return invocationContext.getAttachment(WebServiceContext.class);
- }
-
- /**
- * Returns endpoint instance associated with current invocation.
- *
- * @param invocation current invocation
- * @return target bean in invocation
- */
- private Object getTargetBean(final Invocation invocation)
- {
- final InvocationContext invocationContext = invocation.getInvocationContext();
-
- return invocationContext.getTargetBean();
- }
-
-}
Modified: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB21.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -21,6 +21,8 @@
*/
package org.jboss.webservices.integration.invocation;
+import org.jboss.wsf.common.invocation.AbstractInvocationHandlerJSE;
+
/**
* Handles invocations on MDB EJB21 endpoints.
*
Modified: container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java
===================================================================
--- container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java 2009-09-29 12:50:46 UTC (rev 10788)
+++ container/jboss50/branches/ropalka/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerMDB3.java 2009-09-29 12:51:58 UTC (rev 10789)
@@ -21,6 +21,8 @@
*/
package org.jboss.webservices.integration.invocation;
+import org.jboss.wsf.common.invocation.AbstractInvocationHandlerJSE;
+
/**
* Handles invocations on MDB EJB3 endpoints.
*
15 years, 2 months
JBossWS SVN: r10788 - in common/branches/ropalka/src/main/java/org/jboss/wsf/common: invocation and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-29 08:50:46 -0400 (Tue, 29 Sep 2009)
New Revision: 10788
Added:
common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/
common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java
common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java
common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java
Log:
[JBWS-2674][JBWS-2754] refactoring (WIP)
Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java (rev 0)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java 2009-09-29 12:50:46 UTC (rev 10788)
@@ -0,0 +1,87 @@
+/*
+ * 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.common.invocation;
+
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+
+/**
+ * Base class for all Web Service invocation handlers inside AS.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public abstract class AbstractInvocationHandler extends InvocationHandler
+{
+
+ /** Logger. */
+ protected final Logger log = Logger.getLogger(this.getClass());
+
+ /**
+ * Constructor.
+ */
+ protected AbstractInvocationHandler()
+ {
+ super();
+ }
+
+ /**
+ * Creates invocation.
+ *
+ * @return invocation instance
+ */
+ public final Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ /**
+ * Initialization method.
+ *
+ * @param endpoint endpoint
+ */
+ public void init(final Endpoint endpoint)
+ {
+ // does nothing
+ }
+
+ /**
+ * Returns implementation method that will be used for invocation.
+ *
+ * @param implClass implementation endpoint class
+ * @param seiMethod SEI interface method used for method finding algorithm
+ * @return implementation method
+ * @throws NoSuchMethodException if implementation method wasn't found
+ */
+ protected final Method getImplMethod(final Class<?> implClass, final Method seiMethod) throws NoSuchMethodException
+ {
+ final String methodName = seiMethod.getName();
+ final Class<?>[] paramTypes = seiMethod.getParameterTypes();
+
+ return implClass.getMethod(methodName, paramTypes);
+ }
+
+}
Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java (rev 0)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java 2009-09-29 12:50:46 UTC (rev 10788)
@@ -0,0 +1,181 @@
+/*
+ * 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.common.invocation;
+
+import java.lang.reflect.Method;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public abstract class AbstractInvocationHandlerJSE extends AbstractInvocationHandler
+{
+
+ /**
+ * Constructor.
+ */
+ protected AbstractInvocationHandlerJSE()
+ {
+ super();
+ }
+
+ /**
+ * Retrieves endpoint implementation bean that will be used in invocation process.
+ *
+ * This method does the following steps:
+ *
+ * <ul>
+ * <li>tries to retrieve endpoint instance from invocation context,</li>
+ * <li>if endpoint instance is not found it's created and instantiated (lazy initialization)</li>
+ * <li>
+ * if endpoint instance was created all subclasses will be notified about this event
+ * (using {@link #onEndpointInstantiated(Endpoint, Invocation)} template method).
+ * </li>
+ * </ul>
+ *
+ * @param endpoint to lookup implementation instance for
+ * @param invocation current invocation
+ * @return endpoint implementation
+ * @throws Exception if any error occurs
+ */
+ protected final Object getTargetBean(final Endpoint endpoint, final Invocation invocation) throws Exception
+ {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+ Object targetBean = invocationContext.getTargetBean();
+
+ if (targetBean == null)
+ {
+ try
+ {
+ // create endpoint instance
+ final Class<?> endpointImplClass = endpoint.getTargetBeanClass();
+ targetBean = endpointImplClass.newInstance();
+ invocationContext.setTargetBean(targetBean);
+
+ // notify subclasses
+ this.onEndpointInstantiated(endpoint, invocation);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot create endpoint instance: ", ex);
+ }
+ }
+
+ return targetBean;
+ }
+
+ /**
+ * Invokes method on endpoint implementation.
+ *
+ * This method does the following steps:
+ *
+ * <ul>
+ * <li>lookups endpoint implementation method to be invoked,</li>
+ * <li>
+ * notifies all subclasses about endpoint method is going to be invoked<br/>
+ * (using {@link #onBeforeInvocation(Invocation)} template method),
+ * </li>
+ * <li>endpoint implementation method is invoked,</li>
+ * <li>
+ * notifies all subclasses about endpoint method invocation was completed<br/>
+ * (using {@link #onAfterInvocation(Invocation)} template method).
+ * </li>
+ * </ul>
+ *
+ * @param endpoint which method is going to be invoked
+ * @param invocation current invocation
+ * @throws Exception if any error occurs
+ */
+ public final void invoke(final Endpoint endpoint, final Invocation invocation) throws Exception
+ {
+ try
+ {
+ // prepare for invocation
+ final Object targetBean = this.getTargetBean(endpoint, invocation);
+ final Class<?> implClass = targetBean.getClass();
+ final Method seiMethod = invocation.getJavaMethod();
+ final Method implMethod = this.getImplMethod(implClass, seiMethod);
+ final Object[] args = invocation.getArgs();
+
+ // notify subclasses
+ this.onBeforeInvocation(invocation);
+
+ // invoke implementation method
+ final Object retObj = implMethod.invoke(targetBean, args);
+
+ // set invocation result
+ invocation.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ this.log.error("Method invocation failed with exception: " + e.getMessage(), e);
+ // propagate exception
+ this.handleInvocationException(e);
+ }
+ finally
+ {
+ // notify subclasses
+ this.onAfterInvocation(invocation);
+ }
+ }
+
+ /**
+ * Template method for notifying subclasses that endpoint instance have been instantiated.
+ *
+ * @param endpoint instantiated endpoint
+ * @param invocation current invocation
+ * @throws Exception subclasses have to throw exception on any failure
+ */
+ protected void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation) throws Exception
+ {
+ // does nothing
+ }
+
+ /**
+ * Template method for notifying subclasses that endpoint method is going to be invoked.
+ *
+ * @param invocation current invocation
+ * @throws Exception subclasses have to throw exception on any failure
+ */
+ protected void onBeforeInvocation(final Invocation invocation) throws Exception
+ {
+ // does nothing
+ }
+
+ /**
+ * Template method for notifying subclasses that endpoint method invocation was completed.
+ *
+ * @param invocation current invocation
+ * @throws Exception subclasses have to throw exception on any failure
+ */
+ protected void onAfterInvocation(final Invocation invocation) throws Exception
+ {
+ // does nothing
+ }
+
+}
Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java (rev 0)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java 2009-09-29 12:50:46 UTC (rev 10788)
@@ -0,0 +1,90 @@
+/*
+ * 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.common.invocation;
+
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+
+/**
+ * Handles invocations on JAXRPC endpoints.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class InvocationHandlerJAXRPC extends AbstractInvocationHandlerJSE
+{
+
+ /**
+ * Constructor.
+ */
+ public InvocationHandlerJAXRPC()
+ {
+ super();
+ }
+
+ /**
+ * Calls {@link javax.xml.rpc.server.ServiceLifecycle#init(Object)}
+ * method on target bean if this bean implements
+ * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
+ *
+ * @param invocation current invocation
+ * @throws Exception if any error occurs
+ */
+ @Override
+ protected void onBeforeInvocation(final Invocation invocation) throws Exception
+ {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+ final Object targetBean = invocationContext.getTargetBean();
+ final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;
+
+ if (isJaxrpcLifecycleBean)
+ {
+ final ServletEndpointContext sepContext = invocationContext.getAttachment(ServletEndpointContext.class);
+ ((ServiceLifecycle) targetBean).init(sepContext);
+ }
+ }
+
+ /**
+ * Calls {@link javax.xml.rpc.server.ServiceLifecycle#destroy()}
+ * method on target bean if this bean implements
+ * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
+ *
+ * @param invocation current invocation
+ * @throws Exception if any error occurs
+ */
+ @Override
+ protected void onAfterInvocation(final Invocation invocation) throws Exception
+ {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+ final Object targetBean = invocationContext.getTargetBean();
+ final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;
+
+ if (isJaxrpcLifecycleBean)
+ {
+ ((ServiceLifecycle) targetBean).destroy();
+ }
+ }
+
+}
Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java (rev 0)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java 2009-09-29 12:50:46 UTC (rev 10788)
@@ -0,0 +1,143 @@
+/*
+ * 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.common.invocation;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.wsf.common.injection.InjectionHelper;
+import org.jboss.wsf.common.injection.PreDestroyHolder;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.ResourceInjector;
+import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
+
+/**
+ * Handles invocations on JAXWS endpoints.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class InvocationHandlerJAXWS extends AbstractInvocationHandlerJSE
+{
+
+ /** WebServiceContext injector. */
+ private final ResourceInjector wsContextInjector;
+
+ /**
+ * Constructor.
+ */
+ public InvocationHandlerJAXWS()
+ {
+ super();
+
+ final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ final ResourceInjectorFactory resourceInjectorFactory = spiProvider.getSPI(ResourceInjectorFactory.class);
+ this.wsContextInjector = resourceInjectorFactory.newResourceInjector();
+ }
+
+ /**
+ * Injects resources on target bean and calls post construct method.
+ * Finally it registers target bean for predestroy phase.
+ *
+ * @param endpoint used for predestroy phase registration process
+ * @param invocation current invocation
+ */
+ @Override
+ protected void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
+ {
+ final InjectionsMetaData injectionsMD = endpoint.getAttachment(InjectionsMetaData.class);
+ final Object targetBean = this.getTargetBean(invocation);
+
+ this.log.debug("Injecting resources on JAXWS JSE endpoint: " + targetBean);
+ InjectionHelper.injectResources(targetBean, injectionsMD);
+ this.log.debug("Calling postConstruct method on JAXWS JSE endpoint: " + targetBean);
+ InjectionHelper.callPostConstructMethod(targetBean);
+
+ endpoint.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
+ }
+
+ /**
+ * Injects webservice context on target bean.
+ *
+ * @param invocation current invocation
+ */
+ @Override
+ protected void onBeforeInvocation(final Invocation invocation)
+ {
+ final WebServiceContext wsContext = this.getWebServiceContext(invocation);
+
+ if (wsContext != null)
+ {
+ final Object targetBean = this.getTargetBean(invocation);
+ this.wsContextInjector.inject(targetBean, wsContext);
+ }
+ }
+
+ /**
+ * Cleanups injected webservice context on target bean.
+ *
+ * @param invocation current invocation
+ */
+ @Override
+ protected void onAfterInvocation(final Invocation invocation)
+ {
+ final WebServiceContext wsContext = this.getWebServiceContext(invocation);
+
+ if (wsContext != null)
+ {
+ final Object targetBean = this.getTargetBean(invocation);
+
+ this.wsContextInjector.inject(targetBean, null);
+ }
+ }
+
+ /**
+ * Returns WebServiceContext associated with this invocation.
+ *
+ * @param invocation current invocation
+ * @return web service context or null if not available
+ */
+ private WebServiceContext getWebServiceContext(final Invocation invocation)
+ {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+
+ return invocationContext.getAttachment(WebServiceContext.class);
+ }
+
+ /**
+ * Returns endpoint instance associated with current invocation.
+ *
+ * @param invocation current invocation
+ * @return target bean in invocation
+ */
+ private Object getTargetBean(final Invocation invocation)
+ {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+
+ return invocationContext.getTargetBean();
+ }
+
+}
15 years, 2 months
JBossWS SVN: r10787 - in stack/native/branches/ropalka/modules: core/src/main/java/org/jboss/ws/core/jaxws/spi and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-29 05:57:43 -0400 (Tue, 29 Sep 2009)
New Revision: 10787
Added:
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/
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
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfigFactory.java
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerFactory.java
Removed:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java
Modified:
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory
Log:
[JBWS-2674][JBWS-2754] refactoring (WIP)
Modified: stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory
===================================================================
--- stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory 2009-09-29 08:31:23 UTC (rev 10786)
+++ stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory 2009-09-29 09:57:43 UTC (rev 10787)
@@ -1 +1 @@
-org.jboss.ws.core.jaxws.spi.NettyHttpServerFactory
\ No newline at end of file
+org.jboss.ws.core.jaxws.spi.http.NettyHttpServerFactory
\ No newline at end of file
Added: stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory
===================================================================
--- stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory (rev 0)
+++ stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.management.ServerConfigFactory 2009-09-29 09:57:43 UTC (rev 10787)
@@ -0,0 +1 @@
+org.jboss.ws.core.jaxws.spi.http.NettyHttpServerConfigFactory
\ No newline at end of file
Deleted: stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java
===================================================================
--- stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java 2009-09-29 08:31:23 UTC (rev 10786)
+++ stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java 2009-09-29 09:57:43 UTC (rev 10787)
@@ -1,54 +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.ws.core.jaxws.spi;
-
-import org.jboss.wsf.spi.http.HttpServer;
-import org.jboss.wsf.spi.http.HttpServerFactory;
-
-/**
- * @see org.jboss.wsf.spi.http.HttpServerFactory
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- */
-public final class NettyHttpServerFactory extends HttpServerFactory
-{
-
- /**
- * Constructor.
- */
- public NettyHttpServerFactory()
- {
- super();
- }
-
- /**
- * Returns Netty based http server.
- *
- * @return Netty based http server
- */
- @Override
- public HttpServer getHttpServer()
- {
- throw new UnsupportedOperationException();
- }
-
-}
Added: 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 (rev 0)
+++ stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServer.java 2009-09-29 09:57:43 UTC (rev 10787)
@@ -0,0 +1,67 @@
+/*
+ * 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 javax.xml.ws.Endpoint;
+
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.AbstractExtensible;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+
+/**
+ * TODO: javadoc
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+// TODO: review thread safety
+final class NettyHttpServer extends AbstractExtensible implements HttpServer
+{
+
+ /** JBossWS SPI provider. */
+ 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);
+
+ public HttpContext createContext(final String contextRoot)
+ {
+ return NettyHttpServer.HTTP_CONTEXT_FACTORY.newHttpContext(this, contextRoot);
+ }
+
+ public void destroy(HttpContext context, Endpoint endpoint)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void publish(HttpContext context, Endpoint endpoint)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void start()
+ {
+ // does nothing
+ }
+
+}
Added: 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 (rev 0)
+++ stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfig.java 2009-09-29 09:57:43 UTC (rev 10787)
@@ -0,0 +1,118 @@
+/*
+ * 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 java.io.File;
+import java.net.UnknownHostException;
+
+import org.jboss.ws.WSException;
+import org.jboss.wsf.spi.management.ServerConfig;
+
+/**
+ * TODO: javadoc
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class NettyHttpServerConfig implements ServerConfig
+{
+
+ // TODO: count with security manager enabled
+ private static File TMP_DIR;
+
+ static
+ {
+ try
+ {
+ TMP_DIR = new File(System.getProperty("java.io.tmpdir"));
+ }
+ catch (SecurityException se)
+ {
+ throw new WSException(se);
+ }
+ }
+
+ public File getHomeDir()
+ {
+ return NettyHttpServerConfig.TMP_DIR;
+ }
+
+ public File getServerDataDir()
+ {
+ return NettyHttpServerConfig.TMP_DIR;
+ }
+
+ public File getServerTempDir()
+ {
+ return NettyHttpServerConfig.TMP_DIR;
+ }
+
+ public String getImplementationTitle()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getImplementationVersion()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebServiceHost()
+ {
+ return "localhost";
+ }
+
+ public int getWebServicePort()
+ {
+ return 8686;
+ }
+
+ public int getWebServiceSecurePort()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isModifySOAPAddress()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setModifySOAPAddress(boolean flag)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setWebServiceHost(String host) throws UnknownHostException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setWebServicePort(int port)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setWebServiceSecurePort(int port)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
Added: stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfigFactory.java
===================================================================
--- stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfigFactory.java (rev 0)
+++ stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerConfigFactory.java 2009-09-29 09:57:43 UTC (rev 10787)
@@ -0,0 +1,51 @@
+/*
+ * 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.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+
+/**
+ * TODO: javadoc
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class NettyHttpServerConfigFactory extends ServerConfigFactory
+{
+
+ private static ServerConfig NETTY_CONFIG = new NettyHttpServerConfig();
+
+ /**
+ * Constructor.
+ */
+ public NettyHttpServerConfigFactory()
+ {
+ super();
+ }
+
+ @Override
+ public ServerConfig getServerConfig()
+ {
+ return NettyHttpServerConfigFactory.NETTY_CONFIG;
+ }
+
+}
Added: stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerFactory.java
===================================================================
--- stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerFactory.java (rev 0)
+++ stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerFactory.java 2009-09-29 09:57:43 UTC (rev 10787)
@@ -0,0 +1,56 @@
+/*
+ * 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.spi.http.HttpServer;
+import org.jboss.wsf.spi.http.HttpServerFactory;
+
+/**
+ * @see org.jboss.wsf.spi.http.HttpServerFactory
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class NettyHttpServerFactory extends HttpServerFactory
+{
+
+ private static final HttpServer NETTY_HTTP_SERVER = new NettyHttpServer();
+
+ /**
+ * Constructor.
+ */
+ public NettyHttpServerFactory()
+ {
+ super();
+ }
+
+ /**
+ * Returns Netty based http server.
+ *
+ * @return Netty based http server
+ */
+ @Override
+ public HttpServer getHttpServer()
+ {
+ return NettyHttpServerFactory.NETTY_HTTP_SERVER;
+ }
+
+}
15 years, 2 months
JBossWS SVN: r10786 - in stack/native/branches/ropalka/modules: client/src/main/resources/META-INF/services and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-29 04:31:23 -0400 (Tue, 29 Sep 2009)
New Revision: 10786
Added:
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/
stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java
Log:
[JBWS-2674][JBWS-2754] refactoring (WIP)
Added: stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory
===================================================================
--- stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory (rev 0)
+++ stack/native/branches/ropalka/modules/client/src/main/resources/META-INF/services/org.jboss.wsf.spi.http.HttpServerFactory 2009-09-29 08:31:23 UTC (rev 10786)
@@ -0,0 +1 @@
+org.jboss.ws.core.jaxws.spi.NettyHttpServerFactory
\ No newline at end of file
Added: stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java
===================================================================
--- stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java (rev 0)
+++ stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/NettyHttpServerFactory.java 2009-09-29 08:31:23 UTC (rev 10786)
@@ -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;
+
+import org.jboss.wsf.spi.http.HttpServer;
+import org.jboss.wsf.spi.http.HttpServerFactory;
+
+/**
+ * @see org.jboss.wsf.spi.http.HttpServerFactory
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class NettyHttpServerFactory extends HttpServerFactory
+{
+
+ /**
+ * Constructor.
+ */
+ public NettyHttpServerFactory()
+ {
+ super();
+ }
+
+ /**
+ * Returns Netty based http server.
+ *
+ * @return Netty based http server
+ */
+ @Override
+ public HttpServer getHttpServer()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
15 years, 2 months
JBossWS SVN: r10785 - in framework/branches/ropalka/src/main/java/org/jboss/wsf/framework: http and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-09-29 04:27:28 -0400 (Tue, 29 Sep 2009)
New Revision: 10785
Removed:
framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java
Modified:
framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
Log:
[JBWS-2674][JBWS-2754] refactoring (WIP)
Modified: framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
===================================================================
--- framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2009-09-29 07:41:34 UTC (rev 10784)
+++ framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2009-09-29 08:27:28 UTC (rev 10785)
@@ -25,7 +25,6 @@
import org.jboss.wsf.framework.deployment.DefaultDeploymentModelFactory;
import org.jboss.wsf.framework.deployment.DefaultLifecycleHandlerFactory;
import org.jboss.wsf.framework.http.DefaultHttpContextFactory;
-import org.jboss.wsf.framework.http.DefaultHttpServerFactory;
import org.jboss.wsf.framework.invocation.DefaultResourceInjectorFactory;
import org.jboss.wsf.framework.management.DefaultEndpointMetricsFactory;
import org.jboss.wsf.framework.security.DefaultSecurityAdapterFactory;
@@ -37,7 +36,6 @@
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
import org.jboss.wsf.spi.deployment.LifecycleHandlerFactory;
import org.jboss.wsf.spi.http.HttpContextFactory;
-import org.jboss.wsf.spi.http.HttpServerFactory;
import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
import org.jboss.wsf.spi.management.EndpointMetricsFactory;
@@ -76,10 +74,6 @@
{
returnType = loadService(spiType, DefaultHttpContextFactory.class);
}
- else if (HttpServerFactory.class.equals(spiType))
- {
- returnType = loadService(spiType, DefaultHttpServerFactory.class);
- }
else if (LifecycleHandlerFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultLifecycleHandlerFactory.class);
Deleted: framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java
===================================================================
--- framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java 2009-09-29 07:41:34 UTC (rev 10784)
+++ framework/branches/ropalka/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java 2009-09-29 08:27:28 UTC (rev 10785)
@@ -1,40 +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.framework.http;
-
-import org.jboss.wsf.spi.http.HttpServer;
-import org.jboss.wsf.spi.http.HttpServerFactory;
-
-/**
- * A factory for an abstract HTTP Context
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 07-Jul-2006
- */
-public class DefaultHttpServerFactory extends HttpServerFactory
-{
- @Override
- public HttpServer getHttpServer()
- {
- throw new UnsupportedOperationException();
- }
-}
15 years, 2 months
JBossWS SVN: r10784 - in stack/native/trunk/modules/core/src/main/java/org/jboss: ws/core/jaxws and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-09-29 03:41:34 -0400 (Tue, 29 Sep 2009)
New Revision: 10784
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java
Log:
A bunch of fixes for FindBugs reported issues (run on AS)
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2009-09-28 03:08:53 UTC (rev 10783)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2009-09-29 07:41:34 UTC (rev 10784)
@@ -94,7 +94,7 @@
componentDeserializer = (DeserializerSupport)compDeserializerFactory.getDeserializer();
if (arrDims.length < 1 || 2 < arrDims.length)
- throw new WSException("Unsupported array dimensions: " + Arrays.asList(arrDims));
+ throw new WSException("Unsupported array dimensions: " + arrDims);
Iterator it = DOMUtils.getChildElements(soapElement);
if (arrDims.length == 1)
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java 2009-09-28 03:08:53 UTC (rev 10783)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.java 2009-09-29 07:41:34 UTC (rev 10784)
@@ -309,7 +309,7 @@
// Add @XmlType;
annotation = JavassistUtils.createAnnotation(XmlType.class, constPool);
- if (xmlType.getNamespaceURI() != null & xmlType.getNamespaceURI().length() > 0)
+ if (xmlType.getNamespaceURI() != null && xmlType.getNamespaceURI().length() > 0)
annotation.addParameter("namespace", xmlType.getNamespaceURI());
annotation.addParameter("name", xmlType.getLocalPart());
if (propertyOrder != null)
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2009-09-28 03:08:53 UTC (rev 10783)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2009-09-29 07:41:34 UTC (rev 10784)
@@ -160,14 +160,18 @@
WSDLBindingOperation wsdlBindingOperation = wsdlOperation.getBindingOperation();
if (wsdlBindingOperation == null)
+ {
log.warn("Could not locate binding operation for:" + opQName);
+ }
+ else
+ {
+ // Change operation according namespace defined on binding
+ // <soap:body use="encoded" namespace="http://MarshallTestW2J.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ String namespaceURI = wsdlBindingOperation.getNamespaceURI();
+ if (namespaceURI != null)
+ opQName = new QName(namespaceURI, opName);
+ }
- // Change operation according namespace defined on binding
- // <soap:body use="encoded" namespace="http://MarshallTestW2J.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- String namespaceURI = wsdlBindingOperation.getNamespaceURI();
- if (namespaceURI != null)
- opQName = new QName(namespaceURI, opName);
-
// Set java method name
String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
ServiceEndpointMethodMapping seiMethodMapping = null;
@@ -513,7 +517,7 @@
String ns = xmlType.getNamespaceURI() != null ? xmlType.getNamespaceURI() : "";
XSTypeDefinition xsType = schemaModel.getTypeDefinition(localPart, ns);
XOPScanner scanner = new XOPScanner();
- if (scanner.findXOPTypeDef(xsType) != null | (localPart.equals("base64Binary") && ns.equals(Constants.NS_SCHEMA_XSD)))
+ if (scanner.findXOPTypeDef(xsType) != null || (localPart.equals("base64Binary") && ns.equals(Constants.NS_SCHEMA_XSD)))
{
// FIXME: read the xmime:contentType from the element declaration
// See SchemaUtils#findXOPTypeDef(XSTypeDefinition typeDef) for details
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2009-09-28 03:08:53 UTC (rev 10783)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.java 2009-09-29 07:41:34 UTC (rev 10784)
@@ -70,7 +70,7 @@
{
private static SchemaUtils ourInstance = new SchemaUtils();
- protected static String xsNS = Constants.NS_SCHEMA_XSD;
+ protected static final String xsNS = Constants.NS_SCHEMA_XSD;
private static Map<Class, QName> toolsTypeMappingOverride = new HashMap<Class, QName>();
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java 2009-09-28 03:08:53 UTC (rev 10783)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java 2009-09-29 07:41:34 UTC (rev 10784)
@@ -88,7 +88,7 @@
*/
public static String firstLetterUpperCase(String fname)
{
- if (fname == "" || fname == null)
+ if (fname == null || fname.length() == 0)
throw new WSException("String passed is null");
//Ensure that the first character is uppercase
if (Character.isLowerCase(fname.charAt(0)))
@@ -108,7 +108,7 @@
*/
public static String firstLetterLowerCase(String fname)
{
- if (fname == "" || fname == null)
+ if (fname == null || fname.length() == 0)
throw new WSException("String passed is null");
//Ensure that the first character is lowercase
if (Character.isUpperCase(fname.charAt(0)))
@@ -130,7 +130,7 @@
*/
public static String getJavaIdentifier(String xmlName)
{
- if(xmlName == null || xmlName == "")
+ if(xmlName == null || xmlName.length() == 0)
throw new IllegalArgumentException("xmlName is null");
xmlName = xmlName.trim(); //Get rid of whitespaces
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2009-09-28 03:08:53 UTC (rev 10783)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2009-09-29 07:41:34 UTC (rev 10784)
@@ -46,6 +46,7 @@
protected static final Logger log = Logger.getLogger(EndpointServlet.class);
private List<PreDestroyHolder> preDestroyRegistry = new LinkedList<PreDestroyHolder>();
+ private final Object lock = new Object();
/**
* Provides Native specific endpoint resolver
@@ -78,7 +79,7 @@
@Override
public final void destroy()
{
- synchronized(this.preDestroyRegistry)
+ synchronized(this.lock)
{
for (final PreDestroyHolder holder : this.preDestroyRegistry)
{
@@ -103,7 +104,7 @@
PreDestroyHolder holder = (PreDestroyHolder)ep.getAttachment(PreDestroyHolder.class);
if (holder != null)
{
- synchronized(this.preDestroyRegistry)
+ synchronized(this.lock)
{
if (!this.preDestroyRegistry.contains(holder))
{
15 years, 2 months
Hi
by jbossws-commits@lists.jboss.org
15 years, 2 months