You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by maxthesecond <ma...@yahoo.com> on 2008/05/20 21:19:15 UTC

T5 Services with diferent Implementation



I have an Interface with 2 different implementations

lets say  IMyInterface   MyImplementation1  Myimplementation2


until now I only needed to use one of the implementations at once, so in my
client code I just wrote @Inject private IMyInterface


and everithing was ok, now I'm on the need to use at the same time both
implementations 

My first idea was to write: 

binder.bind(IMyInterface.class,MyImplementation1.class).withId("Myservice1");
binder.bind(IMyInterface.class,MyImplementation2.class).withId("MyService2");

But now the question is: How I am suposed to used it from the client side( I
mean a page a component)?

@Inject MyService1?

thanks for the answer!






-- 
View this message in context: http://www.nabble.com/T5-Services-with-diferent-Implementation-tp17348534p17348534.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: T5 Services with diferent Implementation

Posted by Thiago HP <th...@gmail.com>.
On 5/20/08, Christian Edward Gruber <ch...@gmail.com> wrote:
> Wouldn't it be rather normal to create a tapestry-tx that provided
> transaction wrappers around existing services, much the way tapestry-spring
> and tapestry-hibernate do?  Especially now that there's a bit more AOP going
> on in T5.

I haven't tested the new Tapestry-IoC AOP features yet, but I think
the answer is yes. But I don't expect it to be written by Howard.
IMHO, he must focus on Tapestry-Core and Tapestry-IoC. Someone must do
that. I even started something like that, but I headed in the wrong
direction and now I'm focusing in writing some CRUD-related open
source packages for Tapestry 5. I want to release them in the next
weeks.

I don't like the way tapestry-hibernate is implemented because, AFAIK,
it violates the three-tier architecture (separation of persistence,
business rules and user interface layers). Example: using Hibernate
sessions in page classes.

-- 
Thiago

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


Re: T5 Services with diferent Implementation

Posted by Christian Edward Gruber <ch...@gmail.com>.
Wouldn't it be rather normal to create a tapestry-tx that provided  
transaction wrappers around existing services, much the way tapestry- 
spring and tapestry-hibernate do?  Especially now that there's a bit  
more AOP going on in T5.

Christian.

On 20-May-08, at 17:00 , Thiago HP wrote:

> On 5/20/08, Zheng, Xiahong <Xi...@fmr.com> wrote:
>> I would use Spring to configure the type of services you are trying  
>> to
>> provide to your pages. I am wondering if using Tapestry services  
>> has any
>> advantages in this case.
>
> 1) Tapestry-IoC has a nicer way to describe services (even compared to
> Spring's JavaConfig)
> 2) Tapestry-IoC has distributed configuration (see
> http://tapestry.apache.org/tapestry5/tapestry-ioc/configuration.html),
> Spring doesn't.
>
> The only thing that prevents me from using Tapestry-IoC for
> configuring all my applications' objects (services) is Spring's
> transaction management.
>
> -- 
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


Re: T5 Services with diferent Implementation

Posted by Thiago HP <th...@gmail.com>.
On 5/20/08, Zheng, Xiahong <Xi...@fmr.com> wrote:
> I would use Spring to configure the type of services you are trying to
>  provide to your pages. I am wondering if using Tapestry services has any
>  advantages in this case.

1) Tapestry-IoC has a nicer way to describe services (even compared to
Spring's JavaConfig)
2) Tapestry-IoC has distributed configuration (see
http://tapestry.apache.org/tapestry5/tapestry-ioc/configuration.html),
Spring doesn't.

The only thing that prevents me from using Tapestry-IoC for
configuring all my applications' objects (services) is Spring's
transaction management.

-- 
Thiago

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


RE: T5 Services with diferent Implementation

Posted by "Zheng, Xiahong" <Xi...@FMR.COM>.
I would use Spring to configure the type of services you are trying to
provide to your pages. I am wondering if using Tapestry services has any
advantages in this case. 

-----Original Message-----
From: maxthesecond [mailto:marcha64@yahoo.com] 
Sent: Tuesday, May 20, 2008 4:29 PM
To: users@tapestry.apache.org
Subject: Re: T5 Services with diferent Implementation


Bless you man!
But wouldn't it be easy if in the docs concerning services a mock
example
will bring you through all the steps needed to do a thing that at the
end is
just merely convention??

If you naively go to look after the page

http://tapestry.apache.org/tapestry5/tapestry-annotations/

and you click to this link for enlightment, then when yo click to any of
the
two links that adress you to tapestry core and tapestry ioc, allegedly
annotations, you get a beautiful  "not found".

I really apreciate your help and in general the comunity, but some rough
edges still are present in the documentation that may potentially scare
new
comers.

I apologise for the rant, but I hope you understand it is only for the
sake
of good.

So: no one can say that tapestry comunity is very responsive, but
sometimes
tapestry it's still a little bit too tricky.

Again thanks a lot.





HugoPalma wrote:
> 
> You should be using org.apache.tapestry.annotations.Service
annotation.
> 
>
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/annotat
ions/Service.html
> 
> maxthesecond wrote:
>> Almost, but now compiler doesen't know what @Service is.....
>> I've read the documents but they lack a sample of usage from the
client
>> side
>> of the service....don't know witch files I have to include (import)
>> import
>> org.apache.tapestry.ioc.annotations.??
>> thanks a lot ....just one step and I'm done!
>>
>>
>>
>> HugoPalma wrote:
>>   
>>> Try:
>>>
>>> @Inject
>>> @Service("MyService1") private IMyInterface  _CMF;
>>>
>>>
>>> Check the end of this page
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/inject.html
>>>
>>>     
>>
>>   
> 
> 

-- 
View this message in context:
http://www.nabble.com/T5-Services-with-diferent-Implementation-tp1734853
4p17350128.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


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


Re: T5 Services with diferent Implementation

Posted by maxthesecond <ma...@yahoo.com>.
Bless you man!
But wouldn't it be easy if in the docs concerning services a mock example
will bring you through all the steps needed to do a thing that at the end is
just merely convention??

If you naively go to look after the page

http://tapestry.apache.org/tapestry5/tapestry-annotations/

and you click to this link for enlightment, then when yo click to any of the
two links that adress you to tapestry core and tapestry ioc, allegedly
annotations, you get a beautiful  "not found".

I really apreciate your help and in general the comunity, but some rough
edges still are present in the documentation that may potentially scare new
comers.

I apologise for the rant, but I hope you understand it is only for the sake
of good.

So: no one can say that tapestry comunity is very responsive, but sometimes
tapestry it's still a little bit too tricky.

Again thanks a lot.





HugoPalma wrote:
> 
> You should be using org.apache.tapestry.annotations.Service annotation.
> 
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/annotations/Service.html
> 
> maxthesecond wrote:
>> Almost, but now compiler doesen't know what @Service is.....
>> I've read the documents but they lack a sample of usage from the client
>> side
>> of the service....don't know witch files I have to include (import)
>> import
>> org.apache.tapestry.ioc.annotations.??
>> thanks a lot ....just one step and I'm done!
>>
>>
>>
>> HugoPalma wrote:
>>   
>>> Try:
>>>
>>> @Inject
>>> @Service("MyService1") private IMyInterface  _CMF;
>>>
>>>
>>> Check the end of this page
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/inject.html
>>>
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/T5-Services-with-diferent-Implementation-tp17348534p17350128.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: T5 Services with diferent Implementation

Posted by Hugo Palma <hu...@gmail.com>.
You should be using org.apache.tapestry.annotations.Service annotation.

http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/annotations/Service.html

maxthesecond wrote:
> Almost, but now compiler doesen't know what @Service is.....
> I've read the documents but they lack a sample of usage from the client side
> of the service....don't know witch files I have to include (import) import
> org.apache.tapestry.ioc.annotations.??
> thanks a lot ....just one step and I'm done!
>
>
>
> HugoPalma wrote:
>   
>> Try:
>>
>> @Inject
>> @Service("MyService1") private IMyInterface  _CMF;
>>
>>
>> Check the end of this page
>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/inject.html
>>
>>     
>
>   

Re: T5 Services with diferent Implementation

Posted by maxthesecond <ma...@yahoo.com>.
Almost, but now compiler doesen't know what @Service is.....
I've read the documents but they lack a sample of usage from the client side
of the service....don't know witch files I have to include (import) import
org.apache.tapestry.ioc.annotations.??
thanks a lot ....just one step and I'm done!



HugoPalma wrote:
> 
> Try:
> 
> @Inject
> @Service("MyService1") private IMyInterface  _CMF;
> 
> 
> Check the end of this page
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/inject.html
> 

-- 
View this message in context: http://www.nabble.com/T5-Services-with-diferent-Implementation-tp17348534p17349639.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: T5 Services with diferent Implementation

Posted by Hugo Palma <hu...@gmail.com>.
Try:

@Inject
@Service("MyService1") private IMyInterface  _CMF;


Check the end of this page
http://tapestry.apache.org/tapestry5/tapestry-core/guide/inject.html

maxthesecond wrote:
> Thanks a lot
> but now I get the following compiler error: The anotation @InjectService is
> disallowed for this location.
> ??
>
> BTW the location is on a regular page class:
>
> public class TestProductDivContainer {
> 	@Inject private Logger _logger;
> 	
> 	@ApplicationState(create=true)
> 	private CMSession _CMSession;
> 	 
> 	@InjectService("MyService1") private IMyInterface  _CMF;
>
> }
> 	
> Before I have @Inject private IMyInterface _CMF;
>
>
>
>
> Kheldar666 wrote:
>   
>> @InjectService("MyService1")
>>
>>
>> maxthesecond wrote:
>>     
>>>
>>> I have an Interface with 2 different implementations
>>>
>>> lets say  IMyInterface   MyImplementation1  Myimplementation2
>>>
>>>
>>> until now I only needed to use one of the implementations at once, so in
>>> my client code I just wrote @Inject private IMyInterface
>>>
>>>
>>> and everithing was ok, now I'm on the need to use at the same time both
>>> implementations 
>>>
>>> My first idea was to write: 
>>>
>>> binder.bind(IMyInterface.class,MyImplementation1.class).withId("Myservice1");
>>> binder.bind(IMyInterface.class,MyImplementation2.class).withId("MyService2");
>>>
>>> But now the question is: How I am suposed to used it from the client
>>> side( I mean a page a component)?
>>>
>>> @Inject MyService1?
>>>
>>> thanks for the answer!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>       
>>     
>
>   

Re: T5 Services with diferent Implementation

Posted by maxthesecond <ma...@yahoo.com>.
Thanks a lot
but now I get the following compiler error: The anotation @InjectService is
disallowed for this location.
??

BTW the location is on a regular page class:

public class TestProductDivContainer {
	@Inject private Logger _logger;
	
	@ApplicationState(create=true)
	private CMSession _CMSession;
	 
	@InjectService("MyService1") private IMyInterface  _CMF;

}
	
Before I have @Inject private IMyInterface _CMF;




Kheldar666 wrote:
> 
> @InjectService("MyService1")
> 
> 
> maxthesecond wrote:
>> 
>> 
>> 
>> I have an Interface with 2 different implementations
>> 
>> lets say  IMyInterface   MyImplementation1  Myimplementation2
>> 
>> 
>> until now I only needed to use one of the implementations at once, so in
>> my client code I just wrote @Inject private IMyInterface
>> 
>> 
>> and everithing was ok, now I'm on the need to use at the same time both
>> implementations 
>> 
>> My first idea was to write: 
>> 
>> binder.bind(IMyInterface.class,MyImplementation1.class).withId("Myservice1");
>> binder.bind(IMyInterface.class,MyImplementation2.class).withId("MyService2");
>> 
>> But now the question is: How I am suposed to used it from the client
>> side( I mean a page a component)?
>> 
>> @Inject MyService1?
>> 
>> thanks for the answer!
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5-Services-with-diferent-Implementation-tp17348534p17348992.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: T5 Services with diferent Implementation

Posted by Kheldar666 <ma...@liber-mundi.org>.
@InjectService("MyService1")


maxthesecond wrote:
> 
> 
> 
> I have an Interface with 2 different implementations
> 
> lets say  IMyInterface   MyImplementation1  Myimplementation2
> 
> 
> until now I only needed to use one of the implementations at once, so in
> my client code I just wrote @Inject private IMyInterface
> 
> 
> and everithing was ok, now I'm on the need to use at the same time both
> implementations 
> 
> My first idea was to write: 
> 
> binder.bind(IMyInterface.class,MyImplementation1.class).withId("Myservice1");
> binder.bind(IMyInterface.class,MyImplementation2.class).withId("MyService2");
> 
> But now the question is: How I am suposed to used it from the client side(
> I mean a page a component)?
> 
> @Inject MyService1?
> 
> thanks for the answer!
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5-Services-with-diferent-Implementation-tp17348534p17348567.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