Annotated Registry - Best practise and newbie questions

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Annotated Registry - Best practise and newbie questions

by Jochen_Z :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!
This is a newbie question.
I played a little with hivemind and understood the calculator example and transferred it to a little app of my own.

But now I got stuck and could not find documentation on the hivemind web site. Sorry it there is some to this topic and I did not found it, if so just point me to it! Thanks!!

I've got two (or n) java projects
They will result in two (n) different jars.

1.: What's the best practise to organize these jars? Where do I place the annotated java class for the registry? Where do I put the hivemind.jars?

2.: I want to use a service from jar A in jar B. I have no idea how to accomplish this.

Regards,
Jochen Zimmermann

Re: Annotated Registry - Best practise and newbie questions

by ahueg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jochen,

1.) usually you will have an application (for example web application) that
is responsible for creating the HiveMind registry.
The application can build a complete registry just by loading multiple
annotated module classes from the classpath:

AnnotatedRegistryBuilder builder = new AnnotatedRegistryBuilder();
TypedRegistry registry = builder.constructRegistry(ModuleA.class,  
ModuleB.class);

(There is an autoloading mechanism too, but it's not in place for  
annotated modules
today.)

So it's up to you where you place the annotated module classes as long as  
they
reside in the classpath together with the hivemind jars.

2.) Define two annotated module classes for jar A and B and load them like  
described
above in a common registry.
The autowiring mechanism that is used in the calculator example
does have access to all services defined by all modules that are known to  
the registry.
The same is true for the service-Method which can be used for looking up  
service references:

     public Calculator getCalculatorService()
     {
         CalculatorImpl result = new CalculatorImpl();
          result.setAdder(service(ServiceInB.class));
         return result;
     }

In the annotated class of module A just specify the type of a service that  
is defined
in module B and HiveMind will handle it correctly.

Achim


Am Mon, 02 Apr 2007 16:54:35 +0200 schrieb Jochen Zimmermann  
<zet4080@...>:

> Hi!
> This is a newbie question.
> I played a little with hivemind and understood the calculator example  
> and transferred it to a little app of my own.
>
> But now I got stuck and could not find documentation on the hivemind web  
> site. Sorry it there is some to this topic and I did not found it, if so  
> just point me to it! Thanks!!
>
> I've got two (or n) java projects
> They will result in two (n) different jars.
>
> 1.: What's the best practise to organize these jars? Where do I place  
> the annotated java class for the registry? Where do I put the  
> hivemind.jars?
>
> 2.: I want to use a service from jar A in jar B. I have no idea how to  
> accomplish this.
>
> Regards,
> Jochen Zimmermann