Class RepositoryProvider
java.lang.Object
org.eclipse.rdf4j.repository.manager.RepositoryProvider
A static access point to manage
RepositoryManager
s and Repositories
. RepositoryProvider
ensures that all managers and repositories obtained through it are automatically shutdown when the JVM exits.- Author:
- James Leigh
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Repository
getRepository
(String url) Retrieves a (new or existing) Repository object for the supplied repository URL.static String
Retrieves the Repository ID that will be passed to a RepositoryManager for the given repository URL.static LocalRepositoryManager
getRepositoryManager
(File dir) Creates aLocalRepositoryManager
, if not already created, that will be shutdown when the JVM exits cleanly.static RepositoryManager
Creates aRepositoryManager
, if not already created, that will be shutdown when the JVM exits cleanly.static RepositoryManager
Retrieves theRepositoryManager
that will be used for the given repository URL.
-
Constructor Details
-
RepositoryProvider
public RepositoryProvider()
-
-
Method Details
-
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)
RepositoryManager
using the supplied url as its data dir. - Throws:
RepositoryConfigException
RepositoryException
-
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:
RepositoryConfigException
RepositoryException
-
getRepositoryManagerOfRepository
public static RepositoryManager getRepositoryManagerOfRepository(String url) throws RepositoryConfigException, RepositoryException Retrieves theRepositoryManager
that 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
RepositoryManager
that manages the repository identified by the URL. - Throws:
IllegalArgumentException
- if the supplied URL is not a repository URL.RepositoryConfigException
RepositoryException
-
getRepositoryIdOfRepository
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:
RepositoryException
RepositoryConfigException
-