This looks really good. I have been trying it out, but the assumption about HiveMind being already initiated is tripping me up. When the bean is creating, the HiveMind registry hasn't been created yet. So I am trying to either delay the lookup in the bean, or force HiveMind to come up first. No luck yet.

In my web.xml, I have a context listener set up for org.springframework.web.context.ContextLoaderListener. I am thinking that I will need to create a new context listener for starting HiveMind before spring.

----Original Message Follows----
From: Geoff Longman <[EMAIL PROTECTED]>
Reply-To: "Tapestry users" <[email protected]>
To: Tapestry users <[email protected]>
Subject: Re: Using Tapestry HiveMind services in Spring
Date: Mon, 2 Jan 2006 14:39:57 -0500
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by bay0-mc12-f13.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 2 Jan 2006 11:40:25 -0800
Received: (qmail 13602 invoked by uid 500); 2 Jan 2006 19:40:21 -0000
Received: (qmail 13591 invoked by uid 99); 2 Jan 2006 19:40:21 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jan 2006 11:40:21 -0800 Received: pass (asf.osuosl.org: domain of [EMAIL PROTECTED] designates 66.249.82.193 as permitted sender) Received: from [66.249.82.193] (HELO xproxy.gmail.com) (66.249.82.193) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jan 2006 11:40:18 -0800 Received: by xproxy.gmail.com with SMTP id s9so1616262wxc for <[email protected]>; Mon, 02 Jan 2006 11:39:58 -0800 (PST) Received: by 10.70.74.3 with SMTP id w3mr12791026wxa; Mon, 02 Jan 2006 11:39:57 -0800 (PST)
Received: by 10.70.27.19 with HTTP; Mon, 2 Jan 2006 11:39:57 -0800 (PST)
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Post: <mailto:[email protected]>
List-Id: "Tapestry users" <tapestry-user.jakarta.apache.org>
Delivered-To: mailing list [email protected]
X-ASF-Spam-Status: No, hits=-0.0 required=10.0tests=SPF_PASS
X-Spam-Check-By: apache.org
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FdoS8ng1Y6MgfsLZH/f07Tp4LjroBow4SLYUPdI80UiwGGMIyG2ca2OxuCopUVSy88Y6yWOftLu+jyNRlZBsnjmTzPVGLDebvMDLMXMGbTb74M5mB2aTwau11YV07C8VnvS8wrfjC1R5GMuNZaHDMEo9z+zhxAccoXVpP8KQn/0=
References: <[EMAIL PROTECTED]>
X-Virus-Checked: Checked by ClamAV on apache.org
Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 02 Jan 2006 19:40:25.0344 (UTC) FILETIME=[6084D800:01C60FD4]

I think you can replace thier RegistryFactoryBean with the following
and still use thier ServiceFactoryBeans. (whipped this up, it's
untested)


Geoff

/**
 * [EMAIL PROTECTED] FactoryBean} implementation that locates the HiveMind 
[EMAIL PROTECTED]
Registry} for a Tapestry
* servlet. <p/> This assumes that the Tapestry servlet has already been inited.
 */
public class TapestryRegistryLocatorBean implements FactoryBean,
InitializingBean,
        ApplicationContextAware
{

// org.apache.tapestry.ApplicationServlet defines this but only privately!
    public static final String REGISTRY_KEY_PREFIX =
"org.apache.tapestry.Registry:";

    private WebApplicationContext applicationContext;

    private String tapestryServletName;

    private Registry registry;

    public Object getObject() throws Exception
    {
        return this.registry;
    }

    public Class getObjectType()
    {
        return Registry.class;
    }

    public boolean isSingleton()
    {
        return true;
    }

    public void setApplicationContext(ApplicationContext
applicationContext) throws BeansException
    {
        if (!(applicationContext instanceof WebApplicationContext))
            throw new FatalBeanException(
                    "TapestryRegistryLocatorBean must be installed in
a Spring WebApplicationContext!");

this.applicationContext = (WebApplicationContext) applicationContext;
    }

    public void afterPropertiesSet() throws Exception
    {
        ServletContext context = applicationContext.getServletContext();

String registryKey = REGISTRY_KEY_PREFIX + this.tapestryServletName;

        registry = (Registry) context.getAttribute(registryKey);

    }

    public void setTapestryServletName(String tapestryServletName)
    {
        this.tapestryServletName = tapestryServletName;
    }
}



On 1/2/06, John Smith <[EMAIL PROTECTED]> wrote:
> I am using acegi with spring for the web security of my site. However, the
> login process needs to be able to query the database to get information
> about the user account (something different than just validating username
> and password). Then I need to set the username on the Visit object. I
> already have acegi working, and I already have a DAO for user information
> working in HveMind.
>
> Now I am trying to use the DAO from HivemMind in my acegi security beans. I
> could just create a spring DAO and then just have two sets DAOs (one for
> spring and one for hivemind), but I would like the spring beans to use the
> HiveMind managed DAOs.
>
> I have looked into springmodules which provides access to HiveMind services
> through spring, but it looks like it actually is just creating a new
> Hivemind registry inside spring. It's not using the same instance of the
> registry that Tapestry is using. This may be ok, but I am concerned about
> thread saftey, and other concurrency problems to resources that HiveMind may
> access, like the db.
>
> I am thinking about using the Login page as the bridge between the two. I
> would inject a spring bean into the page, and a HiveMind service. Then
> spring and HiveMind would be in the same place at the same time and I could
> set a reference to HiveMind services on the spring bean.
>
> Anyone have any ideas on this? There is probably a better way.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

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