You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Strand <ma...@entcap.se> on 2006/01/10 15:18:47 UTC
InjectObject
Just a thought, wouldn't it be nice if InjectObject by default injected
the service with an id equal to the return type's fully qualified name?
@InjectObject
public abstract MyService getMyService();
would be the same as
@InjectObject("service:my.package.MyService")
public abstract MyService getMyService();
At least for me the type's name is equal to the service id about 99% of
the time. What do you think?.
--Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: InjectObject
Posted by Ron Piterman <rp...@gmx.net>.
No, it would be really nice if it will inject the (single) Service
defined for its return type.
so
@InjectObject
public IRequestCycle getRequestCycle()
will inject the request cycle.
it if functions for hivemind it should function for tapestry...
Cheers,
Ron
Martin Strand wrote:
> Just a thought, wouldn't it be nice if InjectObject by default injected
> the service with an id equal to the return type's fully qualified name?
>
>
> @InjectObject
> public abstract MyService getMyService();
>
> would be the same as
>
> @InjectObject("service:my.package.MyService")
> public abstract MyService getMyService();
>
>
> At least for me the type's name is equal to the service id about 99% of
> the time. What do you think?.
>
> --Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: InjectObject
Posted by bioye <bi...@yahoo.com>.
Can you expantiate on this solution with examples? I'm accessing services in
a hivemodule.xml in the tapestry-bayeux jar and my code is having trouble
locating the service!
RonPiterman wrote:
>
> Now I think both yours and mine ideas are problematic because they don't
> work in a changing services enviourenment.
> If one adds a new MyService service in a jar, say tacos, you have to
> rewrite all your @InjectObject annotations. wow.
> The same if one adds a new Service defined for a certain interface.
>
> Now what we do, which saves *much* trouble with service names is define
> a single interface for each of our "injectable" services, and add an
> "implemenets InjMyService" to the class definition.
> Thus the service name is defined twice in the whole system:
> 1. in the hivemodule.xml
> 2. in the InjMyService.
>
> Saves many problems...
>
> Cheers,
> Ron
>
>
>
> Martin Strand wrote:
>> Just a thought, wouldn't it be nice if InjectObject by default injected
>> the service with an id equal to the return type's fully qualified name?
>>
>>
>> @InjectObject
>> public abstract MyService getMyService();
>>
>> would be the same as
>>
>> @InjectObject("service:my.package.MyService")
>> public abstract MyService getMyService();
>>
>>
>> At least for me the type's name is equal to the service id about 99% of
>> the time. What do you think?.
>>
>> --Martin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/InjectObject-tp2300409p14460838.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: InjectObject
Posted by Ron Piterman <rp...@gmx.net>.
Now I think both yours and mine ideas are problematic because they don't
work in a changing services enviourenment.
If one adds a new MyService service in a jar, say tacos, you have to
rewrite all your @InjectObject annotations. wow.
The same if one adds a new Service defined for a certain interface.
Now what we do, which saves *much* trouble with service names is define
a single interface for each of our "injectable" services, and add an
"implemenets InjMyService" to the class definition.
Thus the service name is defined twice in the whole system:
1. in the hivemodule.xml
2. in the InjMyService.
Saves many problems...
Cheers,
Ron
Martin Strand wrote:
> Just a thought, wouldn't it be nice if InjectObject by default injected
> the service with an id equal to the return type's fully qualified name?
>
>
> @InjectObject
> public abstract MyService getMyService();
>
> would be the same as
>
> @InjectObject("service:my.package.MyService")
> public abstract MyService getMyService();
>
>
> At least for me the type's name is equal to the service id about 99% of
> the time. What do you think?.
>
> --Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: InjectObject
Posted by Hugo Palma <hu...@gmail.com>.
What about the namespace ? From what namespace would it look for the service
?
On 10/01/06, Martin Strand <ma...@entcap.se> wrote:
>
> Just a thought, wouldn't it be nice if InjectObject by default injected
> the service with an id equal to the return type's fully qualified name?
>
>
> @InjectObject
> public abstract MyService getMyService();
>
> would be the same as
>
> @InjectObject("service:my.package.MyService")
> public abstract MyService getMyService();
>
>
> At least for me the type's name is equal to the service id about 99% of
> the time. What do you think?.
>
> --Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: InjectObject
Posted by Martin Strand <ma...@entcap.se>.
Indeed, that would be better.
Meanwhile, I'll just inject services into an interface like Ron suggested.
Hadn't thought of that before.
On Tue, 10 Jan 2006 15:38:26 +0100, Norbert Sándor <de...@erinors.com>
wrote:
> I won't like this. @InjectObject is for injecting objects, so it
> shouldn't default to injecting a service...
>
> BUT :)
> What about a new InjectService annotation:
>
> @InjectService
> public abstract MyService getMyService();
>
> would be equivalent to
>
> (MyService)registry.getService(MyService.class)
>
> and
>
> @InjectService("mymodule.MyService")
> public abstract MyService getMyService();
>
> would be equivalent to
>
> (MyService)registry.getService("mymodule.MyService", MyService.class)
>
> I hope that I haven't reinvent the wheel :)))
>
> BR,
> Norbi
>
> ----- Original Message ----- From: "Martin Strand"
> <ma...@entcap.se>
> To: <ta...@jakarta.apache.org>
> Sent: Tuesday, January 10, 2006 3:18 PM
> Subject: InjectObject
>
>
>> Just a thought, wouldn't it be nice if InjectObject by default injected
>> the service with an id equal to the return type's fully qualified name?
>>
>>
>> @InjectObject
>> public abstract MyService getMyService();
>>
>> would be the same as
>>
>> @InjectObject("service:my.package.MyService")
>> public abstract MyService getMyService();
>>
>>
>> At least for me the type's name is equal to the service id about 99% of
>> the time. What do you think?.
>>
>> --Martin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>> -- No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.371 / Virus Database: 267.14.16/225 - Release Date: 2006.
>> 01. 09.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
tapestry.form.validator.Validators
Posted by Aj Gregory <aj...@u.washington.edu>.
The configuration point to add validators is very limited given that you
can only pass a class name to it. It would be really nice if it was
something more flexible like a service or object (like the
tapestry.portlet.resolver.PageResolvers configuration)...
Anybody tried to get around this by overriding the default
ValidatorFactory Service and adding another more flexible configuration
point? Or any other suggestions?
I know you can also use the <bean> method but I don't see the advantage
to using this when hivemind is so useful.
-Aj
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: InjectObject
Posted by Norbert Sándor <de...@erinors.com>.
I won't like this. @InjectObject is for injecting objects, so it shouldn't
default to injecting a service...
BUT :)
What about a new InjectService annotation:
@InjectService
public abstract MyService getMyService();
would be equivalent to
(MyService)registry.getService(MyService.class)
and
@InjectService("mymodule.MyService")
public abstract MyService getMyService();
would be equivalent to
(MyService)registry.getService("mymodule.MyService", MyService.class)
I hope that I haven't reinvent the wheel :)))
BR,
Norbi
----- Original Message -----
From: "Martin Strand" <ma...@entcap.se>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, January 10, 2006 3:18 PM
Subject: InjectObject
> Just a thought, wouldn't it be nice if InjectObject by default injected
> the service with an id equal to the return type's fully qualified name?
>
>
> @InjectObject
> public abstract MyService getMyService();
>
> would be the same as
>
> @InjectObject("service:my.package.MyService")
> public abstract MyService getMyService();
>
>
> At least for me the type's name is equal to the service id about 99% of
> the time. What do you think?.
>
> --Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.14.16/225 - Release Date: 2006. 01.
> 09.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org