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/24 07:44:03 UTC
svn commit: r606674 - in
/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws:
BindingProviderImpl.java DispatchImpl.java EndpointReferenceBuilder.java
JaxWsClientProxy.java Messages.properties
Author: mmao
Date: Sun Dec 23 22:44:02 2007
New Revision: 606674
URL: http://svn.apache.org/viewvc?rev=606674&view=rev
Log:
CXF-1323
Support JaxWs 2.1 API
* BindingProvider.getEndpointReference()
* BindingProvider.getEndpointReference(Class)
Added:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java?rev=606674&r1=606673&r2=606674&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/BindingProviderImpl.java Sun Dec 23 22:44:02 2007
@@ -29,20 +29,33 @@
import javax.xml.ws.EndpointReference;
import javax.xml.ws.handler.MessageContext;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+
public class BindingProviderImpl implements BindingProvider {
-
protected ThreadLocal <Map<String, Object>> requestContext =
new ThreadLocal<Map<String, Object>>();
protected ThreadLocal <Map<String, Object>> responseContext =
new ThreadLocal<Map<String, Object>>();
private final Binding binding;
+ private final JaxWsEndpointImpl endpoint;
+ private final EndpointReferenceBuilder builder;
public BindingProviderImpl() {
- binding = null;
+ this.binding = null;
+ this.endpoint = null;
+ this.builder = null;
}
public BindingProviderImpl(Binding b) {
- binding = b;
+ this.binding = b;
+ this.endpoint = null;
+ this.builder = null;
+ }
+
+ public BindingProviderImpl(JaxWsEndpointImpl e) {
+ this.endpoint = e;
+ this.binding = this.endpoint.getJaxwsBinding();
+ this.builder = new EndpointReferenceBuilder(endpoint);
}
public Map<String, Object> getRequestContext() {
@@ -79,12 +92,11 @@
}
}
- //TODO JAX-WS 2.1
- public EndpointReference getEndpointReference() {
- throw new UnsupportedOperationException();
+ public EndpointReference getEndpointReference() {
+ return builder.getEndpointReference();
}
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
- throw new UnsupportedOperationException();
+ return builder.getEndpointReference(clazz);
}
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=606674&r1=606673&r2=606674&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Sun Dec 23 22:44:02 2007
@@ -95,7 +95,7 @@
private ConduitSelector conduitSelector;
DispatchImpl(Bus b, Client client, Service.Mode m, JAXBContext ctx, Class<T> clazz, Executor e) {
- super(((JaxWsEndpointImpl)client.getEndpoint()).getJaxwsBinding());
+ super((JaxWsEndpointImpl)client.getEndpoint());
bus = b;
this.iProvider = client;
executor = e;
Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java?rev=606674&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java Sun Dec 23 22:44:02 2007
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxws;
+
+import java.util.logging.Logger;
+
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+import org.apache.cxf.binding.soap.SoapBindingConstants;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+
+public class EndpointReferenceBuilder {
+ private static final Logger LOG = LogUtils.getL7dLogger(EndpointReferenceBuilder.class);
+ private final JaxWsEndpointImpl endpoint;
+
+ public EndpointReferenceBuilder(JaxWsEndpointImpl e) {
+ this.endpoint = e;
+ }
+ public EndpointReference getEndpointReference() {
+ String bindingId = endpoint.getJaxwsBinding().getBindingID();
+ if (!SoapBindingConstants.SOAP11_BINDING_ID.equals(bindingId)
+ && !SoapBindingConstants.SOAP12_BINDING_ID.equals(bindingId)) {
+ throw new UnsupportedOperationException(new Message("GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING",
+ LOG, bindingId).toString());
+ }
+
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+
+ builder.address(this.endpoint.getEndpointInfo().getAddress());
+ builder.serviceName(this.endpoint.getService().getName());
+ builder.endpointName(this.endpoint.getEndpointInfo().getName());
+
+ //TODO: get wsdlDocumentLocation
+ //builder.wsdlDocumentLocation(endpoint.getService().getServiceInfos().toString());
+
+ return builder.build();
+ }
+
+ public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
+ return clazz.cast(getEndpointReference());
+ }
+}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=606674&r1=606673&r2=606674&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java Sun Dec 23 22:44:02 2007
@@ -42,7 +42,6 @@
import javax.xml.ws.http.HTTPException;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.soap.SOAPFaultException;
-import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
import org.w3c.dom.Node;
@@ -55,6 +54,7 @@
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
import org.apache.cxf.service.model.BindingOperationInfo;
public class JaxWsClientProxy extends org.apache.cxf.frontend.ClientProxy implements
@@ -68,11 +68,13 @@
new ThreadLocal<Map<String, Object>>();
private final Binding binding;
+ private final EndpointReferenceBuilder builder;
public JaxWsClientProxy(Client c, Binding b) {
super(c);
this.binding = b;
setupEndpointAddressContext(getClient().getEndpoint());
+ this.builder = new EndpointReferenceBuilder((JaxWsEndpointImpl)getClient().getEndpoint());
}
private void setupEndpointAddressContext(Endpoint endpoint) {
@@ -256,26 +258,10 @@
}
public EndpointReference getEndpointReference() {
- String bindingId = getBinding().getBindingID();
- if (!"http://schemas.xmlsoap.org/soap/".equals(bindingId)) {
- throw new UnsupportedOperationException(new Message("GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING",
- LOG).toString());
- }
-
- W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
-
- Endpoint endpoint = getClient().getEndpoint();
- builder.address(endpoint.getEndpointInfo().getAddress());
- builder.serviceName(endpoint.getService().getName());
- builder.endpointName(endpoint.getEndpointInfo().getName());
-
- //TODO: get wsdlDocumentLocation
- //builder.wsdlDocumentLocation(endpoint.getService().getServiceInfos().toString());
-
- return builder.build();
+ return builder.getEndpointReference();
}
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
- throw new UnsupportedOperationException();
+ return builder.getEndpointReference(clazz);
}
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties?rev=606674&r1=606673&r2=606674&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/Messages.properties Sun Dec 23 22:44:02 2007
@@ -52,4 +52,4 @@
ENDPOINT_NOT_PUBLISHED = Endpoint has not been published yet.
ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED = Class type {0} is not a subclass of EndpointReference or the Endpoint implementation does not support EndpointReferences of this type.
-GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING = getEndpointReference is not supported if the binding is not SOAP 1.1/HTTP or SOAP 1.2/HTTP.
\ No newline at end of file
+GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING = getEndpointReference not support binding <{0}>, only support SOAP 1.1/HTTP or SOAP 1.2/HTTP.
\ No newline at end of file