I've done this by injecting the hivemind Module that your services come from 
(via a configuration) into your service that needs to use the registry - you 
can then access the registry from this.

Sample hivemind config:

    <service-point id="MyService">
        <invoke-factory>
            <construct class="MyServiceImpl">
                <set-configuration property="hiveMindModule" 
configuration-id="HiveMindModule"/>
            </construct>
        </invoke-factory>
    </service-point>

    <configuration-point id="HiveMindModule">
        <schema>
            <element name="moduleRef">
                <rules>
                    <create-object class="HiveMindModuleAccessor" />
                    <invoke-parent method="addElement"/>
                    <set-module property="module" />
                </rules>
            </element>
        </schema>
    </configuration-point>
    
    <contribution configuration-id="HiveMindModule">
        <moduleRef />
    </contribution>


Where the HiveMindModuleAccessor is a simple class that has a setModule and 
getModule for org.apache.hivemind.internal.Module.

(The 'module' is provided by HiveMinds set-module rule: see 
http://jakarta.apache.org/hivemind/rules.html#set-module for more info)

The MyService service then has the module accessor set inside it via the config.

Hope that helps (not sure if it's the best, or cleanest, way of doing it, but 
it is pure HiveMind, so no dependencies on Tapestry servlets etc).

Joe

-----Original Message-----
From: Tomáš Drenčák [mailto:[EMAIL PROTECTED] 
Sent: 09 September 2005 07:49
To: Tapestry users; [EMAIL PROTECTED]
Subject: Re: How to get hivemind object?

You have to use hivemind Registry object. This is initialized in 
ApplicationServlet. So you can subclass it and add special method e.g.
getRegistry(). Or lookup Registry in servlet context where it's stored.

But I think that hard coding Registry lookup into your code isn't best 
practice....

2005/9/9, Jun Tsai <[EMAIL PROTECTED]>:
> I wirte some service using hivemind .How to access the object using 
> hard code not using @InjectObject.
> 
> Thanks.
> Jun Tsai
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
> 
>

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


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

Reply via email to