You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by fmaylinch <fe...@gmail.com> on 2012/03/19 18:37:45 UTC

Service creation listener?

Hello,

We would like to add a service creation observer so this "master" service is
be notified every time a service is created. We would like to do it together
with an annotation (let's say @Metric) so every time a @Metric service is
created, the master service calls its methods from time to time to obtain
metrics (like number of users, consumed space, opened connections, etc.)

Is there any way to do it in Tapestry? How can we intercept service
instantiation?

Thank you very much,

Ferran

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Service-creation-listener-tp5577764p5577764.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Service creation listener?

Posted by fmaylinch <fe...@gmail.com>.
Thank you Thiago.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Service-creation-listener-tp5577764p5578450.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Service creation listener?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
> On the other hand, I guess you can use Tapestry-IoC service advice to  
> implement this.

I should have been more specific: you can add an advice to be applied for  
all services. Your advice would need to advise all methods and check  
whether it's the first time a method was invoked on it. You can also use  
service decoration. In this case, the method that creates a decorator will  
be invoked for every service instance created by Tapestry-IoC.

Regarding annotations, Tapestry-IoC 5.3.2, as far as I know, doesn't copy  
annotations from service implementations classes nor methods to their  
proxies (Tapestry-IoC creates proxies for all interface-defined services)  
anymore. This would be another JIRA and it'll have my vote. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Service creation listener?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 19 Mar 2012 14:37:45 -0300, fmaylinch <fe...@gmail.com>  
wrote:

> Hello,

Hi!

> Is there any way to do it in Tapestry? How can we intercept service
> instantiation?

I don't think Tapestry-IoC does. Feel free to post a JIRA about this.

On the other hand, I guess you can use Tapestry-IoC service advice to  
implement this.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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