Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 70107 invoked from network); 14 Jan 2009 14:08:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Jan 2009 14:08:36 -0000 Received: (qmail 28321 invoked by uid 500); 14 Jan 2009 14:08:36 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 28234 invoked by uid 500); 14 Jan 2009 14:08:36 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 28225 invoked by uid 99); 14 Jan 2009 14:08:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jan 2009 06:08:36 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jan 2009 14:08:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6BDB923888AF; Wed, 14 Jan 2009 06:08:12 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r734403 - in /jackrabbit/branches/1.4/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java Date: Wed, 14 Jan 2009 14:08:04 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090114140812.6BDB923888AF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Wed Jan 14 06:07:44 2009 New Revision: 734403 URL: http://svn.apache.org/viewvc?rev=734403&view=rev Log: 1.4: Merged revision 683268 (JCR-1664/JCR-1935). Added support for subclasses that still override the previous getRepository signature. Modified: jackrabbit/branches/1.4/jackrabbit-core/ (props changed) jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java Propchange: jackrabbit/branches/1.4/jackrabbit-core/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 14 06:07:44 2009 @@ -1 +1 @@ -/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668086,668147,672125,678788,679389,680135,681031,681287,682409,686688,691181,691550,694164,698200,698209,727402,733080,734366 +/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668086,668147,672125,678788,679389,680135,681031,681287,682409,683268,686688,691181,691550,694164,698200,698209,727402,733080,734366 Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java?rev=734403&r1=734402&r2=734403&view=diff ============================================================================== --- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java (original) +++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java Wed Jan 14 06:07:44 2009 @@ -49,8 +49,7 @@ *

* An instance of this class is normally always also initialized. * The uninitialized state is only used briefly during the static - * {@link #create(String, String) create} method and during - * serialization and JNDI "referenciation". + * construction, deserialization, and JNDI "referenciation". *

* A JVM shutdown hook is used to make sure that the initialized * repository is properly closed when the JVM shuts down. The @@ -86,7 +85,7 @@ /** * The delegate repository instance. Created by {@link #init() init}. */ - private transient JackrabbitRepository delegatee; + private transient JackrabbitRepository repository; /** * Thread that is registered as shutdown hook after {@link #init} has been @@ -95,11 +94,11 @@ private transient Thread hook; /** - * Creates a BindableRepository instance with the given configuration - * information, but does not create the underlying repository instance. + * Creates a BindableRepository instance with the configuration + * information in the given JNDI reference. * - * @param configFilePath repository configuration file path - * @param repHomeDir repository home directory path + * @param reference JNDI reference + * @throws RepositoryException if the repository can not be started */ public BindableRepository(Reference reference) throws RepositoryException { this.reference = reference; @@ -113,8 +112,8 @@ * * @throws RepositoryException if the repository cannot be created */ - protected void init() throws RepositoryException { - delegatee = getRepository(reference); + private void init() throws RepositoryException { + repository = createRepository(); hook = new Thread() { public void run() { shutdown(); @@ -124,14 +123,22 @@ } /** - * Creates a repository instance based on the given reference. Can be - * overridden by subclasses to return different repositories. The default - * implementation returns a {@link RepositoryImpl} instance. + * Creates a repository instance based on the contained JNDI reference. + * Can be overridden by subclasses to return different repositories. + * A subclass can access the JNDI reference through the + * {@link #getReference()} method. The default implementation + * returns a {@link RepositoryImpl} instance. * - * @param reference repository reference * @return repository instance * @throws RepositoryException if the repository could not be created */ + protected JackrabbitRepository createRepository() + throws RepositoryException { + return getRepository(reference); + } + + // JCR-1644: Required for compatibility with subclasses that used to + // override this older signature of the createRepository method. protected JackrabbitRepository getRepository(Reference reference) throws RepositoryException { RepositoryConfig config = RepositoryConfig.create( @@ -140,6 +147,16 @@ return RepositoryImpl.create(config); } + /** + * Returns the underlying repository instance. Can be used by subclasses + * to access the repository instance. + * + * @return repository instance + */ + protected JackrabbitRepository getRepository() { + return repository; + } + //-----------------------------------------------------------< Repository > /** @@ -148,7 +165,7 @@ */ public Session login(Credentials credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException, RepositoryException { - return delegatee.login(credentials, workspaceName); + return repository.login(credentials, workspaceName); } /** @@ -156,7 +173,7 @@ * {@inheritDoc} */ public String getDescriptor(String key) { - return delegatee.getDescriptor(key); + return repository.getDescriptor(key); } /** @@ -164,7 +181,7 @@ * {@inheritDoc} */ public String[] getDescriptorKeys() { - return delegatee.getDescriptorKeys(); + return repository.getDescriptorKeys(); } //--------------------------------------------------------< Referenceable > @@ -212,7 +229,7 @@ * Delegated to the underlying repository instance. */ public void shutdown() { - delegatee.shutdown(); + repository.shutdown(); try { Runtime.getRuntime().removeShutdownHook(hook); } catch (IllegalStateException e) { Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java?rev=734403&r1=734402&r2=734403&view=diff ============================================================================== --- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java (original) +++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java Wed Jan 14 06:07:44 2009 @@ -37,7 +37,7 @@ * cache using java.naming.Reference objects as keys and * storing soft references to BindableRepository instances */ - private static Map cache = new ReferenceMap(); + private static final Map cache = new ReferenceMap(); /** * {@inheritDoc}