Return-Path: Delivered-To: apmail-incubator-cxf-dev-archive@locus.apache.org Received: (qmail 79853 invoked from network); 6 Aug 2007 08:20:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Aug 2007 08:20:15 -0000 Received: (qmail 64726 invoked by uid 500); 6 Aug 2007 08:20:14 -0000 Delivered-To: apmail-incubator-cxf-dev-archive@incubator.apache.org Received: (qmail 64711 invoked by uid 500); 6 Aug 2007 08:20:14 -0000 Mailing-List: contact cxf-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-dev@incubator.apache.org Received: (qmail 64702 invoked by uid 99); 6 Aug 2007 08:20:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2007 01:20:14 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jeff.yu@iona.com designates 12.170.54.180 as permitted sender) Received: from [12.170.54.180] (HELO amer-mx1.iona.com) (12.170.54.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2007 08:19:58 +0000 X-IronPort-AV: E=Sophos;i="4.19,224,1183348800"; d="scan'208";a="3934305" Received: from amer-ems1.ionaglobal.com ([10.65.6.25]) by amer-mx1.iona.com with ESMTP; 06 Aug 2007 04:19:46 -0400 Received: from [10.129.9.197] ([10.129.9.197]) by amer-ems1.IONAGLOBAL.COM with Microsoft SMTPSVC(6.0.3790.1830); Mon, 6 Aug 2007 04:19:43 -0400 Message-ID: <46B6D93C.3080105@iona.com> Date: Mon, 06 Aug 2007 16:18:04 +0800 From: "Jeff.Yu" User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: cxf-dev@incubator.apache.org Subject: Re: svn commit: r562541 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/ frontend/simple/src/main/java/org/apache/cxf/... References: <20070803183101.1A6BE1A981A@eris.apache.org> In-Reply-To: <20070803183101.1A6BE1A981A@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Aug 2007 08:19:44.0343 (UTC) FILETIME=[8B636670:01C7D802] X-Virus-Checked: Checked by ClamAV on apache.org Hi, Dan I just reviewed these changes, all seems good, but I have a question about the finding SEI class logic. With your change, we passed the SEI to the AnnotationInterceptors class instead of finding the accordingly SEI through "WebService endpointInterface" annotation's attribute, but I also found in the AnnotationInterceptorTest class, we set the ServiceImpl to the setServiceClass() method, which I thought we set the SEI class in most of cases.. I am not sure why we made this change? and with this change, we won't find the SEI class in the "Simple Frontend" scenario, I know for most of simple frontend, we won't specify the @WebService endpointInterface="...." annotation, but we can find the SEI in simple front-end with adding this annotation. Thanks Jeff dkulp@apache.org wrote: > Author: dkulp > Date: Fri Aug 3 11:30:59 2007 > New Revision: 562541 > > URL: http://svn.apache.org/viewvc?view=rev&rev=562541 > Log: > [CXF-882] Move @Feature processing stuff to AbstractFactoryBean to be shared for client and server > * Remove reference to WebService annotation from rt-core. Move to JAX-WS frontend. > > > Modified: > incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java > incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java > incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java > > Modified: 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=diff&rev=562541&r1=562540&r2=562541 > ============================================================================== > --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java (original) > +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AnnotationInterceptors.java Fri Aug 3 11:30:59 2007 > @@ -24,12 +24,9 @@ > 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.feature.AbstractFeature; > import org.apache.cxf.feature.Features; > > @@ -37,10 +34,10 @@ > > private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AnnotationInterceptors.class); > > - private Class clazz; > + private Class clazzes[]; > > - public AnnotationInterceptors(Class clz) { > - clazz = clz; > + public AnnotationInterceptors(Class ... clz) { > + clazzes = clz; > } > > public List getInFaultInterceptors() { > @@ -48,24 +45,12 @@ > } > > private List getAnnotationObject(Class annotationClazz, Class type) { > - Annotation annotation = clazz.getAnnotation(annotationClazz); > - if (annotation == null) { > - 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 Fault(new Message("COULD_NOT_FIND_SEICLASS", BUNDLE, seiClass), e); > - } > - annotation = seiClass.getAnnotation(annotationClazz); > - if (annotation != null) { > - return initializeAnnotationObjects(getAnnotationObjectNames(annotation), type); > - } > + > + for (Class cls : clazzes) { > + Annotation annotation = cls.getAnnotation(annotationClazz); > + if (annotation != null) { > + return initializeAnnotationObjects(getAnnotationObjectNames(annotation), type); > } > - } else { > - return initializeAnnotationObjects(getAnnotationObjectNames(annotation), type); > } > return null; > } > > Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java > URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?view=diff&rev=562541&r1=562540&r2=562541 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original) > +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Fri Aug 3 11:30:59 2007 > @@ -29,8 +29,10 @@ > import org.apache.cxf.binding.AbstractBindingFactory; > import org.apache.cxf.binding.soap.Soap12; > import org.apache.cxf.common.injection.ResourceInjector; > +import org.apache.cxf.endpoint.Endpoint; > import org.apache.cxf.endpoint.Server; > import org.apache.cxf.frontend.ServerFactoryBean; > +import org.apache.cxf.interceptor.AnnotationInterceptors; > import org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration; > import org.apache.cxf.jaxws.context.WebServiceContextResourceResolver; > import org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder; > @@ -70,6 +72,22 @@ > doInit = true; > } > > + /** > + * Add annotationed Interceptors and Features to the Endpoint > + * @param ep > + */ > + protected void initializeAnnotationInterceptors(Endpoint ep, Class cls) { > + Class seiClass = ((JaxWsServiceFactoryBean)getServiceFactory()) > + .getJaxWsImplementorInfo().getSEIClass(); > + AnnotationInterceptors provider; > + if (seiClass != null) { > + provider = new AnnotationInterceptors(cls, seiClass); > + } else { > + provider = new AnnotationInterceptors(cls); > + } > + initializeAnnotationInterceptors(provider, ep); > + } > + > @Override > protected Invoker createInvoker() { > return new JAXWSMethodInvoker(getServiceBean()); > > Modified: 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=diff&rev=562541&r1=562540&r2=562541 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java (original) > +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java Fri Aug 3 11:30:59 2007 > @@ -142,7 +142,7 @@ > > @Test > public void testJaxWsFrontendWithAnnotationInSEI() throws Exception { > - jfb.setServiceClass(SayHiInterface.class); > + jfb.setServiceClass(SayHiInterfaceImpl.class); > jfb.setServiceBean(new SayHiInterfaceImpl()); > jfb.create(); > > > Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java > URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=562541&r1=562540&r2=562541 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java (original) > +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java Fri Aug 3 11:30:59 2007 > @@ -42,6 +42,7 @@ > import org.apache.cxf.endpoint.EndpointImpl; > import org.apache.cxf.feature.AbstractFeature; > import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider; > +import org.apache.cxf.interceptor.AnnotationInterceptors; > import org.apache.cxf.service.Service; > import org.apache.cxf.service.factory.ReflectionServiceFactoryBean; > import org.apache.cxf.service.factory.ServiceConstructionException; > @@ -226,6 +227,43 @@ > } > service.getServiceInfos().get(0).addEndpoint(ei); > return ei; > + } > + > + /** > + * Add annotationed Interceptors and Features to the Endpoint > + * @param ep > + */ > + protected void initializeAnnotationInterceptors(Endpoint ep, Class cls) { > + AnnotationInterceptors provider = new AnnotationInterceptors(cls); > + if (initializeAnnotationInterceptors(provider, ep)) { > + LOG.fine("Added annotation based interceptors and features"); > + } > + } > + > + protected boolean initializeAnnotationInterceptors(AnnotationInterceptors provider, Endpoint ep) { > + boolean hasAnnotation = false; > + if (provider.getInFaultInterceptors() != null) { > + ep.getInFaultInterceptors().addAll(provider.getInFaultInterceptors()); > + hasAnnotation = true; > + } > + if (provider.getInInterceptors() != null) { > + ep.getInInterceptors().addAll(provider.getInInterceptors()); > + hasAnnotation = true; > + } > + if (provider.getOutFaultInterceptors() != null) { > + ep.getOutFaultInterceptors().addAll(provider.getOutFaultInterceptors()); > + hasAnnotation = true; > + } > + if (provider.getOutInterceptors() != null) { > + ep.getOutInterceptors().addAll(provider.getOutInterceptors()); > + hasAnnotation = true; > + } > + if (provider.getFeatures() != null) { > + getFeatures().addAll(provider.getFeatures()); > + hasAnnotation = true; > + } > + > + return hasAnnotation; > } > > protected BindingInfo createBindingInfo() { > > Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java > URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java?view=diff&rev=562541&r1=562540&r2=562541 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java (original) > +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java Fri Aug 3 11:30:59 2007 > @@ -50,12 +50,12 @@ > Endpoint ep = createEndpoint(); > > createClient(ep); > + initializeAnnotationInterceptors(ep, getServiceClass()); > } catch (EndpointException e) { > throw new ServiceConstructionException(e); > } catch (BusException e) { > throw new ServiceConstructionException(e); > } > - > applyFeatures(); > return client; > } > > 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=562541&r1=562540&r2=562541 > ============================================================================== > --- 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 Fri Aug 3 11:30:59 2007 > @@ -39,7 +39,6 @@ > 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; > @@ -131,7 +130,7 @@ > } > > if (getServiceBean() != null) { > - initializeAnnotationInterceptors(server.getEndpoint()); > + initializeAnnotationInterceptors(server.getEndpoint(), this.getServiceBean().getClass()); > } > > applyFeatures(); > @@ -196,42 +195,7 @@ > } > } > } > - > - /** > - * Add annotationed Interceptors and Features to the Endpoint > - * @param ep > - */ > - protected void initializeAnnotationInterceptors(Endpoint ep) { > - AnnotationInterceptors provider = new AnnotationInterceptors(getServiceBean().getClass()); > - if (initializeAnnotationInterceptors(provider, ep)) { > - LOG.fine("Added annotation based interceptors"); > - } > - if (provider.getFeatures() != null) { > - getFeatures().addAll(provider.getFeatures()); > - LOG.fine("Added annotation based features"); > - } > - } > - > - protected boolean initializeAnnotationInterceptors(AnnotationInterceptors provider, Endpoint ep) { > - boolean hasAnnotation = false; > - if (provider.getInFaultInterceptors() != null) { > - ep.getInFaultInterceptors().addAll(provider.getInFaultInterceptors()); > - hasAnnotation = true; > - } > - if (provider.getInInterceptors() != null) { > - ep.getInInterceptors().addAll(provider.getInInterceptors()); > - hasAnnotation = true; > - } > - if (provider.getOutFaultInterceptors() != null) { > - ep.getOutFaultInterceptors().addAll(provider.getOutFaultInterceptors()); > - hasAnnotation = true; > - } > - if (provider.getOutInterceptors() != null) { > - ep.getOutInterceptors().addAll(provider.getOutInterceptors()); > - hasAnnotation = true; > - } > - return hasAnnotation; > - } > + > > protected Invoker createInvoker() { > return new BeanInvoker(serviceBean); > > >