You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2007/07/25 10:48:46 UTC

svn commit: r559358 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ rt/frontend/simple/src/main/java/org/apache/cxf...

Author: ffang
Date: Wed Jul 25 01:48:45 2007
New Revision: 559358

URL: http://svn.apache.org/viewvc?view=rev&rev=559358
Log:
[CXF-803] apply patch provided by Jeff Yu

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloService.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/SayHiInterface.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Test2Interceptor.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/TestInterceptor.java   (with props)
Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,32 @@
+/**
+ * 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.interceptor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface InFaultInterceptors {
+    
+    String[] interceptors();
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InFaultInterceptors.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.interceptor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface InInterceptors {
+    
+    String[] interceptors();
+    
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InInterceptors.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,32 @@
+/**
+ * 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.interceptor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface OutFaultInterceptors {
+    
+    String[] interceptors();
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutFaultInterceptors.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.interceptor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface OutInterceptors {
+    
+    String[] interceptors();
+    
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/OutInterceptors.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,127 @@
+/**
+ * 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.interceptor;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.endpoint.EndpointException;
+
+public class AnnotationInterceptors {
+    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AnnotationInterceptors.class);
+    
+    private Class<?> clazz;
+    
+    public AnnotationInterceptors(Class<?> clz) {
+        clazz = clz;
+    }
+    
+    public List<Interceptor> getInFaultInterceptors() throws EndpointException {
+        return getInterceptors(InFaultInterceptors.class);
+    }
+    
+    @SuppressWarnings (value = "unchecked")
+    private List<Interceptor> getInterceptors(Class clz) throws EndpointException {
+        Annotation  annotation = clazz.getAnnotation(clz);
+        if (annotation != null) {
+            return initializeInterceptors(getInterceptorNames(annotation));
+        } else {
+            WebService ws = clazz.getAnnotation(WebService.class);
+            if (ws != null && !StringUtils.isEmpty(ws.endpointInterface())) {
+                String seiClassName = ws.endpointInterface().trim();
+                Class seiClass = null;
+                try {
+                    seiClass = ClassLoaderUtils.loadClass(seiClassName, this.getClass());
+                } catch (ClassNotFoundException e) {
+                    throw new RuntimeException("couldnt find class :" + seiClass, e);
+                }
+                annotation = seiClass.getAnnotation(clz);
+                if (annotation != null) {
+                    return initializeInterceptors(getInterceptorNames(annotation));
+                }
+            }           
+        }
+        return new ArrayList<Interceptor>();
+    }
+    
+    private String[] getInterceptorNames(Annotation ann) {
+        if (ann instanceof InFaultInterceptors) {
+            return ((InFaultInterceptors)ann).interceptors();
+        } else if (ann instanceof InInterceptors) {
+            return ((InInterceptors)ann).interceptors();
+        } else if (ann instanceof OutFaultInterceptors) {
+            return ((OutFaultInterceptors)ann).interceptors();
+        } else if (ann instanceof OutInterceptors) {
+            return ((OutInterceptors)ann).interceptors();
+        }
+        throw new UnsupportedOperationException("Doesn't support other annotation for interceptor: " + ann);
+    }
+    
+    
+    private List<Interceptor> initializeInterceptors(String[] interceptors) throws EndpointException {
+        List<Interceptor> theInterceptors = new ArrayList<Interceptor>();
+        if (interceptors != null && interceptors.length > 0) {
+            for (String interceptorName : interceptors) {
+                Interceptor interceptor = null;
+                try {
+                    interceptor = (Interceptor)ClassLoaderUtils.loadClass(interceptorName, 
+                                                                          this.getClass()).newInstance();
+                } catch (ClassNotFoundException e) {
+                    throw new EndpointException(new Message("COULD_NOT_CREATE_ANNOTATION_INTERCEPOTR", 
+                                                    BUNDLE, interceptorName), e);
+                } catch (InstantiationException ie) {
+                    throw new EndpointException(new Message("COULD_NOT_CREATE_ANNOTATION_INTERCEPOTR", 
+                                                    BUNDLE, interceptorName), ie);
+                } catch (IllegalAccessException iae) {
+                    throw new EndpointException(new Message("COULD_NOT_CREATE_ANNOTATION_INTERCEPOTR", 
+                                                    BUNDLE, interceptorName), iae);
+                }
+                if (interceptor != null) {
+                    theInterceptors.add(interceptor);
+                }
+            }
+        }
+        return theInterceptors;
+    }
+
+
+    public List<Interceptor> getInInterceptors() throws EndpointException {
+        return getInterceptors(InInterceptors.class);
+    }
+
+    public List<Interceptor> getOutFaultInterceptors() throws EndpointException {
+        return getInterceptors(OutFaultInterceptors.class);
+    }
+
+
+    public List<Interceptor> getOutInterceptors() throws EndpointException {
+        return getInterceptors(OutInterceptors.class);
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties?view=diff&rev=559358&r1=559357&r2=559358
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties Wed Jul 25 01:48:45 2007
@@ -32,4 +32,5 @@
 WRITE_ATTACHMENTS=Could not write attachments.
 INVOKE_FAULT_INFO=Couldn't invoke getFaultInfo method.
 NO_FAULT_INFO_METHOD=Custom faults need a getFaultInfo method.
-NO_ACCCESS_FAULT_INFO=Couldn't access getFaultInfo method.
\ No newline at end of file
+NO_ACCCESS_FAULT_INFO=Couldn't access getFaultInfo method.
+COULD_NOT_CREATE_ANNOTATION_INTERCEPOTR=Could not create annotation interceptor: {0}
\ No newline at end of file

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,217 @@
+/**
+ * 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.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxws.AbstractJaxWsTest;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AnnotationInterceptorTest extends AbstractJaxWsTest {
+     
+    private ServerFactoryBean fb;
+    
+    private JaxWsServerFactoryBean jfb;
+    
+    @Before
+    public void setUp() {
+        fb = new ServerFactoryBean();
+        fb.setAddress("http://localhost");
+        fb.setBus(getBus());
+        
+        jfb = new JaxWsServerFactoryBean();
+        jfb.setAddress("http://localhost");
+        jfb.setBus(getBus());
+    }
+    
+    @Test
+    public void testSimpleFrontend() throws Exception {
+        fb.setServiceClass(HelloService.class);        
+        HelloService hello = new HelloServiceImpl();
+        fb.setServiceBean(hello);
+        fb.create();
+        
+        List<Interceptor> interceptors = fb.getServer().getEndpoint().getInInterceptors();
+        assertTrue(hasTestInterceptor(interceptors));
+    }
+    
+    @Test
+    public void testSimpleFrontendWithNoInterceptor() throws Exception {
+        fb.setServiceClass(HelloService.class);        
+        HelloService hello = new HelloServiceImplNoAnnotation();
+        fb.setServiceBean(hello);
+        fb.create();
+        
+        List<Interceptor> interceptors = fb.getServer().getEndpoint().getInInterceptors();
+        assertFalse(hasTestInterceptor(interceptors));
+    }
+    
+    
+    @Test
+    public void testJaxwsFrontendWithNoInterceptor() throws Exception {
+        jfb.setServiceClass(SayHi.class);
+        jfb.setServiceBean(new SayHiNoInterceptor());
+        
+        jfb.create();
+        List<Interceptor> interceptors = jfb.getServer().getEndpoint().getInInterceptors();
+        assertFalse(hasTestInterceptor(interceptors));
+    }
+    
+    @Test
+    public void testJaxwsFrontendWithImpl() throws Exception {
+        jfb.setServiceClass(SayHi.class);
+        SayHi implementor = new SayHiImplementation();
+        jfb.setServiceBean(implementor);
+        
+        jfb.create();
+        List<Interceptor> interceptors = jfb.getServer().getEndpoint().getInInterceptors();
+        assertTrue(hasTestInterceptor(interceptors));
+    }
+    
+    @Test
+    public void testJaxWsFrontendWithInterceptorInSEI() throws Exception {
+        jfb.setServiceClass(SayHiInterface.class);
+        jfb.setServiceBean(new SayHiInterfaceImpl());
+        jfb.create();
+        
+        List<Interceptor> interceptors = jfb.getServer().getEndpoint().getInInterceptors();
+        assertTrue(hasTestInterceptor(interceptors));
+    }
+    
+    @Test
+    public void testJaxWsFrontend() throws Exception {
+        jfb.setServiceClass(SayHiInterface.class);
+        jfb.setServiceBean(new SayHiInterfaceImpl2());
+        jfb.create();
+        
+        List<Interceptor> interceptors = jfb.getServer().getEndpoint().getInInterceptors();
+        assertFalse(hasTestInterceptor(interceptors));
+        assertTrue(hasTest2Interceptor(interceptors));
+    }
+    
+    
+    private boolean hasTestInterceptor(List<Interceptor> interceptors) {
+        boolean flag = false;
+        for (Interceptor it : interceptors) {
+            if (it instanceof TestInterceptor) {
+                flag = true;
+            }
+        }
+        return flag;
+    }
+    
+    private boolean hasTest2Interceptor(List<Interceptor> interceptors) {
+        boolean flag = false;
+        for (Interceptor it : interceptors) {
+            if (it instanceof Test2Interceptor) {
+                flag = true;
+            }
+        }
+        return flag;
+    }
+    
+    @InInterceptors(interceptors = "org.apache.cxf.jaxws.service.TestInterceptor")
+    public class HelloServiceImpl implements HelloService {
+        public String sayHi() {
+            return "HI";
+        }
+    }
+    
+    public class HelloServiceImplNoAnnotation implements HelloService {
+        public String sayHi() {
+            return "HI";
+        }
+    }
+    
+    @WebService(serviceName = "SayHiService", 
+                portName = "HelloPort",
+                targetNamespace = "http://mynamespace.com/",
+                endpointInterface = "org.apache.cxf.jaxws.service.SayHi")
+    @InInterceptors (interceptors = {"org.apache.cxf.jaxws.service.TestInterceptor" })
+    public class SayHiImplementation implements SayHi {
+        public long sayHi(long arg) {
+            return arg;
+        }
+        public void greetMe() {
+            
+        }
+        public String[] getStringArray(String[] strs) {
+            String[] strings = new String[2];
+            strings[0] = "Hello" + strs[0];
+            strings[1] = "Bonjour" + strs[1];
+            return strings;
+        }
+        public List<String> getStringList(List<String> list) {
+            List<String> ret = new ArrayList<String>();
+            ret.add("Hello" + list.get(0));
+            ret.add("Bonjour" + list.get(1));
+            return ret;
+        }        
+    }
+    
+    @WebService(serviceName = "SayHiService", 
+                portName = "HelloPort",
+                targetNamespace = "http://mynamespace.com/",
+                endpointInterface = "org.apache.cxf.jaxws.service.SayHi")
+    public class SayHiNoInterceptor implements SayHi {
+        public long sayHi(long arg) {
+            return arg;
+        }
+        public void greetMe() {
+            
+        }
+        public String[] getStringArray(String[] strs) {
+            String[] strings = new String[2];
+            strings[0] = "Hello" + strs[0];
+            strings[1] = "Bonjour" + strs[1];
+            return strings;
+        }
+        public List<String> getStringList(List<String> list) {
+            List<String> ret = new ArrayList<String>();
+            ret.add("Hello" + list.get(0));
+            ret.add("Bonjour" + list.get(1));
+            return ret;
+        }        
+    }
+    
+    @WebService(endpointInterface = "org.apache.cxf.jaxws.service.SayHiInterface")
+    public class SayHiInterfaceImpl implements SayHiInterface {
+        public String sayHi(String s) {
+            return "HI";
+        } 
+    }
+    
+    @WebService(endpointInterface = "org.apache.cxf.jaxws.service.SayHiInterface")
+    @InInterceptors (interceptors = "org.apache.cxf.jaxws.service.Test2Interceptor")
+    public class SayHiInterfaceImpl2 implements SayHiInterface {
+        public String sayHi(String s) {
+            return "HI";
+        } 
+    }
+    
+    
+}

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

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloService.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloService.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloService.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,23 @@
+/**
+ * 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.service;
+
+public interface HelloService {
+    String sayHi();
+}

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

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/SayHiInterface.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/SayHiInterface.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/SayHiInterface.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/SayHiInterface.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxws.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.cxf.interceptor.InInterceptors;
+
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
+@WebService(name = "Hello", targetNamespace = "http://mynamespace.com/")
+@InInterceptors (interceptors = "org.apache.cxf.jaxws.service.TestInterceptor")
+public interface SayHiInterface {
+
+    @WebMethod(operationName = "sayHi", exclude = false)
+    String sayHi(String s);
+}

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

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Test2Interceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Test2Interceptor.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Test2Interceptor.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Test2Interceptor.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.service;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class Test2Interceptor extends AbstractPhaseInterceptor {
+
+    public Test2Interceptor() {
+        super(Phase.SEND);
+    }
+    
+    public void handleMessage(Message message) {
+        System.out.println("Handle Message in Test2Interceptor");
+    }
+        
+}

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

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/TestInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/TestInterceptor.java?view=auto&rev=559358
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/TestInterceptor.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/TestInterceptor.java Wed Jul 25 01:48:45 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.service;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class TestInterceptor extends AbstractPhaseInterceptor {
+
+    public TestInterceptor() {
+        super(Phase.SEND);
+    }
+    
+    public void handleMessage(Message message) {
+        System.out.println("Handle Message in TestInterceptor");
+    }
+        
+}

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

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

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?view=diff&rev=559358&r1=559357&r2=559358
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Wed Jul 25 01:48:45 2007
@@ -26,7 +26,6 @@
 import java.util.logging.Logger;
 
 import javax.xml.transform.dom.DOMSource;
-
 import org.w3c.dom.Document;
 
 import org.apache.cxf.BusException;
@@ -40,6 +39,7 @@
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.AnnotationInterceptors;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.resource.URIResolver;
@@ -48,6 +48,7 @@
 import org.apache.cxf.service.invoker.BeanInvoker;
 import org.apache.cxf.service.invoker.Invoker;
 
+
 /**
  * This class helps take a {@link org.apache.cxf.service.Service} and 
  * expose as a server side endpoint.
@@ -118,6 +119,10 @@
                 ep.getService().setInvoker(invoker);
             }
             
+            if (getServiceBean() != null) {
+                initializeAnnotationInterceptors(ep);
+            }
+            
             if (start) {
                 server.start();
             }
@@ -190,6 +195,35 @@
                 ((JAXBDataBinding)dataBinding).setExtraClass(extraClass);
             }
         }
+    }
+    
+    protected void initializeAnnotationInterceptors(Endpoint ep) throws EndpointException {
+        Object implementor = getServiceBean();
+        if (initializeAnnotationInterceptors(ep, implementor.getClass())) {
+            LOG.fine("added annotation based interceptors");
+        }
+    }
+    
+    protected boolean initializeAnnotationInterceptors(Endpoint ep, Class<?> clazz) throws EndpointException {
+        boolean hasAnnotation = false;
+        AnnotationInterceptors provider = new AnnotationInterceptors(clazz);
+        if (provider.getInFaultInterceptors().size() > 0) {
+            ep.getInFaultInterceptors().addAll(provider.getInFaultInterceptors());
+            hasAnnotation = true;
+        }
+        if (provider.getInInterceptors().size() > 0) {
+            ep.getInInterceptors().addAll(provider.getInInterceptors());
+            hasAnnotation = true;
+        }
+        if (provider.getOutFaultInterceptors().size() > 0) {
+            ep.getOutFaultInterceptors().addAll(provider.getOutFaultInterceptors());
+            hasAnnotation = true;
+        }
+        if (provider.getOutInterceptors().size() > 0) {
+            ep.getOutInterceptors().addAll(provider.getOutInterceptors());
+            hasAnnotation = true;
+        }
+        return hasAnnotation;
     }
     
     protected Invoker createInvoker() {



Re: svn commit: r559358 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ rt/frontend/simple/src/main/java/org/apache/cxf...

Posted by "Jeff.Yu" <je...@iona.com>.
Hi, Glen

Thanks for your comments, I will update it accordingly in the next 
patch, since I will add another annotation: @Feature.

Thanks
Jeff Yu


Glen Mazza wrote:
> Am Mittwoch, den 25.07.2007, 08:48 +0000 schrieb ffang@apache.org:
>
>   
>> Author: ffang
>> Date: Wed Jul 25 01:48:45 2007
>> New Revision: 559358
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=559358
>> Log:
>> [CXF-803] apply patch provided by Jeff Yu
>>
>> Added:
>> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java
>> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java?view=auto&rev=559358
>> ==============================================================================
>> --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java (added)
>> +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java Wed Jul 25 01:48:45 2007
>> @@ -0,0 +1,127 @@
>> +/**
>> +
>> +package org.apache.cxf.interceptor;
>> +
>> +import java.lang.annotation.Annotation;
>> +import java.util.ArrayList;
>> +import java.util.List;
>> +import java.util.ResourceBundle;
>> +
>> +import javax.jws.WebService;
>> +
>> +import org.apache.cxf.common.classloader.ClassLoaderUtils;
>> +import org.apache.cxf.common.i18n.BundleUtils;
>> +import org.apache.cxf.common.i18n.Message;
>> +import org.apache.cxf.common.util.StringUtils;
>> +import org.apache.cxf.endpoint.EndpointException;
>> +
>> +public class AnnotationInterceptors {
>> +    
>> +    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AnnotationInterceptors.class);
>> +    
>> +    private Class<?> clazz;
>> +    
>> +    public AnnotationInterceptors(Class<?> clz) {
>> +        clazz = clz;
>> +    }
>> +    
>> +    public List<Interceptor> getInFaultInterceptors() throws EndpointException {
>> +        return getInterceptors(InFaultInterceptors.class);
>> +    }
>> +    
>> +    @SuppressWarnings (value = "unchecked")
>> +    private List<Interceptor> getInterceptors(Class clz) throws EndpointException {
>> +        Annotation  annotation = clazz.getAnnotation(clz);
>> +        if (annotation != null) {
>> +            return initializeInterceptors(getInterceptorNames(annotation));
>> +        } else {
>>     
>
> Here, annotation = null means there are no annotations of "clz"
> interceptor type tied to the "clazz".  Standard, easy to understand.
>
>
>   
>> +            WebService ws = clazz.getAnnotation(WebService.class);
>> +            if (ws != null && !StringUtils.isEmpty(ws.endpointInterface())) {
>> +                String seiClassName = ws.endpointInterface().trim();
>> +                Class seiClass = null;
>> +                try {
>> +                    seiClass = ClassLoaderUtils.loadClass(seiClassName, this.getClass());
>> +                } catch (ClassNotFoundException e) {
>> +                    throw new RuntimeException("couldnt find class :" + seiClass, e);
>> +                }
>> +                annotation = seiClass.getAnnotation(clz);
>> +                if (annotation != null) {
>> +                    return initializeInterceptors(getInterceptorNames(annotation));
>> +                }
>> +            }           
>> +        }
>> +        return new ArrayList<Interceptor>();
>> +    }
>>     
>
>
> Here, we aren't using "null" but an empty list to signify this.
> Is this new list going to be used anywhere, if it is empty (i.e., will
> items be further added to this list downstream?)  If not, I think it
> would be faster and more robust to just return "null" in this case
> instead of creating empty items.  (This would also need to be changed in
> initializeInterceptors()--just return a null instead of an empty list.)
>
>
>
>   
>> Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
>> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?view=diff&rev=559358&r1=559357&r2=559358
>> ==============================================================================
>> --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original)
>> +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Wed Jul 25 01:48:45 2007
>>     
>
>   
>> +    
>> +    protected boolean initializeAnnotationInterceptors(Endpoint ep, Class<?> clazz) throws EndpointException {
>> +        boolean hasAnnotation = false;
>> +        AnnotationInterceptors provider = new AnnotationInterceptors(clazz);
>> +        if (provider.getInFaultInterceptors().size() > 0) {
>> +            ep.getInFaultInterceptors().addAll(provider.getInFaultInterceptors());
>> +            hasAnnotation = true;
>> +        }
>> +        if (provider.getInInterceptors().size() > 0) {
>> +
>> ep.getInInterceptors().addAll(provider.getInInterceptors());
>> +            hasAnnotation = true;
>> +        }
>> +        if (provider.getOutFaultInterceptors().size() > 0) {
>> +
>> ep.getOutFaultInterceptors().addAll(provider.getOutFaultInterceptors());
>> +            hasAnnotation = true;
>> +        }
>> +        if (provider.getOutInterceptors().size() > 0) {
>> +
>> ep.getOutInterceptors().addAll(provider.getOutInterceptors());
>> +            hasAnnotation = true;
>> +        }
>> +        return hasAnnotation;
>>      } 
>>     
>
> With this change, the ifs above would simplify to:  
> if (provider.getXXXXInterceptors()) { }
>
> Regards,
> Glen
>
>
>   

Re: svn commit: r559358 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ rt/frontend/simple/src/main/java/org/apache/cxf...

Posted by Glen Mazza <gl...@verizon.net>.
Am Mittwoch, den 25.07.2007, 08:48 +0000 schrieb ffang@apache.org:

> Author: ffang
> Date: Wed Jul 25 01:48:45 2007
> New Revision: 559358
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=559358
> Log:
> [CXF-803] apply patch provided by Jeff Yu
> 
> Added:
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java?view=auto&rev=559358
> ==============================================================================
> --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java (added)
> +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java Wed Jul 25 01:48:45 2007
> @@ -0,0 +1,127 @@
> +/**
> +
> +package org.apache.cxf.interceptor;
> +
> +import java.lang.annotation.Annotation;
> +import java.util.ArrayList;
> +import java.util.List;
> +import java.util.ResourceBundle;
> +
> +import javax.jws.WebService;
> +
> +import org.apache.cxf.common.classloader.ClassLoaderUtils;
> +import org.apache.cxf.common.i18n.BundleUtils;
> +import org.apache.cxf.common.i18n.Message;
> +import org.apache.cxf.common.util.StringUtils;
> +import org.apache.cxf.endpoint.EndpointException;
> +
> +public class AnnotationInterceptors {
> +    
> +    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AnnotationInterceptors.class);
> +    
> +    private Class<?> clazz;
> +    
> +    public AnnotationInterceptors(Class<?> clz) {
> +        clazz = clz;
> +    }
> +    
> +    public List<Interceptor> getInFaultInterceptors() throws EndpointException {
> +        return getInterceptors(InFaultInterceptors.class);
> +    }
> +    
> +    @SuppressWarnings (value = "unchecked")
> +    private List<Interceptor> getInterceptors(Class clz) throws EndpointException {
> +        Annotation  annotation = clazz.getAnnotation(clz);
> +        if (annotation != null) {
> +            return initializeInterceptors(getInterceptorNames(annotation));
> +        } else {

Here, annotation = null means there are no annotations of "clz"
interceptor type tied to the "clazz".  Standard, easy to understand.


> +            WebService ws = clazz.getAnnotation(WebService.class);
> +            if (ws != null && !StringUtils.isEmpty(ws.endpointInterface())) {
> +                String seiClassName = ws.endpointInterface().trim();
> +                Class seiClass = null;
> +                try {
> +                    seiClass = ClassLoaderUtils.loadClass(seiClassName, this.getClass());
> +                } catch (ClassNotFoundException e) {
> +                    throw new RuntimeException("couldnt find class :" + seiClass, e);
> +                }
> +                annotation = seiClass.getAnnotation(clz);
> +                if (annotation != null) {
> +                    return initializeInterceptors(getInterceptorNames(annotation));
> +                }
> +            }           
> +        }
> +        return new ArrayList<Interceptor>();
> +    }


Here, we aren't using "null" but an empty list to signify this.
Is this new list going to be used anywhere, if it is empty (i.e., will
items be further added to this list downstream?)  If not, I think it
would be faster and more robust to just return "null" in this case
instead of creating empty items.  (This would also need to be changed in
initializeInterceptors()--just return a null instead of an empty list.)



> Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?view=diff&rev=559358&r1=559357&r2=559358
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original)
> +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Wed Jul 25 01:48:45 2007

> +    
> +    protected boolean initializeAnnotationInterceptors(Endpoint ep, Class<?> clazz) throws EndpointException {
> +        boolean hasAnnotation = false;
> +        AnnotationInterceptors provider = new AnnotationInterceptors(clazz);
> +        if (provider.getInFaultInterceptors().size() > 0) {
> +            ep.getInFaultInterceptors().addAll(provider.getInFaultInterceptors());
> +            hasAnnotation = true;
> +        }
> +        if (provider.getInInterceptors().size() > 0) {
> +
> ep.getInInterceptors().addAll(provider.getInInterceptors());
> +            hasAnnotation = true;
> +        }
> +        if (provider.getOutFaultInterceptors().size() > 0) {
> +
> ep.getOutFaultInterceptors().addAll(provider.getOutFaultInterceptors());
> +            hasAnnotation = true;
> +        }
> +        if (provider.getOutInterceptors().size() > 0) {
> +
> ep.getOutInterceptors().addAll(provider.getOutInterceptors());
> +            hasAnnotation = true;
> +        }
> +        return hasAnnotation;
>      } 

With this change, the ifs above would simplify to:  
if (provider.getXXXXInterceptors()) { }

Regards,
Glen