You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Simon Buettner <si...@froebus.de> on 2005/09/20 22:00:36 UTC

external use of hivemind services

Hi, 
i have my Hibernate SessionFactory installed as an application wide tapestry.state.ApplicationObjects.
How can other Objects that can not use the @Inject Annotations access this service?

The Objects are in the application, but they are not direct in a page or component.
Like a User Manager that is called in Page. I dont want to refer to the service i injected by a parameter.  

thanx 

Re: external use of hivemind services

Posted by Kent Tong <ke...@cpttm.org.mo>.
Simon Buettner <simon.buettner <at> froebus.de> writes:

> 
> Hi, 
> i have my Hibernate SessionFactory installed as an application wide
tapestry.state.ApplicationObjects.
> How can other Objects that can not use the  <at> Inject Annotations access
this service?
> 
> The Objects are in the application, but they are not direct in a page or
component.

Turn them into hivemind services. This way, when constructing the
services, use auto-wiring or use <set-service> inside <construct>.
Then inject them into your pages or components.

--
Author of a book for learning Tapestry (www.agileskills2.org/EWDT)


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


Re: external use of hivemind services

Posted by Howard Lewis Ship <hl...@gmail.com>.
The trick is to get the ApplicationStateManager object, and obtain the
state object from it.

If you have an IRequestCycle, you can invoke
getInfrastructure().getApplicationStateManager()

You can then invoke get() on the ASM, passing the name of the state object.

The @InjectState annotation is, effectively, building this code for you.

If you are building a HiveMind service, you can inject the ASM using:

<set-object name="manager" object="infrastructure:applicationStateManager"/>

On 9/20/05, Simon Buettner <si...@froebus.de> wrote:
> Hi,
> i have my Hibernate SessionFactory installed as an application wide tapestry.state.ApplicationObjects.
> How can other Objects that can not use the @Inject Annotations access this service?
>
> The Objects are in the application, but they are not direct in a page or component.
> Like a User Manager that is called in Page. I dont want to refer to the service i injected by a parameter.
>
> thanx
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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