hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Using Hivemind in an existing application
Date Fri, 22 Jul 2005 09:14:28 GMT

For point 1 just write your own factory (implementing
ServiceImplementationFactory) and use getInstance() to return the
instance from the createCoreServiceImplementation method.

I'm not sure I understand point 2, but something similar might apply.

For 3, I'm not sure adding one overloaded method constitutes ugliness,
but you could inject the configuration in the constructor instead if you
prefer (<configuration> instead of <set-configuration>).

Good luck


1. I have something similar to services, implemented as singletons. I 
want to change those to hivemind services with singletons model, but 
this should be transparent for the rest of the application - i.e. if 
other parts of the code use this as a normal singleton, it should work.
The problem is in telling Hivemind to get the service implementation 
using the singleton getter method (called getInstance). Hivemind seems 
to always want to instantiate the class itself using a constructor, or 
my constructor is private and must remain so.
What I would need is a way to specify in <invoke-factory> to use the 
static method (getInstance) of the class to instantiate it instead of 
the constructor.

2. Same problem with configuration points: I have main configuration 
classes implemented as singletons, but there is no way in <rules> 
section to put on the stack an object created by a static method of a 
class instead of an object created using constructor.

3. A problem with <set-configuration>: the setter method is expected to 
receive a List object. This is correct for configuration points with 
0..n cardinality, but there are some issues with configuration points 
with occurs=1.
In the (future) service class, I already have a method 
setConfiguration(Configuration), which is called now by hand. If I want 
to make that class a service, and Configuration a configuration point, I

would have to change the method signature setConfiguration(List), and 
the list would always have one element. But this will make the service 
class look quite ugly, and I think it's also against the 
non-intrusiveness principle of Hivemind.

These are all the (major) problems I ran into.
Could somebody tell me if there are Hivemind issues indeed, or if I am 
using Hivemind in the wrong way? And maybe there are some workarounds...

Thank you,

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message