Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
d3bca39f
Commit
d3bca39f
authored
8 years ago
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1253 Extract error codes into AtlasErrorCode Enum (apoorvnaik via sumasai)
parent
69af0ae7
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
76 deletions
+96
-76
AtlasErrorCode.java
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+14
-0
AtlasClassificationType.java
...n/java/org/apache/atlas/type/AtlasClassificationType.java
+12
-12
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+11
-11
AtlasStructType.java
.../src/main/java/org/apache/atlas/type/AtlasStructType.java
+36
-29
AtlasTypeRegistry.java
...rc/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+9
-8
release-log.txt
release-log.txt
+1
-0
AtlasStructDefStoreV1.java
...tlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+10
-12
AtlasTypeDefGraphStoreV1.java
...s/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+3
-4
No files found.
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
View file @
d3bca39f
...
@@ -29,6 +29,20 @@ public enum AtlasErrorCode {
...
@@ -29,6 +29,20 @@ public enum AtlasErrorCode {
NO_SEARCH_RESULTS
(
204
,
"ATLAS2041E"
,
"Given search filter did not yield any results"
),
NO_SEARCH_RESULTS
(
204
,
"ATLAS2041E"
,
"Given search filter did not yield any results"
),
UNKNOWN_TYPE
(
400
,
"ATLAS4001E"
,
"Unknown type {0} for {1}.{2}"
),
UNKNOWN_TYPE
(
400
,
"ATLAS4001E"
,
"Unknown type {0} for {1}.{2}"
),
CIRCULAR_REFERENCE
(
400
,
"ATLAS4002E"
,
"{0}: invalid supertypes - circular reference back to self {1}"
),
INCOMPATIBLE_SUPERTYPE
(
400
,
"ATLAS4003E"
,
"{0}: incompatible supertype {1}"
),
UNKNOWN_CONSTRAINT
(
400
,
"ATLAS4004E"
,
"{0}.{1}: unknown constraint {1}"
),
UNSUPPORTED_CONSTRAINT
(
400
,
"ATLAS4005E"
,
"{0}.{1} : {2} constraint not supported"
),
CONSTRAINT_NOT_SATISFIED
(
400
,
"ATLAS4006E"
,
"{0}.{1} : {2} incompatible attribute type {3}"
),
CONSTRAINT_MISSING_PARAMS
(
400
,
"ATLAS4007E"
,
"{0}.{1} : invalid constraint. missing parameter {2} in {3}. params={4}"
),
CONSTRAINT_NOT_EXIST
(
400
,
"ATLAS4008E"
,
"{0}.{1} : invalid constraint. {2} {3}.{4} does not exist"
),
CONSTRAINT_NOT_MATCHED
(
400
,
"ATLAS4009E"
,
"{0}.{1} : invalid constraint. Data type of {2} {3}.{4} should be {5}, but found {6}"
),
UNKNOWN_TYPENAME
(
400
,
"ATLAS40010E"
,
"{0}: Unknown typename"
),
CONSTRAINT_NOT_SUPPORTED_ON_MAP_TYPE
(
400
,
"ATLAS40011E"
,
"{0}.{1} : constraints not supported on map type {2}"
),
CANNOT_ADD_MANDATORY_ATTRIBUTE
(
400
,
"ATLAS40012E"
,
"{0}.{1} : can not add mandatory attribute"
),
ATTRIBUTE_DELETION_NOT_SUPPORTED
(
400
,
"ATLAS40013E"
,
"{0}.{1} : attribute delete not supported"
),
SUPERTYPE_REMOVAL_NOT_SUPPORTED
(
400
,
"ATLAS40014E"
,
"superType remove not supported"
),
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS4041E"
,
"Given typename {0} was invalid"
),
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS4041E"
,
"Given typename {0} was invalid"
),
TYPE_GUID_NOT_FOUND
(
404
,
"ATLAS4042E"
,
"Given type guid {0} was invalid"
),
TYPE_GUID_NOT_FOUND
(
404
,
"ATLAS4042E"
,
"Given type guid {0} was invalid"
),
EMPTY_RESULTS
(
404
,
"ATLAS4044E"
,
"No result found for {0}"
),
EMPTY_RESULTS
(
404
,
"ATLAS4044E"
,
"No result found for {0}"
),
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
View file @
d3bca39f
...
@@ -18,6 +18,14 @@
...
@@ -18,6 +18,14 @@
package
org
.
apache
.
atlas
.
type
;
package
org
.
apache
.
atlas
.
type
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
...
@@ -25,14 +33,6 @@ import java.util.List;
...
@@ -25,14 +33,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.commons.collections.CollectionUtils
;
/**
/**
* class that implements behaviour of a classification-type.
* class that implements behaviour of a classification-type.
...
@@ -73,8 +73,8 @@ public class AtlasClassificationType extends AtlasStructType {
...
@@ -73,8 +73,8 @@ public class AtlasClassificationType extends AtlasStructType {
if
(
superType
instanceof
AtlasClassificationType
)
{
if
(
superType
instanceof
AtlasClassificationType
)
{
s
.
add
((
AtlasClassificationType
)
superType
);
s
.
add
((
AtlasClassificationType
)
superType
);
}
else
{
}
else
{
throw
new
AtlasBaseException
(
superTypeName
+
": incompatible supertype in classification "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INCOMPATIBLE_SUPERTYPE
,
superTypeName
,
+
classificationDef
.
getName
());
classificationDef
.
getName
());
}
}
}
}
...
@@ -201,8 +201,8 @@ public class AtlasClassificationType extends AtlasStructType {
...
@@ -201,8 +201,8 @@ public class AtlasClassificationType extends AtlasStructType {
private
void
collectAllSuperTypes
(
List
<
String
>
subTypes
,
Set
<
String
>
superTypes
,
AtlasTypeRegistry
typeRegistry
)
private
void
collectAllSuperTypes
(
List
<
String
>
subTypes
,
Set
<
String
>
superTypes
,
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
throws
AtlasBaseException
{
if
(
subTypes
.
contains
(
classificationDef
.
getName
()))
{
if
(
subTypes
.
contains
(
classificationDef
.
getName
()))
{
throw
new
AtlasBaseException
(
classificationDef
.
getName
()
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CIRCULAR_REFERENCE
,
+
": invalid supertypes - circular reference back to self "
+
subTypes
);
classificationDef
.
getName
(),
subTypes
.
toString
()
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
classificationDef
.
getSuperTypes
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
classificationDef
.
getSuperTypes
()))
{
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
d3bca39f
...
@@ -18,13 +18,7 @@
...
@@ -18,13 +18,7 @@
package
org
.
apache
.
atlas
.
type
;
package
org
.
apache
.
atlas
.
type
;
import
java.util.ArrayList
;
import
org.apache.atlas.AtlasErrorCode
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
...
@@ -32,6 +26,13 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -32,6 +26,13 @@ import org.apache.commons.collections.CollectionUtils;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* class that implements behaviour of an entity-type.
* class that implements behaviour of an entity-type.
...
@@ -71,8 +72,8 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -71,8 +72,8 @@ public class AtlasEntityType extends AtlasStructType {
if
(
superType
instanceof
AtlasEntityType
)
{
if
(
superType
instanceof
AtlasEntityType
)
{
s
.
add
((
AtlasEntityType
)
superType
);
s
.
add
((
AtlasEntityType
)
superType
);
}
else
{
}
else
{
throw
new
AtlasBaseException
(
superTypeName
+
": incompatible supertype in entity "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INCOMPATIBLE_SUPERTYPE
,
superTypeName
,
+
entityDef
.
getName
());
entityDef
.
getName
());
}
}
}
}
...
@@ -201,8 +202,7 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -201,8 +202,7 @@ public class AtlasEntityType extends AtlasStructType {
private
void
collectAllSuperTypes
(
List
<
String
>
subTypes
,
Set
<
String
>
superTypes
,
AtlasTypeRegistry
typeRegistry
)
private
void
collectAllSuperTypes
(
List
<
String
>
subTypes
,
Set
<
String
>
superTypes
,
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
throws
AtlasBaseException
{
if
(
subTypes
.
contains
(
entityDef
.
getName
()))
{
if
(
subTypes
.
contains
(
entityDef
.
getName
()))
{
throw
new
AtlasBaseException
(
entityDef
.
getName
()
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CIRCULAR_REFERENCE
,
entityDef
.
getName
(),
subTypes
.
toString
());
+
": invalid supertypes - circular reference back to self "
+
subTypes
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
entityDef
.
getSuperTypes
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
entityDef
.
getSuperTypes
()))
{
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
View file @
d3bca39f
...
@@ -17,22 +17,28 @@
...
@@ -17,22 +17,28 @@
*/
*/
package
org
.
apache
.
atlas
.
type
;
package
org
.
apache
.
atlas
.
type
;
import
java.util.*
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_PARAM_REF_ATTRIBUTE
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_MAPPED_FROM_REF
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_PARAM_REF_ATTRIBUTE
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_MAPPED_FROM_REF
;
/**
/**
* class that implements behaviour of a struct-type.
* class that implements behaviour of a struct-type.
...
@@ -332,20 +338,20 @@ public class AtlasStructType extends AtlasType {
...
@@ -332,20 +338,20 @@ public class AtlasStructType extends AtlasType {
return
;
return
;
}
}
for
(
Atlas
StructDef
.
Atlas
ConstraintDef
constraintDef
:
attribDef
.
getConstraintDefs
())
{
for
(
AtlasConstraintDef
constraintDef
:
attribDef
.
getConstraintDefs
())
{
String
constraintType
=
constraintDef
!=
null
?
constraintDef
.
getType
()
:
null
;
String
constraintType
=
constraintDef
!=
null
?
constraintDef
.
getType
()
:
null
;
if
(
StringUtils
.
isBlank
(
constraintType
))
{
if
(
StringUtils
.
isBlank
(
constraintType
))
{
continue
;
continue
;
}
}
if
(
constraintType
.
equals
(
CONSTRAINT_TYPE_FOREIGN_KEY
))
{
if
(
constraintType
.
equals
(
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
))
{
resolveForeignKeyConstraint
(
attribDef
,
constraintDef
,
attribType
);
resolveForeignKeyConstraint
(
attribDef
,
constraintDef
,
attribType
);
}
else
if
(
constraintType
.
equals
(
CONSTRAINT_TYPE_MAPPED_FROM_REF
))
{
}
else
if
(
constraintType
.
equals
(
CONSTRAINT_TYPE_MAPPED_FROM_REF
))
{
resolveMappedFromRefConstraint
(
attribDef
,
constraintDef
,
attribType
);
resolveMappedFromRefConstraint
(
attribDef
,
constraintDef
,
attribType
);
}
else
{
}
else
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_CONSTRAINT
,
constraintType
,
+
": unknown constraint "
+
constraintType
);
getTypeName
(),
attribDef
.
getName
()
);
}
}
}
}
}
}
...
@@ -358,8 +364,8 @@ public class AtlasStructType extends AtlasType {
...
@@ -358,8 +364,8 @@ public class AtlasStructType extends AtlasType {
private
void
resolveForeignKeyConstraint
(
AtlasAttributeDef
attribDef
,
AtlasConstraintDef
constraintDef
,
private
void
resolveForeignKeyConstraint
(
AtlasAttributeDef
attribDef
,
AtlasConstraintDef
constraintDef
,
AtlasType
attribType
)
throws
AtlasBaseException
{
AtlasType
attribType
)
throws
AtlasBaseException
{
if
(
this
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
if
(
this
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNSUPPORTED_CONSTRAINT
,
+
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
+
" constraint not supported"
);
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
,
getTypeName
(),
attribDef
.
getName
()
);
}
}
if
(
attribType
.
getTypeCategory
()
==
TypeCategory
.
ARRAY
)
{
if
(
attribType
.
getTypeCategory
()
==
TypeCategory
.
ARRAY
)
{
...
@@ -367,9 +373,9 @@ public class AtlasStructType extends AtlasType {
...
@@ -367,9 +373,9 @@ public class AtlasStructType extends AtlasType {
}
}
if
(
attribType
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
if
(
attribType
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CONSTRAINT_NOT_SATISFIED
,
+
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
+
" incompatible attribute type "
getTypeName
(),
attribDef
.
getName
(),
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
,
+
attribType
.
getTypeName
());
attribType
.
getTypeName
());
}
}
foreignKeyAttributes
.
add
(
attribDef
.
getName
());
foreignKeyAttributes
.
add
(
attribDef
.
getName
());
...
@@ -385,8 +391,8 @@ public class AtlasStructType extends AtlasType {
...
@@ -385,8 +391,8 @@ public class AtlasStructType extends AtlasType {
AtlasType
attribType
)
throws
AtlasBaseException
{
AtlasType
attribType
)
throws
AtlasBaseException
{
if
(
this
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
if
(
this
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNSUPPORTED_CONSTRAINT
,
getTypeName
(),
+
CONSTRAINT_TYPE_MAPPED_FROM_REF
+
" constraint not supported"
);
attribDef
.
getName
(),
CONSTRAINT_TYPE_MAPPED_FROM_REF
);
}
}
if
(
attribType
.
getTypeCategory
()
==
TypeCategory
.
ARRAY
)
{
if
(
attribType
.
getTypeCategory
()
==
TypeCategory
.
ARRAY
)
{
...
@@ -394,32 +400,33 @@ public class AtlasStructType extends AtlasType {
...
@@ -394,32 +400,33 @@ public class AtlasStructType extends AtlasType {
}
}
if
(
attribType
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
if
(
attribType
.
getTypeCategory
()
!=
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CONSTRAINT_NOT_SATISFIED
,
getTypeName
(),
+
CONSTRAINT_TYPE_MAPPED_FROM_REF
+
" incompatible attribute type "
attribDef
.
getName
(),
CONSTRAINT_TYPE_MAPPED_FROM_REF
,
attribDef
.
getTypeName
());
+
attribType
.
getTypeName
());
}
}
String
refAttribName
=
AtlasTypeUtil
.
getStringValue
(
constraintDef
.
getParams
(),
CONSTRAINT_PARAM_REF_ATTRIBUTE
);
String
refAttribName
=
AtlasTypeUtil
.
getStringValue
(
constraintDef
.
getParams
(),
CONSTRAINT_PARAM_REF_ATTRIBUTE
);
if
(
StringUtils
.
isBlank
(
refAttribName
))
{
if
(
StringUtils
.
isBlank
(
refAttribName
))
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CONSTRAINT_MISSING_PARAMS
,
+
" invalid constraint. missing parameter "
+
CONSTRAINT_PARAM_REF_ATTRIBUTE
getTypeName
(),
attribDef
.
getName
(),
+
" in "
+
CONSTRAINT_TYPE_MAPPED_FROM_REF
+
". params="
+
constraintDef
.
getParams
());
CONSTRAINT_PARAM_REF_ATTRIBUTE
,
CONSTRAINT_TYPE_MAPPED_FROM_REF
,
String
.
valueOf
(
constraintDef
.
getParams
()));
}
}
AtlasStructType
structType
=
(
AtlasStructType
)
attribType
;
AtlasStructType
structType
=
(
AtlasStructType
)
attribType
;
AtlasAttributeDef
refAttrib
=
structType
.
getAttributeDef
(
refAttribName
);
AtlasAttributeDef
refAttrib
=
structType
.
getAttributeDef
(
refAttribName
);
if
(
refAttrib
==
null
)
{
if
(
refAttrib
==
null
)
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": invalid constraint. "
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CONSTRAINT_NOT_EXIST
,
+
CONSTRAINT_PARAM_REF_ATTRIBUTE
+
" "
+
structType
.
getTypeName
()
+
"."
+
refAttribName
getTypeName
(),
attribDef
.
getName
(),
+
" does not exist"
);
CONSTRAINT_PARAM_REF_ATTRIBUTE
,
structType
.
getTypeName
(),
refAttribName
);
}
}
if
(!
StringUtils
.
equals
(
getTypeName
(),
refAttrib
.
getTypeName
()))
{
if
(!
StringUtils
.
equals
(
getTypeName
(),
refAttrib
.
getTypeName
()))
{
throw
new
AtlasBaseException
(
getTypeName
()
+
"."
+
attribDef
.
getName
()
+
": invalid constraint. Datatype"
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CONSTRAINT_NOT_MATCHED
,
+
" of "
+
CONSTRAINT_PARAM_REF_ATTRIBUTE
+
" "
+
structType
.
getTypeName
()
+
"."
+
refAttribName
getTypeName
(),
attribDef
.
getName
(),
+
" should be "
+
getTypeName
()
+
", but found "
+
refAttrib
.
getTypeName
());
CONSTRAINT_PARAM_REF_ATTRIBUTE
,
structType
.
getTypeName
(),
refAttribName
,
getTypeName
(),
refAttrib
.
getTypeName
());
}
}
mappedFromRefAttributes
.
put
(
attribDef
.
getName
(),
new
TypeAttributePair
(
attribType
.
getTypeName
(),
refAttribName
));
mappedFromRefAttributes
.
put
(
attribDef
.
getName
(),
new
TypeAttributePair
(
attribType
.
getTypeName
(),
refAttribName
));
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
View file @
d3bca39f
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
package
org
.
apache
.
atlas
.
type
;
package
org
.
apache
.
atlas
.
type
;
import
com.sun.jersey.spi.resource.Singleton
;
import
com.sun.jersey.spi.resource.Singleton
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
...
@@ -25,13 +27,6 @@ import org.apache.atlas.model.typedef.AtlasEntityDef;
...
@@ -25,13 +27,6 @@ import org.apache.atlas.model.typedef.AtlasEntityDef;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_PREFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_SUFFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_MAP_PREFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_MAP_SUFFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_MAP_KEY_VAL_SEP
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -42,6 +37,12 @@ import java.util.Collections;
...
@@ -42,6 +37,12 @@ import java.util.Collections;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_PREFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_SUFFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_MAP_KEY_VAL_SEP
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_MAP_PREFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_MAP_SUFFIX
;
/**
/**
* registry for all types defined in Atlas.
* registry for all types defined in Atlas.
*/
*/
...
@@ -84,7 +85,7 @@ public class AtlasTypeRegistry {
...
@@ -84,7 +85,7 @@ public class AtlasTypeRegistry {
ret
=
new
AtlasMapType
(
keyTypeName
,
valueTypeName
,
this
);
ret
=
new
AtlasMapType
(
keyTypeName
,
valueTypeName
,
this
);
}
else
{
}
else
{
throw
new
AtlasBaseException
(
typeName
+
": unknown typename"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_TYPENAME
,
typeName
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
d3bca39f
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ALL CHANGES:
ATLAS-1253 Extract error codes into AtlasErrorCode Enum (apoorvnaik via sumasai)
ATLAS-1195 Clean up DSL Translation (jnhagelb via dkantor)
ATLAS-1195 Clean up DSL Translation (jnhagelb via dkantor)
ATLAS-1139 Parameter name of a HDFS DataSet entity should contain filesystem path (svimal2106 via sumasai)
ATLAS-1139 Parameter name of a HDFS DataSet entity should contain filesystem path (svimal2106 via sumasai)
ATLAS-1200 Error Catalog enhancement (apoorvnaik via sumasai)
ATLAS-1200 Error Catalog enhancement (apoorvnaik via sumasai)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
View file @
d3bca39f
...
@@ -23,12 +23,6 @@ import org.apache.atlas.model.SearchFilter;
...
@@ -23,12 +23,6 @@ import org.apache.atlas.model.SearchFilter;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_PARAM_ON_DELETE
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_PARAM_VAL_CASCADE
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_MAPPED_FROM_REF
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
...
@@ -52,6 +46,11 @@ import java.util.List;
...
@@ -52,6 +46,11 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_PARAM_ON_DELETE
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_PARAM_VAL_CASCADE
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_FOREIGN_KEY
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasConstraintDef
.
CONSTRAINT_TYPE_MAPPED_FROM_REF
;
/**
/**
* StructDef store in v1 format.
* StructDef store in v1 format.
*/
*/
...
@@ -409,8 +408,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -409,8 +408,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
if
(
CollectionUtils
.
isNotEmpty
(
currAttrNames
))
{
if
(
CollectionUtils
.
isNotEmpty
(
currAttrNames
))
{
for
(
String
currAttrName
:
currAttrNames
)
{
for
(
String
currAttrName
:
currAttrNames
)
{
if
(!
attrNames
.
contains
(
currAttrName
))
{
if
(!
attrNames
.
contains
(
currAttrName
))
{
throw
new
AtlasBaseException
(
structDef
.
getName
()
+
"."
+
currAttrName
+
throw
new
AtlasBaseException
(
AtlasErrorCode
.
ATTRIBUTE_DELETION_NOT_SUPPORTED
,
": attribute delete not supported"
);
structDef
.
getName
(),
currAttrName
);
}
}
}
}
}
}
...
@@ -423,8 +422,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -423,8 +422,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
if
(
CollectionUtils
.
isEmpty
(
currAttrNames
)
||
!
currAttrNames
.
contains
(
attributeDef
.
getName
()))
{
if
(
CollectionUtils
.
isEmpty
(
currAttrNames
)
||
!
currAttrNames
.
contains
(
attributeDef
.
getName
()))
{
// new attribute - only allow if optional
// new attribute - only allow if optional
if
(!
attributeDef
.
isOptional
())
{
if
(!
attributeDef
.
isOptional
())
{
throw
new
AtlasBaseException
(
structDef
.
getName
()
+
"."
+
attributeDef
.
getName
()
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CANNOT_ADD_MANDATORY_ATTRIBUTE
,
structDef
.
getName
(),
attributeDef
.
getName
());
+
": can not add mandatory attribute"
);
}
}
}
}
...
@@ -557,8 +555,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -557,8 +555,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
if
(
StringUtils
.
isNotBlank
(
reverseAttribName
)
||
isComposite
)
{
if
(
StringUtils
.
isNotBlank
(
reverseAttribName
)
||
isComposite
)
{
if
(
AtlasTypeUtil
.
isMapType
(
attrTypeName
))
{
if
(
AtlasTypeUtil
.
isMapType
(
attrTypeName
))
{
throw
new
AtlasBaseException
(
structDef
.
getName
()
+
"."
+
ret
.
getName
()
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CONSTRAINT_NOT_SUPPORTED_ON_MAP_TYPE
,
+
": constraints not supported on map type "
+
attrTypeName
);
structDef
.
getName
(),
ret
.
getName
(),
attrTypeName
);
}
}
String
refAttributeName
=
null
;
String
refAttributeName
=
null
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
View file @
d3bca39f
...
@@ -18,9 +18,8 @@
...
@@ -18,9 +18,8 @@
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
com.google.common.base.Preconditions
;
import
com.google.common.base.Preconditions
;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
org.apache.atlas.AtlasConstants
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
...
@@ -341,7 +340,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
...
@@ -341,7 +340,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
if
(
CollectionUtils
.
isNotEmpty
(
superTypes
))
{
if
(
CollectionUtils
.
isNotEmpty
(
superTypes
))
{
if
(!
superTypes
.
containsAll
(
currentSuperTypes
))
{
if
(!
superTypes
.
containsAll
(
currentSuperTypes
))
{
throw
new
AtlasBaseException
(
"superType remove not supported"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
SUPERTYPE_REMOVAL_NOT_SUPPORTED
);
}
}
for
(
String
superType
:
superTypes
)
{
for
(
String
superType
:
superTypes
)
{
...
@@ -350,7 +349,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
...
@@ -350,7 +349,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
getOrCreateEdge
(
vertex
,
superTypeVertex
,
AtlasGraphUtilsV1
.
SUPERTYPE_EDGE_LABEL
);
getOrCreateEdge
(
vertex
,
superTypeVertex
,
AtlasGraphUtilsV1
.
SUPERTYPE_EDGE_LABEL
);
}
}
}
else
if
(
CollectionUtils
.
isNotEmpty
(
currentSuperTypes
))
{
}
else
if
(
CollectionUtils
.
isNotEmpty
(
currentSuperTypes
))
{
throw
new
AtlasBaseException
(
"superType remove not supported"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
SUPERTYPE_REMOVAL_NOT_SUPPORTED
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment