cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r601130 - in /incubator/cxf/branches/2.0.x-fixes: ./ api/src/main/java/org/apache/cxf/endpoint/ distribution/src/main/release/samples/ distribution/src/main/release/samples/configuration_interceptor/ rt/core/src/main/java/org/apache/cxf/end...
Date Tue, 04 Dec 2007 22:45:08 GMT
Author: dkulp
Date: Tue Dec  4 14:45:07 2007
New Revision: 601130

URL: http://svn.apache.org/viewvc?rev=601130&view=rev
Log:
Merged revisions 601127 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r601127 | dkulp | 2007-12-04 17:37:40 -0500 (Tue, 04 Dec 2007) | 5 lines
  
  [CXF-1244, CXF-973] Fix processing of faultBeans on server side which is enough to fix CXF-1244.
 
  Add some methods to clients to help out GroovyWS and DynamicClient users.
  Add some config to one of the samples to show some of the JMX management stuff (might be
cool to  add to more of the demos)
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
    incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/common_build.xml
    incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/configuration_interceptor/server.xml
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java?rev=601130&r1=601129&r2=601130&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
Tue Dec  4 14:45:07 2007
@@ -44,6 +44,19 @@
 
     /**
      * Invokes an operation syncronously
+     * @param operationName The name of the operation to be invoked. The service namespace
will be used
+     * when looking up the BindingOperationInfo.
+     * @param unwrapped If the operation supports unwrapping, this flag tells whether the
params list
+     * is in unwrapped form (true) or wrapped form.
+     * @param params  The params that matches the parts of the input message of the operation
+     * @return The return values that matche the parts of the output message of the operation
+     */
+    Object[] invoke(String operationName,
+                    boolean unwrapped, 
+                    Object... params) throws Exception;
+    
+    /**
+     * Invokes an operation syncronously
      * @param operationName The name of the operation to be invoked
      * @param params  The params that matches the parts of the input message of the operation
      * @return The return values that matche the parts of the output message of the operation
@@ -51,6 +64,18 @@
     Object[] invoke(QName operationName,
                     Object... params) throws Exception;
 
+    /**
+     * Invokes an operation syncronously
+     * @param operationName The name of the operation to be invoked
+     * @param unwrapped If the operation supports unwrapping, this flag tells whether the
params list
+     * is in unwrapped form (true) or wrapped form.
+     * @param params  The params that matches the parts of the input message of the operation
+     * @return The return values that matche the parts of the output message of the operation
+     */
+    Object[] invoke(QName operationName,
+                    boolean unwrapped, 
+                    Object... params) throws Exception;
+    
     /**
      * Invokes an operation syncronously
      * @param oi  The operation to be invoked

Modified: incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/common_build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/common_build.xml?rev=601130&r1=601129&r2=601130&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/common_build.xml
(original)
+++ incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/common_build.xml
Tue Dec  4 14:45:07 2007
@@ -167,6 +167,7 @@
                 <arg value="@{param3}"/>
                 <arg value="@{param4}"/>
                 <arg value="@{param5}"/>
+                <jvmarg value="-Dcxf.home=${cxf.home}"/>
                 <jvmarg value="@{jvmarg1}"/>
                 <jvmarg value="@{jvmarg2}"/>
                 <jvmarg value="@{jvmarg3}"/>

Modified: incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/configuration_interceptor/server.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/configuration_interceptor/server.xml?rev=601130&r1=601129&r2=601130&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/configuration_interceptor/server.xml
(original)
+++ incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/configuration_interceptor/server.xml
Tue Dec  4 14:45:07 2007
@@ -47,5 +47,21 @@
                 <ref bean="GZIPStream"/>
             </list>
         </property-->
-    </bean> 
+    </bean>
+
+    <bean id="org.apache.cxf.management.InstrumentationManager"
+          class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
+      <property name="bus" ref="cxf" />
+      <property name="enabled" value="true"/>
+      <property name="threaded" value="false"/>
+      <property name="daemon" value="false"/>
+      <property name="JMXServiceURL"
+                value="service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi" />
+    </bean>
+
+    <bean id="org.apache.cxf.management.counters.CounterRepository"
+          class="org.apache.cxf.management.counters.CounterRepository">
+      <property name="bus" ref="cxf" />
+    </bean>
+
 </beans>

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=601130&r1=601129&r2=601130&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Tue Dec  4 14:45:07 2007
@@ -181,19 +181,25 @@
     }
 
     public Object[] invoke(String operationName, Object... params) throws Exception {
+        return invoke(operationName, true, params);
+    }
+    public Object[] invoke(String operationName, boolean unwrapped, Object... params) throws
Exception {
         QName q = new QName(getEndpoint().getService().getName().getNamespaceURI(), operationName);
        
-        return invoke(q, params);
+        return invoke(q, unwrapped, params);
     }
     
     public Object[] invoke(QName operationName, Object... params) throws Exception {
+        return invoke(operationName, true, params);
+    }
+    public Object[] invoke(QName operationName, boolean unwrapped, Object... params) throws
Exception {
         BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
         if (op == null) {
             throw new UncheckedException(
                 new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
         }
         
-        if (op.isUnwrappedCapable()) {
+        if (op.isUnwrappedCapable() && unwrapped) {
             op = op.getUnwrappedOperation();
         }
         

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java?rev=601130&r1=601129&r2=601130&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
Tue Dec  4 14:45:07 2007
@@ -30,6 +30,7 @@
 
 import org.w3c.dom.Node;
 
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -92,10 +93,8 @@
                 Method method = cause.getClass().getMethod("getFaultInfo", new Class[0]);
                 faultInfo = method.invoke(cause, new Object[0]);
             } catch (NoSuchMethodException e) {
-                faultInfo = cause;
-                LOG.fine("Using @WebFault annotated class "
-                        + faultInfo.getClass().getName() 
-                        + " as faultInfo since getFaultInfo() was not found");
+                faultInfo = createFaultInfoBean(fault, cause);
+                
             } catch (InvocationTargetException e) {
                 throw new Fault(new org.apache.cxf.common.i18n.Message("INVOCATION_TARGET_EXC",
BUNDLE), e);
             } catch (IllegalAccessException e) {
@@ -127,6 +126,52 @@
                 super.handleMessage(message);
             }
         }
+    }
+
+    private Object createFaultInfoBean(WebFault fault, Throwable cause) {
+        if (!StringUtils.isEmpty(fault.faultBean())) {
+            try {
+                Class cls = ClassLoaderUtils.loadClass(fault.faultBean(),
+                                                       cause.getClass());
+                if (cls != null) {
+                    Object ret = cls.newInstance();
+                    //copy props
+                    Method meth[] = cause.getClass().getMethods();
+                    for (Method m : meth) {
+                        if (m.getParameterTypes().length == 0
+                            && (m.getName().startsWith("get")
+                            || m.getName().startsWith("is"))) {
+                            try {
+                                Method m2 = cls.getMethod(m.getName(),
+                                                          m.getParameterTypes());
+                                String name;
+                                if (m.getName().startsWith("get")) {
+                                    name = "set" + m.getName().substring(3);
+                                } else {
+                                    name = "set" + m.getName().substring(2);
+                                }
+                                m2 = cls.getMethod(name, m.getReturnType());
+                                m2.invoke(ret, m.invoke(cause));
+                            } catch (Exception e) {
+                                //ignore
+                            }
+                        }
+                    }
+                    return ret;
+                }
+            } catch (ClassNotFoundException e1) {
+                //ignore
+            } catch (InstantiationException e) {
+                //ignore
+            } catch (IllegalAccessException e) {
+                //ignore
+            }
+        }
+
+        LOG.fine("Using @WebFault annotated class "
+                 + cause.getClass().getName() 
+                 + " as faultInfo since getFaultInfo() was not found");
+        return cause;
     }
 
     private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) {

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=601130&r1=601129&r2=601130&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Tue Dec  4 14:45:07 2007
@@ -32,10 +32,13 @@
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Service;
 import javax.xml.ws.Service.Mode;
+import javax.xml.ws.WebFault;
 
 import org.apache.cxf.binding.AbstractBindingFactory;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.databinding.source.SourceDataBinding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
@@ -302,8 +305,19 @@
         } catch (SecurityException e) {
             throw new ServiceConstructionException(e);
         } catch (NoSuchMethodException e) {
-            return super.getBeanClass(exClass);
+            //ignore for now
         }
+        WebFault fault = exClass.getAnnotation(WebFault.class);
+        if (fault != null && !StringUtils.isEmpty(fault.faultBean())) {
+            try {
+                return ClassLoaderUtils.loadClass(fault.faultBean(),
+                                                   exClass);
+            } catch (ClassNotFoundException e1) {
+                //ignore
+            }
+        }
+        
+        return super.getBeanClass(exClass);
     }
 
     /**



Mime
View raw message