use of org.apache.rya.api.persist.RyaDAOException in project incubator-rya by apache.
the class AccumuloRyaDAO method removeNamespace.
@Override
public void removeNamespace(final String pfx) throws RyaDAOException {
try {
final Mutation del = new Mutation(new Text(pfx));
del.putDelete(INFO_NAMESPACE_TXT, EMPTY_TEXT);
bw_ns.addMutation(del);
if (flushEachUpdate.get()) {
mt_bw.flush();
}
} catch (final Exception e) {
throw new RyaDAOException(e);
}
}
use of org.apache.rya.api.persist.RyaDAOException in project incubator-rya by apache.
the class AccumuloRyaDAO method getVersion.
@Override
public String getVersion() throws RyaDAOException {
String version = null;
final CloseableIteration<RyaStatement, RyaDAOException> versIter = queryEngine.query(new RyaStatement(RTS_SUBJECT_RYA, RTS_VERSION_PREDICATE_RYA, null), conf);
if (versIter.hasNext()) {
version = versIter.next().getObject().getData();
}
versIter.close();
return version;
}
use of org.apache.rya.api.persist.RyaDAOException in project incubator-rya by apache.
the class AccumuloRyaDAO method iterateNamespace.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public CloseableIteration<Namespace, RyaDAOException> iterateNamespace() throws RyaDAOException {
try {
final Scanner scanner = connector.createScanner(tableLayoutStrategy.getNs(), ALL_AUTHORIZATIONS);
scanner.fetchColumnFamily(INFO_NAMESPACE_TXT);
final Iterator<Map.Entry<Key, Value>> result = scanner.iterator();
return new AccumuloNamespaceTableIterator(result);
} catch (final Exception e) {
throw new RyaDAOException(e);
}
}
use of org.apache.rya.api.persist.RyaDAOException in project incubator-rya by apache.
the class AccumuloRyaDAO method getNamespace.
@Override
public String getNamespace(final String pfx) throws RyaDAOException {
try {
final Scanner scanner = connector.createScanner(tableLayoutStrategy.getNs(), ALL_AUTHORIZATIONS);
scanner.fetchColumn(INFO_NAMESPACE_TXT, EMPTY_TEXT);
scanner.setRange(new Range(new Text(pfx)));
final Iterator<Map.Entry<Key, Value>> iterator = scanner.iterator();
if (iterator.hasNext()) {
return new String(iterator.next().getValue().get(), StandardCharsets.UTF_8);
}
} catch (final Exception e) {
throw new RyaDAOException(e);
}
return null;
}
use of org.apache.rya.api.persist.RyaDAOException in project incubator-rya by apache.
the class AccumuloRyaDAO method destroy.
@Override
public void destroy() throws RyaDAOException {
if (!isInitialized.get()) {
return;
}
// TODO: write lock
try {
isInitialized.set(false);
mt_bw.flush();
mt_bw.close();
} catch (final Exception e) {
throw new RyaDAOException(e);
}
for (final AccumuloIndexer indexer : this.secondaryIndexers) {
try {
indexer.destroy();
} catch (final Exception e) {
logger.warn("Failed to destroy indexer", e);
}
}
}
Aggregations