cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r644856 - in /incubator/cxf/trunk: common/common/ common/common/src/main/java/org/apache/cxf/common/util/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/
Date Fri, 04 Apr 2008 19:47:35 GMT
Author: dkulp
Date: Fri Apr  4 12:47:31 2008
New Revision: 644856

URL: http://svn.apache.org/viewvc?rev=644856&view=rev
Log:
[CXF-1494] Add a utility method for getting Class objects from impls that will auto-detect
use of spring aop proxies.
Flip jaxws/simple frontends to use is so "serviceClass" is no longer needed.
Sergey is going ot look into using it for jaxrs

Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java
  (with props)
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
  (with props)
Modified:
    incubator/cxf/trunk/common/common/pom.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java

Modified: incubator/cxf/trunk/common/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/pom.xml?rev=644856&r1=644855&r2=644856&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/pom.xml (original)
+++ incubator/cxf/trunk/common/common/pom.xml Fri Apr  4 12:47:31 2008
@@ -113,6 +113,14 @@
             <version>1.2.14</version>
             <optional>true</optional>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+            <version>${spring.version}</version>
+            <optional>provided</optional>
+        </dependency>
+
         
         <dependency>
             <groupId>org.codehaus.woodstox</groupId>

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java?rev=644856&view=auto
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java
(added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java
Fri Apr  4 12:47:31 2008
@@ -0,0 +1,43 @@
+/**
+ * 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.common.util;
+
+/**
+ * 
+ */
+public class ClassHelper {
+    static final ClassHelper HELPER;
+    static {
+        HELPER = new ClassHelper();
+    }
+    
+    
+    protected ClassHelper() {
+    }
+    
+    protected Class getRealClassInternal(Object o) {
+        return o.getClass();
+    }
+    
+    
+    public static Class getRealClass(Object o) {
+        return HELPER.getRealClassInternal(o);
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ClassHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java?rev=644856&view=auto
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
(added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
Fri Apr  4 12:47:31 2008
@@ -0,0 +1,38 @@
+/**
+ * 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.common.util;
+
+import org.springframework.aop.support.AopUtils;
+
+/**
+ * 
+ */
+class SpringAopClassHelper extends ClassHelper {
+    SpringAopClassHelper() throws Exception {
+        Class.forName("org.springframework.aop.support.AopUtils");
+    }
+    
+    protected Class getRealClassInternal(Object o) {
+        if (AopUtils.isAopProxy(o)) {
+            return AopUtils.getTargetClass(o);
+        } 
+        return o.getClass();
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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?rev=644856&r1=644855&r2=644856&view=diff
==============================================================================
--- 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
Fri Apr  4 12:47:31 2008
@@ -44,6 +44,7 @@
 import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
 import org.apache.cxf.configuration.Configurable;
 import org.apache.cxf.configuration.Configurer;
@@ -165,7 +166,7 @@
      * @return the class of the implementor object
      */
     public Class getImplementorClass() {
-        return implementorClass != null ? implementorClass : implementor.getClass();
+        return implementorClass != null ? implementorClass : ClassHelper.getRealClass(implementor);
     }
 
     public List<Source> getMetadata() {

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?rev=644856&r1=644855&r2=644856&view=diff
==============================================================================
--- 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 Apr  4 12:47:31 2008
@@ -31,6 +31,7 @@
 import org.apache.cxf.BusException;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.databinding.AbstractDataBinding;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Endpoint;
@@ -102,7 +103,7 @@
         try {
             applyExtraClass();
             if (serviceBean != null && getServiceClass() == null) {
-                setServiceClass(serviceBean.getClass());
+                setServiceClass(ClassHelper.getRealClass(serviceBean));
             }
             if (invoker != null) {
                 getServiceFactory().setInvoker(invoker);
@@ -136,7 +137,8 @@
         }
         
         if (serviceBean != null) {
-            initializeAnnotationInterceptors(server.getEndpoint(), this.getServiceBean().getClass());
+            initializeAnnotationInterceptors(server.getEndpoint(),
+                                             ClassHelper.getRealClass(getServiceBean()));
         } else if (getServiceClass() != null) {
             initializeAnnotationInterceptors(server.getEndpoint(), getServiceClass());
         }
@@ -237,7 +239,7 @@
     
     public Class<?> getServiceBeanClass() {
         if (serviceBean != null) {
-            return serviceBean.getClass();
+            return ClassHelper.getRealClass(serviceBean);
         } else {
             return getServiceFactory().getServiceClass();
         }



Mime
View raw message