On 05/07/2010 16:32, Claus Ibsen-2 [via Camel] wrote:
> Hi
>
> Have you looked at org.apache.camel.spi.InterceptStrategy?
Looking at the code, the child Processor instance is already created, so 
I'm not sure it would be safe to change the child definitions?

Mark
>
>
> On Mon, Jul 5, 2010 at 5:00 PM, Mark Proctor <[hidden email] 
> </user/SendEmail.jtp?type=node&node=696580&i=0>> wrote:
>
> >
> > As well as using Policy to wrap the child processors, I'd like to be 
> able to
> > change/augment the child definitions before they are built. My 
> current use
> > case for this is so I can augment the DataFormats, with additional
> > configurations. Additionally this Policy also takes care of setting the
> > current context ClassLoader, but that already works fine with the 
> existing
> > Policy wrap api.
> >
> > API comptability is a problem, but as a sketch to what I'm trying to
> > achieve, here is a change that while a little clunky (due api 
> compatability)
> > should achieve the job. This allows the wrap to still call the child
> > Process, via the delegate, but to also inspect and change the child
> > Definitions prior to building.
> >
> > public interface DefinitionAwarePolicy extends Policy {
> >    Processor wrap(RouteContext routeContext,
> > ProcessorDefinition<ProcessorDefinition> processorDefinition, Processor
> > processor);
> > }
> >
> > PolicyDefinition.
> >    public Processor createProcessor(RouteContext routeContext) throws
> > Exception {
> >        DelegateProcessor childProcessor = new DelegateProcessor();
> >
> >        Policy policy = resolvePolicy(routeContext);
> >        ObjectHelper.notNull(policy, "policy", this);
> >        Processor target;
> >        if ( policy instanceof Policy ) {
> >            target = policy.wrap(routeContext, childProcessor);
> >        } else {
> >            target = ((DefinitionAwarePolicy)policy).wrap(routeContext,
> > this, childProcessor);
> >        }
> >
> >        childProcessor.setProcessor( 
> this.createChildProcessor(routeContext,
> > true) );
> >
> >        // wrap the target so it becomes a service and we can manage its
> > lifecycle
> >        WrapProcessor wrap = new WrapProcessor(target, childProcessor);
> >        return wrap;
> >    }
> > --
> > View this message in context: 
> http://camel.465427.n5.nabble.com/Using-Policy-to-alter-Definitions-before-building-tp696567p696567.html
>  
> <http://camel.465427.n5.nabble.com/Using-Policy-to-alter-Definitions-before-building-tp696567p696567.html?by-user=t>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
>
> -- 
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com 
> <http://fusesource.com?by-user=t>
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
> ------------------------------------------------------------------------
> View message @ 
> http://camel.465427.n5.nabble.com/Using-Policy-to-alter-Definitions-before-building-tp696567p696580.html
>  
>
> To unsubscribe from Using Policy to alter Definitions before building, 
> click here 
> < (link removed) ==>. 
>
>


-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Policy-to-alter-Definitions-before-building-tp696567p696584.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to