Author: dain
Date: Thu Mar  6 11:47:01 2008
New Revision: 634391

URL: http://svn.apache.org/viewvc?rev=634391&view=rev
Log:
Fix compile errors on Java6 update 4 due to change in JaxWS version

Added:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/
    openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/
    openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/EndpointReference.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/WebServiceFeature.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/wsaddressing/
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/EjbWsContext.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java

Added: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/EndpointReference.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/EndpointReference.java?rev=634391&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/EndpointReference.java
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/EndpointReference.java
 Thu Mar  6 11:47:01 2008
@@ -0,0 +1,34 @@
+/**
+ * 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 javax.xml.ws;
+
+/**
+ * This class is only provided so JaxWS code can be compiled under Java6 
update 4 which
+ * uses JaxWS 2.1.  All of the methods throw UnsupportedOperationException.
+ */
[EMAIL PROTECTED]({"UnusedDeclaration"})
+public abstract class EndpointReference {
+    public static EndpointReference readFrom(javax.xml.transform.Source 
eprInfoset) {
+        throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
+    }
+
+    public abstract void writeTo(javax.xml.transform.Result result);
+
+    public <T> T getPort(Class<T> serviceEndpointInterface, 
WebServiceFeature... features) {
+        throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
+    }
+}

Added: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/WebServiceFeature.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/WebServiceFeature.java?rev=634391&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/WebServiceFeature.java
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/WebServiceFeature.java
 Thu Mar  6 11:47:01 2008
@@ -0,0 +1,31 @@
+/**
+ * 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 javax.xml.ws;
+
+/**
+ * This class is only provided so JaxWS code can be compiled under Java6 
update 4 which
+ * uses JaxWS 2.1.
+ */
+public abstract class WebServiceFeature {
+    protected boolean enabled;
+
+    public abstract java.lang.String getID();
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+}

Added: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java?rev=634391&view=auto
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
 (added)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
 Thu Mar  6 11:47:01 2008
@@ -0,0 +1,42 @@
+/**
+ * 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 javax.xml.ws.wsaddressing;
+
+import javax.xml.ws.EndpointReference;
+import javax.xml.transform.Source;
+import javax.xml.transform.Result;
+
+/**
+ * This class is only provided so JaxWS code can be compiled under Java6 
update 4 which
+ * uses JaxWS 2.1.  All of the methods throw UnsupportedOperationException.
+ */
[EMAIL PROTECTED]({"UnusedDeclaration"})
+public final class W3CEndpointReference extends EndpointReference {
+    protected static final java.lang.String NS = 
"http://www.w3.org/2005/08/addressing";;
+
+    protected W3CEndpointReference() {
+        throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
+    }
+
+    public W3CEndpointReference(Source source) {
+        throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
+    }
+
+    public void writeTo(Result result) {
+        throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
+    }    
+}

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/EjbWsContext.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/EjbWsContext.java?rev=634391&r1=634390&r2=634391&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/EjbWsContext.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/EjbWsContext.java
 Thu Mar  6 11:47:01 2008
@@ -20,9 +20,11 @@
 
 import javax.ejb.SessionContext;
 import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.EndpointReference;
 import javax.xml.ws.handler.MessageContext;
 
 import org.apache.openejb.core.ThreadContext;
+import org.w3c.dom.Element;
 
 public class EjbWsContext implements WebServiceContext {
     private SessionContext context;
@@ -46,5 +48,10 @@
 
     public boolean isUserInRole(String roleName) {
         return this.context.isCallerInRole(roleName);
+    }
+
+    @SuppressWarnings({"UnusedDeclaration"})
+    public <T extends EndpointReference> T getEndpointReference(Class<T> 
clazz, Element... referenceParameters) {
+        throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
     }
 }

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java?rev=634391&r1=634390&r2=634391&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java
 Thu Mar  6 11:47:01 2008
@@ -19,6 +19,7 @@
 
 import org.apache.openejb.util.Logger;
 import org.apache.openejb.util.LogCategory;
+import org.w3c.dom.Element;
 
 import javax.xml.ws.spi.Provider;
 import javax.xml.ws.spi.ServiceDelegate;
@@ -27,6 +28,9 @@
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.namespace.QName;
@@ -49,9 +53,39 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.FileOutputStream;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
 
 public class ProviderWrapper extends Provider {
     public static final Logger logger = 
Logger.getInstance(LogCategory.OPENEJB_WS, ProviderWrapper.class);
+    private static final Method createW3CEndpointReference;
+    private static final Method createDispatch;
+
+    static {
+        Method method = null;
+        try {
+            method = Provider.class.getMethod("createW3CEndpointReference",
+                    String.class,
+                    QName.class,
+                    QName.class,
+                    List.class,
+                    String.class,
+                    List.class);
+        } catch (NoSuchMethodException e) {
+        }
+        createW3CEndpointReference = method;
+
+        method = null;
+        try {
+            method = Provider.class.getMethod("createDispatch",
+                    EndpointReference.class,
+                    JAXBContext.class,
+                    Service.Mode.class,
+                    WebServiceFeature[].class);
+        } catch (NoSuchMethodException e) {
+        }
+        createDispatch = method;
+    }
 
     //
     // Magic to get our proider wrapper installed with the PortRefData
@@ -126,6 +160,34 @@
         return delegate.createAndPublishEndpoint(address, implementor);
     }
 
+    @SuppressWarnings({"UnusedDeclaration"})
+    public W3CEndpointReference createW3CEndpointReference(String address,
+            QName serviceName,
+            QName portName,
+            List<Element> metadata,
+            String wsdlDocumentLocation,
+            List<Element> referenceParameters) {
+        if (createW3CEndpointReference == null) {
+            throw new UnsupportedOperationException("JaxWS 2.1 APIs are not 
supported");
+        }
+        try {
+            return (W3CEndpointReference) 
createW3CEndpointReference.invoke(delegate,
+                    address,
+                    serviceName,
+                    portName,
+                    metadata,
+                    wsdlDocumentLocation,
+                    referenceParameters);
+        } catch (IllegalAccessException e) {
+            throw new WebServiceException(e);
+        } catch (InvocationTargetException e) {
+            if (e.getCause() != null) {
+                throw new WebServiceException(e.getCause());
+            }
+            throw new WebServiceException(e);
+        }
+    }
+
     private class ServiceDelegateWrapper extends ServiceDelegate {
         private final ServiceDelegate serviceDelegate;
 
@@ -170,6 +232,31 @@
             Dispatch<Object> dispatch = 
serviceDelegate.createDispatch(portName, context, mode);
             setProperties(dispatch, portName);
             return dispatch;
+        }
+
+        @SuppressWarnings({"unchecked"})
+        public Dispatch<Object> createDispatch(
+                EndpointReference endpointReference,
+                JAXBContext context,
+                Service.Mode mode,
+                WebServiceFeature... features) {
+            if (createDispatch == null) {
+                throw new UnsupportedOperationException("JaxWS 2.1 APIs are 
not supported");
+            }
+            try {
+                return (Dispatch<Object>) createDispatch.invoke(delegate,
+                        endpointReference,
+                        context,
+                        mode,
+                        features);
+            } catch (IllegalAccessException e) {
+                throw new WebServiceException(e);
+            } catch (InvocationTargetException e) {
+                if (e.getCause() != null) {
+                    throw new WebServiceException(e.getCause());
+                }
+                throw new WebServiceException(e);
+            }
         }
 
         public QName getServiceName() {


Reply via email to