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
c4fc5b4f
Commit
c4fc5b4f
authored
Apr 29, 2017
by
Suma Shivaprasad
Committed by
Madhan Neethiraj
Apr 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1744: updated to address review comments and ATLAS startup failure
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
ca64ef4e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
AtlasAbstractDefStoreV1.java
...as/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
+6
-2
QueryParser.scala
...y/src/main/scala/org/apache/atlas/query/QueryParser.scala
+0
-3
AtlasEntityDefStoreV1Test.java
...las/repository/store/graph/AtlasEntityDefStoreV1Test.java
+5
-1
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
View file @
c4fc5b4f
...
@@ -25,6 +25,8 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
...
@@ -25,6 +25,8 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.query.QueryParser
;
import
org.apache.atlas.query.QueryParser
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
...
@@ -34,13 +36,14 @@ import java.util.regex.Pattern;
...
@@ -34,13 +36,14 @@ import java.util.regex.Pattern;
* Abstract typedef-store for v1 format.
* Abstract typedef-store for v1 format.
*/
*/
public
abstract
class
AtlasAbstractDefStoreV1
{
public
abstract
class
AtlasAbstractDefStoreV1
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAbstractDefStoreV1
.
class
);
protected
final
AtlasTypeDefGraphStoreV1
typeDefStore
;
protected
final
AtlasTypeDefGraphStoreV1
typeDefStore
;
protected
final
AtlasTypeRegistry
typeRegistry
;
protected
final
AtlasTypeRegistry
typeRegistry
;
private
static
final
String
NAME_REGEX
=
"[a-zA-Z][a-zA-Z0-9_ ]*"
;
private
static
final
String
NAME_REGEX
=
"[a-zA-Z][a-zA-Z0-9_ ]*"
;
private
static
final
Pattern
NAME_PATTERN
=
Pattern
.
compile
(
NAME_REGEX
);
private
static
final
Pattern
NAME_PATTERN
=
Pattern
.
compile
(
NAME_REGEX
);
p
rivate
static
final
String
ALLOW_RESERVED_KEYWORDS
=
"atlas.types.allowReservedKeywords"
;
p
ublic
static
final
String
ALLOW_RESERVED_KEYWORDS
=
"atlas.types.allowReservedKeywords"
;
public
AtlasAbstractDefStoreV1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasAbstractDefStoreV1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
this
.
typeDefStore
=
typeDefStore
;
this
.
typeDefStore
=
typeDefStore
;
...
@@ -53,7 +56,7 @@ public abstract class AtlasAbstractDefStoreV1 {
...
@@ -53,7 +56,7 @@ public abstract class AtlasAbstractDefStoreV1 {
}
}
try
{
try
{
final
boolean
allowReservedKeywords
=
ApplicationProperties
.
get
().
getBoolean
(
ALLOW_RESERVED_KEYWORDS
,
fals
e
);
final
boolean
allowReservedKeywords
=
ApplicationProperties
.
get
().
getBoolean
(
ALLOW_RESERVED_KEYWORDS
,
tru
e
);
if
(!
allowReservedKeywords
&&
typeDef
instanceof
AtlasStructDef
)
{
if
(!
allowReservedKeywords
&&
typeDef
instanceof
AtlasStructDef
)
{
final
List
<
AtlasStructDef
.
AtlasAttributeDef
>
attributeDefs
=
((
AtlasStructDef
)
typeDef
).
getAttributeDefs
();
final
List
<
AtlasStructDef
.
AtlasAttributeDef
>
attributeDefs
=
((
AtlasStructDef
)
typeDef
).
getAttributeDefs
();
...
@@ -64,6 +67,7 @@ public abstract class AtlasAbstractDefStoreV1 {
...
@@ -64,6 +67,7 @@ public abstract class AtlasAbstractDefStoreV1 {
}
}
}
}
}
catch
(
AtlasException
e
)
{
}
catch
(
AtlasException
e
)
{
LOG
.
error
(
"Exception while loading configuration "
,
e
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INTERNAL_ERROR
,
"Could not load configuration"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INTERNAL_ERROR
,
"Could not load configuration"
);
}
}
}
}
...
...
repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
View file @
c4fc5b4f
...
@@ -422,9 +422,6 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi
...
@@ -422,9 +422,6 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi
}
}
def
isKeyword
(
s
:
String
)
=
queryreservedWords
.
contains
(
s
)
def
isKeyword
(
s
:
String
)
=
queryreservedWords
.
contains
(
s
)
def
isDelimiter
(
s
:
String
)
=
querydelims
.
contains
(
s
)
}
}
class
QueryLexer
(
val
keywords
:
Seq
[
String
],
val
delims
:
Seq
[
String
])
extends
StdLexical
with
ImplicitConversions
{
class
QueryLexer
(
val
keywords
:
Seq
[
String
],
val
delims
:
Seq
[
String
])
extends
StdLexical
with
ImplicitConversions
{
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
View file @
c4fc5b4f
...
@@ -19,11 +19,14 @@ package org.apache.atlas.repository.store.graph;
...
@@ -19,11 +19,14 @@ package org.apache.atlas.repository.store.graph;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.AfterClass
;
...
@@ -58,8 +61,9 @@ public class AtlasEntityDefStoreV1Test {
...
@@ -58,8 +61,9 @@ public class AtlasEntityDefStoreV1Test {
}
}
@Test
(
dataProvider
=
"invalidAttributeNameWithReservedKeywords"
)
@Test
(
dataProvider
=
"invalidAttributeNameWithReservedKeywords"
)
public
void
testCreateTypeWithReservedKeywords
(
AtlasEntityDef
atlasEntityDef
)
{
public
void
testCreateTypeWithReservedKeywords
(
AtlasEntityDef
atlasEntityDef
)
throws
AtlasException
{
try
{
try
{
ApplicationProperties
.
get
().
setProperty
(
AtlasAbstractDefStoreV1
.
ALLOW_RESERVED_KEYWORDS
,
false
);
entityDefStore
.
create
(
atlasEntityDef
,
null
);
entityDefStore
.
create
(
atlasEntityDef
,
null
);
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
Assert
.
assertEquals
(
e
.
getAtlasErrorCode
(),
AtlasErrorCode
.
ATTRIBUTE_NAME_INVALID
);
Assert
.
assertEquals
(
e
.
getAtlasErrorCode
(),
AtlasErrorCode
.
ATTRIBUTE_NAME_INVALID
);
...
...
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