Ohhh. . . .this is *so* close to what I need!

I have a stand-alone HttpSessionListener impl class in my Tap 4 project
that needs access to an ASO.

As a hivemodule noob, how can I get access to the
ApplicationStateManager like shown in Barry's awesome example below?

I *assume* I can't define my HttpSessionListener as a 'service point' or
'contribution' or 'purple elephant' or any other hivemodule glyph, which
is why I'm posting here.

Thanks in advance!

Tom

-----Original Message-----
From: Barry Books [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 06, 2006 10:50 AM
To: Tapestry users
Subject: Re: How to pass a reference of ASO to my SqueezeAdaptor

Here is mine. Just add the state manager as a property and pull out
what you need.

public Object unsqueeze(DataSqueezer squeezer, String string) {
                try {
                        Repository repository = (Repository)
stateManager.get("repository");
                        User user = (User) stateManager.get("user");
                        return repository.select(user, new
Long(string.substring(1)));
                } catch (NumberFormatException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                return null;
        }


        private ApplicationStateManager stateManager;
        public void setStateManager(ApplicationStateManager
stateManager) {
               this.stateManager = stateManager;
        }
}

<contribution configuration-id="tapestry.state.ApplicationObjects">
  <state-object name="user" scope="session">
    <create-instance class="com.trsvax.mill.baseobject.party.User"/>
  </state-object>
</contribution>

<contribution configuration-id="tapestry.data.SqueezeAdaptors">
<adaptor object="service:millSqueezer"/>
</contribution>

<service-point interface="com.trsvax.mill.MillSqueezer"
id="millSqueezer">
<invoke-factory>
<construct class="com.trsvax.mill.MillSqueezer">
       <set-object property="stateManager"
value="infrastructure:applicationStateManager"/>
</construct>
</invoke-factory>
</service-point>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to