You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "David J. M. Karlsen" <da...@davidkarlsen.com> on 2004/11/01 22:43:52 UTC

service+configuration - how?

Hi!

I currently use hivemind to retreive instances of interface-implementations.
(instanciation of a class for the service-interface).

I'd like to combine this with some specific properties for configuring 
the implementation.

I find the examples on configuration-points and contributions somewhat 
hard to understand. (It seems that I have to create a separate class for 
the config - and call this from the implementation - instead of 
declaring it all in the Hivemind config-file).

What I would like is some private static variables in the 
implementation-class to be set when instanciated.

Lets's say this is the iface:

interface IMyService {
    public void methodA();
}

and the implementation:
public class MyService implements IMyService{
    final static private String aStringProp;
    final static private Integer anIntegerProp;

    public void methodA(){
       //do something
}
}

how could I do this the easiest way through the use of HiveMind, such 
that when I retrieve the service through the registry, the constructed 
object would automatically have it's properties set?

I'd rather avoid having a separate class for configuration as I find 
this too fine-grained.

Thanks in advance - and thanks for a great API!

Kind regards,
David Karlsen


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


Re: service+configuration - how?

Posted by Howard Lewis Ship <hl...@gmail.com>.
The hivemind.BuilderFactory exists to configure your service
implementation using dependency injection.


On Mon, 01 Nov 2004 22:43:52 +0100, David J. M. Karlsen
<da...@davidkarlsen.com> wrote:
> Hi!
> 
> I currently use hivemind to retreive instances of interface-implementations.
> (instanciation of a class for the service-interface).
> 
> I'd like to combine this with some specific properties for configuring
> the implementation.
> 
> I find the examples on configuration-points and contributions somewhat
> hard to understand. (It seems that I have to create a separate class for
> the config - and call this from the implementation - instead of
> declaring it all in the Hivemind config-file).
> 
> What I would like is some private static variables in the
> implementation-class to be set when instanciated.
> 
> Lets's say this is the iface:
> 
> interface IMyService {
>     public void methodA();
> }
> 
> and the implementation:
> public class MyService implements IMyService{
>     final static private String aStringProp;
>     final static private Integer anIntegerProp;
> 
>     public void methodA(){
>        //do something
> }
> }
> 
> how could I do this the easiest way through the use of HiveMind, such
> that when I retrieve the service through the registry, the constructed
> object would automatically have it's properties set?
> 
> I'd rather avoid having a separate class for configuration as I find
> this too fine-grained.
> 
> Thanks in advance - and thanks for a great API!
> 
> Kind regards,
> David Karlsen
> 
> ---------------------------------------------------------------------
> 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
http://howardlewisship.com

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