org.openrdf.repository.manager
Class LocalRepositoryManager

java.lang.Object
  extended by org.openrdf.repository.manager.RepositoryManager
      extended by org.openrdf.repository.manager.LocalRepositoryManager
Direct Known Subclasses:
NotifyingLocalRepositoryManager

public class LocalRepositoryManager
extends RepositoryManager

An implementation of the RepositoryManager interface that operates directly on the repository data files in the local file system.

Author:
Arjohn Kampman

Field Summary
static String REPOSITORIES_DIR
           
 
Fields inherited from class org.openrdf.repository.manager.RepositoryManager
logger
 
Constructor Summary
LocalRepositoryManager(File baseDir)
          Creates a new RepositoryManager that operates on the specfified base directory.
 
Method Summary
 String addRepositoryConfig(String id, Model config)
          Adds or updates the configuration of a repository to the manager's system repository.
protected  void cleanUpRepository(String repositoryID)
          Clean up a removed repository.
protected  Repository createRepository(String id)
          Creates and initializes the repository with the specified ID.
 List<RepositoryInfo> getAllRepositoryInfos(boolean skipSystemRepo)
           
 File getBaseDir()
          Gets the base dir against which to resolve relative paths.
 URL getLocation()
          Gets the base dir against which to resolve relative paths.
 File getRepositoryDir(String repositoryID)
           
 RepositoryInfo getRepositoryInfo(String id)
          Gets the repository that is known by the specified ID from this manager.
 void initialize()
          Initializes the repository manager.
 File resolvePath(String path)
          Resolves the specified path against the manager's base directory.
 
Methods inherited from class org.openrdf.repository.manager.RepositoryManager
getAllRepositories, getAllRepositoryInfos, getAllUserRepositoryInfos, getConfigTemplateManager, getInitializedRepositories, getInitializedRepositoryIDs, getNewRepositoryID, getRepository, getRepositoryConfig, getRepositoryIDs, hasRepositoryConfig, refresh, removeRepositoryConfig, setConfigTemplateManager, setRepositoryConfigManager, shutDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REPOSITORIES_DIR

public static final String REPOSITORIES_DIR
See Also:
Constant Field Values
Constructor Detail

LocalRepositoryManager

public LocalRepositoryManager(File baseDir)
Creates a new RepositoryManager that operates on the specfified base directory.

Parameters:
baseDir - The base directory where data for repositories can be stored, among other things.
Method Detail

initialize

public void initialize()
                throws StoreConfigException
Initializes the repository manager.

Specified by:
initialize in class RepositoryManager
Throws:
StoreException - If the manager failed to initialize the SYSTEM repository.
StoreConfigException - If the manager failed to initialize the SYSTEM repository.

getBaseDir

public File getBaseDir()
Gets the base dir against which to resolve relative paths.


getLocation

public URL getLocation()
                throws MalformedURLException
Gets the base dir against which to resolve relative paths.

Specified by:
getLocation in class RepositoryManager
Throws:
MalformedURLException - If the path cannot be parsed as a URL

resolvePath

public File resolvePath(String path)
Resolves the specified path against the manager's base directory.

See Also:
getBaseDir()

getRepositoryDir

public File getRepositoryDir(String repositoryID)

createRepository

protected Repository createRepository(String id)
                               throws StoreConfigException,
                                      StoreException
Description copied from class: RepositoryManager
Creates and initializes the repository with the specified ID.

Specified by:
createRepository in class RepositoryManager
Parameters:
id - A repository ID.
Returns:
The created repository, or null if no such repository exists.
Throws:
StoreConfigException - If no repository could be created due to invalid or incomplete configuration data.
StoreException

addRepositoryConfig

public String addRepositoryConfig(String id,
                                  Model config)
                           throws StoreConfigException,
                                  StoreException
Description copied from class: RepositoryManager
Adds or updates the configuration of a repository to the manager's system repository. The system repository may already contain a configuration for a repository with the same ID as specified by config, in which case all previous configuration data for that repository will be cleared before the new configuration is added.

Overrides:
addRepositoryConfig in class RepositoryManager
config - The repository configuration that should be added to or updated in the system repository.
Throws:
StoreConfigException - If the manager doesn't know how to update a configuration due to inconsistent configuration data in the system repository. For example, this happens when there are multiple existing configurations with the concerning ID.
StoreException - If the manager failed to update it's system repository.

getRepositoryInfo

public RepositoryInfo getRepositoryInfo(String id)
                                 throws StoreConfigException
Description copied from class: RepositoryManager
Gets the repository that is known by the specified ID from this manager.

Specified by:
getRepositoryInfo in class RepositoryManager
Parameters:
id - A repository ID.
Returns:
A Repository object, or null if no repository was known for the specified ID.
Throws:
StoreConfigException

getAllRepositoryInfos

public List<RepositoryInfo> getAllRepositoryInfos(boolean skipSystemRepo)
                                           throws StoreConfigException
Specified by:
getAllRepositoryInfos in class RepositoryManager
Throws:
StoreConfigException

cleanUpRepository

protected void cleanUpRepository(String repositoryID)
                          throws IOException
Description copied from class: RepositoryManager
Clean up a removed repository. Note that the configuration for this repository is no longer present in the system repository.

Specified by:
cleanUpRepository in class RepositoryManager
Parameters:
repositoryID - the ID of the repository to clean up
Throws:
IOException


Copyright © 2001-2009 Aduna. All Rights Reserved.