use of org.eclipse.rdf4j.repository.config.RepositoryConfigException in project rdf4j by eclipse.
the class RemoteRepositoryManager method removeRepository.
@Override
public boolean removeRepository(String repositoryID) throws RepositoryException, RepositoryConfigException {
boolean existingRepo = hasRepositoryConfig(repositoryID);
if (existingRepo) {
try (RDF4JProtocolSession httpClient = getSesameClient().createRDF4JProtocolSession(serverURL)) {
httpClient.setUsernameAndPassword(username, password);
httpClient.deleteRepository(repositoryID);
} catch (IOException e) {
logger.warn("error while deleting remote repository", e);
throw new RepositoryConfigException(e);
}
}
return existingRepo;
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfigException in project rdf4j by eclipse.
the class SystemRepository method createDelegate.
/*---------*
* Methods *
*---------*/
private Repository createDelegate() {
RepositoryConfig repoConfig = getSystemConfig();
if (repoConfig == null) {
throw new RepositoryConfigException("Could not find SYSTEM configuration");
}
repoConfig.validate();
RepositoryImplConfig config = repoConfig.getRepositoryImplConfig();
RepositoryFactory factory = RepositoryRegistry.getInstance().get(config.getType()).orElseThrow(() -> new RepositoryConfigException("Repository type not in classpath: " + config.getType()));
return factory.getRepository(config);
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfigException 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.RepositoryConfigException in project rdf4j by eclipse.
the class HTTPRepositoryFactory method getRepository.
public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException {
HTTPRepository result = null;
if (config instanceof HTTPRepositoryConfig) {
HTTPRepositoryConfig httpConfig = (HTTPRepositoryConfig) config;
result = new HTTPRepository(httpConfig.getURL());
// result.setUsernameAndPassword(httpConfig.getUsername(), httpConfig.getPassword());
} else {
throw new RepositoryConfigException("Invalid configuration class: " + config.getClass());
}
return result;
}
use of org.eclipse.rdf4j.repository.config.RepositoryConfigException in project rdf4j by eclipse.
the class SPARQLRepositoryConfig method parse.
@Override
public void parse(Model m, Resource implNode) throws RepositoryConfigException {
super.parse(m, implNode);
try {
Models.objectIRI(m.filter(implNode, QUERY_ENDPOINT, null)).ifPresent(iri -> setQueryEndpointUrl(iri.stringValue()));
Models.objectIRI(m.filter(implNode, UPDATE_ENDPOINT, null)).ifPresent(iri -> setUpdateEndpointUrl(iri.stringValue()));
} catch (ModelException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
Aggregations