JBossWS SVN: r15032 - in stack/cxf/trunk/modules/server/src/main: java/org/jboss/wsf/stack/cxf/deployment/aspect and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-10-03 10:22:36 -0400 (Mon, 03 Oct 2011)
New Revision: 15032
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/Message.properties
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml
stack/cxf/trunk/modules/server/src/main/resources/jbossws-jaxrpc-config-as6.xml
Log:
[JBWS-3363] extending SPI - providing hook for instances retrieval
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFInstanceProvider.java 2011-10-03 14:22:36 UTC (rev 15032)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.cxf;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.xml.ws.handler.Handler;
+
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.wsf.spi.deployment.InstanceProvider;
+
+/**
+ * CXF instance provider.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class CXFInstanceProvider implements InstanceProvider {
+
+ private static final ResourceBundle bundle = BundleUtils.getBundle(CXFInstanceProvider.class);
+ private final ServerFactoryBean factory;
+ private final Map<String, Object> cache = new HashMap<String, Object>();
+
+ public CXFInstanceProvider(final ServerFactoryBean factory) {
+ this.factory = factory;
+ }
+
+ public synchronized Object getInstance(final String className) {
+ Object instance = cache.get(className);
+ if (instance == null) {
+ final Object serviceBean = factory.getServiceBean();
+ if (className.equals(factory.getServiceBean().getClass().getName())) {
+ cache.put(className, instance = serviceBean);
+ }
+ if (instance == null)
+ {
+ List<Handler> chain = ((JaxWsEndpointImpl) factory.getServer().getEndpoint()).getJaxwsBinding().getHandlerChain();
+ if (chain != null) {
+ for (Handler handler : chain) {
+ if (className.equals(handler.getClass().getName())) {
+ cache.put(className, instance = handler);
+ }
+ }
+ }
+ }
+ }
+ if (instance == null)
+ throw new IllegalStateException(BundleUtils.getMessage(bundle, "CANNOT_LOAD_CLASS", className));
+ return instance;
+ }
+
+}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/Message.properties
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/Message.properties 2011-10-03 13:47:54 UTC (rev 15031)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/Message.properties 2011-10-03 14:22:36 UTC (rev 15032)
@@ -1,3 +1,4 @@
CANNOT_OBTAIN_REGISTRY=Cannot obtain DestinationRegistry!
CANNOT_OBTAIN_DESTINATION=Cannot obtain destination for: {0}
CANNOT_GET_DESTINATIONFACTORY=Cannot get DestinationFactory for http transport!
+CANNOT_LOAD_CLASS=Cannot load class: {0}
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java 2011-10-03 14:22:36 UTC (rev 15032)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.cxf.deployment.aspect;
+
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.stack.cxf.CXFInstanceProvider;
+
+/**
+ * Instance provider DA.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class CXFInstanceProviderDeploymentAspect extends AbstractDeploymentAspect
+{
+
+ @Override
+ public void start(final Deployment dep)
+ {
+ for (final Endpoint ep : dep.getService().getEndpoints())
+ {
+ final ServerFactoryBean factory = ep.getAttachment(ServerFactoryBean.class);
+ ep.setInstanceProvider(new CXFInstanceProvider(factory));
+ }
+ }
+
+}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2011-10-03 13:47:54 UTC (rev 15031)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2011-10-03 14:22:36 UTC (rev 15032)
@@ -119,6 +119,7 @@
private static void injectServiceAndHandlerResources(Endpoint endpoint)
{
ServerFactoryBean factory = endpoint.getAttachment(ServerFactoryBean.class);
+ if (factory == null) throw new UnsupportedOperationException(); // TODO: move injection to ASIL
if (factory != null)
{
InjectionsMetaData metadata = endpoint.getAttachment(InjectionsMetaData.class);
@@ -129,8 +130,9 @@
{
for (Handler handler : chain)
{
- InjectionHelper.injectResources(handler, metadata, jndiContext);
- InjectionHelper.callPostConstructMethod(handler);
+ final Object handlerInstance = endpoint.getInstanceProvider().getInstance(handler.getClass().getName());
+ InjectionHelper.injectResources(handlerInstance, metadata, jndiContext);
+ InjectionHelper.callPostConstructMethod(handlerInstance);
}
}
}
@@ -143,7 +145,8 @@
{
if (isJaxwsJseEndpoint(endpoint) && factory.getServiceBean() != null)
{
- InjectionHelper.callPreDestroyMethod(factory.getServiceBean());
+ final Object epInstance = endpoint.getInstanceProvider().getInstance(factory.getServiceBean().getClass().getName());
+ InjectionHelper.callPreDestroyMethod(epInstance);
}
}
}
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2011-10-03 13:47:54 UTC (rev 15031)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2011-10-03 14:22:36 UTC (rev 15032)
@@ -64,6 +64,12 @@
<property name="forJaxRpc">false</property>
</bean>
+ <bean name="WSCXFInstanceProviderDeploymentAspect" class="org.jboss.wsf.stack.cxf.deployment.aspect.CXFInstanceProviderDeploymentAspect">
+ <property name="requires">ContainerMetaData,BusHolder</property>
+ <property name="provides">StackInstanceProvider</property>
+ <property name="forJaxRpc">false</property>
+ </bean>
+
<bean name="WSCXFEndpointRecordProcessorDeploymentAspect" class="org.jboss.ws.common.deployment.EndpointRecordProcessorDeploymentAspect">
<property name="mbeanServer"><inject bean="WSMBeanServerLocator" property="mbeanServer"/></property>
<property name="requires">RegisteredEndpoint</property>
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml 2011-10-03 13:47:54 UTC (rev 15031)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as7.xml 2011-10-03 14:22:36 UTC (rev 15032)
@@ -55,6 +55,12 @@
<property name="forJaxRpc" class="boolean">false</property>
</deploymentAspect>
+ <deploymentAspect class="org.jboss.wsf.stack.cxf.deployment.aspect.CXFInstanceProviderDeploymentAspect">
+ <property name="requires" class="java.lang.String">ContainerMetaData,BusHolder</property>
+ <property name="provides" class="java.lang.String">StackInstanceProvider</property>
+ <property name="forJaxRpc" class="boolean">false</property>
+ </deploymentAspect>
+
<deploymentAspect class="org.jboss.ws.common.deployment.JAXBIntroDeploymentAspect">
<property name="provides" class="java.lang.String">JAXBIntros</property>
<property name="forJaxRpc" class="boolean">false</property>
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-jaxrpc-config-as6.xml
===================================================================
--- stack/cxf/trunk/modules/server/src/main/resources/jbossws-jaxrpc-config-as6.xml 2011-10-03 13:47:54 UTC (rev 15031)
+++ stack/cxf/trunk/modules/server/src/main/resources/jbossws-jaxrpc-config-as6.xml 2011-10-03 14:22:36 UTC (rev 15032)
@@ -28,6 +28,12 @@
<property name="forJaxWs">false</property>
</bean>
+ <bean name="WSNativeInstanceProviderDeploymentAspect" class="org.jboss.wsf.stack.jbws.NativeInstanceProviderDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">StackInstanceProvider</property>
+ <property name="forJaxWs">false</property>
+ </bean>
+
<bean name="WSNativePublishContractDeploymentAspect" class="org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect">
<property name="requires">UnifiedMetaDataModel, JAXBIntros</property>
<property name="provides">PublishedContract</property>
13 years, 5 months
JBossWS SVN: r15031 - in stack/native/trunk/modules/core/src/main: java/org/jboss/ws/core/jaxws/handler and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-10-03 09:47:54 -0400 (Mon, 03 Oct 2011)
New Revision: 15031
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProvider.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProviderDeploymentAspect.java
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java
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/wsf/stack/jbws/Message.properties
stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as6.xml
stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as7.xml
Log:
[JBWS-3363] extending SPI - providing hook for instances retrieval
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2011-10-03 13:47:54 UTC (rev 15031)
@@ -48,6 +48,8 @@
import org.jboss.ws.core.soap.SOAPElementImpl;
import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.EndpointAssociation;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
@@ -128,7 +130,7 @@
{
for (HandlerInfo info : infos)
{
- HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
+ HandlerWrapper handler = new HandlerWrapper(getInstance(info));
HandlerType type = (HandlerType)info.getHandlerConfig().get(HandlerType.class.getName());
handlers.add(new HandlerEntry(handler, info, type));
}
@@ -151,6 +153,21 @@
state = STATE_CREATED;
}
+ private Handler getInstance(final HandlerInfo info) throws Exception
+ {
+ final Endpoint ep = EndpointAssociation.getEndpoint();
+ final Handler handler;
+ if (ep != null)
+ {
+ handler = (Handler)ep.getInstanceProvider().getInstance(info.getHandlerClass().getName());
+ }
+ else
+ {
+ handler = (Handler)info.getHandlerClass().newInstance();
+ }
+ return handler;
+ }
+
/**
* Get the state of this handler chain
*/
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2011-10-03 13:47:54 UTC (rev 15031)
@@ -168,14 +168,13 @@
try
{
// Load the handler class using the deployments top level CL
- Class hClass = classLoader.loadClass(className);
- Handler handler = (Handler)hClass.newInstance();
+ Handler<?> handler = getInstance(classLoader, className);
if (handler instanceof GenericHandler)
((GenericHandler)handler).setHandlerName(handlerName);
if (handler instanceof GenericSOAPHandler)
- ((GenericSOAPHandler)handler).setHeaders(soapHeaders);
+ ((GenericSOAPHandler<?>)handler).setHeaders(soapHeaders);
if (injections != null)
{
@@ -197,6 +196,22 @@
}
}
+ private Handler<?> getInstance(final ClassLoader fallbackLoader, final String className) throws Exception
+ {
+ final Endpoint ep = EndpointAssociation.getEndpoint();
+ final Handler<?> handler;
+ if (ep != null)
+ {
+ handler = (Handler<?>)ep.getInstanceProvider().getInstance(className);
+ }
+ else
+ {
+ final Class<?> hClass = fallbackLoader.loadClass(className);
+ handler = (Handler<?>)hClass.newInstance();
+ }
+ return handler;
+ }
+
private boolean addHandler(HandlerMetaDataJAXWS hmd, Handler handler, HandlerType type)
{
if (log.isDebugEnabled())
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java 2011-10-03 13:47:54 UTC (rev 15031)
@@ -51,6 +51,7 @@
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
import org.jboss.wsf.spi.deployment.HttpEndpoint;
import org.jboss.wsf.stack.jbws.EagerInitializeDeploymentAspect;
+import org.jboss.wsf.stack.jbws.NativeInstanceProviderDeploymentAspect;
import org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect;
import org.jboss.wsf.stack.jbws.ServiceEndpointInvokerDeploymentAspect;
import org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect;
@@ -221,6 +222,7 @@
retVal.add(new EndpointAddressDeploymentAspect());
retVal.add(new EndpointNameDeploymentAspect());
retVal.add(new UnifiedMetaDataDeploymentAspect());
+ retVal.add(new NativeInstanceProviderDeploymentAspect());
retVal.add(new ServiceEndpointInvokerDeploymentAspect());
retVal.add(new PublishContractDeploymentAspect());
retVal.add(new EagerInitializeDeploymentAspect());
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 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2011-10-03 13:47:54 UTC (rev 15031)
@@ -371,7 +371,7 @@
{
// create endpoint instance
final Class<?> endpointImplClass = endpoint.getTargetBeanClass();
- endpointImpl = endpointImplClass.newInstance();
+ endpointImpl = endpoint.getInstanceProvider().getInstance(endpointImplClass.getName());
endpoint.addAttachment(Object.class, endpointImpl);
}
catch (Exception ex)
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 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/Message.properties 2011-10-03 13:47:54 UTC (rev 15031)
@@ -26,3 +26,5 @@
CANNOT_PROCESS_METRICS=Cannot process metrics
INVALID_ENDPOINT_ADDRESS=Invalid endpoint address: {0}
ERROR_PROCESSING_WEB_SERVICE_REQUEST=Error processing web service request
+
+CANNOT_LOAD_CLASS=Cannot load class: {0}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProvider.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProvider.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProvider.java 2011-10-03 13:47:54 UTC (rev 15031)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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 java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.wsf.spi.deployment.InstanceProvider;
+
+/**
+ * Native instance provider.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class NativeInstanceProvider implements InstanceProvider {
+
+ private static final ResourceBundle bundle = BundleUtils.getBundle(NativeInstanceProvider.class);
+ private final ClassLoader loader;
+ private final Map<String, Object> cache = new HashMap<String, Object>();
+
+ NativeInstanceProvider(final ClassLoader loader)
+ {
+ this.loader = loader;
+ }
+
+ public synchronized Object getInstance(final String className) {
+ Object instance = cache.get(className);
+ if (instance == null) {
+ try {
+ instance = loader.loadClass(className).newInstance();
+ cache.put(className, instance);
+ } catch (Exception e) {
+ throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_LOAD_CLASS", className), e);
+ }
+ }
+ return instance;
+ }
+
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProviderDeploymentAspect.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProviderDeploymentAspect.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeInstanceProviderDeploymentAspect.java 2011-10-03 13:47:54 UTC (rev 15031)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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 org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.ws.common.utils.DelegateClassLoader;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Instance provider DA.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class NativeInstanceProviderDeploymentAspect extends AbstractDeploymentAspect
+{
+
+ @Override
+ public void start(final Deployment dep)
+ {
+ final ClassLoader loader = dep.getRuntimeClassLoader();
+ final ClassLoader integrationCL = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ final ClassLoader newCL = new DelegateClassLoader(integrationCL, loader);
+ for (final Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.setInstanceProvider(new NativeInstanceProvider(newCL));
+ }
+ }
+
+ @Override
+ public void stop(final Deployment dep)
+ {
+ for (final Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.setInstanceProvider(null);
+ }
+ }
+
+}
Modified: stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as6.xml
===================================================================
--- stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as6.xml 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as6.xml 2011-10-03 13:47:54 UTC (rev 15031)
@@ -43,6 +43,11 @@
<property name="provides">StackEndpointHandler</property>
</bean>
+ <bean name="WSNativeInstanceProviderDeploymentAspect" class="org.jboss.wsf.stack.jbws.NativeInstanceProviderDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">StackInstanceProvider</property>
+ </bean>
+
<bean name="WSNativeEndpointRecordProcessorDeploymentAspect" class="org.jboss.ws.common.deployment.EndpointRecordProcessorDeploymentAspect">
<property name="mbeanServer"><inject bean="WSMBeanServerLocator" property="mbeanServer"/></property>
<property name="requires">RegisteredEndpoint</property>
Modified: stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as7.xml
===================================================================
--- stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as7.xml 2011-10-03 13:10:26 UTC (rev 15030)
+++ stack/native/trunk/modules/core/src/main/resources/jbossws-native-config-as7.xml 2011-10-03 13:47:54 UTC (rev 15031)
@@ -46,6 +46,11 @@
<property name="provides" class="java.lang.String">StackEndpointHandler</property>
</deploymentAspect>
+ <deploymentAspect class="org.jboss.wsf.stack.jbws.NativeInstanceProviderDeploymentAspect">
+ <property name="requires" class="java.lang.String">ContainerMetaData</property>
+ <property name="provides" class="java.lang.String">StackInstanceProvider</property>
+ </deploymentAspect>
+
<deploymentAspect class="org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect">
<property name="requires" class="java.lang.String">UnifiedMetaDataModel, JAXBIntros</property>
<property name="provides" class="java.lang.String">PublishedContract</property>
13 years, 5 months
JBossWS SVN: r15030 - in common/trunk/src/main/java/org/jboss/ws/common: invocation and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-10-03 09:10:26 -0400 (Mon, 03 Oct 2011)
New Revision: 15030
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java
Log:
[JBWS-3363] extending SPI - providing hook for instances retrieval
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2011-10-03 13:05:58 UTC (rev 15029)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2011-10-03 13:10:26 UTC (rev 15030)
@@ -38,6 +38,7 @@
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.EndpointState;
import org.jboss.wsf.spi.deployment.EndpointType;
+import org.jboss.wsf.spi.deployment.InstanceProvider;
import org.jboss.wsf.spi.deployment.LifecycleHandler;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
@@ -70,6 +71,7 @@
protected String address;
protected List<RecordProcessor> recordProcessors = new Vector<RecordProcessor>();
protected SecurityDomainContext securityDomainContext;
+ protected InstanceProvider instanceProvider;
AbstractDefaultEndpoint(String targetBean)
{
@@ -308,4 +310,15 @@
this.securityDomainContext = securityDomainContext;
}
+ public InstanceProvider getInstanceProvider()
+ {
+ return instanceProvider;
+ }
+
+ public void setInstanceProvider(final InstanceProvider instanceProvider)
+ {
+ assertEndpointSetterAccess();
+ this.instanceProvider = instanceProvider;
+ }
+
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java 2011-10-03 13:05:58 UTC (rev 15029)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointHandlerDeploymentAspect.java 2011-10-03 13:10:26 UTC (rev 15030)
@@ -54,18 +54,18 @@
{
for (final Endpoint ep : dep.getService().getEndpoints())
{
- ep.setRequestHandler(getRequestHandler(dep));
- ep.setLifecycleHandler(getLifecycleHandler(dep));
+ ep.setRequestHandler(getRequestHandler());
+ ep.setLifecycleHandler(getLifecycleHandler());
ep.setInvocationHandler(getInvocationHandler(ep));
}
}
- private RequestHandler getRequestHandler(final Deployment dep)
+ private RequestHandler getRequestHandler()
{
return spiProvider.getSPI(RequestHandlerFactory.class).newRequestHandler();
}
- private LifecycleHandler getLifecycleHandler(final Deployment dep)
+ private LifecycleHandler getLifecycleHandler()
{
return spiProvider.getSPI(LifecycleHandlerFactory.class).newLifecycleHandler();
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java 2011-10-03 13:05:58 UTC (rev 15029)
+++ common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java 2011-10-03 13:10:26 UTC (rev 15030)
@@ -59,7 +59,9 @@
public void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
{
final InjectionsMetaData injectionsMD = endpoint.getAttachment(InjectionsMetaData.class);
- final Object targetBean = this.getTargetBean(invocation);
+ final Object _targetBean = this.getTargetBean(invocation);
+ // TODO: refactor injection to AS IL
+ final Object targetBean = endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getName());
this.log.debug("Injecting resources on JAXWS JSE endpoint: " + targetBean);
if (injectionsMD != null)
13 years, 5 months
JBossWS SVN: r15029 - spi/trunk/src/main/java/org/jboss/wsf/spi/deployment.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-10-03 09:05:58 -0400 (Mon, 03 Oct 2011)
New Revision: 15029
Added:
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/InstanceProvider.java
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
Log:
[JBWS-3363] extending SPI - providing hook for instances retrieval
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2011-09-27 11:57:59 UTC (rev 15028)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2011-10-03 13:05:58 UTC (rev 15029)
@@ -135,4 +135,10 @@
/** Set security domain context */
void setSecurityDomainContext(SecurityDomainContext context);
+ /** Get instance provider */
+ InstanceProvider getInstanceProvider();
+
+ /** Set instance provider */
+ void setInstanceProvider(InstanceProvider provider);
+
}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/InstanceProvider.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/InstanceProvider.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/InstanceProvider.java 2011-10-03 13:05:58 UTC (rev 15029)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.spi.deployment;
+
+/**
+ * Instance provider.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public interface InstanceProvider
+{
+
+ Object getInstance(String className);
+
+}
13 years, 5 months