Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 98804 invoked from network); 15 Feb 2006 09:39:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Feb 2006 09:39:44 -0000 Received: (qmail 19346 invoked by uid 500); 15 Feb 2006 09:39:42 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 19335 invoked by uid 99); 15 Feb 2006 09:39:42 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 01:39:42 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [204.127.192.83] (HELO rwcrmhc13.comcast.net) (204.127.192.83) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 01:39:42 -0800 Received: from [192.168.15.99] (c-24-23-198-24.hsd1.ca.comcast.net[24.23.198.24]) by comcast.net (rwcrmhc13) with SMTP id <20060215093920m1300fj0ile>; Wed, 15 Feb 2006 09:39:20 +0000 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <510143ac0602140523g5daed7fav6ce1288d0398d5f3@mail.gmail.com> References: <510143ac0602130204ud9c9879o44efd515ee2eaab@mail.gmail.com> <6004BC60-0D25-4F19-97CB-5277A8215D8F@humanesoftware.com> <3D764F61-8D72-4AB6-A56A-E4A2C2B358B6@humanesoftware.com> <510143ac0602140523g5daed7fav6ce1288d0398d5f3@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <08373F67-EDEF-432D-A21C-BB832BA57343@humanesoftware.com> Content-Transfer-Encoding: 7bit From: Mark Slater Subject: Re: Model-2 Deployment example and test app [Fixed, with suggestions for updated docs] Date: Wed, 15 Feb 2006 01:39:19 -0800 To: jackrabbit-dev@incubator.apache.org X-Mailer: Apple Mail (2.746.2) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Feb 14, 2006, at 5:23 AM, Jukka Zitting wrote: >> I did find one other potential documentation bug in the howto- >> model1.xml page. The text says >> [...] >> I set up a model 1 repository in the same servlet (but with different >> repository settings) and tried to follow these directions. The >> problem that I ran into is that the shutdown() method is not in the >> javax.jcr.Repository interface, and BindableRepository is package >> protected so I can't even cast the object returned by the Context to >> a BindableRepository. Without that, I wasn't able to see how the >> shutdown() method could be called from my servlet's destroy() method. > > Good point. Nowadays there's an alternative Repository frontend called > TransientRepository that solves the shutdown problem by automatically > closing the repository when all the sessions are closed, but it hasn't > yet been integrated with BindableRepository. I'll take a look at > fixing this. It seems there's an interface in org.apache.jackrabbit.api called JackrabbitRepository. Its only method is the prototype for the shutdown() method that needs to be called. I tried changing BindableRepository implement that, and made the method made public. When I did my web app could cast the object it got from the JNDI context to a JackrabbitRepository and things worked just fine. Mark Index: src/main/java/org/apache/jackrabbit/core/jndi/ BindableRepository.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/jndi/ BindableRepository.java (revision 377972) +++ src/main/java/org/apache/jackrabbit/core/jndi/ BindableRepository.java (working copy) @@ -16,6 +16,7 @@ */ package org.apache.jackrabbit.core.jndi; +import org.apache.jackrabbit.api.JackrabbitRepository; import org.apache.jackrabbit.core.RepositoryImpl; import org.apache.jackrabbit.core.config.RepositoryConfig; @@ -59,7 +60,7 @@ * method should be used to explicitly close the repository if * needed. */ -class BindableRepository implements Repository, Referenceable, Serializable { +class BindableRepository implements Repository, JackrabbitRepository, Referenceable, Serializable { /** The serialization UID of this class. */ static final long serialVersionUID = -2298220550793843166L; @@ -253,7 +254,7 @@ /** * Delegated to the underlying repository instance. */ - void shutdown() { + public void shutdown() { ((RepositoryImpl) delegatee).shutdown(); try { Runtime.getRuntime().removeShutdownHook(hook);