use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class Titan0GraphDatabase method getGraphInstance.
public static TitanGraph getGraphInstance() {
if (graphInstance == null) {
synchronized (Titan0GraphDatabase.class) {
if (graphInstance == null) {
Configuration config;
try {
config = getConfiguration();
} catch (AtlasException e) {
throw new RuntimeException(e);
}
graphInstance = TitanFactory.open(config);
atlasGraphInstance = new Titan0Graph();
validateIndexBackend(config);
}
}
}
return graphInstance;
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class NotificationProvider method get.
public static KafkaNotification get() {
if (kafka == null) {
try {
Configuration applicationProperties = ApplicationProperties.get();
kafka = new KafkaNotification(applicationProperties);
} catch (AtlasException e) {
throw new RuntimeException(e);
}
}
return kafka;
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class ClassStore method createInstance.
/*
* - assumes id is already validated
*/
ReferenceableInstance createInstance(MemRepository repo, Id id) throws RepositoryException {
Integer pos = idPosMap.get(id);
String typeName = typeNameList.get(pos);
if (!Objects.equals(typeName, hierarchicalType.getName())) {
return repo.getClassStore(typeName).createInstance(repo, id);
}
ImmutableList<String> traitNames = traitNamesStore.get(pos);
String[] tNs = traitNames.toArray(new String[] {});
try {
return (ReferenceableInstance) classType.createInstance(id, tNs);
} catch (AtlasException me) {
throw new RepositoryException(me);
}
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class TypedInstanceToGraphMapper method walkClassInstances.
private Collection<IReferenceableInstance> walkClassInstances(ITypedReferenceableInstance typedInstance) throws RepositoryException {
EntityProcessor entityProcessor = new EntityProcessor();
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Walking the object graph for instance {}", typedInstance.toShortString());
}
new ObjectGraphWalker(typeSystem, entityProcessor, typedInstance).walk();
} catch (AtlasException me) {
throw new RepositoryException("TypeSystem error when walking the ObjectGraph", me);
}
entityProcessor.addInstanceIfNotExists(typedInstance);
return entityProcessor.getInstances();
}
use of org.apache.atlas.AtlasException in project incubator-atlas by apache.
the class DefaultMetadataServiceTest method testOnChangeRefresh.
@Test
public void testOnChangeRefresh() {
try {
List<String> beforeChangeTypeNames = new ArrayList<>();
beforeChangeTypeNames.addAll(metadataService.getTypeNames(new HashMap<TypeCache.TYPE_FILTER, String>()));
typeDefChangeListener.onChange(new ChangedTypeDefs());
List<String> afterChangeTypeNames = new ArrayList<>();
afterChangeTypeNames.addAll(metadataService.getTypeNames(new HashMap<TypeCache.TYPE_FILTER, String>()));
Collections.sort(beforeChangeTypeNames);
Collections.sort(afterChangeTypeNames);
assertEquals(afterChangeTypeNames, beforeChangeTypeNames);
} catch (AtlasBaseException e) {
fail("Should've succeeded", e);
} catch (AtlasException e) {
fail("getTypeNames should've succeeded", e);
}
}
Aggregations