use of org.openrdf.sail.config.SailConfigException in project incubator-rya by apache.
the class RyaAccumuloSailFactory method getSail.
@Override
public Sail getSail(final SailImplConfig config) throws SailConfigException {
try {
final RdfCloudTripleStore store = new RdfCloudTripleStore();
final RyaAccumuloSailConfig cbconfig = (RyaAccumuloSailConfig) config;
final String instanceName = cbconfig.getInstance();
final String zooKeepers = cbconfig.getZookeepers();
Instance i;
if (cbconfig.isMock()) {
i = new MockInstance(instanceName);
} else {
i = new ZooKeeperInstance(instanceName, zooKeepers);
}
final String user = cbconfig.getUser();
final String pass = cbconfig.getPassword();
final Connector connector = i.getConnector(user, new PasswordToken(pass));
final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(connector);
final AccumuloRdfConfiguration conf = cbconfig.toRdfConfiguation();
ConfigUtils.setIndexers(conf);
conf.setDisplayQueryPlan(true);
crdfdao.setConf(conf);
crdfdao.init();
store.setRyaDAO(crdfdao);
return store;
} catch (RyaDAOException | AccumuloException | AccumuloSecurityException e) {
throw new SailConfigException(e);
}
}
use of org.openrdf.sail.config.SailConfigException in project incubator-rya by apache.
the class RyaAccumuloSailConfig method parse.
@Override
public void parse(final Graph graph, final Resource implNode) throws SailConfigException {
super.parse(graph, implNode);
System.out.println("parsing");
try {
final Literal userLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, USER);
if (userLit != null) {
setUser(userLit.getLabel());
}
final Literal pwdLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, PASSWORD);
if (pwdLit != null) {
setPassword(pwdLit.getLabel());
}
final Literal instLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, INSTANCE);
if (instLit != null) {
setInstance(instLit.getLabel());
}
final Literal zooLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, ZOOKEEPERS);
if (zooLit != null) {
setZookeepers(zooLit.getLabel());
}
final Literal mockLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, IS_MOCK);
if (mockLit != null) {
setMock(Boolean.parseBoolean(mockLit.getLabel()));
}
} catch (final GraphUtilException e) {
throw new SailConfigException(e.getMessage(), e);
}
}
Aggregations