Paul,
You can replace the original DataSqueezer service by your own implementation,
which will register your custom squeeze adaptor.
public class MyDataSqueezerImpl extends
org.apache.tapestry.util.io.DataSqueezerImpl {
public MyDataSqueezerImpl(ClassResolver resolver) {
super(resolver);
new CustomSqueezeAdaptor().register(this);
}
}
Then in your hivemodule.xml:
<module>
<!-- Replacement for the DataSqueezer service -->
<implementation service-id="tapestry.data.DataSqueezer">
<invoke-factory>
<construct class="com.acme.MyDataSqueezerImpl">
<class-resolver/>
</construct>
</invoke-factory>
</implementation>
</module>
No need to register your custom squeeze adaptor in your pages anymore.
Hope this helps,
Raphael
> -----Original Message-----
> From: Paul Cantrell [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 08, 2005 5:53 AM
> To: Tapestry users
> Subject: Registering a custom ISqueezeAdaptor (was: What is a "strategy,"
> and how do I write one?)
>
> OK, I've managed to register my own CustomSqueezeAdaptor by
> implementing PageAttachListener and using the following code:
>
> private static boolean squeezerRegistered;
>
> @InjectObject("service:tapestry.data.DataSqueezer")
> public abstract DataSqueezer getDataSqueezer();
>
> public void pageAttached(PageEvent event)
> {
> synchronized(InnigBasePage.class)
> {
> if(!squeezerRegistered)
> {
> new CustomSqueezeAdaptor().register(getDataSqueezer());
> squeezerRegistered = true;
> }
> }
> }
>
> It works, but it's pretty crummy. Surely there is -- or should be --
> a way to do this entirely from my hivemodule.xml?
>
> Cheers,
>
> Paul
>
>
> On Aug 7, 2005, at 1:16 PM, Norbert Sándor wrote:
>
> > Probably it talks about a data squeezer adaptor.
> > You should create a custom squeezer adaptor or eg. make CustomClass
> > implement Serializable.
> >
> > BR,
> > Norbi
> >
> > ----- Original Message ----- From: "Paul Cantrell"
> > <[EMAIL PROTECTED]>
> > To: "Tapestry users" <[email protected]>
> > Sent: Sunday, August 07, 2005 8:09 PM
> > Subject: What is a "strategy," and how do I write one?
> >
> >
> >
> >> I notice that if I do this...
> >>
> >> <a href="#" jwcid="@DirectLink" listener="listener:doStuff"
> >> parameters="ognl:value">
> >>
> >> ...with this backing code:
> >>
> >> public abstract CustomClass getValue();
> >> public void doStuff(CustomClass value) { ... }
> >>
> >> ...it doesn't work (which I would expect), but I get this error
> >> message:
> >>
> >> Could not find a strategy instance for class CustomClass
> >>
> >> ...which suggests that this *could* work if only I registered a
> >> "strategy" with Tapestry, whatever that means. I looked through
> >> the docs and a did a quick web search on this, without luck --
> >> though I'm sure good information is out there somewhere.
> >>
> >> Anybody on this list know how it's done? I'm using 4.0 beta 3.
> >>
> >> Cheers,
> >>
> >> Paul
> _________________________________________________________________
>
> "Prediction is hard, especially of the future." -- Niels Bohr
>
>
> ---------------------------------------------------------------------
> 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]