Hi

It would be great if you created a JIRA ticket for this change, and
explained it a bit more what this change is fixing.
Its not obvious for all people what/why this is needed.


On Sat, Oct 15, 2011 at 3:25 AM,  <dk...@apache.org> wrote:
> Author: dkulp
> Date: Sat Oct 15 01:25:12 2011
> New Revision: 1183577
>
> URL: http://svn.apache.org/viewvc?rev=1183577&view=rev
> Log:
> Update to remove the part types "up front" instead of per request.
>
> Removed:
>    
> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java
> Modified:
>    
> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
>
> Modified: 
> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
> URL: 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java?rev=1183577&r1=1183576&r2=1183577&view=diff
> ==============================================================================
> --- 
> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
>  (original)
> +++ 
> camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
>  Sat Oct 15 01:25:12 2011
> @@ -19,12 +19,18 @@ package org.apache.camel.component.cxf.f
>  import java.util.ArrayList;
>  import java.util.Collection;
>
> +import javax.xml.transform.Source;
> +
>  import 
> org.apache.camel.component.cxf.interceptors.ConfigureDocLitWrapperInterceptor;
> -import 
> org.apache.camel.component.cxf.interceptors.RemoveClassTypeInterceptor;
>  import org.apache.cxf.Bus;
> +import org.apache.cxf.binding.Binding;
>  import org.apache.cxf.endpoint.Client;
>  import org.apache.cxf.endpoint.Server;
>  import org.apache.cxf.interceptor.ClientFaultConverter;
> +import org.apache.cxf.service.model.BindingMessageInfo;
> +import org.apache.cxf.service.model.BindingOperationInfo;
> +import org.apache.cxf.service.model.MessageInfo;
> +import org.apache.cxf.service.model.MessagePartInfo;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
>
> @@ -45,20 +51,58 @@ public class PayLoadDataFormatFeature ex
>     public void initialize(Client client, Bus bus) {
>         removeFaultInInterceptorFromClient(client);
>         client.getEndpoint().getBinding().getInInterceptors().add(new 
> ConfigureDocLitWrapperInterceptor(true));
> -        client.getEndpoint().getBinding().getInInterceptors().add(new 
> RemoveClassTypeInterceptor());
> +        resetPartTypes(client.getEndpoint().getBinding());
>     }
>
> +
>     @Override
>     public void initialize(Server server, Bus bus) {
>         server.getEndpoint().getBinding().getInInterceptors().add(new 
> ConfigureDocLitWrapperInterceptor(true));
> -        server.getEndpoint().getBinding().getInInterceptors().add(new 
> RemoveClassTypeInterceptor());
> +        resetPartTypes(server.getEndpoint().getBinding());
>     }
>
>     @Override
>     protected Logger getLogger() {
>         return LOG;
>     }
> +
> +    private void resetPartTypes(Binding bop2) {
> +        for (BindingOperationInfo bop : 
> bop2.getBindingInfo().getOperations()) {
> +            resetPartTypes(bop);
> +        }
> +    }
>
> +    private void resetPartTypes(BindingOperationInfo bop) {
> +        if (bop.isUnwrapped()) {
> +            bop = bop.getWrappedOperation();
> +        }
> +        if (bop.isUnwrappedCapable()) {
> +            
> resetPartTypeClass(bop.getWrappedOperation().getOperationInfo().getInput());
> +            
> resetPartTypeClass(bop.getWrappedOperation().getOperationInfo().getOutput());
> +            resetPartTypeClass(bop.getWrappedOperation().getInput());
> +            resetPartTypeClass(bop.getWrappedOperation().getOutput());
> +        } else {
> +            resetPartTypeClass(bop.getOperationInfo().getInput());
> +            resetPartTypeClass(bop.getOperationInfo().getOutput());
> +            resetPartTypeClass(bop.getInput());
> +            resetPartTypeClass(bop.getOutput());
> +        }
> +    }
> +
> +    protected void resetPartTypeClass(BindingMessageInfo bmi) {
> +        if (bmi != null) {
> +            for (MessagePartInfo part : bmi.getMessageParts()) {
> +                part.setTypeClass(null);
> +            }
> +        }
> +    }
> +    protected void resetPartTypeClass(MessageInfo msgInfo) {
> +        if (msgInfo != null) {
> +            for (MessagePartInfo part : msgInfo.getMessageParts()) {
> +                part.setTypeClass(null);
> +            }
> +        }
> +    }
>     private void removeFaultInInterceptorFromClient(Client client) {
>         removeInterceptors(client.getInFaultInterceptors(), 
> REMOVING_FAULT_IN_INTERCEPTORS);
>         
> removeInterceptors(client.getEndpoint().getService().getInFaultInterceptors(),
>  REMOVING_FAULT_IN_INTERCEPTORS);
>
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to