Class RepositoryProvider
- java.lang.Object
-
- org.eclipse.rdf4j.repository.manager.RepositoryProvider
-
public class RepositoryProvider extends Object
A static access point to manageRepositoryManagers andRepositories. RepositoryProvider ensures that all managers and repositories obtained through it are automatically shutdown when the JVM exits.- Author:
- James Leigh
-
-
Constructor Summary
Constructors Constructor Description RepositoryProvider()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RepositorygetRepository(String url)Retrieves a (new or existing) Repository object for the supplied repository URL.static StringgetRepositoryIdOfRepository(String url)Retrieves the Repository ID that will be passed to a RepositoryManager for the given repository URL.static LocalRepositoryManagergetRepositoryManager(File dir)Creates aLocalRepositoryManager, if not already created, that will be shutdown when the JVM exits cleanly.static RepositoryManagergetRepositoryManager(String url)Creates aRepositoryManager, if not already created, that will be shutdown when the JVM exits cleanly.static RepositoryManagergetRepositoryManagerOfRepository(String url)Retrieves theRepositoryManagerthat will be used for the given repository URL.
-
-
-
Method Detail
-
getRepositoryManager
public static RepositoryManager getRepositoryManager(String url) throws RepositoryConfigException, RepositoryException
Creates aRepositoryManager, if not already created, that will be shutdown when the JVM exits cleanly.- Parameters:
url- location of the data directory for the RepositoryManager. This should be a URL of the form http://host:port/path/ (for a RemoteRepositoryManager) or file:///path/ (for a LocalRepositoryManager).- Returns:
- a (new or existing)
RepositoryManagerusing the supplied url as its data dir. - Throws:
RepositoryConfigExceptionRepositoryException
-
getRepositoryManager
public static LocalRepositoryManager getRepositoryManager(File dir) throws RepositoryConfigException, RepositoryException
Creates aLocalRepositoryManager, if not already created, that will be shutdown when the JVM exits cleanly.- Parameters:
dir- the data directory for the repository manager.- Returns:
- a (new or existing)
LocalRepositoryManager. - Throws:
RepositoryConfigExceptionRepositoryException
-
getRepositoryManagerOfRepository
public static RepositoryManager getRepositoryManagerOfRepository(String url) throws RepositoryConfigException, RepositoryException
Retrieves theRepositoryManagerthat will be used for the given repository URL. Creates aRepositoryManager, if not already created, that will be shutdown when the JVM exits cleanly.- Parameters:
url- the location of the repository for which to retrieve the corresponding RepositoryManager. The parameter must be a URL of the form http://host:port/path/repositories/id or file:///path/repositories/id.- Returns:
- the
RepositoryManagerthat manages the repository identified by the URL. - Throws:
IllegalArgumentException- if the supplied URL is not a repository URL.RepositoryConfigExceptionRepositoryException
-
getRepositoryIdOfRepository
public static String getRepositoryIdOfRepository(String url)
Retrieves the Repository ID that will be passed to a RepositoryManager for the given repository URL.- Parameters:
url- the location URL for the repository. The parameter must be a URL of the form http://host:port/path/repositories/id or file:///path/repositories/id.- Returns:
- the repository identifier string for the given repository URL.
- Throws:
IllegalArgumentException- if the supplied URL is not a repository URL.
-
getRepository
public static Repository getRepository(String url) throws RepositoryException, RepositoryConfigException
Retrieves a (new or existing) Repository object for the supplied repository URL. The Repository will be shutdown when the JVM exits cleanly.- Parameters:
url- the repository URL. The parameter must be a URL of the form http://host:port/path/repositories/id or file:///path/repositories/id.- Returns:
- Repository from a RepositoryManager or null if repository is not defined
- Throws:
RepositoryExceptionRepositoryConfigException
-
-