You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Zachary Pinter <zp...@gmail.com> on 2005/03/02 15:21:33 UTC

Re: Tapestry 3.0 and Hivemind Integration Resources

Continuing with the Tapestry 3.0/HiveMind discussion:

I've got the HiveMind Registry/Service properties setup something like this:

public class MyBasePage extends BasePage {
    private static Registry _registry;
    
    public void finishLoad(IRequestCycle cycle, IPageLoader loader,
            IComponentSpecification specification) {   
        HttpServletRequest request =  cycle.getRequestContext().getRequest();
        _registry = HiveMindFilter.getRegistry(request);
        super.finishLoad(cycle, loader, specification); 
    }
    
    public Registry getRegistry()
    {
        return _registry;
    }

    public Object getHive(String name)
    {
        try {
            return getRegistry().getService(Class.forName(name));
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Couldn't find class "+name);
        }
    }
}

When calling getHive, I pass something like
"myproject.hivemind.services.Login", which gives me a service point
does not exist exception. I'm pretty sure I've got my module in the
wrong place. I use Eclipse/Jetty for development and only use ant for
creating/deploying war files.

I've got a project setup like this:

/src
/classes
/context
/context/css
/context/images
/context/WEB-INF
/lib

Which folder or subfolder should I place the module's xml file in and
what should the file be named? If my module is called module1, should
the file be module1.xml, or hivemodule.xml, or does it even matter?

-- 
Zachary Pinter
z@absolutez.net

On Tue, 22 Feb 2005 15:37:54 -0500, Howard Lewis Ship <hl...@gmail.com> wrote:
> I'd just obtain it inside finishLoad():
> 
> protected void finishLoad()
> {
>   HttpServletRequest request= getRequestCycle(). ......
> 
>   _registry = HiveMindFilter.getRegistry(request);
> }
> 
> public Registry getRegistry()
> {
>   return _registry;
> }
> 
> I'll get back to you about the OGNL code.  This will go on the HiveMind wiki.
> 
> 
> On Tue, 22 Feb 2005 13:14:58 -0600, Zachary Pinter <zp...@gmail.com> wrote:
> > So, if  I had a class MyBasePage that all my pages inherited from,
> > would the following be a good way to access the Registry?:
> >
> > public class MyBasePage extends BasePage {
> >
> >     public static final String HIVEMIND_REGISTRY="hivemind_registry";
> >
> >     public Registry getRegistry()
> >     {
> >         if (((Map) getGlobal()).get(HIVEMIND_REGISTRY) == null)
> >             ((Map)getGlobal()).put(HIVEMIND_REGISTRY,RegistryBuilder.constructDefaultRegistry());
> >         return (Registry)((Map) getGlobal()).get(HIVEMIND_REGISTRY);
> >     }
> > }
> >
> > Also, how would you do the ognl mapping?
> >
> > Thanks again!
> >
> > --
> > Zachary Pinter
> > z@absolutez.net
> >
> > On Tue, 22 Feb 2005 12:20:14 -0500, Howard Lewis Ship <hl...@gmail.com> wrote:
> > > I've been trying to scratch together a few moments to discuss it on
> > > the HiveMind wiki. Basic approach was:
> > >
> > > - OGNL mapping to extract services from a Registry by name
> > > - Add Registry as property of base page (or of engine, or make
> > > Registry the Global object)
> > > - Inject services using <property-specification>'s initial-value attribute.
> > >
> > > In Tapestry 3.1, it just looks like this:
> > >
> > > <inject property="myProperty" object="service:mymodule.MyService"/>
> > >
> > > On Tue, 22 Feb 2005 09:36:46 -0600, Zachary Pinter <zp...@gmail.com> wrote:
> > > > I've been searching through google and the mailing list, but all the
> > > > information I find about Tapestry and Hivemind is in relation to
> > > > Tapestry 3.1.
> > > >
> > > > I'm interested in looking into Hivemind now (since it seems like it
> > > > will be an even better choice come 3.1), but I can't seem to find any
> > > > resources on doing so.
> > > >
> > > > Are there any example applications, tutorials,or articles concerning
> > > > Hivemind and Tapestry? If not, could somebody give me a quick point in
> > > > the right direction?
> > > >
> > > > From the wiki, the best I could find was using the initial-value of a
> > > > page property to access services:
> > > >
> > > > <property
> > > >     name="boo"
> > > >     initial-value='hive["my.module.MyService"]'/>
> > > >
> > > > Is it as simple as that? What would the java file for the page look
> > > > like for that? Do you use global or visit to work with hivemind?
> > > >
> > > > Thanks in advance for all responses!
> > > >
> > > > --
> > > > Zachary Pinter
> > > > z@absolutez.net
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tapestry-user-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
> > >
> >
> 
> --
> 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-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org