Mixing T5 and Guice --- best practices

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Mixing T5 and Guice --- best practices

Jan Vissers
Partially inspired by a question/some work by Leon Pennings (on this
list), partially because of my interest in Guice - if been trying to
test some stuff on how best to integrate Guice and T5. Before asking
whether my approach is appropriate I would like to ask what your opinion
is on the whole idea of mixing Guice and T5 IoC?



This is what I've done for the NumberGuess tutorial.

public interface IPlayGenerator {
    int generateRandomNumber();
}

public class PlayGeneratorImpl implements IPlayGenerator {
    public int generateRandomNumber() {
       Random random = new Random();
       return random.nextInt(10) + 1;
    }
}

//Guice stuff
public class PlayModule extends AbstractModule {
    @Override
    protected void configure() {
       
bind(IPlayGenerator.class).to(PlayGeneratorImpl.class).in(Scopes.SINGLETON);
    }
}

//Actual client service
public class NumberGuessPlayer {
    private final IPlayGenerator generator;

    //Guice Inject
    @Inject
    public NumberGuessPlayer(IPlayGenerator generator) {
        this.generator = generator;
    }

    public int play() {
        return generator.generateRandomNumber();
    }
}

//T5/Guice bootstrapping
public class AppModule {
    // Guice Injector instance
    private static final Injector injector;

    static {
        injector = Guice.createInjector(new Module[] { new PlayModule() });
    }

    public static NumberGuessPlayer buildNumberGuessPlayerFinder() {
        return injector.getInstance(NumberGuessPlayer.class);
    }
    ...
    ...
}

//Start page
public class Start {
    @InjectPage
    private Guess guess;

    /T5 Inject
    @Inject
    private NumberGuessPlayer player;

    Object onAction() {
       int target = player.play();

       guess.setup(target);

       return guess;
    }
}


Any comments, tips....?

-J

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Howard Lewis Ship
Seems like you'll need access to the Registry, or at least and ObjectLocator
to make them play together (allow Guice beans to be injected into Tapestry
services/components).

A contribution to MasterObjectProvider could do the job.

Haven't looked into it in detail.

On 10/29/07, Jan Vissers <[hidden email]> wrote:

>
> Partially inspired by a question/some work by Leon Pennings (on this
> list), partially because of my interest in Guice - if been trying to
> test some stuff on how best to integrate Guice and T5. Before asking
> whether my approach is appropriate I would like to ask what your opinion
> is on the whole idea of mixing Guice and T5 IoC?
>
>
>
> This is what I've done for the NumberGuess tutorial.
>
> public interface IPlayGenerator {
>     int generateRandomNumber();
> }
>
> public class PlayGeneratorImpl implements IPlayGenerator {
>     public int generateRandomNumber() {
>        Random random = new Random();
>        return random.nextInt(10) + 1;
>     }
> }
>
> //Guice stuff
> public class PlayModule extends AbstractModule {
>     @Override
>     protected void configure() {
>
> bind(IPlayGenerator.class).to(PlayGeneratorImpl.class).in(Scopes.SINGLETON
> );
>     }
> }
>
> //Actual client service
> public class NumberGuessPlayer {
>     private final IPlayGenerator generator;
>
>     //Guice Inject
>     @Inject
>     public NumberGuessPlayer(IPlayGenerator generator) {
>         this.generator = generator;
>     }
>
>     public int play() {
>         return generator.generateRandomNumber();
>     }
> }
>
> //T5/Guice bootstrapping
> public class AppModule {
>     // Guice Injector instance
>     private static final Injector injector;
>
>     static {
>         injector = Guice.createInjector(new Module[] { new PlayModule()
> });
>     }
>
>     public static NumberGuessPlayer buildNumberGuessPlayerFinder() {
>         return injector.getInstance(NumberGuessPlayer.class);
>     }
>     ...
>     ...
> }
>
> //Start page
> public class Start {
>     @InjectPage
>     private Guess guess;
>
>     /T5 Inject
>     @Inject
>     private NumberGuessPlayer player;
>
>     Object onAction() {
>        int target = player.play();
>
>        guess.setup(target);
>
>        return guess;
>     }
> }
>
>
> Any comments, tips....?
>
> -J
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind
Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Thiago H de Paula Figueiredo
In reply to this post by Jan Vissers
On Mon, 29 Oct 2007 16:28:33 -0200, Jan Vissers <[hidden email]>  
wrote:

> Partially inspired by a question/some work by Leon Pennings (on this  
> list), partially because of my interest in Guice -

What exactly makes you interested in Guice? As far as I know (but I  
haven't taken a look in Guice for some time already, so I can be wrong),  
Tapestry-IoC does (almost) everything Guice does, but better. One of the  
reasons is that T-IoC needs no annotations in your beans. :)

--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Howard Lewis Ship
Credit where credit is due: I've borrowed a lot of great ideas from Guice.
Initially, T5 IoC started as just a better HiveMind, but the influence of
Guice really pushed the envelope in a number of ways.  Guice, coming in new
and based on generics and annotations, had a large number of innovations.

We disagree on a number of crucial ideas including certain aspects of scope
and lifecycle, the need for service contributions (something none of the
other IoC containers seem to "get") ... but Guice pushes the spectrum of
finding matches based on type and annotations.

On 10/29/07, Thiago H de Paula Figueiredo <[hidden email]> wrote:

>
> On Mon, 29 Oct 2007 16:28:33 -0200, Jan Vissers <[hidden email]>
> wrote:
>
> > Partially inspired by a question/some work by Leon Pennings (on this
> > list), partially because of my interest in Guice -
>
> What exactly makes you interested in Guice? As far as I know (but I
> haven't taken a look in Guice for some time already, so I can be wrong),
> Tapestry-IoC does (almost) everything Guice does, but better. One of the
> reasons is that T-IoC needs no annotations in your beans. :)
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia
> Eteg Tecnologia da Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind
Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Jan Vissers
In reply to this post by Jan Vissers
Thanks for this quick response - however the code below is already working
in my case. This simple examples shows how to let Guice and T5 work
together - I was just looking for some thoughts on whether this is
actually a good/the best idea.


> Seems like you'll need access to the Registry, or at least and
> ObjectLocator
> to make them play together (allow Guice beans to be injected into Tapestry
> services/components).
>
> A contribution to MasterObjectProvider could do the job.
>
> Haven't looked into it in detail.
>
> On 10/29/07, Jan Vissers <[hidden email]> wrote:
>>
>> Partially inspired by a question/some work by Leon Pennings (on this
>> list), partially because of my interest in Guice - if been trying to
>> test some stuff on how best to integrate Guice and T5. Before asking
>> whether my approach is appropriate I would like to ask what your opinion
>> is on the whole idea of mixing Guice and T5 IoC?
>>
>>
>>
>> This is what I've done for the NumberGuess tutorial.
>>
>> public interface IPlayGenerator {
>>     int generateRandomNumber();
>> }
>>
>> public class PlayGeneratorImpl implements IPlayGenerator {
>>     public int generateRandomNumber() {
>>        Random random = new Random();
>>        return random.nextInt(10) + 1;
>>     }
>> }
>>
>> //Guice stuff
>> public class PlayModule extends AbstractModule {
>>     @Override
>>     protected void configure() {
>>
>> bind(IPlayGenerator.class).to(PlayGeneratorImpl.class).in(Scopes.SINGLETON
>> );
>>     }
>> }
>>
>> //Actual client service
>> public class NumberGuessPlayer {
>>     private final IPlayGenerator generator;
>>
>>     //Guice Inject
>>     @Inject
>>     public NumberGuessPlayer(IPlayGenerator generator) {
>>         this.generator = generator;
>>     }
>>
>>     public int play() {
>>         return generator.generateRandomNumber();
>>     }
>> }
>>
>> //T5/Guice bootstrapping
>> public class AppModule {
>>     // Guice Injector instance
>>     private static final Injector injector;
>>
>>     static {
>>         injector = Guice.createInjector(new Module[] { new PlayModule()
>> });
>>     }
>>
>>     public static NumberGuessPlayer buildNumberGuessPlayerFinder() {
>>         return injector.getInstance(NumberGuessPlayer.class);
>>     }
>>     ...
>>     ...
>> }
>>
>> //Start page
>> public class Start {
>>     @InjectPage
>>     private Guess guess;
>>
>>     /T5 Inject
>>     @Inject
>>     private NumberGuessPlayer player;
>>
>>     Object onAction() {
>>        int target = player.play();
>>
>>        guess.setup(target);
>>
>>        return guess;
>>     }
>> }
>>
>>
>> Any comments, tips....?
>>
>> -J
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> --
> Howard M. Lewis Ship
> Partner and Senior Architect at Feature50
>
> Creator Apache Tapestry and Apache HiveMind
>



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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Jan Vissers
In reply to this post by Jan Vissers
Exactly - and to me T5 IoC looks/is very closely related to T5 the web
application framework, whereas Guice seems more general purpose.


> Credit where credit is due: I've borrowed a lot of great ideas from Guice.
> Initially, T5 IoC started as just a better HiveMind, but the influence of
> Guice really pushed the envelope in a number of ways.  Guice, coming in
> new
> and based on generics and annotations, had a large number of innovations.
>
> We disagree on a number of crucial ideas including certain aspects of
> scope
> and lifecycle, the need for service contributions (something none of the
> other IoC containers seem to "get") ... but Guice pushes the spectrum of
> finding matches based on type and annotations.
>
> On 10/29/07, Thiago H de Paula Figueiredo <[hidden email]> wrote:
>>
>> On Mon, 29 Oct 2007 16:28:33 -0200, Jan Vissers <[hidden email]>
>> wrote:
>>
>> > Partially inspired by a question/some work by Leon Pennings (on this
>> > list), partially because of my interest in Guice -
>>
>> What exactly makes you interested in Guice? As far as I know (but I
>> haven't taken a look in Guice for some time already, so I can be wrong),
>> Tapestry-IoC does (almost) everything Guice does, but better. One of the
>> reasons is that T-IoC needs no annotations in your beans. :)
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Desenvolvedor, Instrutor e Consultor de Tecnologia
>> Eteg Tecnologia da Informação Ltda.
>> http://www.eteg.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> --
> Howard M. Lewis Ship
> Partner and Senior Architect at Feature50
>
> Creator Apache Tapestry and Apache HiveMind
>



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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Filip S. Adamsen-2
Nothing stops you from using T5 IoC in a non-T5 application, though.

-Filip

Jan Vissers skrev:
> Exactly - and to me T5 IoC looks/is very closely related to T5 the web
> application framework, whereas Guice seems more general purpose.

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Jan Vissers
In reply to this post by Jan Vissers
That's true.

To compare it would be interesting to find out how many projects out there
use Hivemind without Tapestry 4?

A different question. If I would chose to use Guice as IoC and T5 IoC
simply as a bridge into Guice - which part(s) of T5 as a web app framework
would I be unable to use?

-J




> Nothing stops you from using T5 IoC in a non-T5 application, though.
>
> -Filip
>
> Jan Vissers skrev:
>> Exactly - and to me T5 IoC looks/is very closely related to T5 the web
>> application framework, whereas Guice seems more general purpose.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

BenT
I used Hivemind without Tapestry 4 on a handful of high volume applications
at a large bank.  In fact, I came to use Tapestry after working with
Hivemind first.  Its concept of distributed configuration is quite unique
and very powerful.  Tapestry 5 IoC has the same.

Ben

On 10/29/07, Jan Vissers <[hidden email]> wrote:

>
> That's true.
>
> To compare it would be interesting to find out how many projects out there
> use Hivemind without Tapestry 4?
>
> A different question. If I would chose to use Guice as IoC and T5 IoC
> simply as a bridge into Guice - which part(s) of T5 as a web app framework
> would I be unable to use?
>
> -J
>
>
>
>
> > Nothing stops you from using T5 IoC in a non-T5 application, though.
> >
> > -Filip
> >
> > Jan Vissers skrev:
> >> Exactly - and to me T5 IoC looks/is very closely related to T5 the web
> >> application framework, whereas Guice seems more general purpose.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Alex Shneyderman
In reply to this post by Howard Lewis Ship
On 10/29/07, Howard Lewis Ship <[hidden email]> wrote:
> and lifecycle, the need for service contributions (something none of the
> other IoC containers seem to "get") ... but Guice pushes the spectrum of

Not exactly correct. They do not provide it out of the box :-( One can
do the same with
spring for example - that's what grails does - but of course tapestry
shines in the simplicity
of the setup. But I agree that contributions are a big thing and none
of the containers seem
to make it easy to contribute. Perhaps not enough Eclipse influence up
there - they are all
stuck with IDEA ? :-)

Alex.

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Jan Vissers
In reply to this post by Jan Vissers
On the why of Guice...
Not trying to offend anyone here, but maybe T5 already could have been
finished if instead of writing yet another IoC framework the choice was
made to adopt an elegant one.

https://www.blogger.com/comment.g?blogID=4110180&postID=563902125495823741

Bob Lee:

"If you want to know why Guice is so popular, the best advice I can give
is, try it. Who knows? You might decide to lobby for a couple new features
and adopt it, in which case you could spend more time on your web
framework."

Given the fact that Guice already had a major influence on T5, it is still
not quite clear to me why T5 IoC exists. But then again - I'm just a
simple developer waiting for the next great version of *the web
framework*.

-J.

> On Mon, 29 Oct 2007 16:28:33 -0200, Jan Vissers <[hidden email]>
> wrote:
>
>> Partially inspired by a question/some work by Leon Pennings (on this
>> list), partially because of my interest in Guice -
>
> What exactly makes you interested in Guice? As far as I know (but I
> haven't taken a look in Guice for some time already, so I can be wrong),
> Tapestry-IoC does (almost) everything Guice does, but better. One of the
> reasons is that T-IoC needs no annotations in your beans. :)
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia
> Eteg Tecnologia da Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Nick Westgate
This is almost a FAQ. See the older post here:
http://tapestryjava.blogspot.com/search?q=guice

Also see the "Why Not ..." sections:
http://tapestry.apache.org/tapestry5/tapestry-ioc/

Cheers,
Nick.


Jan Vissers wrote:

> On the why of Guice...
> Not trying to offend anyone here, but maybe T5 already could have been
> finished if instead of writing yet another IoC framework the choice was
> made to adopt an elegant one.
>
> https://www.blogger.com/comment.g?blogID=4110180&postID=563902125495823741
>
> Bob Lee:
>
> "If you want to know why Guice is so popular, the best advice I can give
> is, try it. Who knows? You might decide to lobby for a couple new features
> and adopt it, in which case you could spend more time on your web
> framework."
>
> Given the fact that Guice already had a major influence on T5, it is still
> not quite clear to me why T5 IoC exists. But then again - I'm just a
> simple developer waiting for the next great version of *the web
> framework*.
>
> -J.
>
>> On Mon, 29 Oct 2007 16:28:33 -0200, Jan Vissers <[hidden email]>
>> wrote:
>>
>>> Partially inspired by a question/some work by Leon Pennings (on this
>>> list), partially because of my interest in Guice -
>> What exactly makes you interested in Guice? As far as I know (but I
>> haven't taken a look in Guice for some time already, so I can be wrong),
>> Tapestry-IoC does (almost) everything Guice does, but better. One of the
>> reasons is that T-IoC needs no annotations in your beans. :)
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Desenvolvedor, Instrutor e Consultor de Tecnologia
>> Eteg Tecnologia da Informação Ltda.
>> http://www.eteg.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Nick Westgate
In reply to this post by Jan Vissers
Jan, forgot to add I know you saw this last time around. ;-)

Cheers,
Nick.


Jan Vissers wrote:
> On the why of Guice...

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Thiago H de Paula Figueiredo
In reply to this post by Jan Vissers
On Mon, 29 Oct 2007 18:52:42 -0200, Jan Vissers <[hidden email]>  
wrote:

> Exactly - and to me T5 IoC looks/is very closely related to T5 the web
> application framework, whereas Guice seems more general purpose.

I beg to differ. :) T5-IoC was made to be the Tapestry 5 IoC container,  
but it is as general purpose as any other. ;)
The only differences is that Tapestry 5-IoC is used "natively" by Tapestry  
5.

--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Thiago H de Paula Figueiredo
In reply to this post by Jan Vissers
On Mon, 29 Oct 2007 23:08:20 -0200, Jan Vissers <[hidden email]>  
wrote:
> A different question. If I would chose to use Guice as IoC and T5 IoC
> simply as a bridge into Guice - which part(s) of T5 as a web app  
> framework would I be unable to use?

AFAIK, none. Of course, Howard can answer this question better than me. :)

--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Jan Vissers
Please, please don't 'shoot' me - but if this is the case what would be
a reason for me to use T5 IoC, other that for injecting stuff into page
classes?

Thiago H de Paula Figueiredo wrote:
> On Mon, 29 Oct 2007 23:08:20 -0200, Jan Vissers
> <[hidden email]> wrote:
>> A different question. If I would chose to use Guice as IoC and T5 IoC
>> simply as a bridge into Guice - which part(s) of T5 as a web app
>> framework would I be unable to use?
>
> AFAIK, none. Of course, Howard can answer this question better than
> me. :)
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Thiago H de Paula Figueiredo
On Tue, 30 Oct 2007 14:45:26 -0200, Jan Vissers <[hidden email]>  
wrote:

> Please, please don't 'shoot' me - but if this is the case what would be  
> a reason for me to use T5 IoC, other that for injecting stuff into page  
> classes?

Don't forget Tapestry IoC is a general purpose IoC container. ;)

We won't shoot you or anybody else if you come with good arguments. :)

I couldn't figure out yet what are the features you want from the IoC  
container. If I did, I could help you more than just saying "T5 IoC  
rules!". :) And don't forget to read the "Why not X" sections in  
http://tapestry.apache.org/tapestry5/tapestry-ioc/.

--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Ognen Ivanovski-2
In reply to this post by Jan Vissers
Jan Vissers wrote:
> Please, please don't 'shoot' me - but if this is the case what would be
> a reason for me to use T5 IoC, other that for injecting stuff into page
> classes?

I think the T5 IoC is great, fast, simple and covers 80% of the things
you  need an IoC container for. Plug, allows you to override a great
many parts of tapestry which, to me, is a great value. Contributions, I
wont even mention (myself a long time RCP developer, I consider them a
must).

Furthermore, if you need a more powerful container (like spring or
something) you can always plug it in  via an ObjectProvider.

The only things that might be missed at the moment is:

  a) You can't use decorators on pages and components (you could us the
request processing chain of command, but that might not be so expressive)
  b) decoration of multiple services might not be as expressive as one
would like it to be if one would like use declarative transaction
management. Work is being done here
(http://tapestry.apache.org/tapestry5/tapestry-ioc/decorator.html see
Targetting multiple services).



--
Ognen Ivanovski | [hidden email]
phone +389 -2- 30 64 532 | fax +389 -2- 30 79 495
Netcetera | 1000 Skopje | Macedonia | http://netcetera.com.mk


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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Thiago H de Paula Figueiredo
On Wed, 31 Oct 2007 09:39:36 -0200, Ognen Ivanovski  
<[hidden email]> wrote:

>   b) decoration of multiple services might not be as expressive as one  
> would like it to be if one would like use declarative transaction  
> management. Work is being done here  
> (http://tapestry.apache.org/tapestry5/tapestry-ioc/decorator.html see  
> Targetting multiple services).

That page says:

"Note: Another idea will be other ways of matching services: base on  
inheritance of the service interface and/or based on the presence of  
particular class annotations on the service interface. None of this has  
been implemented yet, and can readily be accompllished inside the  
decorator method (which will return null if it decides the service doesn't  
need decoration)."

Well, it's not entirely true. If you write a @Match("*"), Tapestry-IoC  
throws an exception telling that you cannot decorate internal Tapestry-IoC  
services. I'll file a JIRA about this.

--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

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

Reply | Threaded
Open this post in threaded view
|

Re: Mixing T5 and Guice --- best practices

Kristian Marinkovic
In reply to this post by Ognen Ivanovski-2
pages and components can be decorated using mixins!
g,
kris




Ognen Ivanovski <[hidden email]>
Gesendet von: news <[hidden email]>
31.10.2007 12:39
Bitte antworten an
"Tapestry users" <[hidden email]>


An
[hidden email]
Kopie

Thema
Re: Mixing T5 and Guice --- best practices







Jan Vissers wrote:
> Please, please don't 'shoot' me - but if this is the case what would be
> a reason for me to use T5 IoC, other that for injecting stuff into page
> classes?

I think the T5 IoC is great, fast, simple and covers 80% of the things
you  need an IoC container for. Plug, allows you to override a great
many parts of tapestry which, to me, is a great value. Contributions, I
wont even mention (myself a long time RCP developer, I consider them a
must).

Furthermore, if you need a more powerful container (like spring or
something) you can always plug it in  via an ObjectProvider.

The only things that might be missed at the moment is:

  a) You can't use decorators on pages and components (you could us the
request processing chain of command, but that might not be so expressive)
  b) decoration of multiple services might not be as expressive as one
would like it to be if one would like use declarative transaction
management. Work is being done here
(http://tapestry.apache.org/tapestry5/tapestry-ioc/decorator.html see
Targetting multiple services).



--
Ognen Ivanovski | [hidden email]
phone +389 -2- 30 64 532 | fax +389 -2- 30 79 495
Netcetera | 1000 Skopje | Macedonia | http://netcetera.com.mk


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


12