gov.llnl.babel.repository
Class RepositoryFactory

java.lang.Object
  extended bygov.llnl.babel.repository.RepositoryFactory

public class RepositoryFactory
extends java.lang.Object

RepositoryFactory is a singleton factory that manages the creation of repository interfaces based on a repository URI. A URI that starts with "http:" or "https:" specifies a web repository. A URI that starts with "file:" creates a file repository. All other URIs are assumed to be file repositories.


Constructor Summary
RepositoryFactory()
          Create a new instance of the repository factory.
 
Method Summary
 Repository createRepository(java.lang.String uri)
          Create a new repository object based on the URI.
static RepositoryFactory getInstance()
          Return the singleton instance of the repository factory.
static void setInstance(RepositoryFactory instance)
          Set the singleton instance of the repository factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryFactory

public RepositoryFactory()
Create a new instance of the repository factory. Although singleton classes do not typically define a public constructor, this version does so to support multiple repository factories in the same application. Most implementations, however, will not directly create a factory through the constructor and will instead use the singleton functions getInstance and setInstance.

Method Detail

getInstance

public static RepositoryFactory getInstance()
Return the singleton instance of the repository factory. If the symbol table instance has not yet been created, then it will be created by this call.


setInstance

public static void setInstance(RepositoryFactory instance)
Set the singleton instance of the repository factory. Use this function only if you want to change the default factory implementation or use multiple factories in the same application. Otherwise, getInstance will automatically create the repository factory for you.


createRepository

public Repository createRepository(java.lang.String uri)
                            throws RepositoryException
Create a new repository object based on the URI. Web repositories are created using a URL starting with "http:" or "https:" and file repositories are created using a URL starting with "file:" or any other prefix. A RepositoryException is thrown if any error is detected in creating the repository.

Throws:
RepositoryException