cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r450934 - in /incubator/cxf/trunk: rt/frontend/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/ rt/frontend/jaxws/src/main/resources/META-INF/cxf/ rt/frontend/jaxws/s...
Date Thu, 28 Sep 2006 17:33:58 GMT
Author: jliu
Date: Thu Sep 28 10:33:57 2006
New Revision: 450934

URL: http://svn.apache.org/viewvc?view=rev&rev=450934
Log:
[CXF-105] The HandlerChain annotation processing in the JAX-WS frontend. 

Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml   (with props)
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/configuration/javaee_web_services_1_2.xsd
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers.xml

Modified: incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/pom.xml?view=diff&rev=450934&r1=450933&r2=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/pom.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/pom.xml Thu Sep 28 10:33:57 2006
@@ -117,6 +117,10 @@
 				<xsdOption>
 				    <xsd>${basedir}/src/main/resources/schemas/configuration/javaee_web_services_1_2.xsd</xsd>
 				    <bindingFile>${basedir}/src/main/resources/schemas/configuration/javaee_5.xjb</bindingFile>
+                                    <extension>true</extension>
+                                    <extensionArgs>
+                                        <extensionArg>-Xcfg</extensionArg>
+                                    </extensionArgs>
 				</xsdOption>
 			    </xsdOptions>
 			</configuration>
@@ -125,6 +129,23 @@
 			</goals>
 		    </execution>
 		</executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cxf</groupId>
+                        <artifactId>cxf-tools-xjc-cfg</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.cxf</groupId>
+                        <artifactId>cxf-tools-xjc-dv</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.cxf</groupId>
+                        <artifactId>cxf-common-utilities</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                </dependencies>
 	    </plugin>
 	</plugins>
     </build>

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?view=diff&rev=450934&r1=450933&r2=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Thu Sep 28 10:33:57 2006
@@ -32,6 +32,7 @@
 import javax.xml.ws.Binding;
 import javax.xml.ws.Provider;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
@@ -43,6 +44,8 @@
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
 import org.apache.cxf.jaxb.JAXBDataWriterFactory;
 import org.apache.cxf.jaxws.context.WebContextResourceResolver;
+import org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder;
+//import org.apache.cxf.jaxws.javaee.HandlerChainType;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
@@ -56,7 +59,7 @@
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 public class EndpointImpl extends javax.xml.ws.Endpoint {
- 
+
     private static final Logger LOG = LogUtils.getL7dLogger(JaxWsServiceFactoryBean.class);
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
 
@@ -69,7 +72,7 @@
     private Service service;
     private JaxWsEndpointImpl endpoint;
     private JaxWsImplementorInfo implInfo;
-    
+
     @SuppressWarnings("unchecked")
     public EndpointImpl(Bus b, Object i, String uri) {
         bus = b;
@@ -77,7 +80,7 @@
         // bindingURI = uri;
         // build up the Service model
         implInfo = new JaxWsImplementorInfo(implementor.getClass());
-        
+
         AbstractServiceFactoryBean serviceFactory;
         if (implInfo.isWebServiceProvider()) {
             serviceFactory = new ProviderServiceFactoryBean(implInfo);
@@ -94,26 +97,26 @@
         if (ei == null) {
             throw new NullPointerException("Could not find endpoint " + endpointName + " in Service.");
         }
- 
+
         // revisit: should get enableSchemaValidation from configuration
         if (false) {
             addSchemaValidation();
         }
-        
+
         if (implInfo.isWebServiceProvider()) {
             service.setInvoker(new ProviderInvoker((Provider<?>)i));
         } else {
             service.setInvoker(new JAXWSMethodInvoker(i));
         }
-        
+
         //      TODO: use bindigURI     
         try {
-            endpoint = new JaxWsEndpointImpl(bus, service, ei);            
+            endpoint = new JaxWsEndpointImpl(bus, service, ei);
         } catch (EndpointException e) {
             throw new WebServiceException(e);
         }
         configureObject(endpoint);
-        
+
         doInit = true;
     }
 
@@ -183,7 +186,6 @@
     public ServerImpl getServer() {
         return server;
     }
-    
 
     /**
      * inject resources into servant.  The resources are injected
@@ -204,11 +206,11 @@
 
     protected void doPublish(String address) {
         init();
-        
+
         if (null != address) {
             endpoint.getEndpointInfo().setAddress(address);
         }
-        
+
         try {
             MessageObserver observer;
             if (implInfo.isWebServiceProvider()) {
@@ -216,7 +218,7 @@
             } else {
                 observer = new ChainInitiationObserver(endpoint, bus);
             }
-     
+
             server = new ServerImpl(bus, endpoint, observer);
             server.start();
         } catch (BusException ex) {
@@ -225,25 +227,25 @@
             throw new WebServiceException(BUNDLE.getString("FAILED_TO_PUBLISH_ENDPOINT_EXC"), ex);
         }
     }
-    
+
     org.apache.cxf.endpoint.Endpoint getEndpoint() {
         return endpoint;
     }
-    
+
     private void configureObject(Object instance) {
         Configurer configurer = bus.getExtension(Configurer.class);
         if (null != configurer) {
             configurer.configureBean(instance);
         }
     }
-    
+
     private void addSchemaValidation() {
         Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfo());
-        
+
         if (service.getDataBinding().getDataReaderFactory() instanceof JAXBDataReaderFactory) {
             ((JAXBDataReaderFactory)service.getDataBinding().getDataReaderFactory()).setSchema(schema);
         }
-        
+
         if (service.getDataBinding().getDataWriterFactory() instanceof JAXBDataWriterFactory) {
             ((JAXBDataWriterFactory)service.getDataBinding().getDataWriterFactory()).setSchema(schema);
         }
@@ -253,15 +255,36 @@
         if (doInit) {
             try {
                 injectResources(implementor);
-    
+                configureHandlers();
+
             } catch (Exception ex) {
                 ex.printStackTrace();
-                if (ex instanceof WebServiceException) { 
-                    throw (WebServiceException)ex; 
+                if (ex instanceof WebServiceException) {
+                    throw (WebServiceException)ex;
                 }
                 throw new WebServiceException("Creation of Endpoint failed", ex);
             }
         }
         doInit = false;
+    }
+
+    /**
+     * Obtain handler chain from configuration first. If none is specified,
+     * default to the chain configured in the code, i.e. in annotations.
+     *
+     */
+    private void configureHandlers() {
+        LOG.fine("loading handler chain for endpoint");
+        AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
+
+        //TBD: get configuratoin from config file
+        //List<Handler> chain = builder.buildHandlerChainFromConfiguration(hc);
+        //builder.setHandlerInitEnabled(configuration.getBoolean(ENABLE_HANDLER_INIT));
+        List<Handler> chain = null;
+
+        if (null == chain || chain.size() == 0) {
+            chain = builder.buildHandlerChainFromClass(implementor.getClass());
+        }
+        getBinding().setHandlerChain(chain);
     }
 }

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?view=auto&rev=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Thu Sep 28 10:33:57 2006
@@ -0,0 +1,156 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxws.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jws.HandlerChain;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.apache.cxf.configuration.spring.JaxbClassPathXmlApplicationContext;
+import org.apache.cxf.jaxws.javaee.HandlerChainType;
+import org.apache.cxf.jaxws.javaee.HandlerConfigBean;
+import org.springframework.context.ApplicationContext;
+
+public class AnnotationHandlerChainBuilder extends HandlerChainBuilder {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(AnnotationHandlerChainBuilder.class);
+    private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+    public AnnotationHandlerChainBuilder() {
+    }
+
+    public AnnotationHandlerChainBuilder(Bus bus) {
+        super(bus);
+    }
+
+    /**
+     * @param clz
+     * @param existingHandlers
+     * @return
+     */
+    public List<Handler> buildHandlerChainFromClass(Class<?> clz, List<Handler> existingHandlers) {
+
+        LOG.fine("building handler chain");
+        HandlerChainAnnotation hcAnn = findHandlerChainAnnotation(clz);
+        List<Handler> chain = null;
+        if (hcAnn == null) {
+            LOG.fine("no HandlerChain annotation on " + clz);
+            chain = new ArrayList<Handler>();
+        } else {
+            hcAnn.validate();
+            String handlerFile = hcAnn.getFileName();
+
+            // This Configurer needs to be different from system configurer as
+            // it is only aware of handler configure file.
+            ApplicationContext ac = new JaxbClassPathXmlApplicationContext(new String[] {
+                handlerFile,
+                "META-INF/cxf/cxf-property-editors.xml"});
+            Configurer configurer = new ConfigurerImpl(ac);
+
+            HandlerConfigBean hcb = new HandlerConfigBean();
+            configurer.configureBean(hcb);
+            HandlerChainType hc = hcb.getJaxwshandler();
+
+            if (null == hc) {
+                throw new WebServiceException(BUNDLE.getString("CHAIN_NOT_SPECIFIED_EXC"));
+            }
+
+            chain = buildHandlerChain(hc, clz.getClassLoader());
+        }
+        assert chain != null;
+        if (existingHandlers != null) {
+            chain.addAll(existingHandlers);
+        }
+        return sortHandlers(chain);
+    }
+
+    public List<Handler> buildHandlerChainFromClass(Class<?> clz) {
+        return buildHandlerChainFromClass(clz, null);
+    }
+
+    private HandlerChainAnnotation findHandlerChainAnnotation(Class<?> clz) {
+
+        HandlerChain ann = clz.getAnnotation(HandlerChain.class);
+        Class<?> declaringClass = clz;
+
+        if (ann == null) {
+            for (Class<?> iface : clz.getInterfaces()) {
+                if (LOG.isLoggable(Level.FINE)) {
+                    LOG.fine("checking for HandlerChain annotation on " + iface.getName());
+                }
+                ann = iface.getAnnotation(HandlerChain.class);
+                if (ann != null) {
+                    declaringClass = iface;
+                    break;
+                }
+            }
+        }
+        if (ann != null) {
+            return new HandlerChainAnnotation(ann, declaringClass);
+        } else {
+            return null;
+        }
+    }
+
+    private static class HandlerChainAnnotation {
+        private final Class<?> declaringClass;
+        private final HandlerChain ann;
+
+        HandlerChainAnnotation(HandlerChain hc, Class<?> clz) {
+            ann = hc;
+            declaringClass = clz;
+        }
+
+        public Class<?> getDeclaringClass() {
+            return declaringClass;
+        }
+
+        public String getFileName() {
+            return ann.file();
+        }
+
+        public String getChainName() {
+            return ann.name();
+        }
+
+        public void validate() {
+            if (null == ann.file() || "".equals(ann.file())) {
+                throw new WebServiceException(BUNDLE.getString("ANNOTATION_WITHOUT_URL_EXC"));
+            }
+            if (null == ann.name() || "".equals(ann.name())) {
+                LOG.fine("no handler name specified, defaulting to first declared");
+            }
+        }
+
+        public String toString() {
+            return "[" + declaringClass + "," + ann + "]";
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java?view=auto&rev=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java Thu Sep 28 10:33:57 2006
@@ -0,0 +1,184 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxws.handler;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.ResourceInjector;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.javaee.HandlerChainType;
+import org.apache.cxf.jaxws.javaee.ParamValueType;
+import org.apache.cxf.jaxws.javaee.PortComponentHandlerType;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.ResourceResolver;
+
+public class HandlerChainBuilder {
+    static final Logger LOG = LogUtils.getL7dLogger(HandlerChainBuilder.class);
+    private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+    private Bus bus;
+
+    private boolean handlerInitEnabled;
+
+    public HandlerChainBuilder(Bus aBus) {
+        bus = aBus;
+    }
+
+    public HandlerChainBuilder() {
+        this(null);
+    }
+
+    public List<Handler> buildHandlerChainFromConfiguration(HandlerChainType hc) {
+        if (null == hc) {
+            return null;
+        }
+        return sortHandlers(buildHandlerChain(hc, getHandlerClassLoader()));
+    }
+
+    /**
+     * sorts the handlers into correct order. All of the logical handlers first
+     * followed by the protocol handlers
+     * 
+     * @param handlers
+     * @return sorted list of handlers
+     */
+    public 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;
+    }
+
+    public void setHandlerInitEnabled(boolean b) {
+        handlerInitEnabled = b;
+    }
+
+    public boolean isHandlerInitEnabled() {
+        return handlerInitEnabled;
+    }
+
+    protected ClassLoader getHandlerClassLoader() {
+        return getClass().getClassLoader();
+    }
+
+    protected List<Handler> buildHandlerChain(HandlerChainType hc, ClassLoader classLoader) {
+        List<Handler> handlerChain = new ArrayList<Handler>();
+        for (PortComponentHandlerType ht : hc.getHandler()) {
+            try {
+                LOG.log(Level.FINE, "loading handler", trimString(ht.getHandlerName().getValue()));
+
+                Class<? extends Handler> handlerClass = Class.forName(
+                                                                      trimString(ht.getHandlerClass()
+                                                                          .getValue()), true, classLoader)
+                    .asSubclass(Handler.class);
+
+                Handler handler = handlerClass.newInstance();
+                LOG.fine("adding handler to chain: " + handler);
+                configureHandler(handler, ht);
+                handlerChain.add(handler);
+            } catch (Exception e) {
+                throw new WebServiceException(BUNDLE.getString("HANDLER_INSTANTIATION_EXC"), e);
+            }
+        }
+        return handlerChain;
+    }
+
+    private void configureHandler(Handler handler, PortComponentHandlerType h) {
+        if (!handlerInitEnabled) {
+            return;
+        }
+
+        if (h.getInitParam().size() == 0) {
+            return;
+        }
+
+        Map<String, String> params = new HashMap<String, String>();
+
+        for (ParamValueType param : h.getInitParam()) {
+            params.put(trimString(param.getParamName() == null ? null : param.getParamName().getValue()),
+                       trimString(param.getParamValue() == null ? null : param.getParamValue().getValue()));
+        }
+
+        Method initMethod = getInitMethod(handler);
+        if (initMethod != null) {
+            initializeViaInitMethod(handler, params, initMethod);
+        } else {
+            initializeViaInjection(handler, params);
+        }
+    }
+
+    private void initializeViaInjection(Handler handler, final Map<String, String> params) {
+        ResourceManager resMgr = bus.getExtension(ResourceManager.class);
+        List<ResourceResolver> resolvers = resMgr.getResourceResolvers();
+        resolvers.add(new InitParamResourceResolver(params));
+        ResourceInjector resInj = new ResourceInjector(resMgr, resolvers);
+        resInj.inject(handler);
+    }
+
+    private void initializeViaInitMethod(Handler handler, Map<String, String> params, Method init) {
+        try {
+            init.invoke(handler, params);
+        } catch (InvocationTargetException ex) {
+            Throwable t = ex.getCause() != null ? ex.getCause() : ex;
+            LogUtils.log(LOG, Level.WARNING, "INIT_METHOD_THREW_EXCEPTION", t, handler.getClass());
+        } catch (IllegalAccessException ex) {
+            LOG.log(Level.SEVERE, "CANNOT_ACCESS_INIT", handler.getClass());
+        }
+    }
+
+    private Method getInitMethod(Handler handler) {
+        Method m = null;
+        try {
+            m = handler.getClass().getMethod("init", Map.class);
+        } catch (NoSuchMethodException ex) {
+            // emtpy
+        }
+        return m;
+    }
+
+    private String trimString(String str) {
+        return str != null ? str.trim() : null;
+    }
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties?view=diff&rev=450934&r1=450933&r2=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties Thu Sep 28 10:33:57 2006
@@ -1,4 +1,7 @@
 NO_INPUT_STREAM_EXC = No input stream available.
 NO_OUTPUT_STREAM_EXC = No output stream available.
 ANNOTATION_WITHOUT_URL_EXC = @HandlerChain annotation does not contain a file name or url.
-HANDLER_CFG_FILE_NOT_FOUND_EXC = Unable to load handler configuration {0} specified by annotation, file not found."
\ No newline at end of file
+HANDLER_CFG_FILE_NOT_FOUND_EXC = Unable to load handler configuration {0} specified by annotation, file not found."
+HANDLER_INSTANTIATION_EXC = Failed to instantiate handler
+CHAIN_NOT_SPECIFIED_EXC = Chain not specified
+

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml?view=auto&rev=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml Thu Sep 28 10:33:57 2006
@@ -0,0 +1,49 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+   
+    <bean id="org.apache.cxf.jaxws.javaee.customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
+        <property name="propertyEditorRegistrars">
+            <list>
+                <!--
+                <ref bean="org.apache.cxf.management.JaxbPropertyEditorRegistrar"/>
+                -->
+                <bean class="org.apache.cxf.configuration.spring.JaxbPropertyEditorRegistrar">
+                    <property name="packageName" value="org.apache.cxf.jaxws.javaee"/>
+                    <property name="propertyClassNames">
+                        <list>
+                            <value>HandlerChainType</value>
+                            <value>PortComponentHandlerType</value>
+                            <value>DisplayNameType</value>
+                            <value>IconType</value>
+                            <value>FullyQualifiedClassType</value>
+                            <value>ParamValueType</value>
+                            <value>XsdQNameType</value>
+                            <value>String</value>
+                        </list>
+                    </property>
+                </bean>
+           </list>
+        </property>
+    </bean>
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-property-editors.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/configuration/javaee_web_services_1_2.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/configuration/javaee_web_services_1_2.xsd?view=diff&rev=450934&r1=450933&r2=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/configuration/javaee_web_services_1_2.xsd (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/schemas/configuration/javaee_web_services_1_2.xsd Thu Sep 28 10:33:57 2006
@@ -3,8 +3,12 @@
 	    targetNamespace="http://java.sun.com/xml/ns/javaee"
 	    xmlns:javaee="http://java.sun.com/xml/ns/javaee"
 	    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:cfg="http://cxf.apache.org/configuration/cfg"
+            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
 	    elementFormDefault="qualified"
 	    attributeFormDefault="unqualified"
+            jaxb:extensionBindingPrefixes="cfg"
+            jaxb:version="2.0"
 	    version="1.2">
   <xsd:annotation>
     <xsd:documentation>
@@ -743,5 +747,16 @@
     <xsd:attribute name="id" type="xsd:ID"/>
   </xsd:complexType>
 
+  <xsd:element name="jaxwshandler" type="javaee:handler-chainType"/>
+  <xsd:complexType name="HandlerConfigBean">        
+    <xsd:annotation>
+      <xsd:appinfo>                
+        <cfg:configurable/>
+      </xsd:appinfo>
+    </xsd:annotation>
+    <xsd:sequence>
+      <xsd:element ref="javaee:jaxwshandler"/>
+    </xsd:sequence>
+  </xsd:complexType>
 </xsd:schema>
 

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?view=auto&rev=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java Thu Sep 28 10:33:57 2006
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxws.handler;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.MessageContext;
+
+import junit.framework.TestCase;
+
+public class AnnotationHandlerChainBuilderTest extends TestCase {
+
+    public void setUp() {
+    }
+
+    public void testFindHandlerChainAnnotation() {
+        HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
+        System.out.println(TestLogicalHandler.class.getName());
+        AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
+        List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
+        assertNotNull(handlers);
+        assertEquals(2, handlers.size());
+        assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
+        assertEquals(TestLogicalHandler.class, handlers.get(1).getClass());
+    }
+
+    public static class TestLogicalHandler implements LogicalHandler {
+        Map config;
+        boolean initCalled;
+
+        public void close(MessageContext arg0) {
+        }
+
+        public boolean handleFault(MessageContext arg0) {
+            return false;
+        }
+
+        public boolean handleMessage(MessageContext arg0) {
+            return false;
+        }
+
+        public final void init(final Map map) {
+            config = map;
+            initCalled = true;
+        }
+    }
+
+    @WebService()
+    @HandlerChain(file = "./handlers.xml", name = "TestHandlerChain")
+    public class HandlerTestImpl {
+
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java?view=auto&rev=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java Thu Sep 28 10:33:57 2006
@@ -0,0 +1,240 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxws.handler;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.MessageContext;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.jaxws.javaee.FullyQualifiedClassType;
+import org.apache.cxf.jaxws.javaee.HandlerChainType;
+import org.apache.cxf.jaxws.javaee.ParamValueType;
+import org.apache.cxf.jaxws.javaee.PortComponentHandlerType;
+import org.easymock.classextension.EasyMock;
+
+public class HandlerChainBuilderTest extends TestCase {
+
+    Handler[] allHandlers = {EasyMock.createMock(LogicalHandler.class), EasyMock.createMock(Handler.class),
+                             EasyMock.createMock(Handler.class), EasyMock.createMock(LogicalHandler.class)};
+    Handler[] logicalHandlers = {allHandlers[0], allHandlers[3]};
+    Handler[] protocolHandlers = {allHandlers[1], allHandlers[2]};
+
+    HandlerChainBuilder builder = new HandlerChainBuilder(EasyMock.createNiceMock(Bus.class));
+
+    public void setUp() {
+        builder.setHandlerInitEnabled(true);
+    }
+
+    public void testChainSorting() {
+        List<Handler> sortedHandlerChain = builder.sortHandlers(Arrays.asList(allHandlers));
+        assertSame(logicalHandlers[0], sortedHandlerChain.get(0));
+        assertSame(logicalHandlers[1], sortedHandlerChain.get(1));
+        assertSame(protocolHandlers[0], sortedHandlerChain.get(2));
+        assertSame(protocolHandlers[1], sortedHandlerChain.get(3));
+    }
+
+    public void testBuildHandlerChainFromConfiguration() {
+
+        HandlerChainType hc = createHandlerChainType();
+        List<Handler> chain = builder.buildHandlerChainFromConfiguration(hc);
+
+        assertNotNull(chain);
+        assertEquals(4, chain.size());
+        assertEquals(TestLogicalHandler.class, chain.get(0).getClass());
+        assertEquals(TestLogicalHandler.class, chain.get(1).getClass());
+        assertEquals(TestProtocolHandler.class, chain.get(2).getClass());
+        assertEquals(TestProtocolHandler.class, chain.get(3).getClass());
+
+        TestLogicalHandler tlh = (TestLogicalHandler)chain.get(0);
+        assertTrue(!tlh.initCalled);
+        assertNull(tlh.config);
+    }
+
+    public void testBuilderCallsInit() {
+        HandlerChainType hc = createHandlerChainType();
+        hc.getHandler().remove(3);
+        hc.getHandler().remove(2);
+        hc.getHandler().remove(1);
+
+        PortComponentHandlerType h = hc.getHandler().get(0);
+        List<ParamValueType> params = h.getInitParam();
+
+        ParamValueType p = new ParamValueType();
+        org.apache.cxf.jaxws.javaee.String pName = new org.apache.cxf.jaxws.javaee.String();
+        pName.setValue("foo");
+        p.setParamName(pName);
+        org.apache.cxf.jaxws.javaee.XsdStringType pValue = new org.apache.cxf.jaxws.javaee.XsdStringType();
+        pValue.setValue("1");
+        p.setParamValue(pValue);
+        params.add(p);
+
+        p = new ParamValueType();
+        pName = new org.apache.cxf.jaxws.javaee.String();
+        pName.setValue("bar");
+        p.setParamName(pName);
+        pValue = new org.apache.cxf.jaxws.javaee.XsdStringType();
+        pValue.setValue("2");
+        p.setParamValue(pValue);
+        params.add(p);
+
+        List<Handler> chain = builder.buildHandlerChainFromConfiguration(hc);
+        assertEquals(1, chain.size());
+        TestLogicalHandler tlh = (TestLogicalHandler)chain.get(0);
+
+        assertTrue(tlh.initCalled);
+        Map cfg = tlh.config;
+        assertNotNull(tlh.config);
+
+        assertEquals(2, cfg.keySet().size());
+        assertEquals("1", cfg.get("foo"));
+        assertEquals("2", cfg.get("bar"));
+    }
+
+    public void testBuilderCallsInitWithNoInitParamValues() {
+        HandlerChainType hc = createHandlerChainType();
+        hc.getHandler().remove(3);
+        hc.getHandler().remove(2);
+        hc.getHandler().remove(1);
+
+        PortComponentHandlerType h = hc.getHandler().get(0);
+        List<ParamValueType> params = h.getInitParam();
+
+        ParamValueType p = new ParamValueType();
+        org.apache.cxf.jaxws.javaee.String pName = new org.apache.cxf.jaxws.javaee.String();
+        pName.setValue("foo");
+        p.setParamName(pName);
+        params.add(p);
+
+        List<Handler> chain = builder.buildHandlerChainFromConfiguration(hc);
+        assertEquals(1, chain.size());
+        TestLogicalHandler tlh = (TestLogicalHandler)chain.get(0);
+
+        assertTrue(tlh.initCalled);
+        Map cfg = tlh.config;
+        assertNotNull(tlh.config);
+        assertEquals(1, cfg.keySet().size());
+    }
+
+    public void testBuilderCannotLoadHandlerClass() {
+        HandlerChainType hc = createHandlerChainType();
+        hc.getHandler().remove(3);
+        hc.getHandler().remove(2);
+        hc.getHandler().remove(1);
+        FullyQualifiedClassType type = new FullyQualifiedClassType();
+        type.setValue("no.such.class");
+        hc.getHandler().get(0).setHandlerClass(type);
+
+        try {
+            builder.buildHandlerChainFromConfiguration(hc);
+            fail("did not get expected exception");
+        } catch (WebServiceException ex) {
+            // ex.printStackTrace();
+            assertNotNull(ex.getCause());
+            assertEquals(ClassNotFoundException.class, ex.getCause().getClass());
+        }
+    }
+
+    private HandlerChainType createHandlerChainType() {
+        HandlerChainType hc = new HandlerChainType();
+        List<PortComponentHandlerType> handlers = hc.getHandler();
+
+        PortComponentHandlerType h = new PortComponentHandlerType();
+        org.apache.cxf.jaxws.javaee.String name = new org.apache.cxf.jaxws.javaee.String();
+        name.setValue("lh1");
+        h.setHandlerName(name);
+        FullyQualifiedClassType type = new FullyQualifiedClassType();
+        type.setValue(TestLogicalHandler.class.getName());
+        h.setHandlerClass(type);
+        handlers.add(h);
+
+        h = new PortComponentHandlerType();
+        name = new org.apache.cxf.jaxws.javaee.String();
+        name.setValue("ph1");
+        h.setHandlerName(name);
+        type = new FullyQualifiedClassType();
+        type.setValue(TestProtocolHandler.class.getName());
+        h.setHandlerClass(type);
+        handlers.add(h);
+
+        h = new PortComponentHandlerType();
+        name = new org.apache.cxf.jaxws.javaee.String();
+        name.setValue("ph2");
+        h.setHandlerName(name);
+        type = new FullyQualifiedClassType();
+        type.setValue(TestProtocolHandler.class.getName());
+        h.setHandlerClass(type);
+        handlers.add(h);
+
+        h = new PortComponentHandlerType();
+        name = new org.apache.cxf.jaxws.javaee.String();
+        name.setValue("lh2");
+        h.setHandlerName(name);
+        type = new FullyQualifiedClassType();
+        type.setValue(TestLogicalHandler.class.getName());
+        h.setHandlerClass(type);
+        handlers.add(h);
+
+        return hc;
+    }
+
+    public static class TestLogicalHandler implements LogicalHandler {
+
+        Map config;
+        boolean initCalled;
+
+        public void close(MessageContext arg0) {
+        }
+
+        public boolean handleFault(MessageContext arg0) {
+            return false;
+        }
+
+        public boolean handleMessage(MessageContext arg0) {
+            return false;
+        }
+
+        public final void init(final Map map) {
+            config = map;
+            initCalled = true;
+        }
+    }
+
+    public static class TestProtocolHandler implements Handler {
+
+        public void close(MessageContext arg0) {
+        }
+
+        public boolean handleFault(MessageContext arg0) {
+            return false;
+        }
+
+        public boolean handleMessage(MessageContext arg0) {
+            return false;
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml?view=auto&rev=450934
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml Thu Sep 28 10:33:57 2006
@@ -0,0 +1,50 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="org.apache.cxf.jaxws.javaee.HandlerConfigBean" abstract="true">
+        <property name="jaxwshandler">
+            <value>
+                <javaee:jaxwshandler>
+                    <javaee:handler>
+				<javaee:handler-name>lh1</javaee:handler-name>
+				<javaee:handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</javaee:handler-class>
+				<javaee:init-param>
+					<javaee:param-name>token</javaee:param-name>
+					<javaee:param-value>String</javaee:param-value>
+				</javaee:init-param>
+                    </javaee:handler>
+                    <javaee:handler>
+				<javaee:handler-name>lh2</javaee:handler-name>
+				<javaee:handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</javaee:handler-class>
+				<javaee:init-param>
+					<javaee:param-name>token</javaee:param-name>
+					<javaee:param-value>String</javaee:param-value>
+				</javaee:init-param>
+                    </javaee:handler>
+                </javaee:jaxwshandler>
+            </value>
+        </property>
+    </bean>
+    
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/handlers.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestImpl.java?view=diff&rev=450934&r1=450933&r2=450934
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestImpl.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestImpl.java Thu Sep 28 10:33:57 2006
@@ -22,7 +22,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import javax.annotation.Resource;
-import javax.jws.HandlerChain;
+//import javax.jws.HandlerChain;
 import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.handler.MessageContext;
@@ -30,15 +30,14 @@
 import org.apache.handler_test.PingException;
 import org.apache.handler_test.types.PingFaultDetails;
 
-@WebService(serviceName = "HandlerTestService", 
-            portName = "SoapPort", 
-            endpointInterface = "org.apache.handler_test.HandlerTest", 
+@WebService(serviceName = "HandlerTestService",
+            portName = "SoapPort",
+            endpointInterface = "org.apache.handler_test.HandlerTest",
             targetNamespace = "http://apache.org/handler_test")
-@HandlerChain(file = "./handlers.xml", name = "TestHandlerChain")
 public class HandlerTestImpl implements HandlerTest {
 
-    private WebServiceContext context; 
-        
+    private WebServiceContext context;
+
     public final List<String> ping() {
 
         try {
@@ -51,40 +50,40 @@
         } catch (Exception e) {
             e.printStackTrace();
 
-        } 
+        }
         return null;
     }
 
     public final void pingOneWay() {
-    } 
+    }
 
     public final List<String> pingWithArgs(String handlerCommand) throws PingException {
 
-        List<String> ret = new ArrayList<String>(); 
-        ret.add(handlerCommand); 
+        List<String> ret = new ArrayList<String>();
+        ret.add(handlerCommand);
         //ret.addAll(getHandlersInfo(context.getMessageContext()));
 
         if (handlerCommand.contains("throw exception")) {
-            PingFaultDetails details = new PingFaultDetails(); 
+            PingFaultDetails details = new PingFaultDetails();
             details.setDetail(ret.toString());
-            throw new PingException("from servant", details); 
+            throw new PingException("from servant", details);
         }
 
         return ret;
-    } 
+    }
 
 
-    @Resource public void setWebServiceContext(WebServiceContext ctx) { 
+    @Resource public void setWebServiceContext(WebServiceContext ctx) {
         context = ctx;
     }
 
     @SuppressWarnings("unchecked")
-    private List<String> getHandlersInfo(MessageContext ctx) { 
-        List<String> ret = (List<String>)ctx.get("handler.info"); 
+    private List<String> getHandlersInfo(MessageContext ctx) {
+        List<String> ret = (List<String>)ctx.get("handler.info");
         if (ret == null) {
-            ret = new ArrayList<String>(); 
+            ret = new ArrayList<String>();
         }
         return ret;
-    } 
+    }
 
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers.xml?view=diff&rev=450934&r1=450933&r2=450934
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers.xml (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers.xml Thu Sep 28 10:33:57 2006
@@ -1,4 +1,5 @@
- <!--
+<?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
@@ -16,35 +17,34 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<handler-config> 
-  <handler-chain> 
-    <handler-chain-name>TestHandlerChain</handler-chain-name> 
-    <handler> 
-      <handler-name>Handler1</handler-name> 
-      <handler-class>org.apache.cxf.systest.handlers.TestHandler</handler-class> 
-    </handler> 
-    <handler> 
-      <handler-name>Handler2</handler-name> 
-      <handler-class>org.apache.cxf.systest.handlers.TestHandler</handler-class> 
-    </handler> 
-    <handler> 
-      <handler-name>ProtocolHandler1</handler-name> 
-      <handler-class>org.apache.cxf.systest.handlers.TestSOAPHandler</handler-class> 
-    </handler> 
-    <handler> 
-      <handler-name>ProtocolHandler2</handler-name> 
-      <handler-class>org.apache.cxf.systest.handlers.TestSOAPHandler</handler-class> 
-    </handler> 
-    <handler> 
-      <handler-name>StreamHandler1</handler-name> 
-      <handler-class>org.apache.cxf.systest.handlers.TestStreamHandler</handler-class> 
-    </handler> 
-  </handler-chain> 
-  <handler-chain>
-     <handler-chain-name>SingleHandlerChain</handler-chain-name> 
-     <handler> 
-      <handler-name>SingleHandler</handler-name> 
-      <handler-class>org.apache.cxf.systest.handlers.TestHandler</handler-class> 
-    </handler> 
-  </handler-chain>	  
-</handler-config> 
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="org.apache.cxf.jaxws.javaee.HandlerConfigBean" abstract="true">
+        <property name="jaxwshandler">
+            <value>
+                <javaee:jaxwshandler>
+                    <javaee:handler>
+				<javaee:handler-name>lh1</javaee:handler-name>
+				<javaee:handler-class>org.apache.cxf.systest.handlers.TestSOAPHandler</javaee:handler-class>
+				<javaee:init-param>
+					<javaee:param-name>token</javaee:param-name>
+					<javaee:param-value>String</javaee:param-value>
+				</javaee:init-param>
+                    </javaee:handler>
+                    <javaee:handler>
+				<javaee:handler-name>lh2</javaee:handler-name>
+				<javaee:handler-class>org.apache.cxf.systest.handlers.TestSOAPHandler</javaee:handler-class>
+				<javaee:init-param>
+					<javaee:param-name>token</javaee:param-name>
+					<javaee:param-value>String</javaee:param-value>
+				</javaee:init-param>
+                    </javaee:handler>
+                </javaee:jaxwshandler>
+            </value>
+        </property>
+    </bean>
+    
+</beans>
\ No newline at end of file



Mime
View raw message