You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Andrew Kirby <an...@gmail.com> on 2005/06/09 08:59:18 UTC

Access to the Tapestry Hivemind Registry in 4.0

I have a requirement for access to the Hivemind Registry instance that
is constructed within the Tapestry Application Servlet such that I can
lookup and use the default SpecifcationParser service.

I cant find a way to achieve this ?

I am implementing an ISpecificationResolverDelegate class using the
tapestry4-alpha3 code base and need access to the SpecificationParser
service so assume that I can lookup this service from the Tapestry
Registry instance, but cannot determine how to get a handle to this
registry instance to perform the service lookup.

I tried using -

Registry registry = HiveMindFilter.getRegistry
(cycle.getRequestContext().getRequest());

but this returns null when called from my
ISpecificationResolverDelegate implementing class.

The registry has definitely been constructed correctly and populated
as other components have already been parsed correctly when stepping
debugging and stepping through the code.

Any help much appreciated

Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: Access to the Tapestry Hivemind Registry in 4.0

Posted by Andrew Kirby <an...@gmail.com>.
Sorry for taking some time to respond .. have just got back into
further testing this approach.

I have found where the ServletContext is populated with the hivemind
registry using the key - "org.apache.tapestry.Registry:myapp" in the
ApplicationServlet.

However access to the ServletContext appears to be restricted.

>From where could I get access to the ServletContext in which to lookup
the HiveMind registry ?

The best/only manner in which it appears to be available is through - 

ApplicationGlobals.getWebContext().getAttribute("org.apache.tapestry.Registry:myapp");

I would expect that using 

Object globalsObj = cycle.getEngine().getGlobal();

and performing some cast on this Object to get a handle on an instance
of an  ApplicationGlobals class would allow me to complete the lookup.

However from within my ISpecificationResolverDelegate class the
cycle.getengine().getGlobal() returns an *empty*
(java.util.Collections$SynchronizedMap) collection every time it is
invoked.

I checked the ComponentSpecificationResolverImpl class for its call to
invoke the delegate,

IComponentSpecification specification =
getDelegate().findComponentSpecification(
                cycle,
                namespace,
                _type);

and at this point in the execution the cycle.getEngine().getGlobal()
does indeed return an empty syncronized list before invoking the
delegate.

Any help would be much appreciated to understand why the getGlobal()
method appears to allways return an empty list, is there another
method (as this is going to be depreciated) to get a handle to the
current ServletContext or perhaps an amendment to the current code to
allow a more direct access to the HiveMind registry for the currently
executing Tapestry Engine as I feel this would be a very usefull
facility when developers wish to extend various points of the Tapestry
Application as suggested within the current documentation.

Thanks 

Andy 'Im sure hoping it will all suddenly become clear' K


On 6/9/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> The CVS HEAD has code changes where the Registry is stored into the
> ServletContext using the key org.apache.tapestry.Registry:foo where
> foo is the name of the application servlet.
> 
> Actually, just checked, looks like that code is in alpha-3.
> 
> On 6/9/05, Andrew Kirby <an...@gmail.com> wrote:
> > I have a requirement for access to the Hivemind Registry instance that
> > is constructed within the Tapestry Application Servlet such that I can
> > lookup and use the default SpecifcationParser service.
> >
> > I cant find a way to achieve this ?
> >
> > I am implementing an ISpecificationResolverDelegate class using the
> > tapestry4-alpha3 code base and need access to the SpecificationParser
> > service so assume that I can lookup this service from the Tapestry
> > Registry instance, but cannot determine how to get a handle to this
> > registry instance to perform the service lookup.
> >
> > I tried using -
> >
> > Registry registry = HiveMindFilter.getRegistry
> > (cycle.getRequestContext().getRequest());
> >
> > but this returns null when called from my
> > ISpecificationResolverDelegate implementing class.
> >
> > The registry has definitely been constructed correctly and populated
> > as other components have already been parsed correctly when stepping
> > debugging and stepping through the code.
> >
> > Any help much appreciated
> >
> > Andy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> >
> >
> 
> 
> --
> 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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: Access to the Tapestry Hivemind Registry in 4.0

Posted by Howard Lewis Ship <hl...@gmail.com>.
The CVS HEAD has code changes where the Registry is stored into the
ServletContext using the key org.apache.tapestry.Registry:foo where
foo is the name of the application servlet.

Actually, just checked, looks like that code is in alpha-3.

On 6/9/05, Andrew Kirby <an...@gmail.com> wrote:
> I have a requirement for access to the Hivemind Registry instance that
> is constructed within the Tapestry Application Servlet such that I can
> lookup and use the default SpecifcationParser service.
> 
> I cant find a way to achieve this ?
> 
> I am implementing an ISpecificationResolverDelegate class using the
> tapestry4-alpha3 code base and need access to the SpecificationParser
> service so assume that I can lookup this service from the Tapestry
> Registry instance, but cannot determine how to get a handle to this
> registry instance to perform the service lookup.
> 
> I tried using -
> 
> Registry registry = HiveMindFilter.getRegistry
> (cycle.getRequestContext().getRequest());
> 
> but this returns null when called from my
> ISpecificationResolverDelegate implementing class.
> 
> The registry has definitely been constructed correctly and populated
> as other components have already been parsed correctly when stepping
> debugging and stepping through the code.
> 
> Any help much appreciated
> 
> Andy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
> 


-- 
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

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org