gov.llnl.babel.repository

Class 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(Context context)
Create a new instance of the repository factory.

Method Summary

Repository
createRepository(String uri)
Create a new repository object based on the URI.

Constructor Details

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.

Method Details

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.