use of org.eclipse.rdf4j.repository.config.RepositoryConfig in project rdf4j by eclipse.
the class SystemRepository method initialize.
@Override
public void initialize() throws RepositoryException {
super.initialize();
RepositoryConnection con = getConnection();
try {
if (con.isEmpty()) {
logger.debug("Initializing empty {} repository", ID);
con.begin();
con.setNamespace("rdf", RDF.NAMESPACE);
con.setNamespace("sys", RepositoryConfigSchema.NAMESPACE);
con.commit();
RepositoryConfig repConfig = new RepositoryConfig(ID, TITLE, new SystemRepositoryConfig());
RepositoryConfigUtil.updateRepositoryConfigs(con, repConfig);
}
} catch (RepositoryConfigException e) {
throw new RepositoryException(e.getMessage(), e);
} finally {
con.close();
}
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfig in project rdf4j by eclipse.
the class LocalRepositoryManager method getRepositoryInfo.
@Override
public RepositoryInfo getRepositoryInfo(String id) {
RepositoryConfig config = getRepositoryConfig(id);
if (config == null) {
return null;
}
RepositoryInfo repInfo = new RepositoryInfo();
repInfo.setId(config.getID());
repInfo.setDescription(config.getTitle());
try {
repInfo.setLocation(getRepositoryDir(config.getID()).toURI().toURL());
} catch (MalformedURLException mue) {
throw new RepositoryException("Location of repository does not resolve to a valid URL", mue);
}
repInfo.setReadable(true);
repInfo.setWritable(true);
return repInfo;
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfig in project rdf4j by eclipse.
the class TypeFilteringRepositoryManager method getRepositoryConfig.
@Override
public RepositoryConfig getRepositoryConfig(String repositoryID) throws RepositoryConfigException, RepositoryException {
RepositoryConfig result = delegate.getRepositoryConfig(repositoryID);
if (result != null) {
if (!isCorrectType(result)) {
logger.debug("Surpressing retrieval of repository {}: repository type {} did not match expected type {}", new Object[] { result.getID(), result.getRepositoryImplConfig().getType(), type });
result = null;
}
}
return result;
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfig in project rdf4j by eclipse.
the class LocalRepositoryManager method upgrade.
private synchronized void upgrade() {
File repositoriesDir = resolvePath(REPOSITORIES_DIR);
String[] dirs = repositoriesDir.list(new FilenameFilter() {
public boolean accept(File repositories, String name) {
File dataDir = new File(repositories, name);
return dataDir.isDirectory() && new File(dataDir, CFG_FILE).exists();
}
});
if (dirs != null && dirs.length > 0) {
// already upgraded
return;
}
SystemRepository systemRepository = getSystemRepository();
if (systemRepository == null) {
// no legacy SYSTEM
return;
}
Set<String> ids = RepositoryConfigUtil.getRepositoryIDs(systemRepository);
List<RepositoryConfig> configs = new ArrayList<RepositoryConfig>();
for (String id : ids) {
configs.add(getRepositoryConfig(id));
}
for (RepositoryConfig config : configs) {
addRepositoryConfig(config);
}
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfig in project rdf4j by eclipse.
the class LocalRepositoryManager method createRepository.
@Override
protected Repository createRepository(String id) throws RepositoryConfigException, RepositoryException {
Repository repository = null;
RepositoryConfig repConfig = getRepositoryConfig(id);
if (repConfig != null) {
repConfig.validate();
repository = createRepositoryStack(repConfig.getRepositoryImplConfig());
repository.setDataDir(getRepositoryDir(id));
repository.initialize();
}
return repository;
}
Aggregations