You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "richardl@ufp.com" <ri...@ufp.com> on 2008/02/13 07:34:40 UTC

Passing ApplicationObject to BuilderFactory - Tap 4.1.2

Im trying to create one instance of my ServiceManager to be initialized once
and used throughout my pages. The initialization of both my FooFactory and
the ServiceManager are hairy so I need to pass them through a Wrapper that
initializes everything. 

What Im trying to do is pass the ASO from the
tapestry.state.ApplicationObjects as an object into the StateObjectFactory
to be initialized. This is what I have so far but I am getting 

Unable to convert type 'tapestry.state.ApplicationObjects.servicemanager' to
a Java class, either as is, or in package com.myco.weblogin

<?xml version="1.0"?>
<module id="com.myco.weblogin" version="1.0.0">
  <contribution configuration-id="tapestry.state.ApplicationObjects">
    <state-object name="servicemanager" scope="application">
      <create-instance class="com.myco.weblogin.StaticServiceManager"/>
    </state-object>
    <state-object name="foo" scope="application">
       <invoke-factory object="service:FooFactory"/>
    </state-object>
  </contribution>

  <service-point id="FooFactory"
interface="org.apache.tapestry.engine.state.StateObjectFactory">
    <invoke-factory>
      <construct class="com.myco.weblogin.StoreWrapper">
	<set-service property="servletContext"
service-id="tapestry.globals.ServletContext"/>
	<set-object property="serviceManager"
value="instance:tapestry.state.ApplicationObjects.servicemanager"/>
      </construct>
    </invoke-factory>
  </service-point>
</module>

-- 
View this message in context: http://www.nabble.com/Passing-ApplicationObject-to-BuilderFactory---Tap-4.1.2-tp15450422p15450422.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: Passing ApplicationObject to BuilderFactory - Tap 4.1.2

Posted by Andreas Andreou <an...@gmail.com>.
I believe you just need to inject the ApplicationStateManager to your
FooFactory service and from there do a manager.get("servicemanager")
to get to your application object



On Feb 13, 2008 8:34 AM, richardl@ufp.com <ri...@ufp.com> wrote:
>
> Im trying to create one instance of my ServiceManager to be initialized once
> and used throughout my pages. The initialization of both my FooFactory and
> the ServiceManager are hairy so I need to pass them through a Wrapper that
> initializes everything.
>
> What Im trying to do is pass the ASO from the
> tapestry.state.ApplicationObjects as an object into the StateObjectFactory
> to be initialized. This is what I have so far but I am getting
>
> Unable to convert type 'tapestry.state.ApplicationObjects.servicemanager' to
> a Java class, either as is, or in package com.myco.weblogin
>
> <?xml version="1.0"?>
> <module id="com.myco.weblogin" version="1.0.0">
>   <contribution configuration-id="tapestry.state.ApplicationObjects">
>     <state-object name="servicemanager" scope="application">
>       <create-instance class="com.myco.weblogin.StaticServiceManager"/>
>     </state-object>
>     <state-object name="foo" scope="application">
>        <invoke-factory object="service:FooFactory"/>
>     </state-object>
>   </contribution>
>
>   <service-point id="FooFactory"
> interface="org.apache.tapestry.engine.state.StateObjectFactory">
>     <invoke-factory>
>       <construct class="com.myco.weblogin.StoreWrapper">
>         <set-service property="servletContext"
> service-id="tapestry.globals.ServletContext"/>
>         <set-object property="serviceManager"
> value="instance:tapestry.state.ApplicationObjects.servicemanager"/>
>       </construct>
>     </invoke-factory>
>   </service-point>
> </module>
>
> --
> View this message in context: http://www.nabble.com/Passing-ApplicationObject-to-BuilderFactory---Tap-4.1.2-tp15450422p15450422.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
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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