You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Radek Terber <te...@b2bcentrum.cz> on 2010/01/07 13:57:33 UTC

get the service by ID and autoload services

Hi all

I have two questions about Tapestry IOC:

1) Is there any way to obtain service by it's service ID (similarly like 
Spring's getBean(String) method does)? I would like to build general 
autocomplet component which gets service ID (as String) and returns list 
of entities corresponding to given text fragment (which gets too).

2) Is there possibility to autoload services without need explicitly 
registering them? My idea is that I have package (named 
'my.app.services', for examlpe) and I wish register all classes from 
that package as services (similar action is "autoregistering" of 
entities from package 'my.app.services').

Thank for responses.


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


Re: get the service by ID and autoload services

Posted by kristjankelt <kr...@hotmail.com>.

Radek Terber-2 wrote:
> 
> 1) Is there any way to obtain service by it's service ID (similarly like 
> Spring's getBean(String) method does)? I would like to build general 
> autocomplet component which gets service ID (as String) and returns list 
> of entities corresponding to given text fragment (which gets too).
> 

I actually came to the forum for looking a answer to the same question but
your post got me thinking. 

Well, I think that you can do what you want (kind of and actually better
than your suggested way I think). 

Tapestry contains the option to contribute data to the services. This means
that you can create a registry service to what you can actually contribute
list of other services and their id's. 

So in you component (or other service) you actually inject the registry
service and then ask for specific service by a id from it.

That way you can only access the controlled list of services. This is a
advantage because the service id may come from the 0untrusted source (i.e.
database).

Regards,
Kristjan
-- 
View this message in context: http://n2.nabble.com/get-the-service-by-ID-and-autoload-services-tp4266300p4266633.html
Sent from the Tapestry Users 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: get the service by ID and autoload services

Posted by Radek Terber <te...@b2bcentrum.cz>.
Thiago H. de Paula Figueiredo napsal(a):
> Em Thu, 07 Jan 2010 10:57:33 -0200, Radek Terber 
> <te...@b2bcentrum.cz> escreveu:
>
>> Hi all
>
> Hi!
>
>> 1) Is there any way to obtain service by it's service ID (similarly 
>> like Spring's getBean(String) method does)? I would like to build 
>> general autocomplet component which gets service ID (as String) and 
>> returns list of entities corresponding to given text fragment (which 
>> gets too).
>
> You can't get a service only by its name in Tapestry-IoC.
> I just can't figure out why this would be needed for an autocomplete 
> component or mixin, specially when Tapestry already provides one (the 
> Autocomplete mixin).
I plan create "universal" client autocomplet combo with key-value pair 
(like the HTML <select> has). On server side, I would like to have one 
service which (via ajax) get other service name and method name (both 
configured in template, or eventually in normal HTML page) and text 
fragment typped by user, and it returns set of corresponding key-value 
pairs. It is often repeated use case and I think this would be usefull.
>
>> 2) Is there possibility to autoload services without need explicitly 
>> registering them?
>
> Not out of the box, but you can play with ClassNameLocatorImpl in your 
> AppModule.bind() method.
>


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


Re: get the service by ID and autoload services

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 07 Jan 2010 10:57:33 -0200, Radek Terber <te...@b2bcentrum.cz>  
escreveu:

> Hi all

Hi!

> 1) Is there any way to obtain service by it's service ID (similarly like  
> Spring's getBean(String) method does)? I would like to build general  
> autocomplet component which gets service ID (as String) and returns list  
> of entities corresponding to given text fragment (which gets too).

You can't get a service only by its name in Tapestry-IoC.
I just can't figure out why this would be needed for an autocomplete  
component or mixin, specially when Tapestry already provides one (the  
Autocomplete mixin).

> 2) Is there possibility to autoload services without need explicitly  
> registering them?

Not out of the box, but you can play with ClassNameLocatorImpl in your  
AppModule.bind() method.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, 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