Search in sources :

Example 36 with RyaDAOException

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);
    }
}
Also used : RyaDAOException(org.apache.rya.api.persist.RyaDAOException) Text(org.apache.hadoop.io.Text) Mutation(org.apache.accumulo.core.data.Mutation) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) MutationsRejectedException(org.apache.accumulo.core.client.MutationsRejectedException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaDAOException(org.apache.rya.api.persist.RyaDAOException)

Example 37 with RyaDAOException

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;
}
Also used : RyaStatement(org.apache.rya.api.domain.RyaStatement) RyaDAOException(org.apache.rya.api.persist.RyaDAOException)

Example 38 with RyaDAOException

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);
    }
}
Also used : Scanner(org.apache.accumulo.core.client.Scanner) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) MutationsRejectedException(org.apache.accumulo.core.client.MutationsRejectedException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaDAOException(org.apache.rya.api.persist.RyaDAOException)

Example 39 with RyaDAOException

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;
}
Also used : Scanner(org.apache.accumulo.core.client.Scanner) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) Text(org.apache.hadoop.io.Text) Range(org.apache.accumulo.core.data.Range) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) MutationsRejectedException(org.apache.accumulo.core.client.MutationsRejectedException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaDAOException(org.apache.rya.api.persist.RyaDAOException)

Example 40 with RyaDAOException

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);
        }
    }
}
Also used : AccumuloIndexer(org.apache.rya.accumulo.experimental.AccumuloIndexer) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) MutationsRejectedException(org.apache.accumulo.core.client.MutationsRejectedException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaDAOException(org.apache.rya.api.persist.RyaDAOException)

Aggregations

RyaDAOException (org.apache.rya.api.persist.RyaDAOException)100 RyaStatement (org.apache.rya.api.domain.RyaStatement)61 RyaURI (org.apache.rya.api.domain.RyaURI)45 Test (org.junit.Test)39 RyaType (org.apache.rya.api.domain.RyaType)28 IOException (java.io.IOException)26 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)23 AccumuloException (org.apache.accumulo.core.client.AccumuloException)22 SailException (org.openrdf.sail.SailException)15 HashSet (java.util.HashSet)12 AccumuloRyaQueryEngine (org.apache.rya.accumulo.query.AccumuloRyaQueryEngine)12 RdfCloudTripleStoreUtils (org.apache.rya.api.RdfCloudTripleStoreUtils)12 Map (java.util.Map)11 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)11 RyaClientException (org.apache.rya.api.client.RyaClientException)11 MutationsRejectedException (org.apache.accumulo.core.client.MutationsRejectedException)10 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)10 ArrayList (java.util.ArrayList)9 Scanner (org.apache.accumulo.core.client.Scanner)8 Text (org.apache.hadoop.io.Text)8