JBossWS SVN: r16337 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 11:51:26 -0400 (Thu, 31 May 2012)
New Revision: 16337
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
Log:
[JBWS-3505] Removing duplicated code
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2012-05-31 15:50:23 UTC (rev 16336)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2012-05-31 15:51:26 UTC (rev 16337)
@@ -23,16 +23,10 @@
import java.io.IOException;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
-import java.util.StringTokenizer;
import javax.xml.namespace.QName;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.soap.SOAPBinding;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
@@ -42,11 +36,8 @@
import org.apache.cxf.service.Service;
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.utils.DelegateClassLoader;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.ws.common.configuration.ConfigHelper;
import org.jboss.wsf.spi.metadata.config.CommonConfig;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
@@ -62,15 +53,6 @@
private WSDLFilePublisher wsdlPublisher;
private CommonConfig config;
- private static Map<String, String> bindingIDs = new HashMap<String, String>();
- static {
- bindingIDs.put(SOAPBinding.SOAP11HTTP_BINDING, "##SOAP11_HTTP");
- bindingIDs.put(SOAPBinding.SOAP12HTTP_BINDING, "##SOAP12_HTTP");
- bindingIDs.put(SOAPBinding.SOAP11HTTP_MTOM_BINDING, "##SOAP11_HTTP_MTOM");
- bindingIDs.put(SOAPBinding.SOAP12HTTP_MTOM_BINDING, "##SOAP12_HTTP_MTOM");
- bindingIDs.put(HTTPBinding.HTTP_BINDING, "##XML_HTTP");
- }
-
public EndpointImpl(Object implementor)
{
super(implementor);
@@ -124,82 +106,11 @@
}
}
- @SuppressWarnings("rawtypes")
- protected List<Handler> convertToHandlers(List<UnifiedHandlerChainMetaData> handlerChains)
- {
- List<Handler> handlers = new LinkedList<Handler>();
- if (handlerChains != null && !handlerChains.isEmpty())
- {
- final String protocolBinding = bindingIDs.get(getBinding().getBindingID());
- for (UnifiedHandlerChainMetaData handlerChain : handlerChains)
- {
- if (handlerChain.getPortNamePattern() != null || handlerChain.getServiceNamePattern() != null)
- {
- Logger.getLogger(this.getClass()).warn(BundleUtils.getMessage(bundle, "FILTERS_NOT_SUPPORTED"));
- }
- if (matchProtocolBinding(protocolBinding, handlerChain.getProtocolBindings())) {
- for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
- {
- if (uhmd.getInitParams() != null && !uhmd.getInitParams().isEmpty())
- {
- Logger.getLogger(this.getClass()).warn(BundleUtils.getMessage(bundle, "INIT_PARAMS_NOT_SUPPORTED"));
- }
- Object h = newInstance(uhmd.getHandlerClass());
- if (h != null)
- {
- if (h instanceof Handler)
- {
- handlers.add((Handler)h);
- }
- else
- {
- throw new RuntimeException(BundleUtils.getMessage(bundle, "NOT_HANDLER_INSTANCE", h));
- }
- }
- }
- }
- }
- }
- return handlers;
- }
-
- private static boolean matchProtocolBinding(String currentProtocolBinding, String handlerChainProtocolBindings) {
- if (handlerChainProtocolBindings == null)
- return true;
- List<String> protocolBindings = new LinkedList<String>();
- if (handlerChainProtocolBindings != null) {
- StringTokenizer st = new StringTokenizer(handlerChainProtocolBindings, " ", false);
- while (st.hasMoreTokens()) {
- protocolBindings.add(st.nextToken());
- }
- }
- return protocolBindings.contains(currentProtocolBinding);
- }
-
- private static Object newInstance(String className)
- {
- try
- {
- ClassLoader loader = new DelegateClassLoader(ClassLoaderProvider.getDefaultProvider()
- .getServerIntegrationClassLoader(), SecurityActions.getContextClassLoader());
- Class<?> clazz = loader.loadClass(className);
- return clazz.newInstance();
- }
- catch (Exception e)
- {
- Logger.getLogger(EndpointImpl.class).warnf(e, BundleUtils.getMessage(bundle, "CAN_NOT_ADD_HANDLER" , className));
- return null;
- }
- }
-
- @SuppressWarnings("rawtypes")
protected void setupConfigHandlers()
{
if (config != null) {
- List<Handler> handlers = convertToHandlers(config.getPreHandlerChains()); //PRE
- handlers.addAll(getBinding().getHandlerChain()); //ENDPOINT
- handlers.addAll(convertToHandlers(config.getPostHandlerChains())); //POST
- getBinding().setHandlerChain(handlers);
+ ConfigHelper helper = new ConfigHelper();
+ helper.setupConfigHandlers(getBinding(), config);
}
}
12 years, 7 months
JBossWS SVN: r16336 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 11:50:23 -0400 (Thu, 31 May 2012)
New Revision: 16336
Modified:
stack/cxf/trunk/pom.xml
Log:
Using latest jbossws-api
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2012-05-31 15:38:22 UTC (rev 16335)
+++ stack/cxf/trunk/pom.xml 2012-05-31 15:50:23 UTC (rev 16336)
@@ -59,7 +59,7 @@
<!-- Properties -->
<properties>
- <jbossws.api.version>1.0.0.GA</jbossws.api.version>
+ <jbossws.api.version>1.0.1-SNAPSHOT</jbossws.api.version>
<jbossws.spi.version>2.1.0-SNAPSHOT</jbossws.spi.version>
<jbossws.common.version>2.1.0-SNAPSHOT</jbossws.common.version>
<jbossws.common.tools.version>1.1.0-SNAPSHOT</jbossws.common.tools.version>
12 years, 7 months
JBossWS SVN: r16335 - common/trunk/src/main/java/org/jboss/ws/common/configuration.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 11:38:22 -0400 (Thu, 31 May 2012)
New Revision: 16335
Modified:
common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
Log:
[JBWS-3505] Making a method public to reduce duplicated code in cxf stack
Modified: common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-05-31 15:37:31 UTC (rev 16334)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-05-31 15:38:22 UTC (rev 16335)
@@ -97,8 +97,14 @@
}
}
+ /**
+ * Setups a given Binding instance using a specified CommonConfig
+ *
+ * @param binding the Binding instance to setup
+ * @param config the CommonConfig with the input configuration
+ */
@SuppressWarnings("rawtypes")
- private static void setupConfigHandlers(Binding binding, CommonConfig config)
+ public void setupConfigHandlers(Binding binding, CommonConfig config)
{
if (config != null) {
List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding); //PRE
12 years, 7 months
JBossWS SVN: r16334 - api/trunk/src/main/java/org/jboss/ws/api/configuration.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 11:37:31 -0400 (Thu, 31 May 2012)
New Revision: 16334
Modified:
api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java
Log:
[JBWS-3505] Adding javadoc
Modified: api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java 2012-05-31 14:55:41 UTC (rev 16333)
+++ api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java 2012-05-31 15:37:31 UTC (rev 16334)
@@ -30,6 +30,13 @@
*/
public interface ClientConfigurer
{
- public void addConfigHandlers(BindingProvider port, String configFile, String configName);
+ /**
+ * Reads a client configuration and setups the specified BindingProvider accordingly
+ *
+ * @param bp The BindingProvider instance to setup
+ * @param configFile The configuration file
+ * @param configName The configuration name
+ */
+ public void addConfigHandlers(BindingProvider bp, String configFile, String configName);
}
12 years, 7 months
JBossWS SVN: r16333 - in shared-testsuite/trunk/testsuite/src/test: java/org/jboss/test/ws/jaxws and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 10:55:41 -0400 (Thu, 31 May 2012)
New Revision: 16333
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/
shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml
Modified:
shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3505] Adding testcase
Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-05-31 14:51:55 UTC (rev 16332)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-jars-jaxws.xml 2012-05-31 14:55:41 UTC (rev 16333)
@@ -112,6 +112,20 @@
</fileset>
</jar>
+ <!-- jaxws-clientConfig -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-clientConfig.war" needxmlfile="false">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/clientConfig/Endpoint*.class" />
+ </classes>
+ </war>
+
+ <!-- jaxws-clientConfig-client -->
+ <jar destfile="${tests.output.dir}/test-libs/jaxws-clientConfig-client.jar">
+ <metainf dir="${tests.output.dir}/test-resources/jaxws/clientConfig/META-INF">
+ <include name="jaxws-client-config.xml" />
+ </metainf>
+ </jar>
+
<!-- jaxws-complex -->
<war warfile="${tests.output.dir}/test-libs/jaxws-complex.war" webxml="${tests.output.dir}/test-resources/jaxws/complex/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.test.ws.jaxws.clientConfig;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ServiceLoader;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+
+import junit.framework.Test;
+
+import org.jboss.ws.api.configuration.ClientConfigurer;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Verifies client configuration setup
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 31-May-2012
+ */
+public class ClientConfigurationTestCase extends JBossWSTest
+{
+ private static final String targetNS = "http://clientConfig.jaxws.ws.test.jboss.org/";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(ClientConfigurationTestCase.class, "jaxws-clientConfig.war,jaxws-clientConfig-client.jar");
+ }
+
+ public void testClientConfigurer()
+ {
+ Iterator<ClientConfigurer> it = ServiceLoader.load(ClientConfigurer.class).iterator();
+ assertTrue(it.hasNext());
+ ClientConfigurer configurer = it.next();
+ assertNotNull(configurer);
+ assertEquals("org.jboss.ws.common.configuration.ConfigHelper", configurer.getClass().getName());
+ }
+
+ public void testCustomClientConfiguration() throws Exception
+ {
+ QName serviceName = new QName(targetNS, "EndpointImplService");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-clientConfig/EndpointImpl?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ ClientConfigurer configurer = ServiceLoader.load(ClientConfigurer.class).iterator().next();
+ configurer.addConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
+
+ String resStr = port.echo("Kermit");
+ assertEquals("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn", resStr);
+ }
+}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/CustomHandler.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class CustomHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(CustomHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|CustomIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|CustomOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Endpoint.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.test.ws.jaxws.clientConfig;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ public String echo(String input);
+}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/EndpointImpl.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.test.ws.jaxws.clientConfig;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+
+@WebService(name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public class EndpointImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointImpl.class);
+
+ @WebMethod
+ public String echo(String input)
+ {
+ log.info("echo: " + input);
+ return input + "|endpoint";
+ }
+}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/LogHandler.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class LogHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(LogHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|LogIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|LogOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/RoutingHandler.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class RoutingHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(RoutingHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|RoutIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|RoutOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+}
Added: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/UserHandler.java 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.test.ws.jaxws.clientConfig;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
+
+public class UserHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(UserHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|UserIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|UserOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+}
Added: shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/resources/jaxws/clientConfig/META-INF/jaxws-client-config.xml 2012-05-31 14:55:41 UTC (rev 16333)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0 schema/jbossws-jaxws-config_4_0.xsd">
+
+ <client-config>
+ <config-name>Custom Client Config</config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name>Routing Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.RoutingHandler</javaee:handler-class>
+ </javaee:handler>
+ <javaee:handler>
+ <javaee:handler-name>Custom Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.CustomHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ <post-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name>Log Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.clientConfig.LogHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </post-handler-chains>
+ </client-config>
+
+</jaxws-config>
\ No newline at end of file
12 years, 7 months
JBossWS SVN: r16332 - in common/trunk/src/main: java/org/jboss/ws/common/configuration and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 10:51:55 -0400 (Thu, 31 May 2012)
New Revision: 16332
Added:
common/trunk/src/main/java/org/jboss/ws/common/configuration/
common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
common/trunk/src/main/java/org/jboss/ws/common/configuration/Message.properties
common/trunk/src/main/java/org/jboss/ws/common/configuration/SecurityActions.java
common/trunk/src/main/resources/META-INF/services/org.jboss.ws.api.configuration.ClientConfigurer
Log:
[JBWS-3505] Adding common facility for dealing with client/endpoint configurations
Added: common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2012-05-31 14:51:55 UTC (rev 16332)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.common.configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.StringTokenizer;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.configuration.ClientConfigurer;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.common.utils.DelegateClassLoader;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.metadata.config.ClientConfig;
+import org.jboss.wsf.spi.metadata.config.CommonConfig;
+import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
+import org.jboss.wsf.spi.metadata.config.ConfigRoot;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+
+/**
+ * Facility class for setting Client config
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 29-May-2012
+ *
+ */
+public class ConfigHelper implements ClientConfigurer
+{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(ConfigHelper.class);
+
+ private static Map<String, String> bindingIDs = new HashMap<String, String>();
+ static {
+ bindingIDs.put(SOAPBinding.SOAP11HTTP_BINDING, "##SOAP11_HTTP");
+ bindingIDs.put(SOAPBinding.SOAP12HTTP_BINDING, "##SOAP12_HTTP");
+ bindingIDs.put(SOAPBinding.SOAP11HTTP_MTOM_BINDING, "##SOAP11_HTTP_MTOM");
+ bindingIDs.put(SOAPBinding.SOAP12HTTP_MTOM_BINDING, "##SOAP12_HTTP_MTOM");
+ bindingIDs.put(HTTPBinding.HTTP_BINDING, "##XML_HTTP");
+ }
+
+ @Override
+ public void addConfigHandlers(BindingProvider port, String configFile, String configName)
+ {
+ ClientConfig config = readConfig(configFile, configName);
+ setupConfigHandlers(port.getBinding(), config);
+ }
+
+ private static ClientConfig readConfig(String configFile, String configName) {
+ InputStream is = null;
+ try
+ {
+ is = SecurityActions.getContextClassLoader().getResourceAsStream(configFile);
+ ConfigRoot config = ConfigMetaDataParser.parse(is);
+ return config.getClientConfigByName(configName);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(BundleUtils.getMessage(bundle, "COULD_NOT_READ_CONFIG", configFile));
+ }
+ finally
+ {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) { } //ignore
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static void setupConfigHandlers(Binding binding, CommonConfig config)
+ {
+ if (config != null) {
+ List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding); //PRE
+ handlers.addAll(binding.getHandlerChain()); //ENDPOINT
+ handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding)); //POST
+ binding.setHandlerChain(handlers);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static List<Handler> convertToHandlers(List<UnifiedHandlerChainMetaData> handlerChains, Binding binding)
+ {
+ List<Handler> handlers = new LinkedList<Handler>();
+ if (handlerChains != null && !handlerChains.isEmpty())
+ {
+ final String protocolBinding = bindingIDs.get(binding.getBindingID());
+ for (UnifiedHandlerChainMetaData handlerChain : handlerChains)
+ {
+ if (handlerChain.getPortNamePattern() != null || handlerChain.getServiceNamePattern() != null)
+ {
+ Logger.getLogger(ConfigHelper.class).warn(BundleUtils.getMessage(bundle, "FILTERS_NOT_SUPPORTED"));
+ }
+ if (matchProtocolBinding(protocolBinding, handlerChain.getProtocolBindings())) {
+ for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
+ {
+ if (uhmd.getInitParams() != null && !uhmd.getInitParams().isEmpty())
+ {
+ Logger.getLogger(ConfigHelper.class).warn(BundleUtils.getMessage(bundle, "INIT_PARAMS_NOT_SUPPORTED"));
+ }
+ Object h = newInstance(uhmd.getHandlerClass());
+ if (h != null)
+ {
+ if (h instanceof Handler)
+ {
+ handlers.add((Handler)h);
+ }
+ else
+ {
+ throw new RuntimeException(BundleUtils.getMessage(bundle, "NOT_HANDLER_INSTANCE", h));
+ }
+ }
+ }
+ }
+ }
+ }
+ return handlers;
+ }
+
+ private static boolean matchProtocolBinding(String currentProtocolBinding, String handlerChainProtocolBindings) {
+ if (handlerChainProtocolBindings == null)
+ return true;
+ List<String> protocolBindings = new LinkedList<String>();
+ if (handlerChainProtocolBindings != null) {
+ StringTokenizer st = new StringTokenizer(handlerChainProtocolBindings, " ", false);
+ while (st.hasMoreTokens()) {
+ protocolBindings.add(st.nextToken());
+ }
+ }
+ return protocolBindings.contains(currentProtocolBinding);
+ }
+
+ private static Object newInstance(String className)
+ {
+ try
+ {
+ ClassLoader loader = new DelegateClassLoader(ClassLoaderProvider.getDefaultProvider()
+ .getServerIntegrationClassLoader(), SecurityActions.getContextClassLoader());
+ Class<?> clazz = SecurityActions.loadClass(loader, className);
+ return clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(ConfigHelper.class).warnf(e, BundleUtils.getMessage(bundle, "CAN_NOT_ADD_HANDLER" , className));
+ return null;
+ }
+ }
+}
Added: common/trunk/src/main/java/org/jboss/ws/common/configuration/Message.properties
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/Message.properties (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/Message.properties 2012-05-31 14:51:55 UTC (rev 16332)
@@ -0,0 +1,5 @@
+FILTERS_NOT_SUPPORTED=PortNamePattern and ServiceNamePattern filters not supported; adding handlers anyway.
+INIT_PARAMS_NOT_SUPPORTED=Init params not supported.
+NOT_HANDLER_INSTANCE={0} is not a JAX-WS Handler instance
+CAN_NOT_ADD_HANDLER=Could not add handler {0} as part of client or endpoint configuration
+COULD_NOT_READ_CONFIG=Could not read configuration from file {0}
\ No newline at end of file
Added: common/trunk/src/main/java/org/jboss/ws/common/configuration/SecurityActions.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/SecurityActions.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/SecurityActions.java 2012-05-31 14:51:55 UTC (rev 16332)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.common.configuration;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 31-May-2012
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ 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();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the context classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+ /**
+ * Load a class using the provided classloader
+ *
+ * @param name
+ * @return
+ * @throws PrivilegedActionException
+ */
+ static Class<?> loadClass(final ClassLoader cl, final String name) throws PrivilegedActionException, ClassNotFoundException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return cl.loadClass(name);
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+ public Class<?> run() throws PrivilegedActionException
+ {
+ try
+ {
+ return cl.loadClass(name);
+ }
+ catch (Exception e)
+ {
+ throw new PrivilegedActionException(e);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Return the current value of the specified system property
+ *
+ * @param name
+ * @param defaultValue
+ * @return
+ */
+ static String getSystemProperty(final String name, final String defaultValue)
+ {
+ PrivilegedAction<String> action = new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+}
\ No newline at end of file
Added: common/trunk/src/main/resources/META-INF/services/org.jboss.ws.api.configuration.ClientConfigurer
===================================================================
--- common/trunk/src/main/resources/META-INF/services/org.jboss.ws.api.configuration.ClientConfigurer (rev 0)
+++ common/trunk/src/main/resources/META-INF/services/org.jboss.ws.api.configuration.ClientConfigurer 2012-05-31 14:51:55 UTC (rev 16332)
@@ -0,0 +1 @@
+org.jboss.ws.common.configuration.ConfigHelper
\ No newline at end of file
12 years, 7 months
JBossWS SVN: r16331 - spi/trunk.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 10:49:21 -0400 (Thu, 31 May 2012)
New Revision: 16331
Modified:
spi/trunk/pom.xml
Log:
Use latest jbossws-api
Modified: spi/trunk/pom.xml
===================================================================
--- spi/trunk/pom.xml 2012-05-31 14:48:14 UTC (rev 16330)
+++ spi/trunk/pom.xml 2012-05-31 14:49:21 UTC (rev 16331)
@@ -25,7 +25,7 @@
<!-- Properties -->
<properties>
- <jbossws.api.version>1.0.0.GA</jbossws.api.version>
+ <jbossws.api.version>1.0.1-SNAPSHOT</jbossws.api.version>
<jms.api.version>1.0.0.Final</jms.api.version>
<jboss-logging-spi.version>2.0.5.GA</jboss-logging-spi.version>
<servlet.api.version>1.0.0.Final</servlet.api.version>
12 years, 7 months
JBossWS SVN: r16330 - in api/trunk/src/main/java/org/jboss/ws/api: configuration and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 10:48:14 -0400 (Thu, 31 May 2012)
New Revision: 16330
Added:
api/trunk/src/main/java/org/jboss/ws/api/configuration/
api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java
Log:
[JBWS-3505] Adding jbossws-api interface
Added: api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java
===================================================================
--- api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java (rev 0)
+++ api/trunk/src/main/java/org/jboss/ws/api/configuration/ClientConfigurer.java 2012-05-31 14:48:14 UTC (rev 16330)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.api.configuration;
+
+import javax.xml.ws.BindingProvider;
+
+/**
+ * A facility for setting a JBossWS Client Configuration
+ *
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+public interface ClientConfigurer
+{
+ public void addConfigHandlers(BindingProvider port, String configFile, String configName);
+
+}
12 years, 7 months
JBossWS SVN: r16329 - common/trunk.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 10:29:36 -0400 (Thu, 31 May 2012)
New Revision: 16329
Modified:
common/trunk/pom.xml
Log:
Move to more recent jboss-logging-spi and jboss-common-core provided dependencies
Modified: common/trunk/pom.xml
===================================================================
--- common/trunk/pom.xml 2012-05-31 09:26:13 UTC (rev 16328)
+++ common/trunk/pom.xml 2012-05-31 14:29:36 UTC (rev 16329)
@@ -29,8 +29,8 @@
<properties>
<jbossws.spi.version>2.1.0-SNAPSHOT</jbossws.spi.version>
<jboss.jaxbintros.version>1.0.2.GA</jboss.jaxbintros.version>
- <jboss.common.core.version>2.2.14.GA</jboss.common.core.version>
- <jboss-logging-spi.version>2.0.5.GA</jboss-logging-spi.version>
+ <jboss.common.core.version>2.2.17.GA</jboss.common.core.version>
+ <jboss-logging-spi.version>2.1.0.GA</jboss-logging-spi.version>
<wsdl4j.version>1.6.2</wsdl4j.version>
<ejb.api.version>1.0.0.CR2</ejb.api.version>
<jms.api.version>1.0.0.Final</jms.api.version>
12 years, 7 months
JBossWS SVN: r16328 - api/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-05-31 05:26:13 -0400 (Thu, 31 May 2012)
New Revision: 16328
Removed:
api/branches/JBWS-3316/
Log:
Removing old branch not used anymore
12 years, 7 months