Search in sources :

Example 1 with ParentMetadataExistsException

use of org.apache.rya.export.api.metadata.ParentMetadataExistsException in project incubator-rya by apache.

the class MongoParentMetadataRepository method set.

@Override
public void set(final MergeParentMetadata metadata) throws ParentMetadataExistsException {
    if (collection.getCount() > 0) {
        throw new ParentMetadataExistsException("The parent metadata has already been set.");
    }
    final DBObject dbo = adapter.serialize(metadata);
    collection.insert(dbo);
}
Also used : ParentMetadataExistsException(org.apache.rya.export.api.metadata.ParentMetadataExistsException) DBObject(com.mongodb.DBObject)

Example 2 with ParentMetadataExistsException

use of org.apache.rya.export.api.metadata.ParentMetadataExistsException in project incubator-rya by apache.

the class MemoryTimeMerger method runJob.

@Override
public void runJob() {
    final Optional<MergeParentMetadata> metadata = parentStore.getParentMetadata();
    // check the parent for a parent metadata repo
    if (metadata.isPresent()) {
        LOG.info("Merging statements...");
        final MergeParentMetadata parentMetadata = metadata.get();
        if (parentMetadata.getRyaInstanceName().equals(ryaInstanceName)) {
            try {
                importStatements(parentMetadata);
            } catch (AddStatementException | ContainsStatementException | RemoveStatementException | FetchStatementException e) {
                LOG.error("Failed to import statements.", e);
            }
        }
    } else {
        try {
            LOG.info("Cloning statements...");
            export();
        } catch (final ParentMetadataExistsException | FetchStatementException e) {
            LOG.error("Failed to export statements.", e);
        }
    }
}
Also used : AddStatementException(org.apache.rya.export.api.store.AddStatementException) ParentMetadataExistsException(org.apache.rya.export.api.metadata.ParentMetadataExistsException) MergeParentMetadata(org.apache.rya.export.api.metadata.MergeParentMetadata) ContainsStatementException(org.apache.rya.export.api.store.ContainsStatementException) RemoveStatementException(org.apache.rya.export.api.store.RemoveStatementException) FetchStatementException(org.apache.rya.export.api.store.FetchStatementException)

Example 3 with ParentMetadataExistsException

use of org.apache.rya.export.api.metadata.ParentMetadataExistsException in project incubator-rya by apache.

the class AccumuloParentMetadataRepository method set.

@Override
public void set(final MergeParentMetadata metadata) throws ParentMetadataExistsException {
    try {
        createTableIfNeeded();
        writeMetadata(metadata);
    } catch (final MergerException e) {
        throw new ParentMetadataExistsException("Unable to set MergeParentMetadata", e);
    }
}
Also used : ParentMetadataExistsException(org.apache.rya.export.api.metadata.ParentMetadataExistsException) MergerException(org.apache.rya.export.api.MergerException)

Aggregations

ParentMetadataExistsException (org.apache.rya.export.api.metadata.ParentMetadataExistsException)3 DBObject (com.mongodb.DBObject)1 MergerException (org.apache.rya.export.api.MergerException)1 MergeParentMetadata (org.apache.rya.export.api.metadata.MergeParentMetadata)1 AddStatementException (org.apache.rya.export.api.store.AddStatementException)1 ContainsStatementException (org.apache.rya.export.api.store.ContainsStatementException)1 FetchStatementException (org.apache.rya.export.api.store.FetchStatementException)1 RemoveStatementException (org.apache.rya.export.api.store.RemoveStatementException)1