Author: richard.opalka(a)jboss.com
Date: 2012-09-26 00:58:36 -0400 (Wed, 26 Sep 2012)
New Revision: 16767
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AbstractEndpointServlet.java
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
Modified:
stack/native/trunk/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
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/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java
Log:
[JBWS-3550] removing useless classes - svn merge -r 16745:16753
https://svn.jboss.org/repos/jbossws/stack/native/branches/ropalka_JBWS-3550
Property changes on: stack/native/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/asoldano:14057,14069
/stack/native/branches/ropalka:13836-13879
+ /stack/native/branches/asoldano:14057,14069
/stack/native/branches/ropalka:13836-13879
/stack/native/branches/ropalka_JBWS-3550:16746-16753
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2012-09-26
04:53:20 UTC (rev 16766)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2012-09-26
04:58:36 UTC (rev 16767)
@@ -282,23 +282,15 @@
{
synchronized(endpoint)
{
- Object endpointImpl = endpoint.getAttachment(Object.class);
- if (endpointImpl == null)
- {
- try
- {
- // create endpoint instance
- final Class<?> endpointImplClass = endpoint.getTargetBeanClass();
- endpointImpl =
endpoint.getInstanceProvider().getInstance(endpointImplClass.getName()).getValue();
- endpoint.addAttachment(Object.class, endpointImpl);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException(BundleUtils.getMessage(bundle,
"CANNOT_CREATE_ENDPOINT_INSTANCE"), ex);
- }
- }
-
- return endpointImpl;
+ try
+ {
+ final String endpointClassName = endpoint.getTargetBeanName();
+ return
endpoint.getInstanceProvider().getInstance(endpointClassName).getValue();
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(BundleUtils.getMessage(bundle,
"CANNOT_CREATE_ENDPOINT_INSTANCE"), ex);
+ }
}
}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java 2012-09-26
04:53:20 UTC (rev 16766)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.java 2012-09-26
04:58:36 UTC (rev 16767)
@@ -1,111 +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.ws.metadata.umdm;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * The JAXWS metdata data for a handler element
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class HandlerMetaDataJAXWS extends HandlerMetaData
-{
- private static final long serialVersionUID = 7631133188974299826L;
-
- // The JAXWS service name pattern
- private QName serviceNamePattern;
- // The JAXWS port name pattern
- private QName portNamePattern;
- // The JAXWS protocol bindings
- private String protocolBindings;
-
- public static HandlerMetaDataJAXWS newInstance(UnifiedHandlerMetaData uhmd,
HandlerType type)
- {
- HandlerMetaDataJAXWS hmd = new HandlerMetaDataJAXWS(type);
- hmd.setHandlerName(uhmd.getHandlerName());
- hmd.setHandlerClassName(uhmd.getHandlerClass());
- hmd.setInitParams(uhmd.getInitParams());
- UnifiedHandlerChainMetaData handlerChain = uhmd.getHandlerChain();
- if (handlerChain != null)
- {
- hmd.setProtocolBindings(handlerChain.getProtocolBindings());
- hmd.setServiceNamePattern(handlerChain.getServiceNamePattern());
- hmd.setPortNamePattern(handlerChain.getPortNamePattern());
- }
- return hmd;
- }
-
- public HandlerMetaDataJAXWS(HandlerType type)
- {
- super(type);
- }
-
- public QName getPortNamePattern()
- {
- return portNamePattern;
- }
-
- public void setPortNamePattern(QName portNamePattern)
- {
- this.portNamePattern = portNamePattern;
- }
-
- public String getProtocolBindings()
- {
- return protocolBindings;
- }
-
- public void setProtocolBindings(String protocolBindings)
- {
- this.protocolBindings = protocolBindings;
- }
-
- public QName getServiceNamePattern()
- {
- return serviceNamePattern;
- }
-
- public void setServiceNamePattern(QName serviceNamePattern)
- {
- this.serviceNamePattern = serviceNamePattern;
- }
-
- public String toString()
- {
- StringBuilder buffer = new StringBuilder("\nHandlerMetaDataJAXWS:");
- buffer.append("\n type=" + getHandlerType());
- buffer.append("\n name=" + getHandlerName());
- buffer.append("\n class=" + getHandlerClass());
- buffer.append("\n params=" + getInitParams());
- buffer.append("\n protocols=" + getProtocolBindings());
- buffer.append("\n services=" + getServiceNamePattern());
- buffer.append("\n ports=" + getPortNamePattern());
- return buffer.toString();
- }
-
-}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2012-09-26
04:53:20 UTC (rev 16766)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2012-09-26
04:58:36 UTC (rev 16767)
@@ -78,9 +78,6 @@
private String wsdlFile;
private URL mappingLocation;
private String wsdlPublishLocation;
-
- // The optional service handlers
- private List<HandlerMetaDataJAXWS> handlers = new
ArrayList<HandlerMetaDataJAXWS>();
// The type mapping that is maintained by this service
private TypesMetaData types;
@@ -183,16 +180,6 @@
return types;
}
- public void addHandler(HandlerMetaDataJAXWS handler)
- {
- handlers.add(handler);
- }
-
- public List<HandlerMetaDataJAXWS> getHandlerMetaData()
- {
- return Collections.unmodifiableList(handlers);
- }
-
public List<EndpointMetaData> getEndpoints()
{
return new ArrayList<EndpointMetaData>(endpoints.values());
Copied:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AbstractEndpointServlet.java
(from rev 16753,
stack/native/branches/ropalka_JBWS-3550/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AbstractEndpointServlet.java)
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AbstractEndpointServlet.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AbstractEndpointServlet.java 2012-09-26
04:58:36 UTC (rev 16767)
@@ -0,0 +1,197 @@
+/*
+ * 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.stack.jbws;
+
+import static org.jboss.ws.common.integration.WSHelper.isJseDeployment;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ResourceBundle;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.common.ObjectNameFactory;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.EndpointAssociation;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.spi.management.EndpointResolver;
+
+/**
+ * A cross stack webservice endpoint servlet.
+ * @author thomas.diesler(a)jboss.org
+ * @author heiko.braun(a)jboss.com
+ * @author richard.opalka(a)jboss.com
+ */
+public abstract class AbstractEndpointServlet extends HttpServlet
+{
+ private static final ResourceBundle bundle =
BundleUtils.getBundle(AbstractEndpointServlet.class);
+
+ protected Endpoint endpoint;
+ private EndpointRegistry epRegistry;
+
+ /**
+ * Constructor
+ */
+ protected AbstractEndpointServlet() {}
+
+ /**
+ * Servlet lifecycle init method
+ * @param servletConfig servlet configuration
+ */
+ public final void init(ServletConfig servletConfig) throws ServletException
+ {
+ super.init(servletConfig);
+ this.initRegistry();
+ this.initServiceEndpoint(servletConfig);
+ }
+
+ /**
+ * Serves the requests
+ */
+ public final void service(HttpServletRequest req, HttpServletResponse res)
+ throws ServletException, IOException
+ {
+ try
+ {
+ EndpointAssociation.setEndpoint(endpoint);
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ requestHandler.handleHttpRequest(endpoint, req, res, getServletContext());
+ }
+ finally
+ {
+ this.postService();
+ EndpointAssociation.removeEndpoint();
+ }
+ }
+
+ /**
+ * Template method
+ */
+ protected void postService()
+ {
+ // does nothing (because of BC)
+ }
+
+ /**
+ * Template method
+ * @param cfg servlet config
+ */
+ protected void postInit(ServletConfig cfg)
+ {
+ // does nothing (because of BC)
+ }
+
+ /**
+ * Abstract method that must be overriden by each stack servlet endpoint
+ * @param servletContext servlet context
+ * @param servletName servlet name
+ * @return new stack specific endpoint resolver
+ */
+ protected abstract EndpointResolver newEndpointResolver(String servletContext, String
servletName);
+
+ /**
+ * Initialize the service endpoint
+ */
+ private void initServiceEndpoint(ServletConfig servletConfig)
+ {
+ this.initEndpoint(servletConfig.getServletContext().getContextPath(),
getServletName());
+ this.setRuntimeLoader();
+ this.postInit(servletConfig);
+ }
+
+ /**
+ * Initializes endpoint registry
+ */
+ private void initRegistry()
+ {
+ ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class,
cl).getEndpointRegistry();
+ }
+
+ /**
+ * Initialize the service endpoint
+ * @param contextPath context path
+ * @param servletName servlet name
+ */
+ private void initEndpoint(String contextPath, String servletName)
+ {
+ final EndpointResolver resolver = newEndpointResolver(contextPath, servletName);
+ this.endpoint = epRegistry.resolve(resolver);
+
+ if (this.endpoint == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN +
":" +
+ Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + ","
+
+ Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName
+ );
+ throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_OBTAIN_ENDPOINT_FOR", oname));
+ }
+ }
+
+ /**
+ * Sets runtime classloader for JSE endpoints
+ */
+ private void setRuntimeLoader()
+ {
+ final Deployment dep = endpoint.getService().getDeployment();
+
+ if (isJseDeployment(dep))
+ {
+ ClassLoader classLoader = getContextClassLoader();
+ dep.setRuntimeClassLoader(classLoader);
+ }
+ }
+
+ private static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+}
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 2012-09-26
04:53:20 UTC (rev 16766)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2012-09-26
04:58:36 UTC (rev 16767)
@@ -31,9 +31,6 @@
import javax.servlet.http.HttpServletResponse;
import org.jboss.logging.Logger;
-import org.jboss.ws.common.injection.InjectionHelper;
-import org.jboss.ws.common.injection.PreDestroyHolder;
-import org.jboss.ws.common.servlet.AbstractEndpointServlet;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.ServletDelegate;
import org.jboss.wsf.spi.management.EndpointResolver;
@@ -46,8 +43,6 @@
*/
public final class EndpointServlet extends AbstractEndpointServlet implements
ServletDelegate
{
- private List<PreDestroyHolder> preDestroyRegistry = new
LinkedList<PreDestroyHolder>();
- private final Object lock = new Object();
/**
* Provides Native specific endpoint resolver
@@ -62,50 +57,6 @@
}
@Override
- protected final void postService()
- {
- registerForPreDestroy(endpoint);
- }
-
- @Override
- public final void destroy()
- {
- synchronized(this.lock)
- {
- for (final PreDestroyHolder holder : this.preDestroyRegistry)
- {
- try
- {
- final Object targetBean = holder.getObject();
- InjectionHelper.callPreDestroyMethod(targetBean);
- }
- catch (Exception exception)
- {
-
Logger.getLogger(EndpointServlet.class).error(exception.getLocalizedMessage(),
exception);
- }
- }
- this.preDestroyRegistry.clear();
- }
- super.destroy();
- }
-
- private void registerForPreDestroy(Endpoint ep)
- {
- PreDestroyHolder holder =
(PreDestroyHolder)ep.getAttachment(PreDestroyHolder.class);
- if (holder != null)
- {
- synchronized(this.lock)
- {
- if (!this.preDestroyRegistry.contains(holder))
- {
- this.preDestroyRegistry.add(holder);
- }
- }
- ep.removeAttachment(PreDestroyHolder.class);
- }
- }
-
- @Override
public void doHead(HttpServletRequest request, HttpServletResponse response,
ServletContext context)
throws ServletException, IOException
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/Message.properties
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/Message.properties 2012-09-26
04:53:20 UTC (rev 16766)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/Message.properties 2012-09-26
04:58:36 UTC (rev 16767)
@@ -9,3 +9,4 @@
CANNOT_GET_EPR=Cannot get epr when using the XML/HTTP binding
CANNOT_LOAD_CLASS=Cannot load class: {0}
+CANNOT_OBTAIN_ENDPOINT_FOR=Cannot obtain endpoint for: {0}
\ No newline at end of file
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java 2012-09-26
04:53:20 UTC (rev 16766)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java 2012-09-26
04:58:36 UTC (rev 16767)
@@ -23,7 +23,7 @@
import static org.jboss.ws.common.integration.WSHelper.isJaxrpcEjbDeployment;
import static org.jboss.ws.common.integration.WSHelper.isJaxrpcJseDeployment;
-import static org.jboss.ws.common.integration.WSHelper.isJaxwsDeployment;
+import static org.jboss.ws.common.integration.WSHelper.isJaxrpcDeployment;
import java.util.ResourceBundle;
@@ -50,15 +50,16 @@
@Override
public void start(Deployment dep)
{
+ if (!isJaxrpcDeployment(dep)) return;
UnifiedMetaData umd = dep.getAttachment(UnifiedMetaData.class);
if (umd == null)
{
- if (isJaxrpcJseDeployment(dep) && !isJaxwsDeployment(dep))
+ if (isJaxrpcJseDeployment(dep))
{
JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
umd = builder.buildMetaData((ArchiveDeployment)dep);
}
- else if (isJaxrpcEjbDeployment(dep) && !isJaxwsDeployment(dep))
+ else if (isJaxrpcEjbDeployment(dep))
{
JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
umd = builder.buildMetaData((ArchiveDeployment)dep);