You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Eric Cuendet <je...@rptec.ch> on 2006/02/15 00:10:14 UTC

Accessing State Objects from a Service

Hi,
I have a service implementing a IEngineService declared in hivemind. I 
would like to access my SessionData object from this Service.
Is it possible? ow?
Thanks
-jec

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


Re: Accessing State Objects from a Service

Posted by Raul Raja Martinez <do...@estudiowebs.com>.
Actually forget about the hivemodule.xml markup, just include in your 
EngineService:


private ApplicationStateManager appStateManager;

public void setAppStateManager(ApplicationStateManager manager) {
  appStateManager = manager;
}


the ApplicationStateManager will get autowired thanks to hivemind magic 
via setter based Injection. You can inject any service providing a 
setter and declaring the service interface as a parameter.

best regards.

Raul.


Raul Raja Martinez wrote:
> Hi Jean-Eric,
> 
> You may inject the ApplicationStateManager:
> 
> <yourservice ...>
> <set-service property="appStateManager"
>   service-id="tapestry.state.ApplicationStateManager"/>
> </yourservice ...>
> 
> public class YourService {
>   private ApplicationStateManager appStateManager;
> 
>   public void setAppStateManager(ApplicationStateManager manager) {
>     appStateManager = manager;
>   }
> 
>   ApplicationObject getSessionData() {
>     return appStateMgr.get("sessionDataId");
>   }
> }
> 
> There is a post in this mailing list where Kent Tong mentioned the above.
> 
> best regards
> 
> Raul.
> 
> Jean-Eric Cuendet wrote:
>> Hi,
>> I have a service implementing a IEngineService declared in hivemind. I 
>> would like to access my SessionData object from this Service.
>> Is it possible? ow?
>> Thanks
>> -jec
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 


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


Re: Accessing State Objects from a Service

Posted by Raul Raja Martinez <do...@estudiowebs.com>.
Hi Jean-Eric,

You may inject the ApplicationStateManager:

<yourservice ...>
<set-service property="appStateManager"
   service-id="tapestry.state.ApplicationStateManager"/>
</yourservice ...>

public class YourService {
   private ApplicationStateManager appStateManager;

   public void setAppStateManager(ApplicationStateManager manager) {
     appStateManager = manager;
   }

   ApplicationObject getSessionData() {
     return appStateMgr.get("sessionDataId");
   }
}

There is a post in this mailing list where Kent Tong mentioned the above.

best regards

Raul.

Jean-Eric Cuendet wrote:
> Hi,
> I have a service implementing a IEngineService declared in hivemind. I 
> would like to access my SessionData object from this Service.
> Is it possible? ow?
> Thanks
> -jec
> 
> ---------------------------------------------------------------------
> 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