cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1100016 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/
Date Fri, 06 May 2011 01:24:11 GMT
Author: dkulp
Date: Fri May  6 01:24:11 2011
New Revision: 1100016

URL: http://svn.apache.org/viewvc?rev=1100016&view=rev
Log:
[CXF-3492] Attempt to fix issues of exposing a strange proxied object
representing an OSGi service.
Patch from  David Metcalf heavily modified and extended in an attempt to
make it work for both him and our unit tests.

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java?rev=1100016&r1=1100015&r2=1100016&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
Fri May  6 01:24:11 2011
@@ -55,7 +55,7 @@ class SpringAopClassHelper extends Class
     }
 
     protected Class getRealClassInternal(Object o) {
-        if (AopUtils.isAopProxy(o)) {
+        if (AopUtils.isAopProxy(o) && (o instanceof Advised)) {
             Advised advised = (Advised)o;
             try {
                 TargetSource targetSource = advised.getTargetSource();

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java?rev=1100016&r1=1100015&r2=1100016&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java Fri
May  6 01:24:11 2011
@@ -221,12 +221,18 @@ public abstract class AbstractEndpointFa
         }
         return false;
     }
-    
     /**
-     * Add annotationed Interceptors and Features to the Endpoint
+     * Add annotated Interceptors and Features to the Endpoint
      * @param ep
      */
     protected void initializeAnnotationInterceptors(Endpoint ep, Class<?> cls) {
+        initializeAnnotationInterceptors(ep, new Class<?>[] {cls});
+    }
+    /**
+     * 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");

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=1100016&r1=1100015&r2=1100016&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
Fri May  6 01:24:11 2011
@@ -94,15 +94,25 @@ public class JaxWsServerFactoryBean exte
      * Add annotated Interceptors and Features to the Endpoint
      * @param ep
      */
-    protected void initializeAnnotationInterceptors(Endpoint ep, Class<?> cls) {
+    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);
+            boolean found = false;
+            for (Class<?> c : cls) {
+                if (c.equals(seiClass)) {
+                    found = true;
+                }
+            }
+            if (!found) {
+                Class<?> cls2[] = new Class<?>[cls.length + 1];
+                System.arraycopy(cls, 0, cls2, 0, cls.length);
+                cls2[cls.length] = seiClass;
+                cls = cls2;
+            }
         }
+        
+        AnnotationInterceptors provider = new AnnotationInterceptors(cls);
         initializeAnnotationInterceptors(provider, ep);
     }      
     

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=1100016&r1=1100015&r2=1100016&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Fri May  6 01:24:11 2011
@@ -175,21 +175,28 @@ public class ServerFactoryBean extends A
             } catch (IOException e) {
                 throw new ServiceConstructionException(e);
             }
-    
+            
             if (serviceBean != null) {
-                initializeAnnotationInterceptors(server.getEndpoint(),
-                                                 ClassHelper.getRealClass(getServiceBean()));
+                Class<?> cls = ClassHelper.getRealClass(getServiceBean());
+                if (getServiceClass() == null || cls.equals(getServiceClass())) {
+                    initializeAnnotationInterceptors(server.getEndpoint(), cls);
+                } else {
+                    initializeAnnotationInterceptors(server.getEndpoint(), cls, getServiceClass());
+                }
             } else if (getServiceClass() != null) {
                 initializeAnnotationInterceptors(server.getEndpoint(), getServiceClass());
             }
     
             applyFeatures();
-    
+   
             getServiceFactory().sendEvent(FactoryBeanListener.Event.SERVER_CREATED, server,
serviceBean,
                                           serviceBean == null 
                                           ? getServiceClass() == null 
-                                              ? getServiceFactory().getServiceClass() : getServiceClass()
-                                              : ClassHelper.getRealClass(getServiceBean()));
+                                              ? getServiceFactory().getServiceClass() 
+                                              : getServiceClass()
+                                          : getServiceClass() == null
+                                              ? ClassHelper.getRealClass(getServiceBean())

+                                              : getServiceClass());
             
             if (start) {
                 server.start();



Mime
View raw message