You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Cantrell <ca...@pobox.com> on 2005/08/07 20:09:16 UTC

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

_________________________________________________________________

"Nationalism is an infantile disease. It is the measles of mankind."
-- Albert Einstein



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


Registering a custom ISqueezeAdaptor (was: What is a "strategy," and how do I write one?)

Posted by Paul Cantrell <ca...@pobox.com>.
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"  
> <ca...@pobox.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> 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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: What is a "strategy," and how do I write one?

Posted by Paul `Order in Chaos` Cantrell <pc...@pobox.com>.
All right, it looks like I need to implement ISqueezeAdaptor -- easy  
enough!

How do I register my adaptor once I create it? The ideal thing would  
be to just put a few lines in my hivemodule.xml, though I don't see a  
configuration point for it (although I'm totally new to Hivemind, so  
I might just be missing it).

It looks like the only ways to do it are:

(1) Subclass DataSqueezerImpl, and pass my adaptor in the  
superconstructor's second argument.

(2) Get a hold of the DataSqueezer service from HiveMind at some  
point, and register it that way.

Neither of those is very pretty. But in tapestry.data.xml, I see:

     To come: configuratons for defining squeeze adaptors.

So maybe this will be there in the 4.0 release...?

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"  
> <ca...@pobox.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> 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
>>
>> _________________________________________________________________
>>
>> "Nationalism is an infantile disease. It is the measles of mankind."
>> -- Albert Einstein


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


Re: What is a "strategy," and how do I write one?

Posted by Norbert Sándor <de...@erinors.com>.
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" <ca...@pobox.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
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
>
> _________________________________________________________________
>
> "Nationalism is an infantile disease. It is the measles of mankind."
> -- Albert Einstein
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> 



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