I ended up answering your original message before reading this message, which explains better what you want to do. It seems to me the only thing you've missing is how to look up a service dynamically: you can inject ObjectLocator to do that.

On Mon, 23 Sep 2013 11:55:30 -0300, Martin Kersten <martin.kersten...@gmail.com> wrote:

This is design by contract Tapestry itself is all about :). And sure it is
OOP and typesafe (the invoker ensures this).
The only thing that it wont be is compile time safe and refactoring safe
(well yes it is safe to a good extend).

It will be used for internal use so it is quite good.
The values come from the registry. I just mimic the way tapestry use method
invocation all along the whole process
and I want this to happen with my tasks also, since I dont want to write
pages to do tasks. That would explode my
page count literaly. Barry has his point but I want to schedule tasks
directly and not access to pages that might
show up in public available logs where one can extract critical
information. (we want to use a external monitor web service).


Cheers,

Martin (Kersten)


2013/9/23 Dmitry Gusev <dmitry.gu...@gmail.com>

This is very strange approach... not object-oriented and not type-safe,
refactoring-safe also.
Where would a caller take values for those arguments?


On Mon, Sep 23, 2013 at 3:57 PM, Martin Kersten <
martin.kersten...@gmail.com
> wrote:

> Hi Lance,
>
>    I saw this in the user guide lately. What I want is something like
> @AfterRender, @BeforeRender etc. I want to invoke a method (per name
> constraints for example) and provide some objects to inject on top of the
> registery and the dependencies the registery is able to inject itself
> should be automatically added.
>
> Think about this:
>
> interface MyRunnable<T> {
>      //T invoke(Object...arguments);
> }
>
> class Task implements MyRunnable<Boolean> {
>      Boolean invoke(@Inject Session session, @Inject Service service,
> String jsonConfig, long timeout);
> }
>
> final long TIMEOUT = TIME_60_MINUTES;
> Invoker.invoke("invoke", task, "{'config':{'value':10,
> 'value2':'string'}}", TIMEOUT);
>
>
> Thats kind of what I am looking for.
>
>
> Cheers,
>
> Martin (Kersten)
>
>
> 2013/9/23 Dmitry Gusev <dmitry.gu...@gmail.com>
>
> > Didn't know about @PostInjecton, thanks for sharing.
> >
> >
> > On Mon, Sep 23, 2013 at 3:19 PM, Lance Java <lance.j...@googlemail.com
> > >wrote:
> >
> > > Methods marked with @PostInjection will be called after your
> constructor.
> > > The method params will be injected.
> > >
> > >
> > >
> >
>
http://tapestry.apache.org/tapestry5/apidocs//org/apache/tapestry5/ioc/annotations/PostInjection.html
> > >
> > > Eg
> > > public class MyServiceImpl implements MyService {
> > >    public MyServiceImpl(Dependency1 s1, Dependency2 d2) {
> > >       // set
> > >    }
> > >
> > >    @PostInjection
> > >    public cleanupThread(PerthreadManager perthreadManager) {
> > >       perthreadManager.addThreadCleanupListener(…);
> > >    }
> > > }
> > >
> >
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>



--
Dmitry Gusev

AnjLab Team
http://anjlab.com



--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to