Thanks John,

I based my work on that article, the hibernate one and a few others around
the place.  While working through it and with my fledgling HiveMind
knowledge I thought a 100% HiveMind solution might be the go, I just can't
wire it up yet.  I think something based on your idea is probably
immediately achievable, unless someone knows how to wire a service to a ASO,
it's probably easy I just can't see it yet...the simplest solutions are
always the best, right?

So with your solution in mind, I could make the squeezer service just pick
the dataContext and object id store off the thread.  My implementation is
based on:
http://equalitylearning.org/Tassel/app?service=external/ViewComponent&sp=SCa
yenneDataObjectSqueezeAdaptor

The idea with the squeezer is to override the default one which would base64
the DataObjects into pages and urls, not great especially in tables or other
large lists.  This squeezer takes the dataobject id instead of the whole
serialized object.  The only caveat here is the security risk of exposing
the Id, but you could just change you squeezer implementation or perhaps use
different object id's.  This has been discussed on the Cayenne lists.

Thanks again.


-----Original Message-----
From: John Coleman [mailto:[EMAIL PROTECTED] 
Sent: Friday, 9 December 2005 8:36 PM
To: Tapestry users
Subject: Re: Wiring Hivemind to

I found these notes
http://wiki.apache.org/jakarta-tapestry/CayenneTapestrySqueezer, but seems
not so helpful for your case. I have a different solution which may help
you.

What I did to use Cayenne in HiveMind is this:

configure this listener in web.xml:
<listener>
<listener-class>org.objectstyle.cayenne.conf.WebApplicationContextProvider</
listener-class>
</listener>

and in my HiveMind services which are PoolManageable:

 public DataContext getDataContext() {
  return context;
 }

 public void activateService() {
  // this method only works when a DataContext is bound by a listener
  try {
   context = DataContext.getThreadDataContext();
  } catch (java.lang.IllegalStateException ex) {
   // TODO oh dear!
  }
  log.debug("activate service..."
    + Thread.currentThread().getName());
 }

 public void passivateService() {
  try {
   context.commitChanges();
  } catch (CayenneRuntimeException rex) {
   log.error("error commiting changes:", rex);
  }
  log.debug("passivate service..."
    + Thread.currentThread().getName());
 }

This way there is no need to mess with the visit object, just pick the
DataContext off the current thread. In my case whenever a service is pulled
off the pool, it grabs the DataContext and the service can then get that
using a getDataContext() method from the subclass service implementation.
This is quite neat and decouples things a bit.

Ideally I'd like not to use the WebAppContextProvider and have a standalone
solution done 100% in HiveMind POJOs. I'd still like to see how the squeezer
is used, and understand the practical benefits of it.

John


----- Original Message ----- 
From: "Steve Wells" <[EMAIL PROTECTED]>
To: "Tapestry users" <[email protected]>
Sent: Friday, December 09, 2005 5:49 AM
Subject: Re: Wiring Hivemind to


Just to clarify a bit.

What I'm trying to do is get a custom squeezer defined in HiveMind to
access ASO's, without using any static threadLocal implmentation.  The
ASO's are data context and object id stores for the squeezer.

Another way I thought here is to pass the
tapestry.state.ApplicationObjects to the squeezer service:
<service-point id="CayenneAdapter"
interface="org.rz.squeezer.IDataObjectAdapter">
        <invoke-factory>
            <construct class="org.rz.squeezer.DataObjectAdaptor">
                <set-configuration property="visitList"
                configuration-id="tapestry.state.ApplicationObjects"/>
            </construct>

and the constructor:
public DataObjectAdaptor(Map visitList)
I've also exchanged Map with List and Object and get:
Unable to find constructor applicable for autowiring. Use explicit
constructor parameters.

TIA


On Fri, 09 Dec 2005 14:02:32 +1000, "Steve Wells"
<[EMAIL PROTECTED]> said:
> I'm trying to get a Cayenne Data Squeezer to work wired with more
> Hivemind than some previous solutions out there.
> The Squeeze adapter constructor has 2 params which should both be stored
> in session scope, so I'd like to config Hivemind to set the object into
> session scope and pass them to the SqueezeAdapter, maybe this is a dumb
> thing to do.
>
> I've tryed various things but here is the best shot so far:
> hivemodule.xml
> <!-- Cayenne Squeeze adapter service -->
> <service-point id="CayenneAdapter"
> interface="org.rz.squeezer.IDataObjectAdapter">
>         <invoke-factory>
>             <construct
>             class="org.rz.squeezer.DataObjectAdaptor"></construct>
>  <!-- It would be nice if I could get the constructor params to autowire
>  from the session instances -->
>
>    <!-- DataContext param that should go into session and feed into
>    Squeezeadapter -->
>    <contribution configuration-id="tapestry.state.ApplicationObjects">
>         <state-object name="dataContextProvider" scope="session">
>             <create-instance
>             class="org.rz.squeezer.DataContextProviderImpl"/>
>         </state-object>
>     </contribution>
>
> What I also tryed was to create a service for the dataContextProvider
> and pass the reference to the state-object but it seems this is a no go.
>
> Has anyone tried this or can anyone provide at least a hint?
>
> Thanks,
>
> Steve
>
>
> -- 
>   Steve Wells
>   [EMAIL PROTECTED]
>
> -- 
> http://www.fastmail.fm - Same, same, but different.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
-- 
  Steve Wells
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


---------------------------------------------------------------------
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]



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

Reply via email to