use of org.apache.atlas.AtlasException in project atlas by apache.
the class AtlasSimpleAuthorizer method init.
@Override
public void init() {
LOG.info("==> SimpleAtlasAuthorizer.init()");
InputStream inputStream = null;
try {
inputStream = ApplicationProperties.getFileAsInputStream(ApplicationProperties.get(), "atlas.authorizer.simple.authz.policy.file", "atlas-simple-authz-policy.json");
authzPolicy = AtlasJson.fromJson(inputStream, AtlasSimpleAuthzPolicy.class);
} catch (IOException | AtlasException e) {
LOG.error("SimpleAtlasAuthorizer.init(): initialization failed", e);
throw new RuntimeException(e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException excp) {
// ignore
}
}
}
LOG.info("<== SimpleAtlasAuthorizer.init()");
}
use of org.apache.atlas.AtlasException in project atlas by apache.
the class AtlasJanusGraphDatabase method isEmbeddedSolr.
public static boolean isEmbeddedSolr() {
boolean ret = false;
try {
Configuration conf = ApplicationProperties.get();
Object property = conf.getProperty("atlas.graph.index.search.solr.embedded");
if (property != null && property instanceof String) {
ret = Boolean.valueOf((String) property);
}
} catch (AtlasException ignored) {
}
return ret;
}
use of org.apache.atlas.AtlasException in project atlas by apache.
the class GraphSandboxUtil method create.
public static void create(String sandboxName) {
Configuration configuration;
try {
configuration = ApplicationProperties.get();
configuration.setProperty("atlas.graph.storage.directory", getStorageDir(sandboxName, "storage"));
configuration.setProperty("atlas.graph.index.search.directory", getStorageDir(sandboxName, "index"));
LOG.debug("New Storage dir : {}", configuration.getProperty("atlas.graph.storage.directory"));
LOG.debug("New Indexer dir : {}", configuration.getProperty("atlas.graph.index.search.directory"));
} catch (AtlasException ignored) {
throw new SkipException("Failure to setup Sandbox: " + sandboxName);
}
}
use of org.apache.atlas.AtlasException in project atlas by apache.
the class GraphSandboxUtil method useLocalSolr.
public static boolean useLocalSolr() {
boolean ret = false;
try {
Configuration conf = ApplicationProperties.get();
Object property = conf.getProperty("atlas.graph.index.search.solr.embedded");
if (property != null && property instanceof String) {
ret = Boolean.valueOf((String) property);
}
} catch (AtlasException ignored) {
throw new SkipException("useLocalSolr: failed! ", ignored);
}
return ret;
}
use of org.apache.atlas.AtlasException in project atlas by apache.
the class OnAtlasPropertyCondition method matches.
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
boolean matches = false;
String propertyName = (String) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("property");
boolean isDefault = (Boolean) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("isDefault");
String className = ((AnnotationMetadataReadingVisitor) metadata).getClassName();
try {
Configuration configuration = ApplicationProperties.get();
String configuredProperty = configuration.getString(propertyName);
if (StringUtils.isNotEmpty(configuredProperty)) {
matches = configuredProperty.equals(className);
} else if (isDefault)
matches = true;
} catch (AtlasException e) {
LOG.error("Unable to load atlas properties. Dependent bean configuration may fail");
}
return matches;
}
Aggregations