1) Why do you "need to access the object directly" ... it's all about injection. Inject it is the right way.
2) Without annotations, you can use the <inject> element in the XML. Come on ... there's a link directly from the @InjectObject annotation to the doc for the <inject> element. On 9/9/05, pickerel yee <[EMAIL PROTECTED]> wrote: > i'm using jdk 1.4, and @InjectObject annotation cannot work.i think > there's no way but to fetch Registry from the servlet context by the > key 'org.apache.tapestry.Registry.ServletName' if i want to get > hivemind object in my code, do it? > > > > > On 9/9/05, Joe Trewin <[EMAIL PROTECTED]> wrote: > > The MyService object is just your own service that provides access to the > > HiveMind module. > > > > What I've done is injected such an object into my Tapestry page/component > > (or another HiveMind service) using the @InjectObject annotation, and then > > used it to construct other services from the HiveMind registry. > > > > I needed to do this to wrap some extra security around service access > > without using interceptors. > > > > What are you trying to accomplish? > > > > -----Original Message----- > > From: Jun Tsai [mailto:[EMAIL PROTECTED] > > Sent: 09 September 2005 10:14 > > To: Tapestry users > > Subject: Re: How to get hivemind object? > > > > How to inject MyService object ? > > > > On 9/9/05, Joe Trewin <[EMAIL PROTECTED]> wrote: > > > > > > 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] > > > > > > > > > > > > -- > > 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] > > > > > -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator, Jakarta Tapestry Creator, Jakarta HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com
