You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Robert Binna <r....@synedra.com> on 2006/07/26 15:07:23 UTC

Custom Application State Manager

Hi.

I am now developing no with tapestry for some month, and i must say it 
is a great thing. I think I am not a newbie anymore but I am far away 
from beeing an advanced user.

My problem is as follows:

I have developed a custom ApplicationStateManager that is responsible 
for dealing with Hibernate Objects.

I registered it with the following hivemind entries:

<service-point id="HibernateApplicationStateManager" 
interface="org.apache.tapestry.engine.state.ApplicationStateManager">
    <invoke-factory service-id="hivemind.BuilderFactory" model="pooled" >
        <construct 
class="com.icoserve.aim.web.commons.HibernateApplicationStateManager">
            <set-object property="factory" 
value="service:WebAccessFactory" />
            <set-service property="registry" 
service-id="tapestry.state.StateObjectManagerRegistry" />               
        </construct>
    </invoke-factory>
</service-point>
   
<contribution configuration-id="tapestry.InfrastructureOverrides">
    <property name="applicationStateManager" 
object="service:HibernateApplicationStateManager"/>
</contribution>

If I am now retrievin an ASO like this all works well and the 
HibernateApplicationStateManager is used:
  
return (MyState) getEngine().getInfrastructure()
                    .getApplicationStateManager().get("myState");

if i am doing it like this I am into troubles:

@InjectState("myState")
public abstracct MyStategetState()

It seems that the InjectStateWorker is hardwired to the service 
tapestry.state.ApplicationStateManager

Is there any way to override it with my custom AppliationStateManager or 
to set it to infrastructure:applicationStateManager

My development platform is:
       jdk: 1.5.0_05
       tomcat: 5.5.10
       tapestry: 4.0
       os: windows xp

I hope someone can help me.

Kind regards,
             Robert

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


Re: Custom Application State Manager

Posted by Robert Binna <r....@synedra.com>.
Thanks, that works.

James Carman schrieb:

>Override the implementation of the tapestry.state.ApplicationStateManager
>service point:
>
><implementation service-id="tapestry.state.ApplicationStateManager">
>  <invoke-factory service-id="hivemind.BuilderFactory" model="pooled" >
>        <construct 
>class="com.icoserve.aim.web.commons.HibernateApplicationStateManager">
>            <set-object property="factory" 
>value="service:WebAccessFactory" />
>            <set-service property="registry" 
>service-id="tapestry.state.StateObjectManagerRegistry" />               
>        </construct>
>    </invoke-factory>
></implementation>
>
>-----Original Message-----
>From: Robert Binna [mailto:r.binna@synedra.com] 
>Sent: Wednesday, July 26, 2006 9:07 AM
>To: dev@tapestry.apache.org
>Subject: Custom Application State Manager
>
>Hi.
>
>I am now developing no with tapestry for some month, and i must say it 
>is a great thing. I think I am not a newbie anymore but I am far away 
>from beeing an advanced user.
>
>My problem is as follows:
>
>I have developed a custom ApplicationStateManager that is responsible 
>for dealing with Hibernate Objects.
>
>I registered it with the following hivemind entries:
>
><service-point id="HibernateApplicationStateManager" 
>interface="org.apache.tapestry.engine.state.ApplicationStateManager">
>    <invoke-factory service-id="hivemind.BuilderFactory" model="pooled" >
>        <construct 
>class="com.icoserve.aim.web.commons.HibernateApplicationStateManager">
>            <set-object property="factory" 
>value="service:WebAccessFactory" />
>            <set-service property="registry" 
>service-id="tapestry.state.StateObjectManagerRegistry" />               
>        </construct>
>    </invoke-factory>
></service-point>
>   
><contribution configuration-id="tapestry.InfrastructureOverrides">
>    <property name="applicationStateManager" 
>object="service:HibernateApplicationStateManager"/>
></contribution>
>
>If I am now retrievin an ASO like this all works well and the 
>HibernateApplicationStateManager is used:
>  
>return (MyState) getEngine().getInfrastructure()
>                    .getApplicationStateManager().get("myState");
>
>if i am doing it like this I am into troubles:
>
>@InjectState("myState")
>public abstracct MyStategetState()
>
>It seems that the InjectStateWorker is hardwired to the service 
>tapestry.state.ApplicationStateManager
>
>Is there any way to override it with my custom AppliationStateManager or 
>to set it to infrastructure:applicationStateManager
>
>My development platform is:
>       jdk: 1.5.0_05
>       tomcat: 5.5.10
>       tapestry: 4.0
>       os: windows xp
>
>I hope someone can help me.
>
>Kind regards,
>             Robert
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: dev-help@tapestry.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: dev-help@tapestry.apache.org
>
>  
>


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


RE: Custom Application State Manager

Posted by James Carman <ja...@carmanconsulting.com>.
Override the implementation of the tapestry.state.ApplicationStateManager
service point:

<implementation service-id="tapestry.state.ApplicationStateManager">
  <invoke-factory service-id="hivemind.BuilderFactory" model="pooled" >
        <construct 
class="com.icoserve.aim.web.commons.HibernateApplicationStateManager">
            <set-object property="factory" 
value="service:WebAccessFactory" />
            <set-service property="registry" 
service-id="tapestry.state.StateObjectManagerRegistry" />               
        </construct>
    </invoke-factory>
</implementation>

-----Original Message-----
From: Robert Binna [mailto:r.binna@synedra.com] 
Sent: Wednesday, July 26, 2006 9:07 AM
To: dev@tapestry.apache.org
Subject: Custom Application State Manager

Hi.

I am now developing no with tapestry for some month, and i must say it 
is a great thing. I think I am not a newbie anymore but I am far away 
from beeing an advanced user.

My problem is as follows:

I have developed a custom ApplicationStateManager that is responsible 
for dealing with Hibernate Objects.

I registered it with the following hivemind entries:

<service-point id="HibernateApplicationStateManager" 
interface="org.apache.tapestry.engine.state.ApplicationStateManager">
    <invoke-factory service-id="hivemind.BuilderFactory" model="pooled" >
        <construct 
class="com.icoserve.aim.web.commons.HibernateApplicationStateManager">
            <set-object property="factory" 
value="service:WebAccessFactory" />
            <set-service property="registry" 
service-id="tapestry.state.StateObjectManagerRegistry" />               
        </construct>
    </invoke-factory>
</service-point>
   
<contribution configuration-id="tapestry.InfrastructureOverrides">
    <property name="applicationStateManager" 
object="service:HibernateApplicationStateManager"/>
</contribution>

If I am now retrievin an ASO like this all works well and the 
HibernateApplicationStateManager is used:
  
return (MyState) getEngine().getInfrastructure()
                    .getApplicationStateManager().get("myState");

if i am doing it like this I am into troubles:

@InjectState("myState")
public abstracct MyStategetState()

It seems that the InjectStateWorker is hardwired to the service 
tapestry.state.ApplicationStateManager

Is there any way to override it with my custom AppliationStateManager or 
to set it to infrastructure:applicationStateManager

My development platform is:
       jdk: 1.5.0_05
       tomcat: 5.5.10
       tapestry: 4.0
       os: windows xp

I hope someone can help me.

Kind regards,
             Robert

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



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