tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r591858 [10/13] - in /openejb/trunk/openejb3: ./ assembly/openejb-tomcat/ assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/ container/openejb-core/ container/openejb-core/src/main/java/org/apache/openejb/ container/openejb-co...
Date Sun, 04 Nov 2007 22:42:06 GMT
Added: openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple.wsdl
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple.wsdl?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple.wsdl (added)
+++ openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple.wsdl Sun Nov  4 14:41:49 2007
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev: 482336 $ $Date: 2006-12-04 15:12:19 -0500 (Mon, 04 Dec 2006) $ -->
+
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+        xmlns:tns="http://simple.axis2.geronimo.apache.org"
+        xmlns:x1="http://simple.axis2.geronimo.apache.org/types"
+        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        targetNamespace="http://simple.axis2.geronimo.apache.org" name="HelloWorld">
+    <wsdl:types>
+        <schema targetNamespace="http://simple.axis2.geronimo.apache.org/types"
+                xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <element name="sayHello">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="sayHelloResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+
+    <wsdl:message name="sayHelloRequest">
+        <wsdl:part element="x1:sayHello" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHelloResponse">
+        <wsdl:part element="x1:sayHelloResponse" name="out"/>
+    </wsdl:message>
+
+    <wsdl:portType name="Hello">
+        <wsdl:operation name="sayHello">
+            <wsdl:input message="tns:sayHelloRequest" name="sayHelloRequest"/>
+            <wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="HelloSOAPBinding" type="tns:Hello">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="sayHello">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHelloRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHelloResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="HelloService">
+        <wsdl:port binding="tns:HelloSOAPBinding" name="HelloPort">
+            <soap:address location="http://localhost:8080/SoapContext/HelloPort"/>
+            <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/08/addressing/wsdl"/>
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>

Added: openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple_request.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple_request.xml?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple_request.xml (added)
+++ openejb/trunk/openejb3/server/openejb-axis2/src/test/resources/test_service_simple_request.xml Sun Nov  4 14:41:49 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev: 482336 $ $Date: 2006-12-04 15:12:19 -0500 (Mon, 04 Dec 2006) $ -->
+
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+    <soap:Body>
+        <sayHello xmlns="http://apache.org/hello_control/types">
+            <requestType>World</requestType>
+        </sayHello>
+    </soap:Body>
+</soap:Envelope>

Modified: openejb/trunk/openejb3/server/openejb-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/pom.xml?rev=591858&r1=591857&r2=591858&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/pom.xml (original)
+++ openejb/trunk/openejb3/server/openejb-client/pom.xml Sun Nov  4 14:41:49 2007
@@ -60,6 +60,23 @@
     <dependency>
       <groupId>org.apache.geronimo.javamail</groupId>
       <artifactId>geronimo-javamail_1.4_mail</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.axis2</groupId>
+      <artifactId>axis2-jaxws-api</artifactId>
+      <version>1.3</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging-api</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/CallbackMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/CallbackMetaData.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/CallbackMetaData.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/CallbackMetaData.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,46 @@
+/**
+ *
+ * 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.openejb.client;
+
+import java.io.Serializable;
+
+public class CallbackMetaData implements Serializable {
+    private static final long serialVersionUID = -4117738185968143415L;
+    private String className;
+    private String method;
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public String toString() {
+        return className + "." + method + "()";
+    }
+}

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientHandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientHandlerResolverImpl.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientHandlerResolverImpl.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientHandlerResolverImpl.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,210 @@
+/**
+ *
+ * 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.openejb.client;
+
+import javax.naming.Context;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.PortInfo;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class ClientHandlerResolverImpl implements HandlerResolver {
+    private final List<HandlerChainMetaData> handlerChains;
+    private final List<Injection> injections;
+    private final Context context;
+    private final List<ClientInjectionProcessor<Handler>> handlerInstances = new ArrayList<ClientInjectionProcessor<Handler>>();
+
+    public ClientHandlerResolverImpl(List<HandlerChainMetaData> handlerChains, List<Injection> injections, Context context) {
+        this.handlerChains = handlerChains;
+        this.injections = injections;
+        this.context = context;
+    }
+
+    public void destroyHandlers() {
+        List<ClientInjectionProcessor<Handler>> handlerInstances = new ArrayList<ClientInjectionProcessor<Handler>>(this.handlerInstances);
+        this.handlerInstances.clear();
+        for (ClientInjectionProcessor<Handler> handlerInstance : handlerInstances) {
+            handlerInstance.preDestroy();
+        }
+    }
+
+    public List<Handler> getHandlerChain(javax.xml.ws.handler.PortInfo portInfo) {
+        List<Handler> chain = new ArrayList<Handler>();
+        for (HandlerChainMetaData handlerChain : handlerChains) {
+            List<Handler> handlers = buildHandlers(portInfo, handlerChain);
+            handlers = sortHandlers(handlers);
+            chain.addAll(handlers);
+        }
+        chain = sortHandlers(chain);
+        return chain;
+    }
+
+    private List<Handler> buildHandlers(javax.xml.ws.handler.PortInfo portInfo, HandlerChainMetaData handlerChain) {
+        if (!matchServiceName(portInfo, handlerChain.getServiceNamePattern()) || !matchPortName(portInfo, handlerChain.getPortNamePattern()) || !matchBinding(portInfo, handlerChain.getProtocolBindings())) {
+            return Collections.emptyList();
+        }
+
+        List<Handler> handlers = new ArrayList<Handler>(handlerChain.getHandlers().size());
+        for (HandlerMetaData handler : handlerChain.getHandlers()) {
+            try {
+                Class<? extends Handler> handlerClass = loadClass(handler.getHandlerClass()).asSubclass(Handler.class);
+                ClientInjectionProcessor<Handler> processor = new ClientInjectionProcessor<Handler>(handlerClass, injections, handler.getPostConstruct(), handler.getPreDestroy(), context);
+                processor.createInstance();
+                processor.postConstruct();
+                Handler handlerInstance = processor.getInstance();
+
+                handlers.add(handlerInstance);
+                handlerInstances.add(processor);
+            } catch (Exception e) {
+                throw new WebServiceException("Failed to instantiate handler", e);
+            }
+        }
+        return handlers;
+    }
+
+    private boolean matchServiceName(PortInfo info, String namePattern) {
+        return match((info == null ? null : info.getServiceName()), namePattern);
+    }
+
+    private boolean matchPortName(PortInfo info, String namePattern) {
+        return match((info == null ? null : info.getPortName()), namePattern);
+    }
+
+    private boolean matchBinding(PortInfo info, List bindings) {
+        return match((info == null ? null : info.getBindingID()), bindings);
+    }
+
+    private boolean match(String binding, List bindings) {
+        if (binding == null) {
+            return (bindings == null || bindings.isEmpty());
+        } else {
+            if (bindings == null || bindings.isEmpty()) {
+                return true;
+            } else {
+                String actualBindingURI = getBindingURI(binding);
+                Iterator iter = bindings.iterator();
+                while (iter.hasNext()) {
+                    String bindingToken = (String) iter.next();
+                    String bindingURI = getBindingURI(bindingToken);
+                    if (actualBindingURI.equals(bindingURI)) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        }
+    }
+
+    /**
+     * Performs basic localName matching, namespaces are not checked!
+     */
+    private boolean match(QName name, String namePattern) {
+        if (name == null) {
+            return (namePattern == null || namePattern.equals("*"));
+        } else {
+            if (namePattern == null) {
+                return true;
+            } else {
+                String localNamePattern;
+
+                // get the local name from pattern
+                int pos = namePattern.indexOf(':');
+                localNamePattern = (pos == -1) ? namePattern : namePattern
+                        .substring(pos + 1);
+                localNamePattern = localNamePattern.trim();
+
+                if (localNamePattern.equals("*")) {
+                    // matches anything
+                    return true;
+                } else if (localNamePattern.endsWith("*")) {
+                    // match start
+                    localNamePattern = localNamePattern.substring(0, localNamePattern.length() - 1);
+                    return name.getLocalPart().startsWith(localNamePattern);
+                } else {
+                    // match exact
+                    return name.getLocalPart().equals(localNamePattern);
+                }
+            }
+        }
+    }
+
+    /**
+     * sorts the handlers into correct order. All of the logical handlers first
+     * followed by the protocol handlers
+     *
+     * @param handlers
+     * @return sorted list of handlers
+     */
+    private List<Handler> sortHandlers(List<Handler> handlers) {
+        List<LogicalHandler> logicalHandlers = new ArrayList<LogicalHandler>();
+        List<Handler> protocolHandlers = new ArrayList<Handler>();
+
+        for (Handler handler : handlers) {
+            if (handler instanceof LogicalHandler) {
+                logicalHandlers.add((LogicalHandler) handler);
+            } else {
+                protocolHandlers.add(handler);
+            }
+        }
+
+        List<Handler> sortedHandlers = new ArrayList<Handler>();
+        sortedHandlers.addAll(logicalHandlers);
+        sortedHandlers.addAll(protocolHandlers);
+        return sortedHandlers;
+    }
+
+    private static final Map<String, String> BINDING_MAP = new HashMap<String, String>();
+
+    static {
+        BINDING_MAP.put("##SOAP11_HTTP", "http://schemas.xmlsoap.org/wsdl/soap/http");
+        BINDING_MAP.put("##SOAP12_HTTP", "http://www.w3.org/2003/05/soap/bindings/HTTP/");
+        BINDING_MAP.put("##SOAP11_HTTP_MTOM", "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true");
+        BINDING_MAP.put("##SOAP12_HTTP_MTOM", "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true");
+        BINDING_MAP.put("##XML_HTTP", "http://www.w3.org/2004/08/wsdl/http");
+    }
+
+    private static String getBindingURI(String token) {
+        if (token != null) {
+            if (token.startsWith("##")) {
+                String uri = BINDING_MAP.get(token);
+                if (uri == null) {
+                    throw new IllegalArgumentException("Unsupported binding token: " + token);
+                }
+                return uri;
+            }
+            return token;
+        }
+        return BINDING_MAP.get("##SOAP11_HTTP");
+    }
+
+    private Class<?> loadClass(String name) throws ClassNotFoundException {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        if (classLoader != null) {
+            return classLoader.loadClass(name);
+        }
+        return Class.forName(name);
+    }
+}

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInjectionProcessor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInjectionProcessor.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInjectionProcessor.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInjectionProcessor.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,387 @@
+/**
+ *
+ * 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.openejb.client;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Arrays;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.AccessibleObject;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+
+public class ClientInjectionProcessor<T> {
+    private static final Logger logger = Logger.getLogger("OpenEJB.client");
+
+    private final Class<? extends T> beanClass;
+    private final ClassLoader classLoader;
+    private final List<Injection> injections;
+    private final List<CallbackMetaData> postConstructCallbacks;
+    private final List<CallbackMetaData> preDestroyCallbacks;
+    private final Context context;
+    private T instance;
+    private boolean allowStatic;
+
+    public ClientInjectionProcessor(Class<? extends T> beanClass, List<Injection> injections, List<CallbackMetaData> postConstructMethods, List<CallbackMetaData> preDestroyMethods, Context context) {
+        this.beanClass = beanClass;
+        classLoader = beanClass.getClassLoader();
+        this.injections = injections;
+        this.postConstructCallbacks = postConstructMethods;
+        this.preDestroyCallbacks = preDestroyMethods;
+        this.context = context;
+    }
+
+    public void allowStatic() {
+        allowStatic = true;
+    }
+
+    public T createInstance() throws Exception {
+        if (instance == null) {
+            construct();
+        }
+        return instance;
+    }
+
+    public T getInstance() {
+        return instance;
+    }
+
+    private void construct() {
+        Map<Injection,Object> values = new HashMap<Injection,Object>();
+        for (Injection injection : injections) {
+            // only process injections for this class
+            Class<?> targetClass = loadClass(injection.getTargetClass());
+            if (targetClass == null) continue;
+            if (!targetClass.isAssignableFrom(beanClass)) continue;
+
+            try {
+                String jndiName = injection.getJndiName();
+                Object object = context.lookup("java:comp/env/" + jndiName);
+                values.put(injection, object);
+            } catch (NamingException e) {
+                logger.warning("Injection data not found in JNDI context: jndiName='" + injection.getJndiName() + "', target=" + injection.getTargetClass() + "/" + injection.getName());
+            }
+        }
+
+        try {
+            instance = beanClass.newInstance();
+        } catch (Exception e) {
+            throw new IllegalStateException("Error while creating bean " + beanClass.getName(), e);
+        }
+
+        List<String> unsetProperties = new ArrayList<String>();
+        for (Map.Entry<Injection, Object> entry : values.entrySet()) {
+            Injection injection = entry.getKey();
+            Object value = entry.getValue();
+
+            Class<?> targetClass = loadClass(injection.getTargetClass());
+            if (targetClass == null || !targetClass.isAssignableFrom(beanClass)) continue;
+
+            if (!setProperty(targetClass, injection.getName(), value)) {
+                unsetProperties.add(injection.getName());
+            }
+        }
+
+        if (unsetProperties.size() > 0) {
+            for (Object property : unsetProperties) {
+                logger.warning("Injection: Unable to set property '" + property + "' in class " + beanClass.getName());
+            }
+        }
+    }
+
+    public void postConstruct() throws Exception {
+        if (instance == null) throw new IllegalStateException("Instance has not been constructed");
+        if (postConstructCallbacks == null) return;
+
+        for (Method postConstruct : toMethod(postConstructCallbacks)) {
+            try {
+                postConstruct.invoke(instance);
+            } catch (Exception e) {
+                e = unwrap(e);
+                throw new Exception("Error while calling post construct method", e);
+            }
+        }
+    }
+
+    public void preDestroy() {
+        if (instance == null) return;
+        if (preDestroyCallbacks == null) return;
+        for (Method preDestroy : toMethod(preDestroyCallbacks)) {
+            try {
+                preDestroy.invoke(instance);
+            } catch (Exception e) {
+                e = unwrap(e);
+                logger.log(Level.SEVERE, "Error while calling pre destroy method", e);
+            }
+        }
+    }
+
+    private List<Method> toMethod(List<CallbackMetaData> callbacks) {
+        List<String> methodsNotFound = new ArrayList<String>(1);
+        List<Method> methods = new ArrayList<Method>(callbacks.size());
+        for (CallbackMetaData callback : callbacks) {
+            Method method = toMethod(callback);
+            if (method != null) {
+                methods.add(method);
+            } else {
+                methodsNotFound.add(callback.toString());
+            }
+        }
+        if (!methodsNotFound.isEmpty()) {
+            throw new IllegalStateException("Callback methods not found " + methodsNotFound);
+        }
+        return methods;
+    }
+
+    private Method toMethod(CallbackMetaData callback) {
+        try {
+            String className = callback.getClassName();
+            Class<?> clazz = classLoader.loadClass(className);
+            Method method = clazz.getDeclaredMethod(callback.getMethod());
+            return method;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    private boolean setProperty(Class clazz, String name, Object propertyValue) {
+        Method method= findSetter(clazz, name, propertyValue);
+        if (method != null) {
+            try {
+                propertyValue = convert(method.getParameterTypes()[0], propertyValue);
+                method.invoke(instance, propertyValue);
+                return true;
+            } catch (Exception e) {
+                return false;
+            }
+        }
+
+        Field field = findField(clazz, name, propertyValue);
+        if (field != null) {
+            try {
+                propertyValue = convert(field.getType(), propertyValue);
+                field.set(instance, propertyValue);
+                return true;
+            } catch (Exception e) {
+                return false;
+            }
+        }
+
+        return false;
+    }
+
+    public Method findSetter(Class typeClass, String propertyName, Object propertyValue) {
+        if (propertyName == null) throw new NullPointerException("name is null");
+        if (propertyName.length() == 0) throw new IllegalArgumentException("name is an empty string");
+
+        String setterName = "set" + Character.toUpperCase(propertyName.charAt(0));
+        if (propertyName.length() > 0) {
+            setterName += propertyName.substring(1);
+        }
+
+        List<Method> methods = new ArrayList<Method>(Arrays.asList(typeClass.getMethods()));
+        methods.addAll(Arrays.asList(typeClass.getDeclaredMethods()));
+        for (Method method : methods) {
+            if (method.getName().equals(setterName)) {
+                if (method.getParameterTypes().length == 0) {
+                    continue;
+                }
+
+                if (method.getParameterTypes().length > 1) {
+                    continue;
+                }
+
+                if (method.getReturnType() != Void.TYPE) {
+                    continue;
+                }
+
+                if (Modifier.isAbstract(method.getModifiers())) {
+                    continue;
+                }
+
+                if (!allowStatic && Modifier.isStatic(method.getModifiers())) {
+                    continue;
+                }
+
+                Class methodParameterType = method.getParameterTypes()[0];
+                if (methodParameterType.isPrimitive() && propertyValue == null) {
+                    continue;
+                }
+
+
+                if (!isInstance(methodParameterType, propertyValue) && !isConvertable(methodParameterType, propertyValue)) {
+                    continue;
+                }
+
+                if (!Modifier.isPublic(method.getModifiers())) {
+                    setAccessible(method);
+                }
+
+                return method;
+            }
+
+        }
+        return null;
+    }
+
+    public Field findField(Class typeClass, String propertyName, Object propertyValue) {
+        if (propertyName == null) throw new NullPointerException("name is null");
+        if (propertyName.length() == 0) throw new IllegalArgumentException("name is an empty string");
+
+        List<Field> fields = new ArrayList<Field>(Arrays.asList(typeClass.getDeclaredFields()));
+        Class parent = typeClass.getSuperclass();
+        while (parent != null){
+            fields.addAll(Arrays.asList(parent.getDeclaredFields()));
+            parent = parent.getSuperclass();
+        }
+
+        for (Field field : fields) {
+            if (field.getName().equals(propertyName)) {
+
+                if (!allowStatic && Modifier.isStatic(field.getModifiers())) {
+                    continue;
+                }
+
+                Class fieldType = field.getType();
+                if (fieldType.isPrimitive() && propertyValue == null) {
+                    continue;
+                }
+
+                if (!isInstance(fieldType, propertyValue) && !isConvertable(fieldType, propertyValue)) {
+                    continue;
+                }
+
+                if (!Modifier.isPublic(field.getModifiers())) {
+                    setAccessible(field);
+                }
+
+                return field;
+            }
+
+        }
+        return null;
+    }
+
+    private static void setAccessible(final AccessibleObject accessibleObject) {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                accessibleObject.setAccessible(true);
+                return null;
+            }
+        });
+    }
+
+    private static boolean isInstance(Class type, Object instance) {
+        if (type.isPrimitive()) {
+            // for primitives the insance can't be null
+            if (instance == null) {
+                return false;
+            }
+
+            // verify instance is the correct wrapper type
+            if (type.equals(boolean.class)) {
+                return instance instanceof Boolean;
+            } else if (type.equals(char.class)) {
+                return instance instanceof Character;
+            } else if (type.equals(byte.class)) {
+                return instance instanceof Byte;
+            } else if (type.equals(short.class)) {
+                return instance instanceof Short;
+            } else if (type.equals(int.class)) {
+                return instance instanceof Integer;
+            } else if (type.equals(long.class)) {
+                return instance instanceof Long;
+            } else if (type.equals(float.class)) {
+                return instance instanceof Float;
+            } else if (type.equals(double.class)) {
+                return instance instanceof Double;
+            } else {
+                throw new AssertionError("Invalid primitve type: " + type);
+            }
+        }
+
+        return instance == null || type.isInstance(instance);
+    }
+
+    private static boolean isConvertable(Class type, Object propertyValue) {
+        return (propertyValue instanceof String && findEditor(type) != null);
+    }
+
+    private Object convert(Class type, Object value) {
+        if (type == Object.class || !(value instanceof String)) {
+            return value;
+        }
+
+        String stringValue = (String) value;
+        PropertyEditor editor = findEditor(type);
+        if (editor != null) {
+            editor.setAsText(stringValue);
+            value = editor.getValue();
+        }
+        return value;
+    }
+
+    /**
+     * Locate a property editor for qiven class of object.
+     *
+     * @param type The target object class of the property.
+     * @return The resolved editor, if any.  Returns null if a suitable editor
+     *         could not be located.
+     */
+    private static PropertyEditor findEditor(Class type) {
+        if (type == null) throw new NullPointerException("type is null");
+
+        // try to locate this directly from the editor manager first.
+        PropertyEditor editor = PropertyEditorManager.findEditor(type);
+
+        // we're outta here if we got one.
+        if (editor != null) {
+            return editor;
+        }
+
+        // nothing found
+        return null;
+    }
+
+
+    private Class<?> loadClass(String targetClass) {
+        try {
+            return classLoader.loadClass(targetClass);
+        } catch (ClassNotFoundException e) {
+            return null;
+        }
+    }
+
+    private static Exception unwrap(Exception e) {
+        if (e instanceof InvocationTargetException && e.getCause() instanceof Exception) {
+            e = (Exception) e.getCause();
+        }
+        return e;
+    }
+}

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInstance.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInstance.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInstance.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientInstance.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,122 @@
+/**
+ *
+ * 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.openejb.client;
+
+import java.util.Properties;
+import java.util.HashMap;
+
+public class ClientInstance {
+    /**
+     * The time the client instance class was initialized
+     */
+    private final long startTime = System.currentTimeMillis();
+
+    /**
+     * Properties that have to be away from System (i.e. {@link System#setProperty(String, String)} must not be called)
+     */
+    private final Properties internalProperties = new Properties();
+
+    /**
+     * Global component registry
+     */
+    private final HashMap<Class, Object> components;
+
+    private ClientInstance(Properties properties) throws Exception {
+        this.components = new HashMap<Class, Object>();
+
+        this.internalProperties.putAll(System.getProperties());
+        this.internalProperties.putAll(properties);
+    }
+
+    public long getStartTime() {
+        return startTime;
+    }
+
+    public Properties getProperties() {
+        return internalProperties;
+    }
+
+    public String getProperty(String key) {
+        return internalProperties.getProperty(key);
+    }
+
+    public String getProperty(String key, String defaultValue) {
+        return internalProperties.getProperty(key, defaultValue);
+    }
+
+    public Object setProperty(String key, String value) {
+        return internalProperties.setProperty(key, value);
+    }
+
+    /**
+     * @param propName property name
+     *
+     * @return true when property is set; false otherwise
+     */
+    public boolean hasProperty(String propName) {
+        return this.internalProperties.get(propName) != null;
+    }
+
+    /**
+     * Gets a global component instance.
+     *
+     * @param type the class type of the component - required
+     * @return the object associated with the class type or null
+     * @throws IllegalStateException of the component isn't found
+     */
+    @SuppressWarnings({"unchecked"})
+    public <T> T getComponent(Class<T> type) {
+        return (T)components.get(type);
+    }
+
+    /**
+     * Removes a global component instance.
+     *
+     * @param type the class type of the component - required
+     * @return the component instance or null if component type was not registered
+     */
+    @SuppressWarnings({"unchecked"})
+    public <T> T removeComponent(Class<T> type) {
+        return (T)components.remove(type);
+    }
+
+    /**
+     * Registers a component instance with the client, so it may be reference globally.
+     *
+     * @param type the class type of the component - required
+     * @param component the component instance
+     */
+    @SuppressWarnings({"unchecked"})
+    public <T> T setComponent(Class<T> type, T component) {
+        return (T)components.put(type, component);
+    }
+
+    private static ClientInstance client;
+
+    static {
+        try {
+            client = new ClientInstance(System.getProperties());
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to create default instance of SystemInstance", e);
+        }
+    }
+
+    public static ClientInstance get() {
+        return client;
+    }
+}

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerChainMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerChainMetaData.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerChainMetaData.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerChainMetaData.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,54 @@
+/**
+ *
+ * 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.openejb.client;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+public class HandlerChainMetaData implements Serializable {
+    private static final long serialVersionUID = -2861396042527297097L;
+    private String serviceNamePattern;
+    private String portNamePattern;
+    private final List<String> protocolBindings = new ArrayList<String>();
+    private final List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
+
+    public String getServiceNamePattern() {
+        return serviceNamePattern;
+    }
+
+    public void setServiceNamePattern(String serviceNamePattern) {
+        this.serviceNamePattern = serviceNamePattern;
+    }
+
+    public String getPortNamePattern() {
+        return portNamePattern;
+    }
+
+    public void setPortNamePattern(String portNamePattern) {
+        this.portNamePattern = portNamePattern;
+    }
+
+    public List<String> getProtocolBindings() {
+        return protocolBindings;
+    }
+
+    public List<HandlerMetaData> getHandlers() {
+        return handlers;
+    }
+}

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerMetaData.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerMetaData.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/HandlerMetaData.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,53 @@
+/**
+ *
+ * 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.openejb.client;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+public class HandlerMetaData implements Serializable {
+    private static final long serialVersionUID = -297817668220375028L;
+    private String handlerClass;
+    private List<CallbackMetaData> postConstruct = new ArrayList<CallbackMetaData>();
+    private List<CallbackMetaData> preDestroy = new ArrayList<CallbackMetaData>();
+
+    public String getHandlerClass() {
+        return handlerClass;
+    }
+
+    public void setHandlerClass(String handlerClass) {
+        this.handlerClass = handlerClass;
+    }
+
+    public List<CallbackMetaData> getPostConstruct() {
+        return postConstruct;
+    }
+
+    public void setPostConstruct(List<CallbackMetaData> postConstruct) {
+        this.postConstruct = postConstruct;
+    }
+
+    public List<CallbackMetaData> getPreDestroy() {
+        return preDestroy;
+    }
+
+    public void setPreDestroy(List<CallbackMetaData> preDestroy) {
+        this.preDestroy = preDestroy;
+    }
+}

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Injection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Injection.java?rev=591858&r1=591857&r2=591858&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Injection.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Injection.java Sun Nov  4 14:41:49 2007
@@ -16,18 +16,24 @@
  */
 package org.apache.openejb.client;
 
+import java.io.Serializable;
+
 /**
  * @version $Rev$ $Date$
  */
-public class Injection {
+public class Injection implements Serializable {
+    private static final long serialVersionUID = 4009121701163822665L;
     private final String targetClass;
     private final String name;
     private final String jndiName;
 
     public Injection(String targetClass, String name, String jndiName) {
-        this.jndiName = jndiName;
-        this.name = name;
+        if (targetClass == null) throw new NullPointerException("targetClass is null");
+        if (name == null) throw new NullPointerException("name is null");
+        if (jndiName == null) throw new NullPointerException("jndiName is null");
         this.targetClass = targetClass;
+        this.name = name;
+        this.jndiName = jndiName;
     }
 
     public String getJndiName() {
@@ -40,5 +46,25 @@
 
     public String getTargetClass() {
         return targetClass;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Injection injection = (Injection) o;
+
+        return name.equals(injection.name) && targetClass.equals(injection.targetClass);
+    }
+
+    public int hashCode() {
+        int result;
+        result = targetClass.hashCode();
+        result = 31 * result + name.hashCode();
+        return result;
+    }
+
+    public String toString() {
+        return targetClass + "." + name + " -> " + jndiName;
     }
 }

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java?rev=591858&r1=591857&r2=591858&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java Sun Nov  4 14:41:49 2007
@@ -227,6 +227,9 @@
             case ResponseCodes.JNDI_DATA_SOURCE:
                 return createDataSource((DataSourceMetaData) res.getResult());
 
+            case ResponseCodes.JNDI_WEBSERVICE:
+                return createWebservice((WsMetaData) res.getResult());
+
             case ResponseCodes.JNDI_RESOURCE:
                 String type = (String) res.getResult();
                 value = System.getProperty("Resource/" + type);
@@ -239,7 +242,11 @@
                 throw new NameNotFoundException(name + " does not exist in the system.  Check that the app was successfully deployed.");
 
             case ResponseCodes.JNDI_NAMING_EXCEPTION:
-                throw (NamingException) res.getResult();
+                Throwable throwable = ((ThrowableArtifact) res.getResult()).getThrowable();
+                if (throwable instanceof NamingException) {
+                    throw (NamingException) throwable;
+                }
+                throw (NamingException) new NamingException().initCause(throwable);
 
             case ResponseCodes.JNDI_RUNTIME_EXCEPTION:
                 throw (RuntimeException) res.getResult();
@@ -296,6 +303,14 @@
 
     private DataSource createDataSource(DataSourceMetaData dataSourceMetaData) {
         return new ClientDataSource(dataSourceMetaData);
+    }
+
+    private Object createWebservice(WsMetaData webserviceMetaData) throws NamingException {
+        try {
+            return webserviceMetaData.createWebservice();
+        } catch (Exception e) {
+            throw (NamingException) new NamingException("Error creating webservice").initCause(e);
+        }
     }
 
     private ORB getDefaultOrb() {

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java?rev=591858&r1=591857&r2=591858&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java Sun Nov  4 14:41:49 2007
@@ -81,6 +81,10 @@
                 imd.readExternal(in);
                 result = imd;
                 break;
+            case ResponseCodes.JNDI_WEBSERVICE:
+                WsMetaData ws = (WsMetaData) in.readObject();
+                result = ws;
+                break;
         }
     }
 
@@ -113,6 +117,10 @@
             case ResponseCodes.JNDI_INJECTIONS:
                 InjectionMetaData imd = (InjectionMetaData) result;
                 imd.writeExternal(out);
+                break;
+            case ResponseCodes.JNDI_WEBSERVICE:
+                WsMetaData ws = (WsMetaData) result;
+                out.writeObject(ws);
                 break;
         }
     }

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,346 @@
+/**
+ *
+ * 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.openejb.client;
+
+import javax.xml.ws.spi.Provider;
+import javax.xml.ws.spi.ServiceDelegate;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.namespace.QName;
+import javax.xml.bind.JAXBContext;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.List;
+import java.util.Properties;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.util.concurrent.Executor;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
+
+public class JaxWsProviderWrapper extends Provider {
+    private static final Logger logger = Logger.getLogger("OpenEJB.client");
+
+    //
+    // Magic to get our proider wrapper installed with the PortRefData
+    //
+
+    private static ThreadLocal<ProviderWrapperData> threadPortRefs = new ThreadLocal<ProviderWrapperData>();
+
+    public static void beforeCreate(List<PortRefMetaData> portRefMetaDatas) {
+        // Axis JAXWS api is non compliant and checks system property before classloader
+        // so we replace system property so this wrapper is selected.  The original value
+        // is saved into an openejb property so we can load the class in the find method
+        String oldProperty = System.getProperty(JAXWSPROVIDER_PROPERTY);
+        if (oldProperty != null && !oldProperty.equals(JaxWsProviderWrapper.class.getName())) {
+            System.setProperty("openejb." + JAXWSPROVIDER_PROPERTY, oldProperty);
+            System.setProperty(JAXWSPROVIDER_PROPERTY, JaxWsProviderWrapper.class.getName());
+        }
+
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        if (oldClassLoader != null) {
+            Thread.currentThread().setContextClassLoader(new ProviderClassLoader(oldClassLoader));
+        } else {
+            Thread.currentThread().setContextClassLoader(new ProviderClassLoader());
+        }
+        threadPortRefs.set(new ProviderWrapperData(portRefMetaDatas, oldClassLoader));
+    }
+
+    public static void afterCreate() {
+        Thread.currentThread().setContextClassLoader(threadPortRefs.get().callerClassLoader);
+        threadPortRefs.set(null);
+    }
+
+    private static class ProviderWrapperData {
+        private final List<PortRefMetaData> portRefMetaData;
+        private final ClassLoader callerClassLoader;
+
+        public ProviderWrapperData(List<PortRefMetaData> portRefMetaDatas, ClassLoader callerClassLoader) {
+            this.portRefMetaData = portRefMetaDatas;
+            this.callerClassLoader = callerClassLoader;
+        }
+    }
+
+
+    //
+    // Provider wappre implementation
+    //
+
+    private final Provider delegate;
+    private final List<PortRefMetaData> portRefs;
+
+    public JaxWsProviderWrapper() {
+        delegate = findProvider();
+        portRefs = threadPortRefs.get().portRefMetaData;
+    }
+
+    public Provider getDelegate() {
+        return delegate;
+    }
+
+    public ServiceDelegate createServiceDelegate(URL wsdlDocumentLocation, QName serviceName, Class serviceClass) {
+        ServiceDelegate serviceDelegate = delegate.createServiceDelegate(wsdlDocumentLocation, serviceName, serviceClass);
+        serviceDelegate = new ServiceDelegateWrapper(serviceDelegate);
+        return serviceDelegate;
+    }
+
+    public Endpoint createEndpoint(String bindingId, Object implementor) {
+        return delegate.createEndpoint(bindingId, implementor);
+    }
+
+    public Endpoint createAndPublishEndpoint(String address, Object implementor) {
+        return delegate.createAndPublishEndpoint(address, implementor);
+    }
+
+    private class ServiceDelegateWrapper extends ServiceDelegate {
+        private final ServiceDelegate serviceDelegate;
+
+        public ServiceDelegateWrapper(ServiceDelegate serviceDelegate) {
+            this.serviceDelegate = serviceDelegate;
+        }
+
+        public <T> T getPort(QName portName, Class<T> serviceEndpointInterface) {
+            T t = serviceDelegate.getPort(portName, serviceEndpointInterface);
+            setProperties((BindingProvider) t);
+            return t;
+        }
+
+        public <T> T getPort(Class<T> serviceEndpointInterface) {
+            T t = serviceDelegate.getPort(serviceEndpointInterface);
+            setProperties((BindingProvider) t);
+            return t;
+        }
+
+        public void addPort(QName portName, String bindingId, String endpointAddress) {
+            serviceDelegate.addPort(portName, bindingId, endpointAddress);
+        }
+
+        public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Service.Mode mode) {
+            Dispatch<T> dispatch = serviceDelegate.createDispatch(portName, type, mode);
+            setProperties(dispatch);
+            return dispatch;
+        }
+
+        public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Service.Mode mode) {
+            Dispatch<Object> dispatch = serviceDelegate.createDispatch(portName, context, mode);
+            setProperties(dispatch);
+            return dispatch;
+        }
+
+        public QName getServiceName() {
+            QName qName = serviceDelegate.getServiceName();
+            return qName;
+        }
+
+        public Iterator<QName> getPorts() {
+            Iterator<QName> ports = serviceDelegate.getPorts();
+            return ports;
+        }
+
+        public URL getWSDLDocumentLocation() {
+            URL documentLocation = serviceDelegate.getWSDLDocumentLocation();
+            return documentLocation;
+        }
+
+        public HandlerResolver getHandlerResolver() {
+            HandlerResolver handlerResolver = serviceDelegate.getHandlerResolver();
+            return handlerResolver;
+        }
+
+        public void setHandlerResolver(HandlerResolver handlerResolver) {
+            serviceDelegate.setHandlerResolver(handlerResolver);
+        }
+
+        public Executor getExecutor() {
+            Executor executor = serviceDelegate.getExecutor();
+            return executor;
+        }
+
+        public void setExecutor(Executor executor) {
+            serviceDelegate.setExecutor(executor);
+        }
+
+        private void setProperties(BindingProvider proxy) {
+            for (PortRefMetaData portRef : portRefs) {
+                Class<?> intf = null;
+                try {
+                    intf = proxy.getClass().getClassLoader().loadClass(portRef.getServiceEndpointInterface());
+                } catch (ClassNotFoundException e) {
+                }
+                if (intf != null && intf.isInstance(proxy)) {
+                    // set mtom
+                    boolean enableMTOM = portRef.isEnableMtom();
+                    if (enableMTOM && proxy.getBinding() instanceof SOAPBinding) {
+                        ((SOAPBinding)proxy.getBinding()).setMTOMEnabled(enableMTOM);
+                    }
+
+                    // set properties
+                    for (Map.Entry<Object, Object> entry : portRef.getProperties().entrySet()) {
+                        String name = (String) entry.getKey();
+                        String value = (String) entry.getValue();
+                        proxy.getRequestContext().put(name, value);
+                    }
+
+                    return;
+                }
+            }
+        }
+    }
+
+    private static Provider findProvider() {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        if (classLoader == null) classLoader = ClassLoader.getSystemClassLoader();
+
+        // 0. System.getProperty("openejb.javax.xml.ws.spi.Provider")
+        // This is so those using old axis rules still work as expected
+        String providerClass = System.getProperty("openejb." + JAXWSPROVIDER_PROPERTY);
+        Provider provider = createProviderInstance(providerClass, classLoader);
+        if (provider != null) {
+            return provider;
+        }
+
+        // 1. META-INF/services/javax.xml.ws.spi.Provider
+        try {
+            for (URL url : Collections.list(classLoader.getResources("META-INF/services/" + JAXWSPROVIDER_PROPERTY))) {
+                BufferedReader in = null;
+                try {
+                    in = new BufferedReader(new InputStreamReader(url.openStream()));
+
+                    providerClass = in.readLine();
+                    provider = createProviderInstance(providerClass, classLoader);
+                    if (provider != null) {
+                        return provider;
+                    }
+                } catch (Exception ignored) {
+                } finally {
+                    if (in != null) {
+                        try {
+                            in.close();
+                        } catch (IOException e) {
+                        }
+                    }
+                }
+            }
+        } catch (Exception ingored) {
+        }
+
+        // 2. $java.home/lib/jaxws.properties
+        String javaHome = System.getProperty("java.home");
+        File jaxrpcPropertiesFile = new File(new File(javaHome, "lib"), "jaxrpc.properties");
+        if (jaxrpcPropertiesFile.exists()) {
+            InputStream in = null;
+            try {
+                in = new FileInputStream(jaxrpcPropertiesFile);
+                Properties properties = new Properties();
+                properties.load(in);
+
+                providerClass = properties.getProperty(JAXWSPROVIDER_PROPERTY);
+                provider = createProviderInstance(providerClass, classLoader);
+                if (provider != null) {
+                    return provider;
+                }
+            } catch(Exception ignored) {
+            } finally {
+                if (in != null) {
+                    try {
+                        in.close();
+                    } catch (IOException e) {
+                    }
+                }
+            }
+        }
+
+        // 3. System.getProperty("javax.xml.ws.spi.Provider")
+        providerClass = System.getProperty(JAXWSPROVIDER_PROPERTY);
+        provider = createProviderInstance(providerClass, classLoader);
+        if (provider != null) {
+            return provider;
+        }
+
+        throw new WebServiceException("No " + JAXWSPROVIDER_PROPERTY + " implementation found");
+    }
+
+    private static Provider createProviderInstance(String providerClass, ClassLoader classLoader) {
+        if (providerClass != null && providerClass.length() > 0 && !providerClass.equals(JaxWsProviderWrapper.class.getName())) {
+            try {
+                Class<? extends Provider> clazz = classLoader.loadClass(providerClass).asSubclass(Provider.class);
+                return clazz.newInstance();
+            } catch (Throwable e) {
+                logger.log(Level.WARNING, "Unable to construct provider implementation " + providerClass, e);
+            }
+        }
+        return null;
+    }
+
+    private static class ProviderClassLoader extends ClassLoader {
+        private static final String PROVIDER_RESOURCE = "META-INF/services/" + JAXWSPROVIDER_PROPERTY;
+        private static final URL PROVIDER_URL;
+        static {
+            try {
+                File tempFile = File.createTempFile("openejb-jaxws-provider", "tmp");
+                OutputStream out = new FileOutputStream(tempFile);
+                out.write(JaxWsProviderWrapper.class.getName().getBytes());
+                out.close();
+                PROVIDER_URL = tempFile.toURL();
+            } catch (IOException e) {
+                throw new RuntimeException("Cound not create openejb-jaxws-provider file");
+            }
+        }
+
+        public ProviderClassLoader() {
+        }
+
+        public ProviderClassLoader(ClassLoader parent) {
+            super(parent);
+        }
+
+        public Enumeration<URL> getResources(String name) throws IOException {
+            Enumeration<URL> resources = super.getResources(name);
+            if (PROVIDER_RESOURCE.equals(name)) {
+                ArrayList<URL> list = new ArrayList<URL>();
+                list.add(PROVIDER_URL);
+                list.addAll(Collections.list(resources));
+                resources = Collections.enumeration(list);
+            }
+            return resources;
+        }
+
+
+        public URL getResource(String name) {
+            if (PROVIDER_RESOURCE.equals(name)) {
+                return PROVIDER_URL;
+            }
+            return super.getResource(name);
+        }
+    }
+}

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Main.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Main.java?rev=591858&r1=591857&r2=591858&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Main.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/Main.java Sun Nov  4 14:41:49 2007
@@ -22,9 +22,6 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginContext;
 import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.FileOutputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
@@ -79,6 +76,7 @@
         }
 
         InjectionMetaData injectionMetaData = (InjectionMetaData) initialContext.lookup("java:comp/injections");
+        ClientInstance.get().setComponent(InjectionMetaData.class, injectionMetaData);
         for (Injection injection : injectionMetaData.getInjections()) {
             try {
                 Object value = initialContext.lookup("java:comp/env/" + injection.getJndiName());

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.openejb.client;
+
+import java.util.Properties;
+import java.util.List;
+import java.io.Serializable;
+
+public class PortRefMetaData implements Serializable {
+    private static final long serialVersionUID = 4343767807431809218L;
+
+    private String serviceEndpointInterface;
+    private boolean enableMtom;
+    private String portComponentLink;
+    private final Properties properties = new Properties();
+
+    public String getServiceEndpointInterface() {
+        return serviceEndpointInterface;
+    }
+
+    public void setServiceEndpointInterface(String serviceEndpointInterface) {
+        this.serviceEndpointInterface = serviceEndpointInterface;
+    }
+
+    public boolean isEnableMtom() {
+        return enableMtom;
+    }
+
+    public void setEnableMtom(boolean value) {
+        this.enableMtom = value;
+    }
+
+    public String getPortComponentLink() {
+        return portComponentLink;
+    }
+
+    public void setPortComponentLink(String value) {
+        this.portComponentLink = value;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+}

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java?rev=591858&r1=591857&r2=591858&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java Sun Nov  4 14:41:49 2007
@@ -44,5 +44,6 @@
     public static final int JNDI_DATA_SOURCE = 22;
     public static final int JNDI_INJECTIONS = 23;
     public static final int JNDI_RESOURCE = 24;
+    public static final int JNDI_WEBSERVICE = 25;
 }
 

Added: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/WsMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/WsMetaData.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/WsMetaData.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/WsMetaData.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,151 @@
+/**
+ *
+ * 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.openejb.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.HandlerResolver;
+import java.net.URL;
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+public class WsMetaData implements Serializable {
+    private static final long serialVersionUID = -895152184216070327L;
+    private String serviceClassName;
+    private String referenceClassName;
+    private String wsdlUrl;
+    private String serviceQName;
+    private final List<HandlerChainMetaData> handlerChains = new ArrayList<HandlerChainMetaData>();
+    private final List<PortRefMetaData> portRefs = new ArrayList<PortRefMetaData>();
+
+    public String getServiceClassName() {
+        return serviceClassName;
+    }
+
+    public void setServiceClassName(String serviceClassName) {
+        this.serviceClassName = serviceClassName;
+    }
+
+    public String getReferenceClassName() {
+        return referenceClassName;
+    }
+
+    public void setReferenceClassName(String referenceClassName) {
+        this.referenceClassName = referenceClassName;
+    }
+
+    public String getWsdlUrl() {
+        return wsdlUrl;
+    }
+
+    public void setWsdlUrl(String wsdlUrl) {
+        this.wsdlUrl = wsdlUrl;
+    }
+
+    public String getServiceQName() {
+        return serviceQName;
+    }
+
+    public void setServiceQName(String serviceQName) {
+        this.serviceQName = serviceQName;
+    }
+
+    public List<HandlerChainMetaData> getHandlerChains() {
+        return handlerChains;
+    }
+
+    public List<PortRefMetaData> getPortRefs() {
+        return portRefs;
+    }
+
+    public Object createWebservice() throws Exception {
+        // load service class which is used to construct the port
+        Class<? extends Service> serviceClass = loadClass(serviceClassName).asSubclass(Service.class);
+        if (serviceClass == null) {
+            throw new NamingException("Could not load service type class " + serviceClassName);
+        }
+
+        // load the reference class which is the ultimate type of the port
+        Class<?> referenceClass = loadClass(referenceClassName);
+
+        // if ref class is a subclass of Service, use it for the service class
+        if (referenceClass != null && Service.class.isAssignableFrom(referenceClass)) {
+            serviceClass = referenceClass.asSubclass(Service.class);
+        }
+
+        // Service QName
+        QName serviceQName = QName.valueOf(this.serviceQName);
+
+        // WSDL URL
+        URL wsdlLocation = new URL(this.wsdlUrl);
+
+        JaxWsProviderWrapper.beforeCreate(portRefs);
+        Service instance;
+        try {
+            instance = null;
+            if (Service.class.equals(serviceClass)) {
+                instance = Service.create(wsdlLocation, serviceQName);
+            } else {
+                try {
+                    instance = serviceClass.getConstructor(URL.class, QName.class).newInstance(wsdlLocation, serviceQName);
+                } catch (Throwable e) {
+                    throw (NamingException) new NamingException("Could not instantiate jax-ws service class " + serviceClass.getName()).initCause(e);
+                }
+            }
+        } finally {
+            JaxWsProviderWrapper.afterCreate();
+        }
+
+        if (handlerChains != null && !handlerChains.isEmpty()) {
+            InjectionMetaData injectionMetaData = ClientInstance.get().getComponent(InjectionMetaData.class);
+            List<Injection> injections = injectionMetaData.getInjections();
+            HandlerResolver handlerResolver = new ClientHandlerResolverImpl(handlerChains, injections, new InitialContext());
+            instance.setHandlerResolver(handlerResolver);
+        }
+
+        Object port;
+        if (referenceClass != null && !Service.class.isAssignableFrom(referenceClass)) {
+            // do port lookup
+            port = instance.getPort(referenceClass);
+        } else {
+            // return service
+            port = instance;
+        }
+        return port;
+    }
+
+    public static Class<?> loadClass(String className) {
+        if (className == null) return null;
+        try {
+            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+            if (classLoader != null) {
+                try {
+                    Class clazz = classLoader.loadClass(className);
+                    return clazz;
+                } catch(ClassNotFoundException e) {
+                }
+            }
+            return Class.forName(className);
+        } catch (ClassNotFoundException e) {
+            return null;
+        }
+    }
+}

Added: openejb/trunk/openejb3/server/openejb-client/src/test/java/org/apache/openejb/client/JaxWsProviderWrapperTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/test/java/org/apache/openejb/client/JaxWsProviderWrapperTest.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/test/java/org/apache/openejb/client/JaxWsProviderWrapperTest.java (added)
+++ openejb/trunk/openejb3/server/openejb-client/src/test/java/org/apache/openejb/client/JaxWsProviderWrapperTest.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,64 @@
+/**
+ *
+ * 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.openejb.client;
+
+import junit.framework.TestCase;
+
+import javax.xml.ws.spi.Provider;
+import javax.xml.ws.spi.ServiceDelegate;
+import javax.xml.ws.Endpoint;
+import javax.xml.namespace.QName;
+import java.net.URL;
+
+public class JaxWsProviderWrapperTest extends TestCase {
+    public void test() throws Exception {
+        System.setProperty(Provider.JAXWSPROVIDER_PROPERTY, MockProvider.class.getName());
+        Provider provider = Provider.provider();
+        assertNotNull("provider is null", provider);
+        assertFalse("provider should not be an instance of ProviderWrapper", provider instanceof JaxWsProviderWrapper);
+
+        JaxWsProviderWrapper.beforeCreate(null);
+        try {
+            provider = Provider.provider();
+            assertNotNull("provider is null", provider);
+            assertTrue("provider should be an instance of ProviderWrapper", provider instanceof JaxWsProviderWrapper);
+            JaxWsProviderWrapper providerWrapper = (JaxWsProviderWrapper)provider;
+
+            // check delegate
+            Provider delegate = providerWrapper.getDelegate();
+            assertNotNull("providerWrapper delegate is null", delegate);
+            assertFalse("providerWrapper delegate should not be an instance of ProviderWrapper", delegate instanceof JaxWsProviderWrapper);
+        } finally {
+            JaxWsProviderWrapper.afterCreate();
+        }
+    }
+
+    public static class MockProvider extends Provider {
+        public ServiceDelegate createServiceDelegate(URL url, QName qName, Class aClass) {
+            return null;
+        }
+
+        public Endpoint createEndpoint(String string, Object object) {
+            return null;
+        }
+
+        public Endpoint createAndPublishEndpoint(String string, Object object) {
+            return null;
+        }
+    }
+}

Propchange: openejb/trunk/openejb3/server/openejb-cxf/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Nov  4 14:41:49 2007
@@ -0,0 +1,10 @@
+*.iws
+*.ipr
+*.iml
+.classpath
+.project
+.settings
+*.log
+junit*.properties
+target
+bin

Added: openejb/trunk/openejb3/server/openejb-cxf/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-cxf/pom.xml?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-cxf/pom.xml (added)
+++ openejb/trunk/openejb3/server/openejb-cxf/pom.xml Sun Nov  4 14:41:49 2007
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+-->
+
+<!-- $Rev: 579722 $ $Date: 2007-09-26 10:25:44 -0700 (Wed, 26 Sep 2007) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>server</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>openejb-cxf</artifactId>
+  <packaging>jar</packaging>
+  <name>OpenEJB :: Server :: CXF</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-webservices</artifactId>
+      <version>${version}</version>
+    </dependency>
+
+    <dependency>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-rt-frontend-jaxws</artifactId>
+        <version>2.0.2-incubator</version>
+        <exclusions>
+            <exclusion>
+                <groupId>javax.annotation</groupId>
+                <artifactId>jsr250-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>javax.jws</groupId>
+                <artifactId>jsr181-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+
+    <dependency>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-rt-transports-http</artifactId>
+        <version>2.0.2-incubator</version>
+        <exclusions>
+            <exclusion>
+                <groupId>javax.annotation</groupId>
+                <artifactId>jsr250-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>javax.jws</groupId>
+                <artifactId>jsr181-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+
+    <dependency>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-rt-transports-http-jetty</artifactId>
+        <version>2.0.2-incubator</version>
+        <exclusions>
+            <exclusion>
+                <groupId>javax.annotation</groupId>
+                <artifactId>jsr250-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>javax.jws</groupId>
+                <artifactId>jsr181-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+  </dependencies>
+</project>

Added: openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfCatalogUtils.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfCatalogUtils.java?rev=591858&view=auto
==============================================================================
--- openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfCatalogUtils.java (added)
+++ openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfCatalogUtils.java Sun Nov  4 14:41:49 2007
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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.openejb.server.cxf;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.OASISCatalogManager;
+import org.apache.xml.resolver.Catalog;
+import org.apache.openejb.util.Logger;
+import org.apache.openejb.util.LogCategory;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public final class CxfCatalogUtils {
+    private static final Logger logger = Logger.getInstance(LogCategory.CXF, CxfCatalogUtils.class);
+
+    public static void loadOASISCatalog(Bus bus, URL baseURL, String catalogName) {
+        URL catalogURL = null;
+        try {
+            catalogURL = new URL(baseURL, catalogName);
+            logger.debug("Checking for " + catalogURL + " catalog.");
+            catalogURL.openStream().close();
+            loadOASISCatalog(bus, catalogURL);
+        } catch (MalformedURLException e) {
+            logger.warning("Error constructing catalog URL: " + baseURL + " " + catalogName);
+        } catch (FileNotFoundException e) {
+            logger.debug("Catalog " + catalogURL + " is not present in the module");
+        } catch (IOException e) {
+            logger.warning("Failed to load catalog file: " + catalogURL, e);
+        }
+    }
+
+    private static void loadOASISCatalog(Bus bus, URL catalogURL) {
+        OASISCatalogManager catalog = new OASISCatalogManager();
+        try {
+            catalog.loadCatalog(catalogURL);
+            logger.debug("Loaded " + catalogURL + " catalog.");
+            bus.setExtension(catalog.getCatalog(), Catalog.class);
+        } catch (IOException e) {
+            logger.warning("Failed to load catalog file: " + catalogURL, e);
+        }
+    }
+}



Mime
View raw message