gov.llnl.babel.repository
Class RepositoryFactory
java.lang.Object
gov.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.
RepositoryFactory
public RepositoryFactory(Context context)
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
.
createRepository
public Repository createRepository(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.