use of org.apache.atlas.repository.IndexCreationException in project incubator-atlas by apache.
the class GraphBackedSearchIndexer method onAdd.
/**
* This is upon adding a new type to Store.
*
* @param dataTypes data type
* @throws AtlasException
*/
@Override
public void onAdd(Collection<? extends IDataType> dataTypes) throws AtlasException {
AtlasGraphManagement management = provider.get().getManagementSystem();
for (IDataType dataType : dataTypes) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating indexes for type name={}, definition={}", dataType.getName(), dataType.getClass());
}
try {
addIndexForType(management, dataType);
LOG.info("Index creation for type {} complete", dataType.getName());
} catch (Throwable throwable) {
LOG.error("Error creating index for type {}", dataType, throwable);
// Rollback indexes if any failure
rollback(management);
throw new IndexCreationException("Error while creating index for type " + dataType, throwable);
}
}
// Commit indexes
commit(management);
}
Aggregations