Author: alessio.soldano(a)jboss.com
Date: 2009-01-13 05:19:01 -0500 (Tue, 13 Jan 2009)
New Revision: 9015
Added:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
Log:
[JBWS-2452] Implementing getEndpointReference methods in BindingProvidedImpl, ClientImpl
and DispatchImpl
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2009-01-12
17:29:12 UTC (rev 9014)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java 2009-01-13
10:19:01 UTC (rev 9015)
@@ -23,12 +23,16 @@
import java.util.Observable;
+import javax.xml.ws.EndpointReference;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC;
import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC;
+import org.jboss.ws.core.jaxws.binding.EndpointReferenceUtil;
import org.jboss.ws.core.jaxws.binding.HTTPBindingJAXWS;
import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
@@ -103,6 +107,29 @@
return binding;
}
+ public EndpointReference getEndpointReference()
+ {
+ if (binding instanceof HTTPBinding )
+ {
+ throw new UnsupportedOperationException("Cannot get EPR for BindingProvider
instances using the XML/HTTP binding");
+ }
+ return getEndpointReference(W3CEndpointReference.class);
+ }
+
+ public <T extends EndpointReference> T getEndpointReference(Class<T>
clazz)
+ {
+ if (binding instanceof HTTPBinding )
+ {
+ throw new UnsupportedOperationException("Cannot get epr for BindingProvider
instances using the XML/HTTP binding");
+ }
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ builder.address(epMetaData.getEndpointAddress());
+ builder.serviceName(epMetaData.getServiceMetaData().getServiceName());
+ builder.endpointName(epMetaData.getPortName());
+ builder.wsdlDocumentLocation(epMetaData.getEndpointAddress() + "?wsdl");
+ return EndpointReferenceUtil.transform(clazz, builder.build());
+ }
+
public void update(Observable observable, Object object)
{
if(log.isDebugEnabled()) log.debug("Update config: " + object);
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2009-01-12
17:29:12 UTC (rev 9014)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.java 2009-01-13
10:19:01 UTC (rev 9015)
@@ -25,13 +25,11 @@
import java.util.Map;
import javax.xml.ws.Binding;
-import javax.xml.ws.EndpointReference;
-import javax.xml.ws.WebServiceException;
import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.http.HTTPBinding;
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
@@ -94,14 +92,4 @@
{
return (Binding)binding;
}
-
- public EndpointReference getEndpointReference()
- {
- throw new NotImplementedException();
- }
-
- public <T extends EndpointReference> T getEndpointReference(Class<T>
clazz)
- {
- throw new NotImplementedException();
- }
}
Added:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java
(rev 0)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java 2009-01-13
10:19:01 UTC (rev 9015)
@@ -0,0 +1,52 @@
+/*
+ * 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.jaxws.binding;
+
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+/**
+ * Transforms an EPR to an instance of a given EndpointReference class
+ *
+ * @since 12-Jan-2009
+ * @author alessio.soldano(a)jboss.com
+ *
+ */
+public class EndpointReferenceUtil {
+
+ public static <T extends EndpointReference> T transform(Class<T> clazz,
EndpointReference epr) {
+ assert epr != null;
+ if (clazz.isAssignableFrom(W3CEndpointReference.class)) {
+ if (epr instanceof W3CEndpointReference) {
+ return (T) epr;
+ }
+ else
+ {
+ throw new WebServiceException("Unsupported EndpointReference: " +
epr);
+ }
+ }
+ //transformations from different types of EndpointReference could be supported in
future...
+
+ throw new WebServiceException("EndpointReference of type " + clazz +
" not supported.");
+ }
+}
Property changes on:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-01-12
17:29:12 UTC (rev 9014)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2009-01-13
10:19:01 UTC (rev 9015)
@@ -453,12 +453,12 @@
public EndpointReference getEndpointReference()
{
- throw new NotImplementedException();
+ return bindingProvider.getEndpointReference();
}
public <T extends EndpointReference> T getEndpointReference(Class<T>
clazz)
{
- throw new NotImplementedException();
+ return bindingProvider.getEndpointReference(clazz);
}
public EndpointConfigMetaData getEndpointConfigMetaData()
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-01-12
17:29:12 UTC (rev 9014)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2009-01-13
10:19:01 UTC (rev 9015)
@@ -534,12 +534,12 @@
public EndpointReference getEndpointReference()
{
- throw new NotImplementedException();
+ return bindingProvider.getEndpointReference();
}
public <T extends EndpointReference> T getEndpointReference(Class<T>
clazz)
{
- throw new NotImplementedException();
+ return bindingProvider.getEndpointReference(clazz);
}
public String getConfigFile()