Search in sources :

Example 6 with CatalogRuntimeException

use of org.apache.atlas.catalog.exception.CatalogRuntimeException in project incubator-atlas by apache.

the class DefaultPropertyMapper method toFullyQualifiedName.

@Override
public String toFullyQualifiedName(String propName, String type) {
    HierarchicalType dataType = getDataType(type);
    String replacement = m_cleanToQualifiedMap.get(propName);
    if (replacement == null && dataType != null) {
        FieldMapping fieldMap = dataType.fieldMapping();
        if (fieldMap.fields.containsKey(propName)) {
            try {
                replacement = dataType.getQualifiedName(propName);
            } catch (AtlasException e) {
                throw new CatalogRuntimeException(String.format("Unable to resolve fully qualified property name for type '%s': %s", type, e), e);
            }
        }
    }
    if (replacement == null) {
        replacement = propName;
    }
    return replacement;
}
Also used : FieldMapping(org.apache.atlas.typesystem.types.FieldMapping) CatalogRuntimeException(org.apache.atlas.catalog.exception.CatalogRuntimeException) AtlasException(org.apache.atlas.AtlasException) HierarchicalType(org.apache.atlas.typesystem.types.HierarchicalType)

Example 7 with CatalogRuntimeException

use of org.apache.atlas.catalog.exception.CatalogRuntimeException in project incubator-atlas by apache.

the class BaseResourceDefinition method registerProperty.

protected void registerProperty(AttributeDefinition propertyDefinition) {
    try {
        propertyDefs.put(propertyDefinition.name, propertyDefinition);
        properties.put(propertyDefinition.name, new AttributeInfo(typeSystem, propertyDefinition, null));
    } catch (AtlasException e) {
        throw new CatalogRuntimeException("Unable to create attribute: " + propertyDefinition.name, e);
    }
}
Also used : AttributeInfo(org.apache.atlas.typesystem.types.AttributeInfo) CatalogRuntimeException(org.apache.atlas.catalog.exception.CatalogRuntimeException) AtlasException(org.apache.atlas.AtlasException)

Aggregations

CatalogRuntimeException (org.apache.atlas.catalog.exception.CatalogRuntimeException)7 AtlasException (org.apache.atlas.AtlasException)5 ResourceAlreadyExistsException (org.apache.atlas.catalog.exception.ResourceAlreadyExistsException)3 JsonWriter (com.google.gson.stream.JsonWriter)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ResourceNotFoundException (org.apache.atlas.catalog.exception.ResourceNotFoundException)1 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)1 AtlasClassificationDef (org.apache.atlas.model.typedef.AtlasClassificationDef)1 AtlasEntityDef (org.apache.atlas.model.typedef.AtlasEntityDef)1 AtlasTypesDef (org.apache.atlas.model.typedef.AtlasTypesDef)1 ITypedReferenceableInstance (org.apache.atlas.typesystem.ITypedReferenceableInstance)1 Referenceable (org.apache.atlas.typesystem.Referenceable)1 Struct (org.apache.atlas.typesystem.Struct)1 EntityExistsException (org.apache.atlas.typesystem.exception.EntityExistsException)1 EntityNotFoundException (org.apache.atlas.typesystem.exception.EntityNotFoundException)1 AttributeDefinition (org.apache.atlas.typesystem.types.AttributeDefinition)1