org.modeshape.jcr.api
Interface RepositoryFactory

All Superinterfaces:
RepositoryFactory

public interface RepositoryFactory
extends RepositoryFactory


Method Summary
 Repositories getRepositories(String jcrUrl)
          Returns the Repositories instance referenced by the jcrUrl parameter.
 void shutdown()
          Begin the shutdown process for all the JcrEngine JcrEngines created by calls to RepositoryFactory.getRepository(Map).
 boolean shutdown(long timeout, TimeUnit unit)
          Begin the shutdown process for all the JcrEngine JcrEngines created by calls to RepositoryFactory.getRepository(Map).
 
Methods inherited from interface javax.jcr.RepositoryFactory
getRepository
 

Method Detail

shutdown

void shutdown()
Begin the shutdown process for all the JcrEngine JcrEngines created by calls to RepositoryFactory.getRepository(Map).

Calling #getRepository(Map) with a file-based URL parameter causes a new JcrEngine to be instantiated and started. Any JcrEngine created in this manner must be stored by the RepositoryFactory implementation. Invoking this method iteratively invokes the shutdown() method on each JcrEngine.

This method merely initiates the shutdown process for each JcrEngine. There is no guarantee that the shutdown process will have completed prior to this method returning. The shutdown(long, TimeUnit) method provides the ability to wait until all engines are shutdown or the given time elapses.

Invoking this method does not preclude creating new JcrEngines with future calls to RepositoryFactory.getRepository(Map). Any caller using this method as part of an application shutdown process should take care to cease invocations of RepositoryFactory.getRepository(Map) prior to invoking this method.


shutdown

boolean shutdown(long timeout,
                 TimeUnit unit)
                 throws InterruptedException
Begin the shutdown process for all the JcrEngine JcrEngines created by calls to RepositoryFactory.getRepository(Map).

Calling #getRepository(Map) with a file-based URL parameter causes a new JcrEngine to be instantiated and started. Any JcrEngine created in this manner must be stored by the RepositoryFactory implementation. Invoking this method iteratively invokes the shutdown() method on each JcrEngine and then iteratively invokes the awaitTermination(long, TimeUnit) method to await termination.

Although this method initiates the shutdown process for each JcrEngine and invokes the awaitTermination method, there is still no guarantee that the shutdown process will have completed prior to this method returning. It is possible for the time required to shutdown one or more of the engines to exceed the provided time window.

Invoking this method does not preclude creating new JcrEngines with future calls to RepositoryFactory.getRepository(Map). Any caller using this method as part of an application shutdown process should take care to cease invocations of RepositoryFactory.getRepository(Map) prior to invoking this method.

Parameters:
timeout - the maximum time per engine to allow for shutdown
unit - the time unit of the timeout argument
Returns:
true if all engines completely shut down and false if the timeout elapsed before it was shut down completely
Throws:
InterruptedException - if interrupted while waiting

getRepositories

Repositories getRepositories(String jcrUrl)
Returns the Repositories instance referenced by the jcrUrl parameter.

If the jcrUrl parameter contains a valid, ModeShape-compatible URL for a Repositories instance that has not yet been started, that Repositories instance will be created and started as a side effect of this method.

Parameters:
jcrUrl - the ModeShape-compatible URL that specifies the JcrEngine to be used; may not be null
Returns:
the Repositories instance specified by the given url if one exists, otherwise null


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.