use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class AttributeInfo method output.
public void output(Appendable buf, Set<String> typesInProcess) throws AtlasException {
try {
buf.append("{name=").append(name);
buf.append(", dataType=");
dataType.output(buf, typesInProcess);
buf.append(", multiplicity=").append(multiplicity.toString());
buf.append(", isComposite=").append(Boolean.toString(isComposite));
buf.append(", isUnique=").append(Boolean.toString(isUnique));
buf.append(", isIndexable=").append(Boolean.toString(isIndexable));
buf.append(", reverseAttributeName=").append(reverseAttributeName);
buf.append('}');
} catch (IOException e) {
throw new AtlasException(e);
}
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class SecureClientUtils method getSSLClientFile.
private static File getSSLClientFile() throws AtlasException {
String confLocation = System.getProperty("atlas.conf");
File sslDir;
try {
if (confLocation == null) {
String persistDir = null;
URL resource = SecureClientUtils.class.getResource("/");
if (resource != null) {
persistDir = resource.toURI().getPath();
}
assert persistDir != null;
sslDir = new File(persistDir);
} else {
sslDir = new File(confLocation);
}
LOG.info("ssl-client.xml will be created in {}", sslDir);
} catch (Exception e) {
throw new AtlasException("Failed to find client configuration directory", e);
}
return new File(sslDir, SecurityProperties.SSL_CLIENT_PROPERTIES);
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class HBaseBasedAuditRepository method startInternal.
@VisibleForTesting
void startInternal(Configuration atlasConf, org.apache.hadoop.conf.Configuration hbaseConf) throws AtlasException {
String tableNameStr = atlasConf.getString(CONFIG_TABLE_NAME, DEFAULT_TABLE_NAME);
tableName = TableName.valueOf(tableNameStr);
try {
connection = createConnection(hbaseConf);
} catch (IOException e) {
throw new AtlasException(e);
}
if (!HAConfiguration.isHAEnabled(atlasConf)) {
LOG.info("HA is disabled. Hence creating table on startup.");
createTableIfNotExists();
}
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class HBaseBasedAuditRepository method createTableIfNotExists.
private void createTableIfNotExists() throws AtlasException {
Admin admin = null;
try {
admin = connection.getAdmin();
LOG.info("Checking if table {} exists", tableName.getNameAsString());
if (!admin.tableExists(tableName)) {
LOG.info("Creating table {}", tableName.getNameAsString());
HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);
HColumnDescriptor columnFamily = new HColumnDescriptor(COLUMN_FAMILY);
columnFamily.setMaxVersions(1);
columnFamily.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF);
columnFamily.setCompressionType(Compression.Algorithm.GZ);
columnFamily.setBloomFilterType(BloomType.ROW);
tableDescriptor.addFamily(columnFamily);
admin.createTable(tableDescriptor);
} else {
LOG.info("Table {} exists", tableName.getNameAsString());
}
} catch (IOException e) {
throw new AtlasException(e);
} finally {
close(admin);
}
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class HBaseBasedAuditRepository method putEvents.
@Override
public /**
* Add events to the event repository
* @param events events to be added
* @throws AtlasException
*/
void putEvents(List<EntityAuditEvent> events) throws AtlasException {
if (LOG.isDebugEnabled()) {
LOG.debug("Putting {} events", events.size());
}
Table table = null;
try {
table = connection.getTable(tableName);
List<Put> puts = new ArrayList<>(events.size());
for (EntityAuditEvent event : events) {
LOG.debug("Adding entity audit event {}", event);
Put put = new Put(getKey(event.getEntityId(), event.getTimestamp()));
addColumn(put, COLUMN_ACTION, event.getAction());
addColumn(put, COLUMN_USER, event.getUser());
addColumn(put, COLUMN_DETAIL, event.getDetails());
if (persistEntityDefinition) {
addColumn(put, COLUMN_DEFINITION, event.getEntityDefinitionString());
}
puts.add(put);
}
table.put(puts);
} catch (IOException e) {
throw new AtlasException(e);
} finally {
close(table);
}
}
Aggregations