You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eli Doran <el...@elidoran.com> on 2013/05/27 19:50:44 UTC

Tapestry IoC: @Startup with ordering constraint

I like the simplicity of using the @Startup annotation compared to the
startup contribution method.

However, it doesn't have the ability to order its execution as in the
contribution method.

It seems it would be a simple thing to accept the ordering constraint in
the annotation like:

> @Startup("before:SomeOtherStartupOperation")


What do you all think?

Re: Tapestry IoC: @Startup with ordering constraint

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
You can always post a JIRA asking for that.


On Thu, May 30, 2013 at 12:56 PM, Eli Doran <el...@elidoran.com> wrote:

> I am not using Tapestry web framework (which means I'd have everything in
> my App's module, and its submodules, to keep it all together.) This means
> the "other startup methods" are in other modules.
>
> I work with a lot of modules which run together in different combinations.
> They contribute to the startup chain with things they need to run at
> startup. Occasionally, a module relies on another module and needs to run
> after it. I use the ordering constraint in the contribution method for the
> startup chain so I can organize them.
>
> Accepting the ordering constraint in the @Startup annotation would be a
> nicety. It would also make it consistent with the functionality of the
> contribution method.
>
>
>
> On Tue, May 28, 2013 at 10:32 AM, Michael Gentry <mgentry@masslight.net
> >wrote:
>
> > Hi Eli,
> >
> > This would be clever, but you can always have a single @Startup method
> that
> > then calls all of your other startup methods in the order you want.  In
> > some ways, I think this is easier to read/understand.  The startup order
> is
> > clearly defined in a single spot instead of having to go decipher all
> > "before:" and "after:" modifiers on other methods.
> >
> > mrg
> >
> >
> >
> > On Mon, May 27, 2013 at 1:50 PM, Eli Doran <el...@elidoran.com> wrote:
> >
> > > I like the simplicity of using the @Startup annotation compared to the
> > > startup contribution method.
> > >
> > > However, it doesn't have the ability to order its execution as in the
> > > contribution method.
> > >
> > > It seems it would be a simple thing to accept the ordering constraint
> in
> > > the annotation like:
> > >
> > > > @Startup("before:SomeOtherStartupOperation")
> > >
> > >
> > > What do you all think?
> > >
> >
>



-- 
Thiago

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Eli Doran <el...@elidoran.com>.
I see what you mean Denis, thank you.



On Fri, May 31, 2013 at 10:21 AM, Denis Stepanov
<de...@gmail.com>wrote:

> I have tried to push exactly same idea but wasn't successful.
>
> https://issues.apache.org/jira/browse/TAP5-1842
>
> Denis
>
> May 31, 2013 v 4:16 PM, Eli Doran <el...@elidoran.com>:
>
> > There's already a @ServiceId annotation to specify the ID.  This isn't a
> > "service" exactly, it's close enough.
> >
> >
> > On Fri, May 31, 2013 at 10:12 AM, Lance Java <lance.java@googlemail.com
> >wrote:
> >
> >> Perhaps a new annotation is required
> >>
> >> @OrderedStartup(id="doEarly", constraints="before:*")
> >> public static void doStuff() { … }
> >>
> >> @OrderedStartup(id="doStuff")
> >> public static void doStuff() { … }
> >>
> >> @OrderedStartup(id="doMoreStuff", constraints="after:doStuff")
> >> public static void doMoreStuff() { … }
> >> On 31 May 2013 14:50, "Lance Java" <la...@googlemail.com> wrote:
> >>
> >>> I'm not sure this would work. OrderedConfiguration requires that every
> >>> entry has a unique id and @Startup does not require an id. I guess you
> >>> could use ModuleClass.methodName for the default id but it's messy.
> >>>
> >>
>
>

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Denis Stepanov <de...@gmail.com>.
I have tried to push exactly same idea but wasn't successful.

https://issues.apache.org/jira/browse/TAP5-1842

Denis

May 31, 2013 v 4:16 PM, Eli Doran <el...@elidoran.com>:

> There's already a @ServiceId annotation to specify the ID.  This isn't a
> "service" exactly, it's close enough.
> 
> 
> On Fri, May 31, 2013 at 10:12 AM, Lance Java <la...@googlemail.com>wrote:
> 
>> Perhaps a new annotation is required
>> 
>> @OrderedStartup(id="doEarly", constraints="before:*")
>> public static void doStuff() { … }
>> 
>> @OrderedStartup(id="doStuff")
>> public static void doStuff() { … }
>> 
>> @OrderedStartup(id="doMoreStuff", constraints="after:doStuff")
>> public static void doMoreStuff() { … }
>> On 31 May 2013 14:50, "Lance Java" <la...@googlemail.com> wrote:
>> 
>>> I'm not sure this would work. OrderedConfiguration requires that every
>>> entry has a unique id and @Startup does not require an id. I guess you
>>> could use ModuleClass.methodName for the default id but it's messy.
>>> 
>> 


Re: Tapestry IoC: @Startup with ordering constraint

Posted by Eli Doran <el...@elidoran.com>.
There's already a @ServiceId annotation to specify the ID.  This isn't a
"service" exactly, it's close enough.


On Fri, May 31, 2013 at 10:12 AM, Lance Java <la...@googlemail.com>wrote:

> Perhaps a new annotation is required
>
> @OrderedStartup(id="doEarly", constraints="before:*")
> public static void doStuff() { … }
>
> @OrderedStartup(id="doStuff")
> public static void doStuff() { … }
>
> @OrderedStartup(id="doMoreStuff", constraints="after:doStuff")
> public static void doMoreStuff() { … }
> On 31 May 2013 14:50, "Lance Java" <la...@googlemail.com> wrote:
>
> > I'm not sure this would work. OrderedConfiguration requires that every
> > entry has a unique id and @Startup does not require an id. I guess you
> > could use ModuleClass.methodName for the default id but it's messy.
> >
>

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Lance Java <la...@googlemail.com>.
Perhaps a new annotation is required

@OrderedStartup(id="doEarly", constraints="before:*")
public static void doStuff() { … }

@OrderedStartup(id="doStuff")
public static void doStuff() { … }

@OrderedStartup(id="doMoreStuff", constraints="after:doStuff")
public static void doMoreStuff() { … }
On 31 May 2013 14:50, "Lance Java" <la...@googlemail.com> wrote:

> I'm not sure this would work. OrderedConfiguration requires that every
> entry has a unique id and @Startup does not require an id. I guess you
> could use ModuleClass.methodName for the default id but it's messy.
>

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Lance Java <la...@googlemail.com>.
If you derive the id from the method name, this might break backwards
compatability. I'm guessing there are a lot of startup methods called
startup()

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Eli Doran <el...@elidoran.com>.
Yeah, like with builder methods which use the name after "build" as the
Service ID.

For example, to have the ID "SomeTask":

> @Startup("before:SomeOtherOne")
> public void startupSomeTask() { }




On Fri, May 31, 2013 at 9:50 AM, Lance Java <la...@googlemail.com>wrote:

> I'm not sure this would work. OrderedConfiguration requires that every
> entry has a unique id and @Startup does not require an id. I guess you
> could use ModuleClass.methodName for the default id but it's messy.
>

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Lance Java <la...@googlemail.com>.
I'm not sure this would work. OrderedConfiguration requires that every
entry has a unique id and @Startup does not require an id. I guess you
could use ModuleClass.methodName for the default id but it's messy.

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Eli Doran <el...@elidoran.com>.
I am not using Tapestry web framework (which means I'd have everything in
my App's module, and its submodules, to keep it all together.) This means
the "other startup methods" are in other modules.

I work with a lot of modules which run together in different combinations.
They contribute to the startup chain with things they need to run at
startup. Occasionally, a module relies on another module and needs to run
after it. I use the ordering constraint in the contribution method for the
startup chain so I can organize them.

Accepting the ordering constraint in the @Startup annotation would be a
nicety. It would also make it consistent with the functionality of the
contribution method.



On Tue, May 28, 2013 at 10:32 AM, Michael Gentry <mg...@masslight.net>wrote:

> Hi Eli,
>
> This would be clever, but you can always have a single @Startup method that
> then calls all of your other startup methods in the order you want.  In
> some ways, I think this is easier to read/understand.  The startup order is
> clearly defined in a single spot instead of having to go decipher all
> "before:" and "after:" modifiers on other methods.
>
> mrg
>
>
>
> On Mon, May 27, 2013 at 1:50 PM, Eli Doran <el...@elidoran.com> wrote:
>
> > I like the simplicity of using the @Startup annotation compared to the
> > startup contribution method.
> >
> > However, it doesn't have the ability to order its execution as in the
> > contribution method.
> >
> > It seems it would be a simple thing to accept the ordering constraint in
> > the annotation like:
> >
> > > @Startup("before:SomeOtherStartupOperation")
> >
> >
> > What do you all think?
> >
>

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Michael Gentry <mg...@masslight.net>.
Hi Eli,

This would be clever, but you can always have a single @Startup method that
then calls all of your other startup methods in the order you want.  In
some ways, I think this is easier to read/understand.  The startup order is
clearly defined in a single spot instead of having to go decipher all
"before:" and "after:" modifiers on other methods.

mrg



On Mon, May 27, 2013 at 1:50 PM, Eli Doran <el...@elidoran.com> wrote:

> I like the simplicity of using the @Startup annotation compared to the
> startup contribution method.
>
> However, it doesn't have the ability to order its execution as in the
> contribution method.
>
> It seems it would be a simple thing to accept the ordering constraint in
> the annotation like:
>
> > @Startup("before:SomeOtherStartupOperation")
>
>
> What do you all think?
>

Re: Tapestry IoC: @Startup with ordering constraint

Posted by Dusko Jovanovski <du...@gmail.com>.
+1


On Mon, May 27, 2013 at 7:50 PM, Eli Doran <el...@elidoran.com> wrote:

> I like the simplicity of using the @Startup annotation compared to the
> startup contribution method.
>
> However, it doesn't have the ability to order its execution as in the
> contribution method.
>
> It seems it would be a simple thing to accept the ordering constraint in
> the annotation like:
>
> > @Startup("before:SomeOtherStartupOperation")
>
>
> What do you all think?
>