JBossWS SVN: r14744 - in shared-testsuite/trunk/testsuite/src/test: java/org/jboss/test/ws/management/recording and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-07-26 06:46:49 -0400 (Tue, 26 Jul 2011)
New Revision: 14744
Added:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/EndpointWithConfigImpl.java
Modified:
shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxws.xml
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
Log:
[JBWS-3330] Merging testcase from 4.0.0.Beta3 tag
Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxws.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxws.xml 2011-07-26 10:22:18 UTC (rev 14743)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxws.xml 2011-07-26 10:46:49 UTC (rev 14744)
@@ -494,20 +494,31 @@
<!-- management-recording.jar -->
<jar destfile="${tests.output.dir}/test-libs/management-recording-native.jar">
<fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/management/recording/*.class"/>
- <exclude name="org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.class"/>
- <exclude name="org/jboss/test/ws/management/recording/*TestCase.class"/>
+ <include name="org/jboss/test/ws/management/recording/Endpoint.class"/>
+ <include name="org/jboss/test/ws/management/recording/EndpointImpl.class"/>
+ <include name="org/jboss/test/ws/management/recording/MyManaged*.class"/>
+ <include name="org/jboss/test/ws/management/recording/ExtManaged*.class"/>
</fileset>
<manifest>
<attribute name="Dependencies" value="org.jboss.logging"/>
</manifest>
</jar>
+ <jar destfile="${tests.output.dir}/test-libs/management-recording-as7.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/management/recording/Endpoint.class"/>
+ <include name="org/jboss/test/ws/management/recording/EndpointWithConfigImpl.class"/>
+ </fileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.logging"/>
+ </manifest>
+ </jar>
<jar destfile="${tests.output.dir}/test-libs/management-recording.jar">
<fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/management/recording/*.class"/>
+ <include name="org/jboss/test/ws/management/recording/Endpoint.class"/>
+ <include name="org/jboss/test/ws/management/recording/EndpointWithHandlerImpl.class"/>
+ <include name="org/jboss/test/ws/management/recording/MyManaged*.class"/>
+ <include name="org/jboss/test/ws/management/recording/ExtManaged*.class"/>
<include name="org/jboss/test/ws/management/recording/*.xml"/>
- <exclude name="org/jboss/test/ws/management/recording/EndpointImpl.class"/>
- <exclude name="org/jboss/test/ws/management/recording/*TestCase.class"/>
</fileset>
<manifest>
<attribute name="Dependencies" value="org.jboss.logging"/>
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java 2011-07-26 10:22:18 UTC (rev 14743)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/CustomRecordProcessorTestCase.java 2011-07-26 10:46:49 UTC (rev 14744)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.management.recording;
import java.net.URL;
+import java.rmi.RMISecurityManager;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
@@ -47,16 +48,27 @@
protected void setUp() throws Exception
{
- //Native does not require us to set the recording handler on the deployed endpoint
- boolean isNative = isIntegrationNative();
- new JBossWSTestHelper().deploy(isNative ? "management-recording-native.jar" : "management-recording.jar");
- endpointObjectName = isNative ? "jboss.ws:context=management-recording,endpoint=EndpointImpl" : "jboss.ws:context=management-recording,endpoint=EndpointWithHandlerImpl";
+ if (!isTargetJBoss6()) {
+ endpointObjectName = "jboss.ws:context=management-recording,endpoint=EndpointWithConfigImpl";
+ JBossWSTestHelper.deploy("management-recording-as7.jar");
+ } else if (isIntegrationNative()) {
+ endpointObjectName = "jboss.ws:context=management-recording,endpoint=EndpointImpl";
+ JBossWSTestHelper.deploy("management-recording-native.jar");
+ } else {
+ endpointObjectName = "jboss.ws:context=management-recording,endpoint=EndpointWithHandlerImpl";
+ JBossWSTestHelper.deploy("management-recording.jar");
+ }
}
protected void tearDown() throws Exception
{
- boolean isNative = isIntegrationNative();
- new JBossWSTestHelper().undeploy(isNative ? "management-recording-native.jar" : "management-recording.jar");
+ if (!isTargetJBoss6()) {
+ JBossWSTestHelper.undeploy("management-recording-as7.jar");
+ } else if (isIntegrationNative()) {
+ JBossWSTestHelper.undeploy("management-recording-native.jar");
+ } else {
+ JBossWSTestHelper.undeploy("management-recording.jar");
+ }
}
public void testAddCustomProcessor() throws Exception
Copied: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/EndpointWithConfigImpl.java (from rev 14730, shared-testsuite/branches/jbossws-shared-testsuite-4.0.0.Beta3/testsuite/src/test/java/org/jboss/test/ws/management/recording/EndpointWithConfigImpl.java)
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/EndpointWithConfigImpl.java (rev 0)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/EndpointWithConfigImpl.java 2011-07-26 10:46:49 UTC (rev 14744)
@@ -0,0 +1,55 @@
+/*
+ * 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.test.ws.management.recording;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.api.annotation.EndpointConfig;
+import org.jboss.ws.api.annotation.WebContext;
+
+/**
+ * author alessio.soldano(a)jboss.com
+ * @since 20-Jul-2011
+ */
+@Stateless
+@WebService(serviceName="EndpointService", endpointInterface = "org.jboss.test.ws.management.recording.Endpoint")
+@WebContext(contextRoot="/management-recording", urlPattern="/EndpointImpl")
+@EndpointConfig(configName="Recording-Endpoint-Config")
+public class EndpointWithConfigImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointWithConfigImpl.class);
+
+ public String echo1(String input)
+ {
+ log.info("echo1: " + input);
+ return input;
+ }
+
+ public String echo2(String input)
+ {
+ log.info("echo2: " + input);
+ return input;
+ }
+}
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2011-07-26 10:22:18 UTC (rev 14743)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/management/recording/MemoryBufferRecorderTestCase.java 2011-07-26 10:46:49 UTC (rev 14744)
@@ -55,16 +55,27 @@
protected void setUp() throws Exception
{
- //Native does not require us to set the recording handler on the deployed endpoint
- boolean isNative = isIntegrationNative();
- new JBossWSTestHelper().deploy(isNative ? "management-recording-native.jar" : "management-recording.jar");
- endpointObjectName = isNative ? "jboss.ws:context=management-recording,endpoint=EndpointImpl" : "jboss.ws:context=management-recording,endpoint=EndpointWithHandlerImpl";
+ if (!isTargetJBoss6()) {
+ endpointObjectName = "jboss.ws:context=management-recording,endpoint=EndpointWithConfigImpl";
+ JBossWSTestHelper.deploy("management-recording-as7.jar");
+ } else if (isIntegrationNative()) {
+ endpointObjectName = "jboss.ws:context=management-recording,endpoint=EndpointImpl";
+ JBossWSTestHelper.deploy("management-recording-native.jar");
+ } else {
+ endpointObjectName = "jboss.ws:context=management-recording,endpoint=EndpointWithHandlerImpl";
+ JBossWSTestHelper.deploy("management-recording.jar");
+ }
}
protected void tearDown() throws Exception
{
- boolean isNative = isIntegrationNative();
- new JBossWSTestHelper().undeploy(isNative ? "management-recording-native.jar" : "management-recording.jar");
+ if (!isTargetJBoss6()) {
+ JBossWSTestHelper.undeploy("management-recording-as7.jar");
+ } else if (isIntegrationNative()) {
+ JBossWSTestHelper.undeploy("management-recording-native.jar");
+ } else {
+ JBossWSTestHelper.undeploy("management-recording.jar");
+ }
}
public void testRecording() throws Exception
13 years, 5 months
JBossWS SVN: r14743 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core: jaxrpc/client and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-07-26 06:22:18 -0400 (Tue, 26 Jul 2011)
New Revision: 14743
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceObjectFactoryJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceRefBinderJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceReferenceableJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/SecurityActions.java
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/ServiceObjectFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceRefBinderJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceReferenceableJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/NativeServiceRefBinderFactoryImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java
Log:
refactoring Native JAXRPC service ref to separate package
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/Message.properties 2011-07-26 10:22:18 UTC (rev 14743)
@@ -1,6 +1,3 @@
-NOT_ALLOWED_TO_USE=Within a <service-ref> it's not allowed to use a SEI across different <port-component-ref>'s: {0}
-FAILED_TO_NARROW_ENDPOINTS=Failed to narrow available endpoints by <port-component-ref> declaration
-UNABLE_TO_NARROW_PORT_SELECTION=Unable to narrow port selection for {0}
GIVEN_ENDPOINT_CANNOT_BE_NULL=Given endpoint cannot be null
CONNECTION_IS_ALREADY_CLOSED=Connection is already closed
GIVEN_ENDPOINT_CANNOT_BE_NULL=Given endpoint cannot be null
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/NativeServiceRefBinderFactoryImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/NativeServiceRefBinderFactoryImpl.java 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/NativeServiceRefBinderFactoryImpl.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.core.client;
-import org.jboss.ws.core.jaxrpc.client.NativeServiceRefBinderJAXRPC;
+import org.jboss.ws.core.jaxrpc.client.serviceref.NativeServiceRefBinderJAXRPC;
import org.jboss.ws.core.jaxws.client.NativeServiceRefBinderJAXWS;
import org.jboss.wsf.spi.serviceref.ServiceRefBinder;
import org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory;
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/ServiceObjectFactory.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/ServiceObjectFactory.java 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/ServiceObjectFactory.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -1,121 +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.core.client;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.naming.spi.ObjectFactory;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-
-/**
- * This ServiceObjectFactory reconstructs a service for a given WSDL when the webservice client does a JNDI lookup
- * <p/>
- * It uses the information provided by the service-ref element in application-client.xml
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public abstract class ServiceObjectFactory implements ObjectFactory
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(ServiceObjectFactory.class);
- // provide logging
- private static final Logger log = Logger.getLogger(ServiceObjectFactory.class);
-
- /**
- * Narrow available endpoints by <port-component-ref> declarations.
- * Service.getPort(SEI) must be able to retrieve a distinct port definition.
- */
- protected void narrowPortSelection(UnifiedServiceRefMetaData serviceRef, ServiceMetaData serviceMetaData)
- {
- if (serviceMetaData.getEndpoints().size() > 1)
- {
- Map<String, UnifiedPortComponentRefMetaData> pcrefs = new HashMap<String, UnifiedPortComponentRefMetaData>();
- for (UnifiedPortComponentRefMetaData pcref : serviceRef.getPortComponentRefs())
- {
- String seiName = pcref.getServiceEndpointInterface();
-
- // Constraint#1: within a service-ref it's not allowed to use a SEI across different pcref's
- if (pcrefs.get(seiName) != null)
- throw new WSException(BundleUtils.getMessage(bundle, "NOT_ALLOWED_TO_USE", seiName));
-
- pcrefs.put(seiName, pcref);
- }
-
- // Constraint#2: A pcref may only match one EndpointMetaData
- for (String sei : pcrefs.keySet())
- {
- // Narrow available endpoints by port-component-ref declaration
- List<QName> narrowedEndpoints = new ArrayList<QName>();
-
- UnifiedPortComponentRefMetaData pcref = pcrefs.get(sei);
-
- // Constraint#3: Port selection only applies when both SEI and QName are given
- if (pcref.getServiceEndpointInterface() != null && pcref.getPortQName() != null)
- {
- List<QName> pcRef2EndpointMapping = new ArrayList<QName>();
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- if (pcref.getServiceEndpointInterface().equals(epMetaData.getServiceEndpointInterfaceName()))
- {
- pcRef2EndpointMapping.add(epMetaData.getPortName());
- }
- }
-
- for (QName q : pcRef2EndpointMapping)
- {
- EndpointMetaData mappedEndpoint = serviceMetaData.getEndpoint(q);
- if (!pcref.getPortQName().equals(mappedEndpoint.getPortName()))
- narrowedEndpoints.add(q);
- }
-
- // Constraint: Dont exclude all of them ;)
- if (pcRef2EndpointMapping.size() > 0 && (pcRef2EndpointMapping.size() == narrowedEndpoints.size()))
- throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_NARROW_ENDPOINTS"));
-
- for (QName q : narrowedEndpoints)
- {
- EndpointMetaData removed = serviceMetaData.removeEndpoint(q);
- if (log.isDebugEnabled())
- log.debug("Narrowed endpoint " + q + "(" + removed + ")");
- }
- }
- else
- {
- // TODO: In case there is more then one EMPD this should cause an exception
- log.warn(BundleUtils.getMessage(bundle, "UNABLE_TO_NARROW_PORT_SELECTION", pcref));
- }
- }
- }
- }
-}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/Message.properties 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/Message.properties 2011-07-26 10:22:18 UTC (rev 14743)
@@ -8,18 +8,15 @@
CALL_INVOCATION_FAILED_CAUSE=Call invocation failed with code [{0}] because of: {1}
ALREADY_REGISTERED=Different java type already registered: {0}
-CANNOT_OBTAIN_PATH=Cannot obtain path to PortComponentLinkServlet: {0}
-CANNOT_MARSHALL_SERVICE_REF_META_DATA=Cannot marshall service ref meta data, cause: {0}
-CANNOT_MARSHALL_SECURITY_CONFIG=Cannot marshall security config, cause: {0}
CANNOT_OBTAIN_ENDPOINT_META_DATA=Cannot obtain endpoint meta data for: {0}
CANNOT_FIND_ENDPOINT=Cannot find endpoint for name: {0}
SHOULD_NOT_USE_METHOD=Components should not use the {0} method.
SEI_CLASS_CANNOT_BE_NULL=SEI class cannot be null
-NOT_IMPLEMENT_REMOTE=SEI does not implement java.rmi.Remote: {0}
SERVICE_META_DATA_NOT_AVAILABLE=Service meta data not available
CANNOT_FIND_ENDPOINT_META_DATA=Cannot find endpoint meta data for: {0}
+NOT_IMPLEMENT_REMOTE=SEI does not implement java.rmi.Remote: {0}
CANNOT_CREATE_PROXY=Cannot create proxy
SEI_CLASS_CANNOT_BE_NULL=SEI class cannot be null
SERVICE_META_DATA_NOT_AVAILABLE=Service meta data not available
@@ -30,11 +27,3 @@
RETURN_VALUE_NOT_SUPPORTED=Return value not supported by: {0}
UNSUPPORTED_PROPERTY=Unsupported property: {0}
LEGACY_PROPERY=Legacy propery {0} mapped to {1}
-CANNOT_UNMARSHALL_SERVICE_REF_META_DATA=Cannot unmarshall service ref meta data
-CANNOT_UNMARSHALL_SECURITY_CONFIG=Cannot unmarshall security config, cause: {0}
-CANNOT_RESOLVE_PORT_COMPONENT_LINK=Cannot resolve port-component-link: {0}
-CANNOT_SET_ENDPOINT_ADDRESS=Cannot set endpoint address for port-component-link, unsuported number of endpoints
-NOT_IMPLEMENT_SERVICE=The service interface does not implement javax.xml.rpc.Service: {0}
-THE_SEI_DOES_NOT_IMPLEMENT_JAVA.RMI.REMOTE=The SEI does not implement java.rmi.Remote: {0}
-CANNOT_CREATE_SERVICE=Cannot create service
-CANNOT_UNMARSHAL_JAXRPC_MAPPING_FILE=Cannot unmarshal jaxrpc-mapping-file: {0}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceRefBinderJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceRefBinderJAXRPC.java 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceRefBinderJAXRPC.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxrpc.client;
-
-import javax.naming.Referenceable;
-
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-import org.jboss.wsf.spi.serviceref.ServiceRefBinder;
-
-/**
- * Binds a JAXRPC Service object to the client's ENC.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- */
-public final class NativeServiceRefBinderJAXRPC implements ServiceRefBinder
-{
- @Override
- public Referenceable createReferenceable(final UnifiedServiceRefMetaData serviceRefMD)
- {
- return new NativeServiceReferenceableJAXRPC(serviceRefMD);
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceReferenceableJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceReferenceableJAXRPC.java 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/NativeServiceReferenceableJAXRPC.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -1,185 +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.core.jaxrpc.client;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.net.URL;
-import java.util.ResourceBundle;
-
-import javax.naming.BinaryRefAddr;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.Referenceable;
-import javax.naming.StringRefAddr;
-
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-
-/**
- * A JNDI reference to a javax.xml.rpc.Service
- * <p/>
- * It holds the information to reconstrut the javax.xml.rpc.Service
- * when the client does a JNDI lookup.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class NativeServiceReferenceableJAXRPC implements Referenceable
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(NativeServiceReferenceableJAXRPC.class);
- public static final String SERVICE_REF_META_DATA = "SERVICE_REF_META_DATA";
- public static final String SECURITY_CONFIG = "SECURITY_CONFIG";
- public static final String PORT_COMPONENT_LINK = "PORT_COMPONENT_LINK";
- public static final String PORT_COMPONENT_LINK_SERVLET = "PORT_COMPONENT_LINK_SERVLET";
-
- private UnifiedServiceRefMetaData refMetaData;
- private UnifiedVirtualFile vfsRoot;
-
- /**
- * A service referenceable for a WSDL document that is part of the deployment
- */
- public NativeServiceReferenceableJAXRPC(UnifiedServiceRefMetaData refMetaData)
- {
- this.refMetaData = refMetaData;
- this.vfsRoot = refMetaData.getVfsRoot();
- }
-
- /**
- * Retrieves the Reference of this object.
- *
- * @return The non-null Reference of this object.
- * @throws javax.naming.NamingException If a naming exception was encountered while retrieving the reference.
- */
- public Reference getReference() throws NamingException
- {
- Reference myRef = new Reference(NativeServiceReferenceableJAXRPC.class.getName(), ServiceObjectFactoryJAXRPC.class.getName(), null);
-
- // Add a reference to the ServiceRefMetaData and WSDLDefinitions
- myRef.add(new BinaryRefAddr(SERVICE_REF_META_DATA, marshallServiceRef()));
-
- // FIXME: JBWS-1431 Merge ws-security config with jaxrpc/jaxws config
- if (getSecurityConfig() != null)
- myRef.add(new BinaryRefAddr(SECURITY_CONFIG, marshallSecurityConfig()));
-
- // Add references to port component links
- for (UnifiedPortComponentRefMetaData pcr : refMetaData.getPortComponentRefs())
- {
- String pcLink = pcr.getPortComponentLink();
- if (pcLink != null)
- {
- myRef.add(new StringRefAddr(PORT_COMPONENT_LINK, pcLink));
- try
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- ServerConfig config = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
-
- String host = config.getWebServiceHost();
- int port = config.getWebServicePort();
-
- String servletURL = "http://" + host + ":" + port + "/jbossws/pclink";
- myRef.add(new StringRefAddr(PORT_COMPONENT_LINK_SERVLET, servletURL));
- }
- catch (Exception ex)
- {
- throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_PATH", ex));
- }
- }
- }
-
- return myRef;
- }
-
- /** Marshall the ServiceRefMetaData to an byte array
- */
- private byte[] marshallServiceRef() throws NamingException
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
- try
- {
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(refMetaData);
- oos.close();
- }
- catch (IOException e)
- {
- throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_MARSHALL_SERVICE_REF_META_DATA", e.toString()));
- }
- return baos.toByteArray();
- }
-
- /** Marshall the WSSecurityConfiguration to an byte array
- */
- private byte[] marshallSecurityConfig() throws NamingException
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
- try
- {
- WSSecurityConfiguration securityConfig = WSSecurityConfigFactory.newInstance().createConfiguration(
- refMetaData.getVfsRoot(), WSSecurityOMFactory.CLIENT_RESOURCE_NAME
- );
-
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(securityConfig);
- oos.close();
- }
- catch (IOException e)
- {
- throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_MARSHALL_SECURITY_CONFIG", e.toString()));
- }
- return baos.toByteArray();
- }
-
- private URL getSecurityConfig()
- {
- URL securityConfigURL = null;
- try
- {
- UnifiedVirtualFile vfConfig = vfsRoot.findChild("WEB-INF/" + WSSecurityOMFactory.CLIENT_RESOURCE_NAME);
- securityConfigURL = vfConfig.toURL();
- }
- catch (IOException ex)
- {
- // ignore
- }
- try
- {
- UnifiedVirtualFile vfConfig = vfsRoot.findChild("META-INF/" + WSSecurityOMFactory.CLIENT_RESOURCE_NAME);
- securityConfigURL = vfConfig.toURL();
- }
- catch (IOException ex)
- {
- // ignore
- }
- return securityConfigURL;
- }
-}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -92,7 +92,7 @@
/**
* Construct a Service without WSDL meta data
*/
- ServiceImpl(QName serviceName)
+ public ServiceImpl(QName serviceName)
{
UnifiedMetaData wsMetaData = new UnifiedMetaData(new ResourceLoaderAdapter());
serviceMetaData = new ServiceMetaData(wsMetaData, serviceName);
@@ -102,7 +102,7 @@
/**
* Construct a Service that has access to some WSDL meta data
*/
- ServiceImpl(QName serviceName, URL wsdlURL, URL mappingURL, URL securityURL)
+ public ServiceImpl(QName serviceName, URL wsdlURL, URL mappingURL, URL securityURL)
{
this.wsdlLocation = wsdlURL;
JAXRPCClientMetaDataBuilder builder = new JAXRPCClientMetaDataBuilder();
@@ -116,7 +116,7 @@
/**
* Construct a Service that has access to some WSDL meta data
*/
- ServiceImpl(QName serviceName, URL wsdlURL, JavaWsdlMapping mappingURL, WSSecurityConfiguration securityConfig, UnifiedServiceRefMetaData usrMetaData)
+ public ServiceImpl(QName serviceName, URL wsdlURL, JavaWsdlMapping mappingURL, WSSecurityConfiguration securityConfig, UnifiedServiceRefMetaData usrMetaData)
{
this.wsdlLocation = wsdlURL;
this.usrMetaData = usrMetaData;
@@ -494,7 +494,7 @@
handlerRegistry.registerClientHandlerChain(portName, infos, roles);
}
- void setupHandlerChain(EndpointMetaData epMetaData)
+ public void setupHandlerChain(EndpointMetaData epMetaData)
{
if (epMetaData.isHandlersInitialized() == false)
{
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2011-07-26 08:04:46 UTC (rev 14742)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -1,295 +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.core.jaxrpc.client;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectInputStream;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.rmi.Remote;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Properties;
-import java.util.ResourceBundle;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.Service;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.core.client.ServiceObjectFactory;
-import org.jboss.ws.core.server.PortComponentResolver;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-
-/**
- * This ServiceObjectFactory reconstructs a javax.xml.rpc.Service
- * for a given WSDL when the webservice client does a JNDI lookup
- * <p/>
- * It uses the information provided by the service-ref element in application-client.xml
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class ServiceObjectFactoryJAXRPC extends ServiceObjectFactory
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(ServiceObjectFactoryJAXRPC.class);
- // provide logging
- private static final Logger log = Logger.getLogger(ServiceObjectFactoryJAXRPC.class);
-
- /**
- * Creates an object using the location or reference information specified.
- * <p/>
- *
- * @param obj The possibly null object containing location or reference
- * information that can be used in creating an object.
- * @param name The name of this object relative to <code>nameCtx</code>,
- * or null if no name is specified.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified, or null if <code>name</code> is
- * relative to the default initial context.
- * @param environment The possibly null environment that is used in
- * creating the object.
- * @return The object created; null if an object cannot be created.
- * @throws Exception if this object factory encountered an exception
- * while attempting to create an object, and no other object factories are
- * to be tried.
- * @see javax.naming.spi.NamingManager#getObjectInstance
- * @see javax.naming.spi.NamingManager#getURLContext
- */
- public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception
- {
- try
- {
- Reference ref = (Reference)obj;
-
- // Unmarshall the ServiceRefMetaData
- UnifiedServiceRefMetaData serviceRef = null;
- RefAddr metaRefAddr = ref.get(NativeServiceReferenceableJAXRPC.SERVICE_REF_META_DATA);
- ByteArrayInputStream bais = new ByteArrayInputStream((byte[])metaRefAddr.getContent());
- try
- {
- ObjectInputStream ois = new ObjectInputStream(bais);
- serviceRef = (UnifiedServiceRefMetaData)ois.readObject();
- ois.close();
- }
- catch (IOException ex)
- {
- NamingException ne = new NamingException(BundleUtils.getMessage(bundle, "CANNOT_UNMARSHALL_SERVICE_REF_META_DATA"));
- ne.setRootCause(ex);
- throw ne;
- }
-
- // Unmarshall the WSSecurityConfiguration
- WSSecurityConfiguration securityConfig = null;
- RefAddr wsseRefAddr = ref.get(NativeServiceReferenceableJAXRPC.SECURITY_CONFIG);
- if (wsseRefAddr != null)
- {
- bais = new ByteArrayInputStream((byte[])wsseRefAddr.getContent());
- try
- {
- ObjectInputStream ois = new ObjectInputStream(bais);
- securityConfig = (WSSecurityConfiguration)ois.readObject();
- ois.close();
- }
- catch (IOException e)
- {
- throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_UNMARSHALL_SECURITY_CONFIG", e.toString()));
- }
- }
-
- ServiceImpl jaxrpcService = null;
- URL wsdlLocation = serviceRef.getWsdlLocation();
- if (wsdlLocation != null)
- {
- if (log.isDebugEnabled())
- log.debug("Create jaxrpc service from wsdl");
-
- // Create the actual service object
- QName serviceName = serviceRef.getServiceQName();
- JavaWsdlMapping javaWsdlMapping = getJavaWsdlMapping(serviceRef);
- jaxrpcService = new ServiceImpl(serviceName, wsdlLocation, javaWsdlMapping, securityConfig, serviceRef);
- }
- else
- {
- if (log.isDebugEnabled())
- log.debug("Create jaxrpc service with no wsdl");
- jaxrpcService = new ServiceImpl(new QName(Constants.NS_JBOSSWS_URI, "AnonymousService"));
- }
-
- ServiceMetaData serviceMetaData = jaxrpcService.getServiceMetaData();
-
- // Set any service level properties
- if (serviceRef.getCallProperties().size() > 0)
- {
- Properties callProps = new Properties();
- serviceMetaData.setProperties(callProps);
- for (UnifiedCallPropertyMetaData prop : serviceRef.getCallProperties())
- callProps.setProperty(prop.getPropName(), prop.getPropValue());
- }
-
- // The web service client using a port-component-link, the contet is the URL to
- // the PortComponentLinkServlet that will return the actual endpoint address
- RefAddr pcLinkRef = ref.get(NativeServiceReferenceableJAXRPC.PORT_COMPONENT_LINK);
- if (pcLinkRef != null)
- {
- String pcLink = (String)pcLinkRef.getContent();
- log.debug("Resolving port-component-link: " + pcLink);
-
- // First try to obtain the endpoint address loacally
- String endpointAddress = null;
- try
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- EndpointRegistry epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
- Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) );
- if (endpoint == null)
- throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_RESOLVE_PORT_COMPONENT_LINK", pcLink));
-
- ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class);
- endpointAddress = sepMetaData.getEndpointAddress();
- }
- catch (Throwable ex)
- {
- // ignore, we are probably a remote client
- }
-
- // We may be remote in the esoteric case where an appclient uses the port-comonent-link feature
- if (endpointAddress == null)
- {
- String servletPath = (String)ref.get(NativeServiceReferenceableJAXRPC.PORT_COMPONENT_LINK_SERVLET).getContent();
- servletPath += "?pcLink=" + URLEncoder.encode(pcLink, "UTF-8");
- InputStream is = new URL(servletPath).openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- endpointAddress = br.readLine();
- br.close();
- is.close();
- }
-
- if (log.isDebugEnabled())
- log.debug("Resolved to: " + endpointAddress);
- if (serviceMetaData.getEndpoints().size() == 1)
- {
- EndpointMetaData epMetaData = serviceMetaData.getEndpoints().get(0);
- epMetaData.setEndpointAddress(endpointAddress);
- }
- else
- {
- log.warn(BundleUtils.getMessage(bundle, "CANNOT_SET_ENDPOINT_ADDRESS"));
- }
- }
-
- narrowPortSelection(serviceRef, serviceMetaData);
-
- /********************************************************
- * Setup the Proxy that implements the service-interface
- ********************************************************/
-
- // load the service interface class
- ClassLoader contextCL = SecurityActions.getContextClassLoader();
- Class<?> siClass = SecurityActions.loadClass(contextCL, serviceRef.getServiceInterface());
- if (Service.class.isAssignableFrom(siClass) == false)
- throw new JAXRPCException(BundleUtils.getMessage(bundle, "NOT_IMPLEMENT_SERVICE", siClass.getName()));
-
- // load all service endpoint interface classes
- for (UnifiedPortComponentRefMetaData pcr : serviceRef.getPortComponentRefs())
- {
- String seiName = pcr.getServiceEndpointInterface();
- if (seiName != null)
- {
- Class seiClass = contextCL.loadClass(seiName);
- if (Remote.class.isAssignableFrom(seiClass) == false)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "NOT_IMPLEMENT_REMOTE", seiClass.getName()));
- }
- }
-
- // Setup the handler chain
- setupHandlerChain(jaxrpcService);
-
- InvocationHandler handler = new ServiceProxy(jaxrpcService, siClass);
- return Proxy.newProxyInstance(contextCL, new Class[] { siClass, ServiceExt.class }, handler);
- }
- catch (Exception ex)
- {
- log.error(BundleUtils.getMessage(bundle, "CANNOT_CREATE_SERVICE"), ex);
- throw ex;
- }
- }
-
- /**
- * Setup the handler chain(s) for this service
- */
- private void setupHandlerChain(ServiceImpl jaxrpcService) throws Exception
- {
- List<EndpointMetaData> endpoints = jaxrpcService.getServiceMetaData().getEndpoints();
- for (EndpointMetaData epMetaData : endpoints)
- {
- jaxrpcService.setupHandlerChain(epMetaData);
- }
- }
-
- private JavaWsdlMapping getJavaWsdlMapping(UnifiedServiceRefMetaData serviceRef)
- {
- JavaWsdlMapping javaWsdlMapping = null;
- if (serviceRef.getMappingFile() != null)
- {
- String mappingFile = serviceRef.getMappingFile();
- try
- {
- JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance();
- URL mappingURL = serviceRef.getVfsRoot().findChild(mappingFile).toURL();
- javaWsdlMapping = mappingFactory.parse(mappingURL);
- }
- catch (Exception e)
- {
- throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_UNMARSHAL_JAXRPC_MAPPING_FILE", mappingFile), e);
- }
- }
- return javaWsdlMapping;
- }
-}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/Message.properties
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/Message.properties (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/Message.properties 2011-07-26 10:22:18 UTC (rev 14743)
@@ -0,0 +1,17 @@
+# NativeServiceReferenceableJAXRPC.java
+CANNOT_OBTAIN_PATH=Cannot obtain path to PortComponentLinkServlet: {0}
+CANNOT_MARSHALL_SERVICE_REF_META_DATA=Cannot marshall service ref meta data, cause: {0}
+CANNOT_MARSHALL_SECURITY_CONFIG=Cannot marshall security config, cause: {0}
+
+# NativeServiceObjectFactoryJAXRPC.java
+NOT_IMPLEMENT_REMOTE=SEI does not implement java.rmi.Remote: {0}
+CANNOT_UNMARSHALL_SERVICE_REF_META_DATA=Cannot unmarshall service ref meta data
+CANNOT_UNMARSHALL_SECURITY_CONFIG=Cannot unmarshall security config, cause: {0}
+CANNOT_RESOLVE_PORT_COMPONENT_LINK=Cannot resolve port-component-link: {0}
+CANNOT_SET_ENDPOINT_ADDRESS=Cannot set endpoint address for port-component-link, unsuported number of endpoints
+NOT_IMPLEMENT_SERVICE=The service interface does not implement javax.xml.rpc.Service: {0}
+CANNOT_CREATE_SERVICE=Cannot create service
+NOT_ALLOWED_TO_USE=Within a <service-ref> it's not allowed to use a SEI across different <port-component-ref>'s: {0}
+FAILED_TO_NARROW_ENDPOINTS=Failed to narrow available endpoints by <port-component-ref> declaration
+UNABLE_TO_NARROW_PORT_SELECTION=Unable to narrow port selection for {0}
+CANNOT_UNMARSHALL_JAXRPC_MAPPING_FILE=Cannot unmarshal jaxrpc-mapping-file: {0}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceObjectFactoryJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceObjectFactoryJAXRPC.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceObjectFactoryJAXRPC.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -0,0 +1,368 @@
+/*
+ * 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.core.jaxrpc.client.serviceref;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.rmi.Remote;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.Service;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.core.jaxrpc.client.ServiceExt;
+import org.jboss.ws.core.jaxrpc.client.ServiceImpl;
+import org.jboss.ws.core.jaxrpc.client.ServiceProxy;
+import org.jboss.ws.core.server.PortComponentResolver;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+/**
+ * This ServiceObjectFactory reconstructs a javax.xml.rpc.Service
+ * for a given WSDL when the webservice client does a JNDI lookup
+ * <p/>
+ * It uses the information provided by the service-ref element in application-client.xml
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-April-2004
+ */
+public final class NativeServiceObjectFactoryJAXRPC implements ObjectFactory
+{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(NativeServiceObjectFactoryJAXRPC.class);
+ // provide logging
+ private static final Logger log = Logger.getLogger(NativeServiceObjectFactoryJAXRPC.class);
+
+ /**
+ * Creates an object using the location or reference information specified.
+ * <p/>
+ *
+ * @param obj The possibly null object containing location or reference
+ * information that can be used in creating an object.
+ * @param name The name of this object relative to <code>nameCtx</code>,
+ * or null if no name is specified.
+ * @param nameCtx The context relative to which the <code>name</code>
+ * parameter is specified, or null if <code>name</code> is
+ * relative to the default initial context.
+ * @param environment The possibly null environment that is used in
+ * creating the object.
+ * @return The object created; null if an object cannot be created.
+ * @throws Exception if this object factory encountered an exception
+ * while attempting to create an object, and no other object factories are
+ * to be tried.
+ * @see javax.naming.spi.NamingManager#getObjectInstance
+ * @see javax.naming.spi.NamingManager#getURLContext
+ */
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception
+ {
+ try
+ {
+ Reference ref = (Reference)obj;
+
+ // Unmarshall the ServiceRefMetaData
+ UnifiedServiceRefMetaData serviceRef = null;
+ RefAddr metaRefAddr = ref.get(NativeServiceReferenceableJAXRPC.SERVICE_REF_META_DATA);
+ ByteArrayInputStream bais = new ByteArrayInputStream((byte[])metaRefAddr.getContent());
+ try
+ {
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ serviceRef = (UnifiedServiceRefMetaData)ois.readObject();
+ ois.close();
+ }
+ catch (IOException ex)
+ {
+ NamingException ne = new NamingException(BundleUtils.getMessage(bundle, "CANNOT_UNMARSHALL_SERVICE_REF_META_DATA"));
+ ne.setRootCause(ex);
+ throw ne;
+ }
+
+ // Unmarshall the WSSecurityConfiguration
+ WSSecurityConfiguration securityConfig = null;
+ RefAddr wsseRefAddr = ref.get(NativeServiceReferenceableJAXRPC.SECURITY_CONFIG);
+ if (wsseRefAddr != null)
+ {
+ bais = new ByteArrayInputStream((byte[])wsseRefAddr.getContent());
+ try
+ {
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ securityConfig = (WSSecurityConfiguration)ois.readObject();
+ ois.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_UNMARSHALL_SECURITY_CONFIG", e.toString()));
+ }
+ }
+
+ ServiceImpl jaxrpcService = null;
+ URL wsdlLocation = serviceRef.getWsdlLocation();
+ if (wsdlLocation != null)
+ {
+ if (log.isDebugEnabled())
+ log.debug("Create jaxrpc service from wsdl");
+
+ // Create the actual service object
+ QName serviceName = serviceRef.getServiceQName();
+ JavaWsdlMapping javaWsdlMapping = getJavaWsdlMapping(serviceRef);
+ jaxrpcService = new ServiceImpl(serviceName, wsdlLocation, javaWsdlMapping, securityConfig, serviceRef);
+ }
+ else
+ {
+ if (log.isDebugEnabled())
+ log.debug("Create jaxrpc service with no wsdl");
+ jaxrpcService = new ServiceImpl(new QName(Constants.NS_JBOSSWS_URI, "AnonymousService"));
+ }
+
+ ServiceMetaData serviceMetaData = jaxrpcService.getServiceMetaData();
+
+ // Set any service level properties
+ if (serviceRef.getCallProperties().size() > 0)
+ {
+ Properties callProps = new Properties();
+ serviceMetaData.setProperties(callProps);
+ for (UnifiedCallPropertyMetaData prop : serviceRef.getCallProperties())
+ callProps.setProperty(prop.getPropName(), prop.getPropValue());
+ }
+
+ // The web service client using a port-component-link, the contet is the URL to
+ // the PortComponentLinkServlet that will return the actual endpoint address
+ RefAddr pcLinkRef = ref.get(NativeServiceReferenceableJAXRPC.PORT_COMPONENT_LINK);
+ if (pcLinkRef != null)
+ {
+ String pcLink = (String)pcLinkRef.getContent();
+ log.debug("Resolving port-component-link: " + pcLink);
+
+ // First try to obtain the endpoint address loacally
+ String endpointAddress = null;
+ try
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ EndpointRegistry epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+ Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) );
+ if (endpoint == null)
+ throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_RESOLVE_PORT_COMPONENT_LINK", pcLink));
+
+ ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class);
+ endpointAddress = sepMetaData.getEndpointAddress();
+ }
+ catch (Throwable ex)
+ {
+ // ignore, we are probably a remote client
+ }
+
+ // We may be remote in the esoteric case where an appclient uses the port-comonent-link feature
+ if (endpointAddress == null)
+ {
+ String servletPath = (String)ref.get(NativeServiceReferenceableJAXRPC.PORT_COMPONENT_LINK_SERVLET).getContent();
+ servletPath += "?pcLink=" + URLEncoder.encode(pcLink, "UTF-8");
+ InputStream is = new URL(servletPath).openStream();
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ endpointAddress = br.readLine();
+ br.close();
+ is.close();
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Resolved to: " + endpointAddress);
+ if (serviceMetaData.getEndpoints().size() == 1)
+ {
+ EndpointMetaData epMetaData = serviceMetaData.getEndpoints().get(0);
+ epMetaData.setEndpointAddress(endpointAddress);
+ }
+ else
+ {
+ log.warn(BundleUtils.getMessage(bundle, "CANNOT_SET_ENDPOINT_ADDRESS"));
+ }
+ }
+
+ narrowPortSelection(serviceRef, serviceMetaData);
+
+ /********************************************************
+ * Setup the Proxy that implements the service-interface
+ ********************************************************/
+
+ // load the service interface class
+ ClassLoader contextCL = SecurityActions.getContextClassLoader();
+ Class<?> siClass = SecurityActions.loadClass(contextCL, serviceRef.getServiceInterface());
+ if (Service.class.isAssignableFrom(siClass) == false)
+ throw new JAXRPCException(BundleUtils.getMessage(bundle, "NOT_IMPLEMENT_SERVICE", siClass.getName()));
+
+ // load all service endpoint interface classes
+ for (UnifiedPortComponentRefMetaData pcr : serviceRef.getPortComponentRefs())
+ {
+ String seiName = pcr.getServiceEndpointInterface();
+ if (seiName != null)
+ {
+ Class<?> seiClass = contextCL.loadClass(seiName);
+ if (Remote.class.isAssignableFrom(seiClass) == false)
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "NOT_IMPLEMENT_REMOTE", seiClass.getName()));
+ }
+ }
+
+ // Setup the handler chain
+ setupHandlerChain(jaxrpcService);
+
+ InvocationHandler handler = new ServiceProxy(jaxrpcService, siClass);
+ return Proxy.newProxyInstance(contextCL, new Class[] { siClass, ServiceExt.class }, handler);
+ }
+ catch (Exception ex)
+ {
+ log.error(BundleUtils.getMessage(bundle, "CANNOT_CREATE_SERVICE"), ex);
+ throw ex;
+ }
+ }
+
+ /**
+ * Narrow available endpoints by <port-component-ref> declarations.
+ * Service.getPort(SEI) must be able to retrieve a distinct port definition.
+ */
+ protected void narrowPortSelection(UnifiedServiceRefMetaData serviceRef, ServiceMetaData serviceMetaData)
+ {
+ if (serviceMetaData.getEndpoints().size() > 1)
+ {
+ Map<String, UnifiedPortComponentRefMetaData> pcrefs = new HashMap<String, UnifiedPortComponentRefMetaData>();
+ for (UnifiedPortComponentRefMetaData pcref : serviceRef.getPortComponentRefs())
+ {
+ String seiName = pcref.getServiceEndpointInterface();
+
+ // Constraint#1: within a service-ref it's not allowed to use a SEI across different pcref's
+ if (pcrefs.get(seiName) != null)
+ throw new WSException(BundleUtils.getMessage(bundle, "NOT_ALLOWED_TO_USE", seiName));
+
+ pcrefs.put(seiName, pcref);
+ }
+
+ // Constraint#2: A pcref may only match one EndpointMetaData
+ for (String sei : pcrefs.keySet())
+ {
+ // Narrow available endpoints by port-component-ref declaration
+ List<QName> narrowedEndpoints = new ArrayList<QName>();
+
+ UnifiedPortComponentRefMetaData pcref = pcrefs.get(sei);
+
+ // Constraint#3: Port selection only applies when both SEI and QName are given
+ if (pcref.getServiceEndpointInterface() != null && pcref.getPortQName() != null)
+ {
+ List<QName> pcRef2EndpointMapping = new ArrayList<QName>();
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ if (pcref.getServiceEndpointInterface().equals(epMetaData.getServiceEndpointInterfaceName()))
+ {
+ pcRef2EndpointMapping.add(epMetaData.getPortName());
+ }
+ }
+
+ for (QName q : pcRef2EndpointMapping)
+ {
+ EndpointMetaData mappedEndpoint = serviceMetaData.getEndpoint(q);
+ if (!pcref.getPortQName().equals(mappedEndpoint.getPortName()))
+ narrowedEndpoints.add(q);
+ }
+
+ // Constraint: Dont exclude all of them ;)
+ if (pcRef2EndpointMapping.size() > 0 && (pcRef2EndpointMapping.size() == narrowedEndpoints.size()))
+ throw new WSException(BundleUtils.getMessage(bundle, "FAILED_TO_NARROW_ENDPOINTS"));
+
+ for (QName q : narrowedEndpoints)
+ {
+ EndpointMetaData removed = serviceMetaData.removeEndpoint(q);
+ if (log.isDebugEnabled())
+ log.debug("Narrowed endpoint " + q + "(" + removed + ")");
+ }
+ }
+ else
+ {
+ // TODO: In case there is more then one EMPD this should cause an exception
+ log.warn(BundleUtils.getMessage(bundle, "UNABLE_TO_NARROW_PORT_SELECTION", pcref));
+ }
+ }
+ }
+ }
+
+ /**
+ * Setup the handler chain(s) for this service
+ */
+ private void setupHandlerChain(ServiceImpl jaxrpcService) throws Exception
+ {
+ List<EndpointMetaData> endpoints = jaxrpcService.getServiceMetaData().getEndpoints();
+ for (EndpointMetaData epMetaData : endpoints)
+ {
+ jaxrpcService.setupHandlerChain(epMetaData);
+ }
+ }
+
+ private JavaWsdlMapping getJavaWsdlMapping(UnifiedServiceRefMetaData serviceRef)
+ {
+ JavaWsdlMapping javaWsdlMapping = null;
+ if (serviceRef.getMappingFile() != null)
+ {
+ String mappingFile = serviceRef.getMappingFile();
+ try
+ {
+ JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance();
+ URL mappingURL = serviceRef.getVfsRoot().findChild(mappingFile).toURL();
+ javaWsdlMapping = mappingFactory.parse(mappingURL);
+ }
+ catch (Exception e)
+ {
+ throw new WSException(BundleUtils.getMessage(bundle, "CANNOT_UNMARSHALL_JAXRPC_MAPPING_FILE", mappingFile), e);
+ }
+ }
+ return javaWsdlMapping;
+ }
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceRefBinderJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceRefBinderJAXRPC.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceRefBinderJAXRPC.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxrpc.client.serviceref;
+
+import javax.naming.Referenceable;
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.wsf.spi.serviceref.ServiceRefBinder;
+
+/**
+ * Binds a JAXRPC Service object to the client's ENC.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class NativeServiceRefBinderJAXRPC implements ServiceRefBinder
+{
+ @Override
+ public Referenceable createReferenceable(final UnifiedServiceRefMetaData serviceRefMD)
+ {
+ return new NativeServiceReferenceableJAXRPC(serviceRefMD);
+ }
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceReferenceableJAXRPC.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceReferenceableJAXRPC.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/NativeServiceReferenceableJAXRPC.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -0,0 +1,185 @@
+/*
+ * 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.core.jaxrpc.client.serviceref;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.net.URL;
+import java.util.ResourceBundle;
+
+import javax.naming.BinaryRefAddr;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+/**
+ * A JNDI reference to a javax.xml.rpc.Service
+ * <p/>
+ * It holds the information to reconstrut the javax.xml.rpc.Service
+ * when the client does a JNDI lookup.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-April-2004
+ */
+public final class NativeServiceReferenceableJAXRPC implements Referenceable
+{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(NativeServiceReferenceableJAXRPC.class);
+ public static final String SERVICE_REF_META_DATA = "SERVICE_REF_META_DATA";
+ public static final String SECURITY_CONFIG = "SECURITY_CONFIG";
+ public static final String PORT_COMPONENT_LINK = "PORT_COMPONENT_LINK";
+ public static final String PORT_COMPONENT_LINK_SERVLET = "PORT_COMPONENT_LINK_SERVLET";
+
+ private UnifiedServiceRefMetaData refMetaData;
+ private UnifiedVirtualFile vfsRoot;
+
+ /**
+ * A service referenceable for a WSDL document that is part of the deployment
+ */
+ public NativeServiceReferenceableJAXRPC(UnifiedServiceRefMetaData refMetaData)
+ {
+ this.refMetaData = refMetaData;
+ this.vfsRoot = refMetaData.getVfsRoot();
+ }
+
+ /**
+ * Retrieves the Reference of this object.
+ *
+ * @return The non-null Reference of this object.
+ * @throws javax.naming.NamingException If a naming exception was encountered while retrieving the reference.
+ */
+ public Reference getReference() throws NamingException
+ {
+ Reference myRef = new Reference(NativeServiceReferenceableJAXRPC.class.getName(), NativeServiceObjectFactoryJAXRPC.class.getName(), null);
+
+ // Add a reference to the ServiceRefMetaData and WSDLDefinitions
+ myRef.add(new BinaryRefAddr(SERVICE_REF_META_DATA, marshallServiceRef()));
+
+ // FIXME: JBWS-1431 Merge ws-security config with jaxrpc/jaxws config
+ if (getSecurityConfig() != null)
+ myRef.add(new BinaryRefAddr(SECURITY_CONFIG, marshallSecurityConfig()));
+
+ // Add references to port component links
+ for (UnifiedPortComponentRefMetaData pcr : refMetaData.getPortComponentRefs())
+ {
+ String pcLink = pcr.getPortComponentLink();
+ if (pcLink != null)
+ {
+ myRef.add(new StringRefAddr(PORT_COMPONENT_LINK, pcLink));
+ try
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ ServerConfig config = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
+
+ String host = config.getWebServiceHost();
+ int port = config.getWebServicePort();
+
+ String servletURL = "http://" + host + ":" + port + "/jbossws/pclink";
+ myRef.add(new StringRefAddr(PORT_COMPONENT_LINK_SERVLET, servletURL));
+ }
+ catch (Exception ex)
+ {
+ throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_OBTAIN_PATH", ex));
+ }
+ }
+ }
+
+ return myRef;
+ }
+
+ /** Marshall the ServiceRefMetaData to an byte array
+ */
+ private byte[] marshallServiceRef() throws NamingException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
+ try
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(refMetaData);
+ oos.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_MARSHALL_SERVICE_REF_META_DATA", e.toString()));
+ }
+ return baos.toByteArray();
+ }
+
+ /** Marshall the WSSecurityConfiguration to an byte array
+ */
+ private byte[] marshallSecurityConfig() throws NamingException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
+ try
+ {
+ WSSecurityConfiguration securityConfig = WSSecurityConfigFactory.newInstance().createConfiguration(
+ refMetaData.getVfsRoot(), WSSecurityOMFactory.CLIENT_RESOURCE_NAME
+ );
+
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(securityConfig);
+ oos.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException(BundleUtils.getMessage(bundle, "CANNOT_MARSHALL_SECURITY_CONFIG", e.toString()));
+ }
+ return baos.toByteArray();
+ }
+
+ private URL getSecurityConfig()
+ {
+ URL securityConfigURL = null;
+ try
+ {
+ UnifiedVirtualFile vfConfig = vfsRoot.findChild("WEB-INF/" + WSSecurityOMFactory.CLIENT_RESOURCE_NAME);
+ securityConfigURL = vfConfig.toURL();
+ }
+ catch (IOException ex)
+ {
+ // ignore
+ }
+ try
+ {
+ UnifiedVirtualFile vfConfig = vfsRoot.findChild("META-INF/" + WSSecurityOMFactory.CLIENT_RESOURCE_NAME);
+ securityConfigURL = vfConfig.toURL();
+ }
+ catch (IOException ex)
+ {
+ // ignore
+ }
+ return securityConfigURL;
+ }
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/SecurityActions.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/SecurityActions.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/serviceref/SecurityActions.java 2011-07-26 10:22:18 UTC (rev 14743)
@@ -0,0 +1,111 @@
+/*
+ * 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.core.jaxrpc.client.serviceref;
+
+import java.net.URL;
+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 19-Jun-2009
+ *
+ */
+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();
+ }
+ });
+ }
+ }
+
+ /**
+ * 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);
+ }
+ }
+ });
+ }
+ }
+
+ static URL getResource(final ClassLoader cl, final String filename)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return cl.getResource(filename);
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run()
+ {
+ return cl.getResource(filename);
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
13 years, 5 months
JBossWS SVN: r14742 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-07-26 04:04:46 -0400 (Tue, 26 Jul 2011)
New Revision: 14742
Modified:
stack/cxf/trunk/pom.xml
Log:
[JBWS-3333] Start by moving to Apache CXF 2.4.2-SNAPSHOT, dependencies to be updated later
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2011-07-26 07:21:37 UTC (rev 14741)
+++ stack/cxf/trunk/pom.xml 2011-07-26 08:04:46 UTC (rev 14742)
@@ -58,7 +58,7 @@
-->
<!-- END -->
<jboss700.version>7.0.0.Final</jboss700.version>
- <cxf.version>2.4.1</cxf.version>
+ <cxf.version>2.4.2-SNAPSHOT</cxf.version>
<cxf.asm.version>3.3</cxf.asm.version>
<cxf.xjcplugins.version>2.3.2</cxf.xjcplugins.version>
<fastinfoset.api.version>1.2.7</fastinfoset.api.version>
13 years, 5 months
JBossWS SVN: r14741 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-07-26 03:21:37 -0400 (Tue, 26 Jul 2011)
New Revision: 14741
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
Log:
Remove the reflection hack code
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-07-26 02:38:17 UTC (rev 14740)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2011-07-26 07:21:37 UTC (rev 14741)
@@ -42,6 +42,9 @@
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
import org.apache.cxf.management.InstrumentationManager;
import org.apache.cxf.management.counters.CounterRepository;
+import org.apache.cxf.management.interceptor.ResponseTimeMessageInInterceptor;
+import org.apache.cxf.management.interceptor.ResponseTimeMessageInvokerInterceptor;
+import org.apache.cxf.management.interceptor.ResponseTimeMessageOutInterceptor;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.ObjectNameFactory;
import org.jboss.ws.common.injection.InjectionHelper;
@@ -174,7 +177,6 @@
public static void registerInstrumentManger(Bus bus, ServletContext svCtx) throws ServletException
{
- //TODO!! Jim, remove reflection use inside this by providing proper hook in CXF and move this configuration to BusHolder
if (svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT) != null
&& "true".equalsIgnoreCase((String) svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT)))
{
@@ -188,19 +190,17 @@
//attach couterRepository
CounterRepository couterRepository = new CounterRepository();
couterRepository.setBus(bus);
+
+
+ ResponseTimeMessageInInterceptor in = new ResponseTimeMessageInInterceptor();
+ ResponseTimeMessageInvokerInterceptor invoker = new ResponseTimeMessageInvokerInterceptor();
+ ResponseTimeMessageOutInterceptor out = new ResponseTimeMessageOutInterceptor();
+
+ bus.getInInterceptors().add(in);
+ bus.getInInterceptors().add(invoker);
+ bus.getOutInterceptors().add(out);
+ bus.setExtension(couterRepository, CounterRepository.class);
- try
- {
- Method method = CounterRepository.class.getDeclaredMethod("registerInterceptorsToBus", new Class[]
- {});
- method.setAccessible(true);
- method.invoke(couterRepository, new Object[]
- {});
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
}
}
}
13 years, 5 months
JBossWS SVN: r14740 - common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-07-25 22:38:17 -0400 (Mon, 25 Jul 2011)
New Revision: 14740
Modified:
common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/Message.properties
Log:
[JBWS-3332]:Try to get port from WebServerInfo if the connector is not registered in jmx server
Modified: common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
--- common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2011-07-26 02:36:39 UTC (rev 14739)
+++ common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2011-07-26 02:38:17 UTC (rev 14740)
@@ -39,10 +39,13 @@
import org.jboss.ws.common.ObjectNameFactory;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.StackConfig;
import org.jboss.wsf.spi.management.StackConfigFactory;
+import org.jboss.wsf.spi.management.WebServerInfo;
+import org.jboss.wsf.spi.management.WebServerInfoFactory;
import org.jboss.wsf.spi.metadata.config.EndpointConfig;
/**
@@ -153,11 +156,25 @@
webServicePort = getConnectorPort("HTTP/1.1", false);
int localPort = webServicePort;
- if (localPort <= 0)
+ if (localPort <= 0)
{
- // Do not initialize webServicePort with the default, the connector port may become available later
- log.debug("Unable to calculate 'WebServicePort', using default '8080'");
- localPort = 8080;
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ try
+ {
+ WebServerInfo webServerInfo = spiProvider.getSPI(WebServerInfoFactory.class, cl).newWebServerInfo();
+ localPort = webServerInfo.getPort("HTTP/1.1", false);
+ }
+ catch (WSFException e)
+ {
+ log.warn(BundleUtils.getMessage(bundle, "COULD_NOT_GET_WEBSERVERINFO"), e);
+ }
+ if (localPort <= 0)
+ {
+ // Do not initialize webServicePort with the default, the connector port may become available later
+ log.debug("Unable to calculate 'WebServicePort', using default '8080'");
+ localPort = 8080;
+ }
}
return localPort;
@@ -171,9 +188,25 @@
int localPort = webServiceSecurePort;
if (localPort <= 0)
{
- // Do not initialize webServiceSecurePort with the default, the connector port may become available later
- log.debug("Unable to calculate 'WebServiceSecurePort', using default '8443'");
- localPort = 8443;
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ try
+ {
+ WebServerInfo webServerInfo = spiProvider.getSPI(WebServerInfoFactory.class, cl).newWebServerInfo();
+
+ localPort = webServerInfo.getPort("HTTP/1.1", true);
+ }
+ catch (WSFException e)
+ {
+ log.warn(BundleUtils.getMessage(bundle, "COULD_NOT_GET_WEBSERVERINFO"), e);
+ }
+
+ if (localPort <= 0)
+ {
+ // Do not initialize webServiceSecurePort with the default, the connector port may become available later
+ log.debug("Unable to calculate 'WebServiceSecurePort', using default '8443'");
+ localPort = 8443;
+ }
}
return localPort;
Modified: common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/Message.properties
===================================================================
--- common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/Message.properties 2011-07-26 02:36:39 UTC (rev 14739)
+++ common/branches/JBWS-3332/src/main/java/org/jboss/ws/common/management/Message.properties 2011-07-26 02:38:17 UTC (rev 14740)
@@ -12,3 +12,4 @@
ENDPOINT_NAME_CANNOT_BE_NULL_FOR=Endpoint name cannot be null for: {0}
ENDPOINT_ALREADY_REGISTERED=Endpoint already registered: {0}
ENDPOINT_NOT_REGISTERED=Endpoint not registered: {0}
+COULD_NOT_GET_WEBSERVERINFO=Can not get WebServerInfo from SPIProvider
13 years, 5 months
JBossWS SVN: r14739 - spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-07-25 22:36:39 -0400 (Mon, 25 Jul 2011)
New Revision: 14739
Added:
spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfo.java
spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfoFactory.java
Log:
[JBWS-3332]:Add classes to get WebServer info
Added: spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfo.java
===================================================================
--- spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfo.java (rev 0)
+++ spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfo.java 2011-07-26 02:36:39 UTC (rev 14739)
@@ -0,0 +1,6 @@
+package org.jboss.wsf.spi.management;
+
+public interface WebServerInfo
+{
+ int getPort(String protocol, boolean secure);
+}
Added: spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfoFactory.java
===================================================================
--- spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfoFactory.java (rev 0)
+++ spi/branches/JBWS-3332/src/main/java/org/jboss/wsf/spi/management/WebServerInfoFactory.java 2011-07-26 02:36:39 UTC (rev 14739)
@@ -0,0 +1,27 @@
+/*
+ * 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.wsf.spi.management;
+
+public abstract class WebServerInfoFactory
+{
+ public abstract WebServerInfo newWebServerInfo();
+}
13 years, 5 months
JBossWS SVN: r14738 - spi/branches.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-07-25 22:11:09 -0400 (Mon, 25 Jul 2011)
New Revision: 14738
Added:
spi/branches/JBWS-3332/
Log:
Create JBWS-3332 workspace
13 years, 5 months
JBossWS SVN: r14737 - common/branches.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2011-07-25 22:07:10 -0400 (Mon, 25 Jul 2011)
New Revision: 14737
Added:
common/branches/JBWS-3332/
Log:
Create workspace for JBWS-3332
13 years, 5 months
JBossWS SVN: r14736 - in shared-testsuite: tags and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-07-21 07:30:34 -0400 (Thu, 21 Jul 2011)
New Revision: 14736
Added:
shared-testsuite/tags/jbossws-shared-testsuite-4.0.0.Beta3/
Removed:
shared-testsuite/branches/jbossws-shared-testsuite-4.0.0.Beta3/
Log:
Tagging jbossws-shared-testsuite-4.0.0.Beta3
13 years, 5 months
JBossWS SVN: r14735 - in stack/cxf: tags and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-07-21 07:28:06 -0400 (Thu, 21 Jul 2011)
New Revision: 14735
Added:
stack/cxf/tags/jbossws-cxf-4.0.0.Beta3/
Removed:
stack/cxf/branches/jbossws-cxf-4.0.0.Beta3/
Log:
Tagging jbossws-cxf-4.0.0.Beta3
13 years, 5 months