It may, or may not be wrapped in PropertyPlaceholderDelegateRegistry,
in that case, I would try this:

        Registry registry = context.getRegistry();
        if (registry instanceof PropertyPlaceholderDelegateRegistry)
            registry =
((PropertyPlaceholderDelegateRegistry)registry).getRegistry();


Then cast to implementation-specific Registry type to access bind()
(or put) method.

(Pretty much what Donald was saying...)

On Mon, Mar 18, 2013 at 2:14 PM, Donald Whytock <[email protected]> wrote:
> On Mon, Mar 18, 2013 at 2:02 PM, Gert Villemos <[email protected]> wrote:
>> Hmmm... tried that but doesnt work.
>>
>> getContext() returns a
>> org.apache.camel.impl.PropertyPlaceholderDelegateRegistry object. Which cant
>> be cast to JndiRegistry.
>>
>> My setup is the following; In a Spring based route I have bean A. Bean As
>> @Handler will create an instance of bean B, which is a RouteBuilder, and add
>> bean B's routes to the context. Bean A thus 'starts' bean B.
>
> Apologies...I was looking at the DefaultCamelContext source and seeing
> that by default it creates a JndiRegistry.
>
> I'm assuming you meant getRegistry() above instead of getContext()?
> Such that camelContext.getRegistry() returns the
> PropertyPlaceholderDelegateRegistry?
>
> According to the current javadoc, PropertyPlaceholderDelegateRegistry
> is "A Registry which delegates to the real registry."  The object has
> its own getRegistry() method, which returns a Registry.
>
> So...I'm sorry to say this, but...have you tried
>
> JndiRegistry registry = (JndiRegistry) 
> camelContext.getRegistry().getRegistry();
>
> ?

Reply via email to