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
36e8243a
Commit
36e8243a
authored
Jan 09, 2015
by
Harish Butani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add high level defineTypes method on TypeSystem
parent
7b205697
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
TypeSystem.java
...ain/java/org/apache/hadoop/metadata/types/TypeSystem.java
+17
-0
TypesDef.scala
.../src/main/scala/org/apache/hadoop/metadata/TypesDef.scala
+22
-1
No files found.
typesystem/src/main/java/org/apache/hadoop/metadata/types/TypeSystem.java
View file @
36e8243a
...
@@ -21,6 +21,7 @@ package org.apache.hadoop.metadata.types;
...
@@ -21,6 +21,7 @@ package org.apache.hadoop.metadata.types;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.TypesDef
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
import
java.util.*
;
import
java.util.*
;
...
@@ -119,6 +120,22 @@ public class TypeSystem {
...
@@ -119,6 +120,22 @@ public class TypeSystem {
return
transientTypes
.
defineTypes
();
return
transientTypes
.
defineTypes
();
}
}
public
Map
<
String
,
IDataType
>
defineTypes
(
TypesDef
typesDef
)
throws
MetadataException
{
for
(
EnumTypeDefinition
enumDef
:
typesDef
.
enumTypesAsJavaList
())
{
defineEnumType
(
enumDef
);
}
ImmutableList
<
StructTypeDefinition
>
structDefs
=
ImmutableList
.
copyOf
(
typesDef
.
structTypesAsJavaList
());
ImmutableList
<
HierarchicalTypeDefinition
<
TraitType
>>
traitDefs
=
ImmutableList
.
copyOf
(
typesDef
.
traitTypesAsJavaList
());
ImmutableList
<
HierarchicalTypeDefinition
<
ClassType
>>
classDefs
=
ImmutableList
.
copyOf
(
typesDef
.
classTypesAsJavaList
());
return
defineTypes
(
structDefs
,
traitDefs
,
classDefs
);
}
public
Map
<
String
,
IDataType
>
defineTypes
(
ImmutableList
<
StructTypeDefinition
>
structDefs
,
public
Map
<
String
,
IDataType
>
defineTypes
(
ImmutableList
<
StructTypeDefinition
>
structDefs
,
ImmutableList
<
HierarchicalTypeDefinition
<
TraitType
>>
traitDefs
,
ImmutableList
<
HierarchicalTypeDefinition
<
TraitType
>>
traitDefs
,
ImmutableList
<
HierarchicalTypeDefinition
<
ClassType
>>
classDefs
)
ImmutableList
<
HierarchicalTypeDefinition
<
ClassType
>>
classDefs
)
...
...
typesystem/src/main/scala/org/apache/hadoop/metadata/TypesDef.scala
View file @
36e8243a
...
@@ -23,4 +23,25 @@ import org.apache.hadoop.metadata.types._
...
@@ -23,4 +23,25 @@ import org.apache.hadoop.metadata.types._
case
class
TypesDef
(
enumTypes
:
Seq
[
EnumTypeDefinition
],
case
class
TypesDef
(
enumTypes
:
Seq
[
EnumTypeDefinition
],
structTypes
:
Seq
[
StructTypeDefinition
],
structTypes
:
Seq
[
StructTypeDefinition
],
traitTypes
:
Seq
[
HierarchicalTypeDefinition
[
TraitType
]],
traitTypes
:
Seq
[
HierarchicalTypeDefinition
[
TraitType
]],
classTypes
:
Seq
[
HierarchicalTypeDefinition
[
ClassType
]])
classTypes
:
Seq
[
HierarchicalTypeDefinition
[
ClassType
]])
{
def
enumTypesAsJavaList
()
=
{
import
scala.collection.JavaConverters._
enumTypes
.
asJava
}
def
structTypesAsJavaList
()
=
{
import
scala.collection.JavaConverters._
structTypes
.
asJava
}
def
traitTypesAsJavaList
()
=
{
import
scala.collection.JavaConverters._
traitTypes
.
asJava
}
def
classTypesAsJavaList
()
=
{
import
scala.collection.JavaConverters._
classTypes
.
asJava
}
}
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