You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Massimo Lusetti <ml...@gmail.com> on 2005/06/03 11:25:02 UTC

Trying to use StrategyFactory

I'm trying to use strategy factory to drop down a big list of hivemind
services which in fact does the same thing, they just have to do
something different in small places where custom data should be
treated differently.
For more info see my previous post and discussion with Knut.

Here i would like to refactor my class model to have the possibility
to use HiveMind StrategyFactory within my modules.

I've tried to configure it but i got some wired error. In the log i
got NPE from DefaultErrorHandler saying StrategyFactory.buildRegistry
cause it and tell me the exact line on my module. The line is the
object="..." line within the <strategy> element inside the
<contribution>.

In the console (stdout) i got a java.lang.VerifyError tell me that one
method has a bad signature "Wrong return type in function".
Actually the situation is slightly different since the object I've
configured in the <strategy> element is a class which implement the
interface of the service but doing that extending a Common abstract
class which implement the interface and which every "service" extends
to provide custom implementations and using the Commons one when
there's no need to customize it.

So my class in the object attribute of the element is implementing the
service interface not directly but extending a Commons abstract class
which implements the interface.

Does this cause problem to StrategyFactory or I've done something else wrong ?

Thanks

-- 
Massimo

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


Re: Trying to use StrategyFactory

Posted by Howard Lewis Ship <hl...@gmail.com>.
See http://jakarta.apache.org/hivemind/hivemind/ObjectProviders.html

The object attribute doesn't have to be a service-id; as you saw, it
can be an instance of an object, or a service, or a configuration, or
lots of other things.

On 6/3/05, Massimo Lusetti <ml...@gmail.com> wrote:
> Well, looking around the source tree I've seen and example of strategy
> usage in a test case.
> The only difference between my module descriptor and the test case
> descriptor is the "instance:" prefix in the object attribute value
> 
> Putting that prefix in mine descriptor and it all goes OK. I got my
> strategy example/test run well.
> I've found the instance: prefix being a prefix for ObjectProviders
> configuration, does this is needed for StrategyFactory ?
> Could, please, someone with a clue explain a bit ?
> 
> Ciao
> --
> Massimo
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Trying to use StrategyFactory

Posted by Massimo Lusetti <ml...@gmail.com>.
Well, looking around the source tree I've seen and example of strategy
usage in a test case.
The only difference between my module descriptor and the test case
descriptor is the "instance:" prefix in the object attribute value

Putting that prefix in mine descriptor and it all goes OK. I got my
strategy example/test run well.
I've found the instance: prefix being a prefix for ObjectProviders
configuration, does this is needed for StrategyFactory ?
Could, please, someone with a clue explain a bit ?

Ciao
-- 
Massimo

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