You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Didier LAFFORGUE <di...@capgemini.com> on 2005/12/01 10:49:28 UTC

Using Hivemind in components

Hi guys,

I'm creating a new component for Tapestry 4.0 and I have a big question about hivemind and its integration in my component.
If my component uses a hivemind service, is it possible to "inject" an implementation of this service when I declare my component in a page ? In this case, my component will use only the "interface" of the service and I should declare the implementation in the hivemind.xml of my application. Is it right ?
Best regards.

 Didier


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.

Re: Using Hivemind in components

Posted by Ron Piterman <rp...@gmx.net>.
What you do is the following:
- you configure a service in hivemind, normally using an interface.
- you configure an implementation for the service, also in hivemind.
- you inject the service to the component (using the interface in the 
method signature), and hivemind creates an instance for you. The page is 
not involved.

If you want to inject different implementations of the same interface to 
different components, making the decision on the page level, use a 
normal component parameter.
Cheers,
Ron

Didier LAFFORGUE wrote:
> Hi guys,
> 
> I'm creating a new component for Tapestry 4.0 and I have a big question about hivemind and its integration in my component.
> If my component uses a hivemind service, is it possible to "inject" an implementation of this service when I declare my component in a page ? In this case, my component will use only the "interface" of the service and I should declare the implementation in the hivemind.xml of my application. Is it right ?
> Best regards.
> 
>  Didier
> 
> 
> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.
> 


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


Re: Using Hivemind in components

Posted by Didier LAFFORGUE <di...@capgemini.com>.
Ok, now, I see how to construct my component.
Thanks John and Ron !!!

Didier

----- Original Message ----- 
From: "John Coleman" <jo...@ntlworld.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, December 01, 2005 8:21 PM
Subject: Re: Using Hivemind in components


> Here is the longhand way of doing it, but in this case no interface is 
> used,
> instead the class is used directly...
>
> in Home.page xml file:
> <page-specification class="Home">
> <inject property="userServices" object="service:iomodule.UserServices"/>
> </page-specification>
>
> (you can do the above injection directly in your page class, see below)
>
> in Home.java:
>
> import container.services.business.UserServices;
>
> public abstract class Home extends BasePage {
>
> @InjectObject("service:iomodule.UserServices") // option if you use
> annotations instead?
> public abstract UserServices getUserServices(); // property with interface
> of type to inject with service from hivemind
>
> public void dosomething() {
>      getUserServices().dosomething();
> }
>
> }
>
> in hivemodule:
> <module id="iomodule" version="1.0.0">
> <service-point id="UserServices"
> interface="container.services.business.UserServices" visibility="public"/>
> <implementation service-id="UserServices">
> <invoke-factory model="threaded">
> <construct class="container.services.business.UserServices"/>
> </invoke-factory>
> </module>
>
>
> John
>
>
> ----- Original Message ----- 
> From: "Didier LAFFORGUE" <di...@capgemini.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Thursday, December 01, 2005 9:49 AM
> Subject: Using Hivemind in components
>
>
>
> Hi guys,
>
> I'm creating a new component for Tapestry 4.0 and I have a big question
> about hivemind and its integration in my component.
> If my component uses a hivemind service, is it possible to "inject" an
> implementation of this service when I declare my component in a page ? In
>
> this case, my component will use only the "interface" of the service and I
> should declare the implementation in the hivemind.xml of my application. 
> Is
> it right ?
> Best regards.
>
> Didier
>
>
> This message contains information that may be privileged or confidential 
> and
> is the property of the Capgemini Group. It is intended only for the person
> to whom it is addressed. If you are not the intended recipient,  you are 
> not
> authorized to read, print, retain, copy, disseminate,  distribute, or use
> this message or any part thereof. If you receive this  message in error,
> please notify the sender immediately and delete all  copies of this 
> message.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org 


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: Using Hivemind in components

Posted by John Coleman <jo...@ntlworld.com>.
Here is the longhand way of doing it, but in this case no interface is used,
instead the class is used directly...

in Home.page xml file:
<page-specification class="Home">
<inject property="userServices" object="service:iomodule.UserServices"/>
</page-specification>

(you can do the above injection directly in your page class, see below)

in Home.java:

import container.services.business.UserServices;

public abstract class Home extends BasePage {

@InjectObject("service:iomodule.UserServices") // option if you use
annotations instead?
 public abstract UserServices getUserServices(); // property with interface
of type to inject with service from hivemind

 public void dosomething() {
      getUserServices().dosomething();
 }

}

in hivemodule:
<module id="iomodule" version="1.0.0">
<service-point id="UserServices"
interface="container.services.business.UserServices" visibility="public"/>
<implementation service-id="UserServices">
<invoke-factory model="threaded">
<construct class="container.services.business.UserServices"/>
</invoke-factory>
</module>


John


----- Original Message ----- 
From: "Didier LAFFORGUE" <di...@capgemini.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, December 01, 2005 9:49 AM
Subject: Using Hivemind in components



Hi guys,

I'm creating a new component for Tapestry 4.0 and I have a big question
about hivemind and its integration in my component.
If my component uses a hivemind service, is it possible to "inject" an
implementation of this service when I declare my component in a page ? In
this case, my component will use only the "interface" of the service and I
should declare the implementation in the hivemind.xml of my application. Is
it right ?
Best regards.

 Didier


This message contains information that may be privileged or confidential and
is the property of the Capgemini Group. It is intended only for the person
to whom it is addressed. If you are not the intended recipient,  you are not
authorized to read, print, retain, copy, disseminate,  distribute, or use
this message or any part thereof. If you receive this  message in error,
please notify the sender immediately and delete all  copies of this message.



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