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
15d67e52
Commit
15d67e52
authored
Aug 25, 2017
by
Richard Ding
Committed by
Madhan Neethiraj
Aug 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2083: Refactor Atlas<Type>DefStore classes to reduce code duplication
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
4820a20b
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
131 additions
and
520 deletions
+131
-520
AtlasClassificationDefStore.java
...s/repository/store/graph/AtlasClassificationDefStore.java
+0
-54
AtlasDefStore.java
...rg/apache/atlas/repository/store/graph/AtlasDefStore.java
+19
-14
AtlasEntityDefStore.java
...che/atlas/repository/store/graph/AtlasEntityDefStore.java
+0
-54
AtlasRelationshipDefStore.java
...las/repository/store/graph/AtlasRelationshipDefStore.java
+0
-52
AtlasStructDefStore.java
...che/atlas/repository/store/graph/AtlasStructDefStore.java
+0
-54
AtlasTypeDefGraphStore.java
.../atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+32
-31
AtlasAbstractDefStoreV1.java
...as/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
+33
-1
AtlasClassificationDefStoreV1.java
...ository/store/graph/v1/AtlasClassificationDefStoreV1.java
+3
-52
AtlasEntityDefStoreV1.java
...tlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+3
-52
AtlasEnumDefStoreV1.java
.../atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
+23
-26
AtlasRelationshipDefStoreV1.java
...epository/store/graph/v1/AtlasRelationshipDefStoreV1.java
+3
-52
AtlasStructDefStoreV1.java
...tlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+3
-52
AtlasTypeDefGraphStoreV1.java
...s/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+7
-12
TestModules.java
repository/src/test/java/org/apache/atlas/TestModules.java
+1
-7
AtlasEntityDefStoreV1Test.java
.../repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
+2
-3
AtlasRelationshipDefStoreV1Test.java
...itory/store/graph/v1/AtlasRelationshipDefStoreV1Test.java
+2
-4
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java
deleted
100644 → 0
View file @
4820a20b
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs
;
import
java.util.List
;
/**
* Interface for graph persistence store for AtlasClassificationDef
*/
public
interface
AtlasClassificationDefStore
{
Object
preCreate
(
AtlasClassificationDef
classificationDef
)
throws
AtlasBaseException
;
AtlasClassificationDef
create
(
AtlasClassificationDef
classifiDef
,
Object
preCreateResult
)
throws
AtlasBaseException
;
List
<
AtlasClassificationDef
>
getAll
()
throws
AtlasBaseException
;
AtlasClassificationDef
getByName
(
String
name
)
throws
AtlasBaseException
;
AtlasClassificationDef
getByGuid
(
String
guid
)
throws
AtlasBaseException
;
AtlasClassificationDef
update
(
AtlasClassificationDef
classifiDef
)
throws
AtlasBaseException
;
AtlasClassificationDef
updateByName
(
String
name
,
AtlasClassificationDef
classifiDef
)
throws
AtlasBaseException
;
AtlasClassificationDef
updateByGuid
(
String
guid
,
AtlasClassificationDef
classifiDef
)
throws
AtlasBaseException
;
Object
preDeleteByName
(
String
name
)
throws
AtlasBaseException
;
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
Object
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
;
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
}
repository/src/main/java/org/apache/atlas/repository/store/graph/Atlas
Enum
DefStore.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
View file @
15d67e52
...
...
@@ -18,31 +18,36 @@
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
java.util.List
;
/**
* Interface for graph persistence store for Atlas
Enum
Def
* Interface for graph persistence store for Atlas
Type
Def
*/
public
interface
Atlas
EnumDefStore
{
Atlas
EnumDef
create
(
AtlasEnumDef
enum
Def
)
throws
AtlasBaseException
;
public
interface
Atlas
DefStore
<
T
extends
AtlasBaseTypeDef
>
{
Atlas
Vertex
preCreate
(
T
type
Def
)
throws
AtlasBaseException
;
List
<
AtlasEnumDef
>
getAll
(
)
throws
AtlasBaseException
;
T
create
(
T
typeDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
;
AtlasEnumDef
getByName
(
String
name
)
throws
AtlasBaseException
;
List
<
T
>
getAll
(
)
throws
AtlasBaseException
;
AtlasEnumDef
getByGuid
(
String
guid
)
throws
AtlasBaseException
;
T
getByName
(
String
name
)
throws
AtlasBaseException
;
AtlasEnumDef
update
(
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
;
T
getByGuid
(
String
guid
)
throws
AtlasBaseException
;
AtlasEnumDef
updateByName
(
String
name
,
AtlasEnumDef
enum
Def
)
throws
AtlasBaseException
;
T
update
(
T
type
Def
)
throws
AtlasBaseException
;
AtlasEnumDef
updateByGuid
(
String
guid
,
AtlasEnumDef
enum
Def
)
throws
AtlasBaseException
;
T
updateByName
(
String
name
,
T
type
Def
)
throws
AtlasBaseException
;
void
deleteByName
(
String
name
)
throws
AtlasBaseException
;
T
updateByGuid
(
String
guid
,
T
typeDef
)
throws
AtlasBaseException
;
void
deleteByGuid
(
String
guid
)
throws
AtlasBaseException
;
AtlasVertex
preDeleteByName
(
String
name
)
throws
AtlasBaseException
;
void
deleteByName
(
String
name
,
AtlasVertex
preDeleteResult
)
throws
AtlasBaseException
;
AtlasVertex
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
;
void
deleteByGuid
(
String
guid
,
AtlasVertex
preDeleteResult
)
throws
AtlasBaseException
;
}
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
deleted
100644 → 0
View file @
4820a20b
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs
;
import
java.util.List
;
/**
* Interface for graph persistence store for AtlasEntityDef
*/
public
interface
AtlasEntityDefStore
{
Object
preCreate
(
AtlasEntityDef
entityDef
)
throws
AtlasBaseException
;
AtlasEntityDef
create
(
AtlasEntityDef
entityDef
,
Object
preCreateResult
)
throws
AtlasBaseException
;
List
<
AtlasEntityDef
>
getAll
()
throws
AtlasBaseException
;
AtlasEntityDef
getByName
(
String
name
)
throws
AtlasBaseException
;
AtlasEntityDef
getByGuid
(
String
guid
)
throws
AtlasBaseException
;
AtlasEntityDef
update
(
AtlasEntityDef
entityDef
)
throws
AtlasBaseException
;
AtlasEntityDef
updateByName
(
String
name
,
AtlasEntityDef
entityDef
)
throws
AtlasBaseException
;
AtlasEntityDef
updateByGuid
(
String
guid
,
AtlasEntityDef
entityDef
)
throws
AtlasBaseException
;
Object
preDeleteByName
(
String
name
)
throws
AtlasBaseException
;
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
Object
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
;
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
}
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStore.java
deleted
100644 → 0
View file @
4820a20b
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
java.util.List
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasRelationshipDef
;
/**
* Interface for graph persistence store for AtlasRelationshipDef
*/
public
interface
AtlasRelationshipDefStore
{
Object
preCreate
(
AtlasRelationshipDef
relationshipDef
)
throws
AtlasBaseException
;
AtlasRelationshipDef
create
(
AtlasRelationshipDef
relationshipDef
,
Object
preCreateResult
)
throws
AtlasBaseException
;
List
<
AtlasRelationshipDef
>
getAll
()
throws
AtlasBaseException
;
AtlasRelationshipDef
getByName
(
String
name
)
throws
AtlasBaseException
;
AtlasRelationshipDef
getByGuid
(
String
guid
)
throws
AtlasBaseException
;
AtlasRelationshipDef
update
(
AtlasRelationshipDef
relationshipDef
)
throws
AtlasBaseException
;
AtlasRelationshipDef
updateByName
(
String
name
,
AtlasRelationshipDef
relationshipDef
)
throws
AtlasBaseException
;
AtlasRelationshipDef
updateByGuid
(
String
guid
,
AtlasRelationshipDef
relationshipDef
)
throws
AtlasBaseException
;
Object
preDeleteByName
(
String
name
)
throws
AtlasBaseException
;
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
Object
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
;
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
}
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java
deleted
100644 → 0
View file @
4820a20b
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs
;
import
java.util.List
;
/**
* Interface for graph persistence store for AtlasStructDef
*/
public
interface
AtlasStructDefStore
{
Object
preCreate
(
AtlasStructDef
structDef
)
throws
AtlasBaseException
;
AtlasStructDef
create
(
AtlasStructDef
structDef
,
Object
preCreateResult
)
throws
AtlasBaseException
;
List
<
AtlasStructDef
>
getAll
()
throws
AtlasBaseException
;
AtlasStructDef
getByName
(
String
name
)
throws
AtlasBaseException
;
AtlasStructDef
getByGuid
(
String
guid
)
throws
AtlasBaseException
;
AtlasStructDef
update
(
AtlasStructDef
structDef
)
throws
AtlasBaseException
;
AtlasStructDef
updateByName
(
String
name
,
AtlasStructDef
structDef
)
throws
AtlasBaseException
;
AtlasStructDef
updateByGuid
(
String
guid
,
AtlasStructDef
structDef
)
throws
AtlasBaseException
;
Object
preDeleteByName
(
String
name
)
throws
AtlasBaseException
;
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
Object
preDeleteByGuid
(
String
name
)
throws
AtlasBaseException
;
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
;
}
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
View file @
15d67e52
...
...
@@ -27,6 +27,7 @@ import org.apache.atlas.model.SearchFilter;
import
org.apache.atlas.model.typedef.*
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.util.FilterUtil
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.*
;
...
...
@@ -65,15 +66,15 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
this
.
typeUpdateLockMaxWaitTimeSeconds
=
AtlasRepositoryConfiguration
.
getTypeUpdateLockMaxWaitTimeInSeconds
();
}
protected
abstract
Atlas
EnumDefStore
getEnumDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
DefStore
<
AtlasEnumDef
>
getEnumDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
StructDefStore
getStructDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
DefStore
<
AtlasStructDef
>
getStructDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
ClassificationDefStore
getClassificationDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
DefStore
<
AtlasClassificationDef
>
getClassificationDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
EntityDefStore
getEntityDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
DefStore
<
AtlasEntityDef
>
getEntityDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
RelationshipDefStore
getRelationshipDefStore
(
AtlasTypeRegistry
typeRegistry
);
protected
abstract
Atlas
DefStore
<
AtlasRelationshipDef
>
getRelationshipDefStore
(
AtlasTypeRegistry
typeRegistry
);
@Override
public
void
init
()
throws
AtlasBaseException
{
...
...
@@ -471,16 +472,16 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
AtlasTransientTypeRegistry
ttr
=
lockTypeRegistryAndReleasePostCommit
();
Atlas
EnumDefStore
enumDefStore
=
getEnumDefStore
(
ttr
);
Atlas
StructDefStore
structDefStore
=
getStructDefStore
(
ttr
);
Atlas
ClassificationDefStore
classifiDefStore
=
getClassificationDefStore
(
ttr
);
Atlas
EntityDefStore
entityDefStore
=
getEntityDefStore
(
ttr
);
Atlas
RelationshipDefStore
relationshipDefStore
=
getRelationshipDefStore
(
ttr
);
Atlas
DefStore
<
AtlasEnumDef
>
enumDefStore
=
getEnumDefStore
(
ttr
);
Atlas
DefStore
<
AtlasStructDef
>
structDefStore
=
getStructDefStore
(
ttr
);
Atlas
DefStore
<
AtlasClassificationDef
>
classifiDefStore
=
getClassificationDefStore
(
ttr
);
Atlas
DefStore
<
AtlasEntityDef
>
entityDefStore
=
getEntityDefStore
(
ttr
);
Atlas
DefStore
<
AtlasRelationshipDef
>
relationshipDefStore
=
getRelationshipDefStore
(
ttr
);
List
<
Object
>
preDeleteStructDefs
=
new
ArrayList
<>();
List
<
Object
>
preDeleteClassifiDefs
=
new
ArrayList
<>();
List
<
Object
>
preDeleteEntityDefs
=
new
ArrayList
<>();
List
<
Object
>
preDeleteRelationshipDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preDeleteStructDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preDeleteClassifiDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preDeleteEntityDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preDeleteRelationshipDefs
=
new
ArrayList
<>();
// pre deletes
...
...
@@ -578,9 +579,9 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
for
(
AtlasEnumDef
enumDef
:
typesDef
.
getEnumDefs
())
{
if
(
StringUtils
.
isNotBlank
(
enumDef
.
getGuid
()))
{
enumDefStore
.
deleteByGuid
(
enumDef
.
getGuid
());
enumDefStore
.
deleteByGuid
(
enumDef
.
getGuid
()
,
null
);
}
else
{
enumDefStore
.
deleteByName
(
enumDef
.
getName
());
enumDefStore
.
deleteByName
(
enumDef
.
getName
()
,
null
);
}
}
}
...
...
@@ -792,21 +793,21 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
private
AtlasTypesDef
addToGraphStore
(
AtlasTypesDef
typesDef
,
AtlasTransientTypeRegistry
ttr
)
throws
AtlasBaseException
{
AtlasTypesDef
ret
=
new
AtlasTypesDef
();
Atlas
EnumDefStore
enumDefStore
=
getEnumDefStore
(
ttr
);
Atlas
StructDefStore
structDefStore
=
getStructDefStore
(
ttr
);
Atlas
ClassificationDefStore
classifiDefStore
=
getClassificationDefStore
(
ttr
);
Atlas
EntityDefStore
entityDefStore
=
getEntityDefStore
(
ttr
);
Atlas
RelationshipDefStore
relationshipDefStore
=
getRelationshipDefStore
(
ttr
);
Atlas
DefStore
<
AtlasEnumDef
>
enumDefStore
=
getEnumDefStore
(
ttr
);
Atlas
DefStore
<
AtlasStructDef
>
structDefStore
=
getStructDefStore
(
ttr
);
Atlas
DefStore
<
AtlasClassificationDef
>
classifiDefStore
=
getClassificationDefStore
(
ttr
);
Atlas
DefStore
<
AtlasEntityDef
>
entityDefStore
=
getEntityDefStore
(
ttr
);
Atlas
DefStore
<
AtlasRelationshipDef
>
relationshipDefStore
=
getRelationshipDefStore
(
ttr
);
List
<
Object
>
preCreateStructDefs
=
new
ArrayList
<>();
List
<
Object
>
preCreateClassifiDefs
=
new
ArrayList
<>();
List
<
Object
>
preCreateEntityDefs
=
new
ArrayList
<>();
List
<
Object
>
preCreateRelationshipDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preCreateStructDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preCreateClassifiDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preCreateEntityDefs
=
new
ArrayList
<>();
List
<
AtlasVertex
>
preCreateRelationshipDefs
=
new
ArrayList
<>();
// for enumerations run the create
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
for
(
AtlasEnumDef
enumDef
:
typesDef
.
getEnumDefs
())
{
AtlasEnumDef
createdDef
=
enumDefStore
.
create
(
enumDef
);
AtlasEnumDef
createdDef
=
enumDefStore
.
create
(
enumDef
,
null
);
ttr
.
updateGuid
(
createdDef
.
getName
(),
createdDef
.
getGuid
());
...
...
@@ -892,11 +893,11 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
private
AtlasTypesDef
updateGraphStore
(
AtlasTypesDef
typesDef
,
AtlasTransientTypeRegistry
ttr
)
throws
AtlasBaseException
{
AtlasTypesDef
ret
=
new
AtlasTypesDef
();
Atlas
EnumDefStore
enumDefStore
=
getEnumDefStore
(
ttr
);
Atlas
StructDefStore
structDefStore
=
getStructDefStore
(
ttr
);
Atlas
ClassificationDefStore
classifiDefStore
=
getClassificationDefStore
(
ttr
);
Atlas
EntityDefStore
entityDefStore
=
getEntityDefStore
(
ttr
);
Atlas
RelationshipDefStore
relationDefStore
=
getRelationshipDefStore
(
ttr
);
Atlas
DefStore
<
AtlasEnumDef
>
enumDefStore
=
getEnumDefStore
(
ttr
);
Atlas
DefStore
<
AtlasStructDef
>
structDefStore
=
getStructDefStore
(
ttr
);
Atlas
DefStore
<
AtlasClassificationDef
>
classifiDefStore
=
getClassificationDefStore
(
ttr
);
Atlas
DefStore
<
AtlasEntityDef
>
entityDefStore
=
getEntityDefStore
(
ttr
);
Atlas
DefStore
<
AtlasRelationshipDef
>
relationDefStore
=
getRelationshipDefStore
(
ttr
);
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
for
(
AtlasEnumDef
enumDef
:
typesDef
.
getEnumDefs
())
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
View file @
15d67e52
...
...
@@ -24,6 +24,8 @@ import org.apache.atlas.exception.AtlasBaseException;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.query.QueryParser
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -35,7 +37,7 @@ import java.util.regex.Pattern;
/**
* Abstract typedef-store for v1 format.
*/
public
abstract
class
AtlasAbstractDefStoreV1
{
abstract
class
AtlasAbstractDefStoreV1
<
T
extends
AtlasBaseTypeDef
>
implements
AtlasDefStore
<
T
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAbstractDefStoreV1
.
class
);
protected
final
AtlasTypeDefGraphStoreV1
typeDefStore
;
protected
final
AtlasTypeRegistry
typeRegistry
;
...
...
@@ -77,4 +79,34 @@ public abstract class AtlasAbstractDefStoreV1 {
return
m
.
matches
();
}
@Override
public
void
deleteByName
(
String
name
,
AtlasVertex
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasAbstractDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
AtlasVertex
vertex
=
(
preDeleteResult
==
null
)
?
preDeleteByName
(
name
)
:
preDeleteResult
;
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasAbstractDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
}
@Override
public
void
deleteByGuid
(
String
guid
,
AtlasVertex
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasAbstractDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
AtlasVertex
vertex
=
(
preDeleteResult
==
null
)
?
preDeleteByGuid
(
guid
)
:
preDeleteResult
;
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasAbstractDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
}
}
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
View file @
15d67e52
...
...
@@ -23,7 +23,6 @@ import org.apache.atlas.exception.AtlasBaseException;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasClassificationDefStore
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
@@ -41,7 +40,7 @@ import java.util.regex.Pattern;
/**
* ClassificationDef store in v1 format.
*/
public
class
AtlasClassificationDefStoreV1
extends
AtlasAbstractDefStoreV1
implements
AtlasClassificationDefStore
{
class
AtlasClassificationDefStoreV1
extends
AtlasAbstractDefStoreV1
<
AtlasClassificationDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasClassificationDefStoreV1
.
class
);
private
static
final
String
TRAIT_NAME_REGEX
=
"[a-zA-Z][a-zA-Z0-9_ .]*"
;
...
...
@@ -84,19 +83,13 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
}
@Override
public
AtlasClassificationDef
create
(
AtlasClassificationDef
classificationDef
,
Object
preCreateResult
)
public
AtlasClassificationDef
create
(
AtlasClassificationDef
classificationDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasClassificationDefStoreV1.create({}, {})"
,
classificationDef
,
preCreateResult
);
}
AtlasVertex
vertex
;
if
(
preCreateResult
==
null
||
!(
preCreateResult
instanceof
AtlasVertex
))
{
vertex
=
preCreate
(
classificationDef
);
}
else
{
vertex
=
(
AtlasVertex
)
preCreateResult
;
}
AtlasVertex
vertex
=
(
preCreateResult
==
null
)
?
preCreate
(
classificationDef
)
:
preCreateResult
;
updateVertexAddReferences
(
classificationDef
,
vertex
);
...
...
@@ -281,27 +274,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
}
@Override
public
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasClassificationDefStoreV1.deleteByName({})"
,
name
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByName
(
name
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasClassificationDefStoreV1.deleteByName({})"
,
name
);
}
}
@Override
public
AtlasVertex
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasClassificationDefStoreV1.preDeleteByGuid({})"
,
guid
);
...
...
@@ -328,27 +300,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
return
ret
;
}
@Override
public
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasClassificationDefStoreV1.deleteByGuid({})"
,
guid
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByGuid
(
guid
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasClassificationDefStoreV1.deleteByGuid({})"
,
guid
);
}
}
private
void
updateVertexPreCreate
(
AtlasClassificationDef
classificationDef
,
AtlasClassificationType
classificationType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
View file @
15d67e52
...
...
@@ -22,7 +22,6 @@ import org.apache.atlas.exception.AtlasBaseException;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasEntityDefStore
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
@@ -39,7 +38,7 @@ import java.util.List;
/**
* EntityDef store in v1 format.
*/
public
class
AtlasEntityDefStoreV1
extends
AtlasAbstractDefStoreV1
implements
AtlasEntityDefStore
{
public
class
AtlasEntityDefStoreV1
extends
AtlasAbstractDefStoreV1
<
AtlasEntityDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityDefStoreV1
.
class
);
@Inject
...
...
@@ -79,18 +78,12 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
}
@Override
public
AtlasEntityDef
create
(
AtlasEntityDef
entityDef
,
Object
preCreateResult
)
throws
AtlasBaseException
{
public
AtlasEntityDef
create
(
AtlasEntityDef
entityDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEntityDefStoreV1.create({}, {})"
,
entityDef
,
preCreateResult
);
}
AtlasVertex
vertex
;
if
(
preCreateResult
==
null
||
!(
preCreateResult
instanceof
AtlasVertex
))
{
vertex
=
preCreate
(
entityDef
);
}
else
{
vertex
=
(
AtlasVertex
)
preCreateResult
;
}
AtlasVertex
vertex
=
(
preCreateResult
==
null
)
?
preCreate
(
entityDef
)
:
preCreateResult
;
updateVertexAddReferences
(
entityDef
,
vertex
);
...
...
@@ -280,27 +273,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
}
@Override
public
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEntityDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByName
(
name
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEntityDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
}
@Override
public
AtlasVertex
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEntityDefStoreV1.preDeleteByGuid({})"
,
guid
);
...
...
@@ -332,27 +304,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
return
ret
;
}
@Override
public
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEntityDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByGuid
(
guid
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEntityDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
}
private
void
updateVertexPreCreate
(
AtlasEntityDef
entityDef
,
AtlasEntityType
entityType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV1
.
updateVertexPreCreate
(
entityDef
,
entityType
,
vertex
,
typeDefStore
);
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
View file @
15d67e52
...
...
@@ -23,9 +23,7 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasEnumDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -39,7 +37,7 @@ import java.util.List;
/**
* EnumDef store in v1 format.
*/
public
class
AtlasEnumDefStoreV1
extends
AtlasAbstractDefStoreV1
implements
AtlasEnumDefStore
{
class
AtlasEnumDefStoreV1
extends
AtlasAbstractDefStoreV1
<
AtlasEnumDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEnumDefStoreV1
.
class
);
public
AtlasEnumDefStoreV1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
...
...
@@ -47,9 +45,9 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public
Atlas
EnumDef
c
reate
(
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
{
public
Atlas
Vertex
preC
reate
(
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV1.c
reate({})"
,
enumDef
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV1.preC
reate({})"
,
enumDef
);
}
validateType
(
enumDef
);
...
...
@@ -64,10 +62,25 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
toVertex
(
enumDef
,
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV1.preCreate({}): {}"
,
enumDef
,
vertex
);
}
return
vertex
;
}
@Override
public
AtlasEnumDef
create
(
AtlasEnumDef
enumDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV1.create({}, {})"
,
enumDef
,
preCreateResult
);
}
AtlasVertex
vertex
=
(
preCreateResult
==
null
)
?
preCreate
(
enumDef
)
:
preCreateResult
;
AtlasEnumDef
ret
=
toEnumDef
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEn
umDefStoreV1.create({}): {}"
,
enumDef
,
ret
);
LOG
.
debug
(
"<== AtlasEn
tityDefStoreV1.create({}, {}): {}"
,
enumDef
,
preCreateResult
,
ret
);
}
return
ret
;
...
...
@@ -210,41 +223,25 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
}
@Override
public
void
deleteByName
(
String
name
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV1.deleteByName({})"
,
name
);
}
public
AtlasVertex
preDeleteByName
(
String
name
)
throws
AtlasBaseException
{
AtlasVertex
vertex
=
typeDefStore
.
findTypeVertexByNameAndCategory
(
name
,
TypeCategory
.
ENUM
);
if
(
vertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_NOT_FOUND
,
name
);
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV1.deleteByName({})"
,
name
);
}
return
vertex
;
}
@Override
public
void
deleteByGuid
(
String
guid
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV1.deleteByGuid({})"
,
guid
);
}
public
AtlasVertex
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
{
AtlasVertex
vertex
=
typeDefStore
.
findTypeVertexByGuidAndCategory
(
guid
,
TypeCategory
.
ENUM
);
if
(
vertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_GUID_NOT_FOUND
,
guid
);
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV1.deleteByGuid({})"
,
guid
);
}
return
vertex
;
}
private
void
toVertex
(
AtlasEnumDef
enumDef
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
View file @
15d67e52
...
...
@@ -29,7 +29,6 @@ import org.apache.atlas.query.QueryParser;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore
;
import
org.apache.atlas.type.AtlasRelationshipType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
@@ -46,7 +45,7 @@ import java.util.List;
/**
* RelationshipDef store in v1 format.
*/
public
class
AtlasRelationshipDefStoreV1
extends
AtlasAbstractDefStoreV1
implements
AtlasRelationshipDefStore
{
public
class
AtlasRelationshipDefStoreV1
extends
AtlasAbstractDefStoreV1
<
AtlasRelationshipDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasRelationshipDefStoreV1
.
class
);
@Inject
...
...
@@ -124,19 +123,13 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
}
@Override
public
AtlasRelationshipDef
create
(
AtlasRelationshipDef
relationshipDef
,
Object
preCreateResult
)
public
AtlasRelationshipDef
create
(
AtlasRelationshipDef
relationshipDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasRelationshipDefStoreV1.create({}, {})"
,
relationshipDef
,
preCreateResult
);
}
AtlasVertex
vertex
;
if
(
preCreateResult
==
null
||
!(
preCreateResult
instanceof
AtlasVertex
))
{
vertex
=
preCreate
(
relationshipDef
);
}
else
{
vertex
=
(
AtlasVertex
)
preCreateResult
;
}
AtlasVertex
vertex
=
(
preCreateResult
==
null
)
?
preCreate
(
relationshipDef
)
:
preCreateResult
;
AtlasRelationshipDef
ret
=
toRelationshipDef
(
vertex
);
...
...
@@ -321,27 +314,6 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
}
@Override
public
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasRelationshipDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByName
(
name
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasRelationshipDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
}
@Override
public
AtlasVertex
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasRelationshipDefStoreV1.preDeleteByGuid({})"
,
guid
);
...
...
@@ -368,27 +340,6 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
return
ret
;
}
@Override
public
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasRelationshipDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByGuid
(
guid
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasRelationshipDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
}
private
void
updateVertexPreCreate
(
AtlasRelationshipDef
relationshipDef
,
AtlasRelationshipType
relationshipType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasRelationshipEndDef
end1
=
relationshipDef
.
getEndDef1
();
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
View file @
15d67e52
...
...
@@ -26,7 +26,6 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graph.GraphHelper
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasStructDefStore
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.atlas.type.AtlasType
;
...
...
@@ -51,7 +50,7 @@ import java.util.Set;
/**
* StructDef store in v1 format.
*/
public
class
AtlasStructDefStoreV1
extends
AtlasAbstractDefStoreV1
implements
AtlasStructDefStore
{
public
class
AtlasStructDefStoreV1
extends
AtlasAbstractDefStoreV1
<
AtlasStructDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasStructDefStoreV1
.
class
);
public
AtlasStructDefStoreV1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
...
...
@@ -90,18 +89,12 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
}
@Override
public
AtlasStructDef
create
(
AtlasStructDef
structDef
,
Object
preCreateResult
)
throws
AtlasBaseException
{
public
AtlasStructDef
create
(
AtlasStructDef
structDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasStructDefStoreV1.create({}, {})"
,
structDef
,
preCreateResult
);
}
AtlasVertex
vertex
;
if
(
preCreateResult
==
null
||
!(
preCreateResult
instanceof
AtlasVertex
))
{
vertex
=
preCreate
(
structDef
);
}
else
{
vertex
=
(
AtlasVertex
)
preCreateResult
;
}
AtlasVertex
vertex
=
(
preCreateResult
==
null
)
?
preCreate
(
structDef
)
:
preCreateResult
;
if
(
CollectionUtils
.
isEmpty
(
structDef
.
getAttributeDefs
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
BAD_REQUEST
,
"Missing attributes for structdef"
);
...
...
@@ -289,27 +282,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
}
@Override
public
void
deleteByName
(
String
name
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasStructDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByName
(
name
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasStructDefStoreV1.deleteByName({}, {})"
,
name
,
preDeleteResult
);
}
}
@Override
public
AtlasVertex
preDeleteByGuid
(
String
guid
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasStructDefStoreV1.preDeleteByGuid({})"
,
guid
);
...
...
@@ -336,27 +308,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
return
ret
;
}
@Override
public
void
deleteByGuid
(
String
guid
,
Object
preDeleteResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasStructDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
AtlasVertex
vertex
;
if
(
preDeleteResult
==
null
||
!(
preDeleteResult
instanceof
AtlasVertex
))
{
vertex
=
preDeleteByGuid
(
guid
);
}
else
{
vertex
=
(
AtlasVertex
)
preDeleteResult
;
}
typeDefStore
.
deleteTypeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasStructDefStoreV1.deleteByGuid({}, {})"
,
guid
,
preDeleteResult
);
}
}
private
AtlasStructDef
toStructDef
(
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDef
ret
=
null
;
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
View file @
15d67e52
...
...
@@ -34,18 +34,13 @@ import org.apache.atlas.AtlasErrorCode;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.listener.TypeDefChangeListener
;
import
org.apache.atlas.model.typedef.
AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.
*
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasEdgeDirection
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasClassificationDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasEntityDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasEnumDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasStructDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasTypeDefGraphStore
;
import
org.apache.atlas.repository.store.graph.*
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
;
...
...
@@ -81,27 +76,27 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
@Override
protected
Atlas
EnumDefStore
getEnumDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
protected
Atlas
DefStore
<
AtlasEnumDef
>
getEnumDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasEnumDefStoreV1
(
this
,
typeRegistry
);
}
@Override
protected
Atlas
StructDefStore
getStructDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
protected
Atlas
DefStore
<
AtlasStructDef
>
getStructDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasStructDefStoreV1
(
this
,
typeRegistry
);
}
@Override
protected
Atlas
ClassificationDefStore
getClassificationDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
protected
Atlas
DefStore
<
AtlasClassificationDef
>
getClassificationDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasClassificationDefStoreV1
(
this
,
typeRegistry
);
}
@Override
protected
Atlas
EntityDefStore
getEntityDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
protected
Atlas
DefStore
<
AtlasEntityDef
>
getEntityDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasEntityDefStoreV1
(
this
,
typeRegistry
);
}
@Override
protected
Atlas
RelationshipDefStore
getRelationshipDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
protected
Atlas
DefStore
<
AtlasRelationshipDef
>
getRelationshipDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasRelationshipDefStoreV1
(
this
,
typeRegistry
);
}
...
...
repository/src/test/java/org/apache/atlas/TestModules.java
View file @
15d67e52
...
...
@@ -40,10 +40,7 @@ import org.apache.atlas.repository.graph.HardDeleteHandler;
import
org.apache.atlas.repository.graph.SoftDeleteHandler
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.impexp.ExportService
;
import
org.apache.atlas.repository.store.graph.AtlasEntityDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipStore
;
import
org.apache.atlas.repository.store.graph.*
;
import
org.apache.atlas.repository.store.graph.v1.*
;
import
org.apache.atlas.repository.typestore.GraphBackedTypeStore
;
import
org.apache.atlas.repository.typestore.ITypeStore
;
...
...
@@ -123,9 +120,6 @@ public class TestModules {
bind
(
ITypeStore
.
class
).
to
(
GraphBackedTypeStore
.
class
).
asEagerSingleton
();
bind
(
AtlasTypeDefStore
.
class
).
to
(
AtlasTypeDefGraphStoreV1
.
class
).
asEagerSingleton
();
//For testing
bind
(
AtlasEntityDefStore
.
class
).
to
(
AtlasEntityDefStoreV1
.
class
).
asEagerSingleton
();
bind
(
AtlasRelationshipDefStore
.
class
).
to
(
AtlasRelationshipDefStoreV1
.
class
).
asEagerSingleton
();
bind
(
AtlasTypeRegistry
.
class
).
asEagerSingleton
();
bind
(
EntityGraphMapper
.
class
).
asEagerSingleton
();
bind
(
ExportService
.
class
).
asEagerSingleton
();
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/
v1/
AtlasEntityDefStoreV1Test.java
View file @
15d67e52
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.inject.Inject
;
...
...
@@ -26,7 +26,6 @@ import org.apache.atlas.TestModules;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
...
...
@@ -42,7 +41,7 @@ public class AtlasEntityDefStoreV1Test {
@Inject
private
AtlasEntityDefStore
entityDefStore
;
AtlasEntityDefStore
V1
entityDefStore
;
@DataProvider
public
Object
[][]
invalidAttributeNameWithReservedKeywords
(){
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStoreV1Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/
v1/
AtlasRelationshipDefStoreV1Test.java
View file @
15d67e52
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
com.google.inject.Inject
;
import
org.apache.atlas.ApplicationProperties
;
...
...
@@ -27,8 +27,6 @@ import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import
org.apache.atlas.model.typedef.AtlasRelationshipEndDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1
;
import
org.apache.atlas.repository.store.graph.v1.AtlasRelationshipDefStoreV1
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
...
...
@@ -46,7 +44,7 @@ public class AtlasRelationshipDefStoreV1Test {
@Inject
private
AtlasRelationshipDefStore
relationshipDefStore
;
AtlasRelationshipDefStore
V1
relationshipDefStore
;
@DataProvider
public
Object
[][]
invalidAttributeNameWithReservedKeywords
(){
...
...
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