You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2007/12/12 08:42:21 UTC
svn commit: r603501 - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/wsdl/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/
Author: mmao
Date: Tue Dec 11 23:42:20 2007
New Revision: 603501
URL: http://svn.apache.org/viewvc?rev=603501&view=rev
Log:
CXF-1288
* Dispatch support WebServiceFeatures
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsClientEndpointImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=603501&r1=603500&r2=603501&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Tue Dec 11 23:42:20 2007
@@ -230,6 +230,11 @@
return null;
}
+ public static QName getPortQName(EndpointReferenceType ref) {
+ QName serviceName = getServiceName(ref);
+ return new QName(serviceName.getNamespaceURI(), getPortName(ref));
+ }
+
public static void setPortName(EndpointReferenceType ref, String portName) {
MetadataType metadata = ref.getMetadata();
if (metadata != null) {
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=603501&r1=603500&r2=603501&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue Dec 11 23:42:20 2007
@@ -153,7 +153,8 @@
portInfos.put(portName, portInfo);
}
- private Endpoint getJaxwsEndpoint(QName portName, AbstractServiceFactoryBean sf) {
+ private Endpoint getJaxwsEndpoint(QName portName, AbstractServiceFactoryBean sf,
+ WebServiceFeature...features) {
Service service = sf.getService();
EndpointInfo ei = null;
if (portName == null) {
@@ -178,7 +179,7 @@
}
try {
- return new JaxWsClientEndpointImpl(bus, service, ei, this);
+ return new JaxWsClientEndpointImpl(bus, service, ei, this, features);
} catch (EndpointException e) {
throw new WebServiceException(e);
}
@@ -206,55 +207,7 @@
}
configureObject(dispatchService);
return serviceFactory;
- }
-
- public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode) {
- JaxWsClientFactoryBean clientFac = new JaxWsClientFactoryBean();
-
- //Initialize Features.
- configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac);
-
- AbstractServiceFactoryBean sf = null;
- try {
- sf = createDispatchService(new SourceDataBinding());
- } catch (ServiceConstructionException e) {
- throw new WebServiceException(e);
- }
- Endpoint endpoint = getJaxwsEndpoint(portName, sf);
- Client client = new ClientImpl(getBus(), endpoint, clientFac.getConduitSelector());
- for (AbstractFeature af : clientFac.getFeatures()) {
- af.initialize(client, bus);
- }
-
- Dispatch<T> disp = new DispatchImpl<T>(bus, client, mode, type, getExecutor());
- configureObject(disp);
-
- return disp;
- }
-
- public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Mode mode) {
- JaxWsClientFactoryBean clientFac = new JaxWsClientFactoryBean();
-
- //Initialize Features.
- configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac);
-
- AbstractServiceFactoryBean sf = null;
- try {
- sf = createDispatchService(new JAXBDataBinding(context));
- } catch (ServiceConstructionException e) {
- throw new WebServiceException(e);
- }
- Endpoint endpoint = getJaxwsEndpoint(portName, sf);
- Client client = new ClientImpl(getBus(), endpoint, clientFac.getConduitSelector());
- for (AbstractFeature af : clientFac.getFeatures()) {
- af.initialize(client, bus);
- }
- Dispatch<Object> disp = new DispatchImpl<Object>(bus, client, mode,
- context, Object.class, getExecutor());
- configureObject(disp);
-
- return disp;
- }
+ }
public Executor getExecutor() {
return executor;
@@ -526,36 +479,94 @@
return new QName(tns, name);
}
+ @Override
+ public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode) {
+ return createDispatch(portName, type, mode, new WebServiceFeature[]{});
+ }
- // TODO JAX-WS 2.1
+ @Override
public <T> Dispatch<T> createDispatch(QName portName,
Class<T> type,
Mode mode,
WebServiceFeature... features) {
- throw new UnsupportedOperationException();
- }
+ JaxWsClientFactoryBean clientFac = new JaxWsClientFactoryBean();
+
+ //Initialize Features.
+ configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac);
+
+ AbstractServiceFactoryBean sf = null;
+ try {
+ sf = createDispatchService(new SourceDataBinding());
+ } catch (ServiceConstructionException e) {
+ throw new WebServiceException(e);
+ }
+ Endpoint endpoint = getJaxwsEndpoint(portName, sf, features);
+ Client client = new ClientImpl(getBus(), endpoint, clientFac.getConduitSelector());
+ for (AbstractFeature af : clientFac.getFeatures()) {
+ af.initialize(client, bus);
+ }
+
+ Dispatch<T> disp = new DispatchImpl<T>(bus, client, mode, type, getExecutor());
+ configureObject(disp);
+ return disp;
+ }
+
+ @Override
public <T> Dispatch<T> createDispatch(EndpointReference endpointReference,
Class<T> type,
Mode mode,
WebServiceFeature... features) {
- throw new UnsupportedOperationException();
- }
+ EndpointReferenceType ref = VersionTransformer.convertToInternal(endpointReference);
+ return createDispatch(EndpointReferenceUtils.getPortQName(ref),
+ type, mode, features);
+ }
+
+ @Override
+ public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Mode mode) {
+ return createDispatch(portName, context, mode, new WebServiceFeature[]{});
+ }
+
+ @Override
public Dispatch<Object> createDispatch(QName portName,
JAXBContext context,
Mode mode,
WebServiceFeature... features) {
- throw new UnsupportedOperationException();
+ JaxWsClientFactoryBean clientFac = new JaxWsClientFactoryBean();
+
+ //Initialize Features.
+ configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac);
+
+ AbstractServiceFactoryBean sf = null;
+ try {
+ sf = createDispatchService(new JAXBDataBinding(context));
+ } catch (ServiceConstructionException e) {
+ throw new WebServiceException(e);
+ }
+ Endpoint endpoint = getJaxwsEndpoint(portName, sf, features);
+ Client client = new ClientImpl(getBus(), endpoint, clientFac.getConduitSelector());
+ for (AbstractFeature af : clientFac.getFeatures()) {
+ af.initialize(client, bus);
+ }
+ Dispatch<Object> disp = new DispatchImpl<Object>(bus, client, mode,
+ context, Object.class, getExecutor());
+ configureObject(disp);
+
+ return disp;
}
+ @Override
public Dispatch<Object> createDispatch(EndpointReference endpointReference,
JAXBContext context,
Mode mode,
WebServiceFeature... features) {
- throw new UnsupportedOperationException();
+ EndpointReferenceType ref = VersionTransformer.convertToInternal(endpointReference);
+ return createDispatch(EndpointReferenceUtils.getPortQName(ref),
+ context, mode, features);
}
+ @Override
public <T> T getPort(EndpointReference endpointReference, Class<T> serviceEndpointInterface,
WebServiceFeature... features) {
return getPort(VersionTransformer.convertToInternal(endpointReference), serviceEndpointInterface,
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsClientEndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsClientEndpointImpl.java?rev=603501&r1=603500&r2=603501&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsClientEndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsClientEndpointImpl.java Tue Dec 11 23:42:20 2007
@@ -19,8 +19,11 @@
package org.apache.cxf.jaxws.support;
+import java.util.Arrays;
import java.util.concurrent.Executor;
+import javax.xml.ws.WebServiceFeature;
+
import org.apache.cxf.Bus;
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.jaxws.ServiceImpl;
@@ -35,9 +38,10 @@
private ServiceImpl executorProvider;
- public JaxWsClientEndpointImpl(Bus bus, Service s, EndpointInfo ei, ServiceImpl si)
+ public JaxWsClientEndpointImpl(Bus bus, Service s, EndpointInfo ei, ServiceImpl si,
+ WebServiceFeature... wf)
throws EndpointException {
- super(bus, s, ei);
+ super(bus, s, ei, Arrays.asList(wf));
executorProvider = si;
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=603501&r1=603500&r2=603501&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Tue Dec 11 23:42:20 2007
@@ -83,6 +83,11 @@
public JaxWsEndpointImpl(Bus bus, Service s, EndpointInfo ei) throws EndpointException {
this(bus, s, ei, null, null, null, true);
}
+
+ public JaxWsEndpointImpl(Bus bus, Service s, EndpointInfo ei,
+ List<WebServiceFeature> wf) throws EndpointException {
+ this(bus, s, ei, null, wf, null, true);
+ }
public JaxWsEndpointImpl(Bus bus, Service s, EndpointInfo ei, JaxWsImplementorInfo implementorInfo,
List<WebServiceFeature> wf, List<AbstractFeature> af, boolean isFromWsdl)