You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@onami.apache.org by Jordan Zimmerman <jo...@jordanzimmerman.com> on 2013/02/25 02:36:04 UTC

More stages in Lifecycle

What do you folks think about generalizing Lifecycle to support arbitrary stages. Currently, there is AfterInjection and Dispose. Governator, for example, has Pre Configuration, Configuration, Set Resources, Post Construction, Validation and Warm Up. The "Disposer" interface could be generalized into general purpose StageContainer and could manage state changes on a object going through its lifecycle. Each stage would be associated with an Annotation.

Thoughts?

-Jordan

Re: More stages in Lifecycle

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
It might be easier if I code an example of what I'm talking about. Stay tuned...

-Jordan

On Feb 25, 2013, at 1:28 PM, Simone Tripodi <si...@apache.org> wrote:

> Hi Jordan,
> 
> thanks for your reply - I need a little more of contextualisation
> because maybe I didn't get what you mean configuring an Injectee: do
> you need to pass a Configuration object to it?
> IIUC, why you need it rather than letting Guice injects elements to
> the injectee, loading the configuration in a Module - like we did in
> [configuration]?
> Why you need to check the pre-configuration?
> 
> I am asking because I would like to understand more about your
> thoughts, if could even submit some usecases it would be super! :)
> 
> Many thanks in advance, all the best!
> -Simo
> 
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
> 
> 
> On Mon, Feb 25, 2013 at 9:52 PM, Jordan Zimmerman
> <jo...@jordanzimmerman.com> wrote:
>> As an example, in Governator, there is an @PreConfiguration annotation. This allows an instance to make changes to the configuration source before @Configuration assignments are done. Further, both of these happen before @PostConstruct methods are called.
>> 
>> I really like how the Disposer/DefaultDisposer container is designed. My thought is to generalize this to something like Stager/DefaultStager which would be a container for an object to go through stages. The user of Stager would call a method, advance(Stage stage), or something to move to the next stage. Onami users (like Governator in the future) could use this to control fine grained object lifecycle.
>> 
>> -Jordan
>> 
>> On Feb 25, 2013, at 12:23 AM, Simone Tripodi <si...@apache.org> wrote:
>> 
>>> Hi Jordan!
>>> 
>>> that is an interesting option, I kindly ask you to qualify the action
>>> associated to each phase/stage.
>>> 
>>> i.e., for configuration, we defined a dedicated `configuration`[1]
>>> module which, if used with `converters`[2], delegates to Guice the
>>> task to simply Inject & Configure elements; for validation, we also
>>> defined a dedicated module which integrates JSR303 (Bean Validation).
>>> 
>>> We are anyway open to discuss in a rounded table other options, in
>>> order to simplify Onami components adoption by more users.
>>> 
>>> TIA, all the best!
>>> -Simo
>>> 
>>> [1] http://onami.incubator.apache.org/configuration/
>>> [2] http://onami.incubator.apache.org/converters/
>>> [3] http://onami.incubator.apache.org/validation/
>>> 
>>> http://people.apache.org/~simonetripodi/
>>> http://simonetripodi.livejournal.com/
>>> http://twitter.com/simonetripodi
>>> http://www.99soft.org/
>>> 
>>> 
>>> On Mon, Feb 25, 2013 at 2:36 AM, Jordan Zimmerman
>>> <jo...@jordanzimmerman.com> wrote:
>>>> What do you folks think about generalizing Lifecycle to support arbitrary stages. Currently, there is AfterInjection and Dispose. Governator, for example, has Pre Configuration, Configuration, Set Resources, Post Construction, Validation and Warm Up. The "Disposer" interface could be generalized into general purpose StageContainer and could manage state changes on a object going through its lifecycle. Each stage would be associated with an Annotation.
>>>> 
>>>> Thoughts?
>>>> 
>>>> -Jordan
>> 


Re: More stages in Lifecycle

Posted by Simone Tripodi <si...@apache.org>.
Hi Jordan,

thanks for your reply - I need a little more of contextualisation
because maybe I didn't get what you mean configuring an Injectee: do
you need to pass a Configuration object to it?
IIUC, why you need it rather than letting Guice injects elements to
the injectee, loading the configuration in a Module - like we did in
[configuration]?
Why you need to check the pre-configuration?

I am asking because I would like to understand more about your
thoughts, if could even submit some usecases it would be super! :)

Many thanks in advance, all the best!
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Mon, Feb 25, 2013 at 9:52 PM, Jordan Zimmerman
<jo...@jordanzimmerman.com> wrote:
> As an example, in Governator, there is an @PreConfiguration annotation. This allows an instance to make changes to the configuration source before @Configuration assignments are done. Further, both of these happen before @PostConstruct methods are called.
>
> I really like how the Disposer/DefaultDisposer container is designed. My thought is to generalize this to something like Stager/DefaultStager which would be a container for an object to go through stages. The user of Stager would call a method, advance(Stage stage), or something to move to the next stage. Onami users (like Governator in the future) could use this to control fine grained object lifecycle.
>
> -Jordan
>
> On Feb 25, 2013, at 12:23 AM, Simone Tripodi <si...@apache.org> wrote:
>
>> Hi Jordan!
>>
>> that is an interesting option, I kindly ask you to qualify the action
>> associated to each phase/stage.
>>
>> i.e., for configuration, we defined a dedicated `configuration`[1]
>> module which, if used with `converters`[2], delegates to Guice the
>> task to simply Inject & Configure elements; for validation, we also
>> defined a dedicated module which integrates JSR303 (Bean Validation).
>>
>> We are anyway open to discuss in a rounded table other options, in
>> order to simplify Onami components adoption by more users.
>>
>> TIA, all the best!
>> -Simo
>>
>> [1] http://onami.incubator.apache.org/configuration/
>> [2] http://onami.incubator.apache.org/converters/
>> [3] http://onami.incubator.apache.org/validation/
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>>
>> On Mon, Feb 25, 2013 at 2:36 AM, Jordan Zimmerman
>> <jo...@jordanzimmerman.com> wrote:
>>> What do you folks think about generalizing Lifecycle to support arbitrary stages. Currently, there is AfterInjection and Dispose. Governator, for example, has Pre Configuration, Configuration, Set Resources, Post Construction, Validation and Warm Up. The "Disposer" interface could be generalized into general purpose StageContainer and could manage state changes on a object going through its lifecycle. Each stage would be associated with an Annotation.
>>>
>>> Thoughts?
>>>
>>> -Jordan
>

Re: More stages in Lifecycle

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
As an example, in Governator, there is an @PreConfiguration annotation. This allows an instance to make changes to the configuration source before @Configuration assignments are done. Further, both of these happen before @PostConstruct methods are called. 

I really like how the Disposer/DefaultDisposer container is designed. My thought is to generalize this to something like Stager/DefaultStager which would be a container for an object to go through stages. The user of Stager would call a method, advance(Stage stage), or something to move to the next stage. Onami users (like Governator in the future) could use this to control fine grained object lifecycle.

-Jordan

On Feb 25, 2013, at 12:23 AM, Simone Tripodi <si...@apache.org> wrote:

> Hi Jordan!
> 
> that is an interesting option, I kindly ask you to qualify the action
> associated to each phase/stage.
> 
> i.e., for configuration, we defined a dedicated `configuration`[1]
> module which, if used with `converters`[2], delegates to Guice the
> task to simply Inject & Configure elements; for validation, we also
> defined a dedicated module which integrates JSR303 (Bean Validation).
> 
> We are anyway open to discuss in a rounded table other options, in
> order to simplify Onami components adoption by more users.
> 
> TIA, all the best!
> -Simo
> 
> [1] http://onami.incubator.apache.org/configuration/
> [2] http://onami.incubator.apache.org/converters/
> [3] http://onami.incubator.apache.org/validation/
> 
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
> 
> 
> On Mon, Feb 25, 2013 at 2:36 AM, Jordan Zimmerman
> <jo...@jordanzimmerman.com> wrote:
>> What do you folks think about generalizing Lifecycle to support arbitrary stages. Currently, there is AfterInjection and Dispose. Governator, for example, has Pre Configuration, Configuration, Set Resources, Post Construction, Validation and Warm Up. The "Disposer" interface could be generalized into general purpose StageContainer and could manage state changes on a object going through its lifecycle. Each stage would be associated with an Annotation.
>> 
>> Thoughts?
>> 
>> -Jordan


Re: More stages in Lifecycle

Posted by Simone Tripodi <si...@apache.org>.
Hi Jordan!

that is an interesting option, I kindly ask you to qualify the action
associated to each phase/stage.

i.e., for configuration, we defined a dedicated `configuration`[1]
module which, if used with `converters`[2], delegates to Guice the
task to simply Inject & Configure elements; for validation, we also
defined a dedicated module which integrates JSR303 (Bean Validation).

We are anyway open to discuss in a rounded table other options, in
order to simplify Onami components adoption by more users.

TIA, all the best!
-Simo

[1] http://onami.incubator.apache.org/configuration/
[2] http://onami.incubator.apache.org/converters/
[3] http://onami.incubator.apache.org/validation/

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Mon, Feb 25, 2013 at 2:36 AM, Jordan Zimmerman
<jo...@jordanzimmerman.com> wrote:
> What do you folks think about generalizing Lifecycle to support arbitrary stages. Currently, there is AfterInjection and Dispose. Governator, for example, has Pre Configuration, Configuration, Set Resources, Post Construction, Validation and Warm Up. The "Disposer" interface could be generalized into general purpose StageContainer and could manage state changes on a object going through its lifecycle. Each stage would be associated with an Annotation.
>
> Thoughts?
>
> -Jordan