Hi Marcel,

On Fri, Nov 19, 2010 at 2:05 PM, Marcel Offermans
<[email protected]> wrote:
> Hello Bram,
>
> On 19 Nov 2010, at 13:45 , Bram de Kruijff wrote:
>
>> So I was thinking. What if Dependencymanager would allow you to
>> specify a "ComponentManager" class/object that would be responsible
>> for handling all lifecycle callbacks, configuration callbacks and
>> maybe be the factory? Actually I think this is stuff I would normally
>> put in the activator, but when using Dependencymanager you lose some
>> of this fexibility?
>
> It is already possible to use a separate instance to handle all callbacks for 
> a component. You can specify it when defining your callback methods, so:
>
> manager.add(createComponent()
>  .setImplementation(MyBusinessImpl.class)
>  .setCallbacks(new CallbackHandler(), "init", "start", /* etc... */
>
> with:
>
> class CallbackHandler {
>  public void init(Component c) {
>    // your code goes here
>  }
>  public void start(Component c) {
>    // and here, etc.
>  }
>
> Through the Component interface you gain access to the actual instance and 
> many other relevant things, and you can even use this mechanism to add more 
> dependencies, or further configure the implementation based on the 
> configuration. So essentially, you can make the callback handler into a 
> factory.

Thanks, I overlooked this signature. However, it seems only to solve
my case partially as I do not get the updated on the callback handler.
A quick look at the code seems to indicate that the
ConfigurationDependency does not consider the callbackhandler(?) I
guess if this where the case indeed this mechanism would allow me to
fully seperate business and service logic and create the factory I am
looking for.

Regards,
Bram

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to