Contoller will be IController and ControllerImpl. Device will implement IController. All that is configured in HiveModule is the service defining Controller, it's methods and instantiated values will be available to Device. Is this what you mean?

Not quite. Let me try to explain my situation better.
I have a module like :
/<module id="app" version="1.0.0" package="app">
   <service-point id="Controller" interface="app.Controller">
       <invoke-factory model="singleton">
           <construct class="app.Controller"/>
       </invoke-factory>
       <interceptor service-id="hivemind.LoggingInterceptor"/>
   </service-point>
</module>/

and the Controller.class:
/package app;
class Controller
{
   /* implementaion is not important */
}

and I also have a Device class:
//package app;
class //Device /
/ {
   private Controller controller;
   public void setController( Controller controller )
   {
       this.controller = controller;
   }
}
/
Now , what I would like is to get a Device instance that will have the controller injected into it. This without having to add a /<service-point/> /for the Device into the xml descriptor module.
So, something like this should work(or anything similar) :
Registry registry = ....
Device device = (Device) registry.getService( /Device/.class );

Basically I would like that for any given class to get its managed instance (like the Device class in the example) without needing the <service-point> declared.

Thanks,
Andrei Chiritescu


adasal wrote:

Contoller will be IController and ControllerImpl. Device will implement IController. All that is configured in HiveModule is the service defining Controller, it's methods and instantiated values will be available to Device. Is this what you mean?
Or you can get an instance of the service :-
Contoller registry.getService("app.IController",
                ControllerImpl..class)
or do something like this:-

public class XXXEngine extends BaseEngine {
....................
protected Object createGlobal(RequestContext context) {
        HttpServletRequest request = context.getRequest();

        return HiveMindFilter.getRegistry(request);
    }
used like e.g. this:-

protected void cleanupAfterRequest(IRequestCycle cycle) {
        super.cleanupAfterRequest(cycle);

        Registry registry = (Registry) getGlobal();
//which allows:-
ISessionManager sessionManager = (ISessionManager) registry.getService(ISessionManager.class);

.........
What is being controlled here is access to a single session object, but your problems may be similar.
Tapestry-3.0.3 hivemind-1.0.0
Adam

On 10/5/05, *Andrei Chiritescu* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Do you know whether hivemind contains a method to get an instance
    from a
    specific class (given the classname), which then does all the
    autowiring? I would just like to get a class instance based on
    classname, so that an entry in hivemodule is not necessary.

    I there a method to get an instance of a specific class (given the
    fully
    qualified classname) that is managed by Hivemind(has the services
    injected) without having to add an entry in the hivemodule
    descriptor?
    Basically what I have is a "Controller" service (declared in the xml
    module) and a lot of Device classes which require the Controller.
    What I
    want is to get a instance of Device class that has the Controller
    class
    wired (injected by hivemind) without adding the Device service in the
    xml descriptor.

    Is this possible?

    Regards,
    Andrei Chiritescu


    ---------------------------------------------------------------------
    To unsubscribe, e-mail:
    [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail:
    [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to