use of org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry in project incubator-atlas by apache.
the class AtlasTypeDefGraphStore method updateClassificationDefByGuid.
@Override
@GraphTransaction
public AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef) throws AtlasBaseException {
AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit();
tryUpdateByGUID(guid, classificationDef, ttr);
return getClassificationDefStore(ttr).updateByGuid(guid, classificationDef);
}
use of org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry in project incubator-atlas by apache.
the class AtlasTypeDefGraphStore method createTypesDef.
@Override
@GraphTransaction
public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()));
}
AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit();
tryTypeCreation(typesDef, ttr);
AtlasTypesDef ret = addToGraphStore(typesDef, ttr);
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()));
}
return ret;
}
use of org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry in project incubator-atlas by apache.
the class ModelTestUtil method newEntityDef.
public static AtlasEntityDef newEntityDef(AtlasTypeRegistry typesRegistry, AtlasEntityDef[] superTypes) {
int entDefIdx = IDX_ENTITY_DEF.getAndIncrement();
AtlasEntityDef ret = new AtlasEntityDef();
ret.setName(PREFIX_ENTITY_DEF + entDefIdx);
ret.setDescription(ret.getName());
ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME));
if (superTypes != null) {
for (AtlasEntityDef superType : superTypes) {
ret.addSuperType(superType.getName());
}
}
AtlasTransientTypeRegistry ttr = null;
boolean commit = false;
try {
ttr = typesRegistry.lockTypeRegistryForUpdate();
ttr.addType(ret);
commit = true;
} catch (AtlasBaseException excp) {
LOG.error("failed to create entity-def", excp);
ret = null;
} finally {
typesRegistry.releaseTypeRegistryForUpdate(ttr, commit);
}
return ret;
}
use of org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry in project incubator-atlas by apache.
the class ModelTestUtil method newClassificationDef.
public static AtlasClassificationDef newClassificationDef(AtlasTypeRegistry typesRegistry, AtlasClassificationDef[] superTypes) {
int classificationDefIdx = IDX_CLASSIFICATION_DEF.getAndIncrement();
AtlasClassificationDef ret = new AtlasClassificationDef();
ret.setName(PREFIX_CLASSIFICATION_DEF + classificationDefIdx);
ret.setDescription(ret.getName());
ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME));
if (superTypes != null) {
for (AtlasClassificationDef superType : superTypes) {
ret.addSuperType(superType.getName());
}
}
AtlasTransientTypeRegistry ttr = null;
boolean commit = false;
try {
ttr = typesRegistry.lockTypeRegistryForUpdate();
ttr.addType(ret);
commit = true;
} catch (AtlasBaseException excp) {
LOG.error("failed to create classification-def", excp);
ret = null;
} finally {
typesRegistry.releaseTypeRegistryForUpdate(ttr, commit);
}
return ret;
}
use of org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry in project incubator-atlas by apache.
the class ModelTestUtil method newStructDef.
public static AtlasStructDef newStructDef(AtlasTypeRegistry typesRegistry) {
int structDefIdx = IDX_STRUCT_DEF.getAndIncrement();
AtlasStructDef ret = new AtlasStructDef();
ret.setName(PREFIX_STRUCT_DEF + structDefIdx);
ret.setDescription(ret.getName());
ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME));
AtlasTransientTypeRegistry ttr = null;
boolean commit = false;
try {
ttr = typesRegistry.lockTypeRegistryForUpdate();
ttr.addType(ret);
commit = true;
} catch (AtlasBaseException excp) {
LOG.error("failed to create struct-def", excp);
ret = null;
} finally {
typesRegistry.releaseTypeRegistryForUpdate(ttr, commit);
}
return ret;
}
Aggregations