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
5bc6f6bd
Commit
5bc6f6bd
authored
9 years ago
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-296 IllegalArgumentException during hive HiveHookIT integration tests…
ATLAS-296 IllegalArgumentException during hive HiveHookIT integration tests (tbeerbower via shwethags)
parent
6f421e99
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
NotificationEntityChangeListener.java
...notification/entity/NotificationEntityChangeListener.java
+28
-4
release-log.txt
release-log.txt
+1
-0
Referenceable.java
.../main/java/org/apache/atlas/typesystem/Referenceable.java
+9
-10
No files found.
notification/src/main/java/org/apache/atlas/notification/entity/NotificationEntityChangeListener.java
View file @
5bc6f6bd
...
...
@@ -18,14 +18,22 @@
package
org
.
apache
.
atlas
.
notification
.
entity
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParser
;
import
com.google.gson.JsonSerializationContext
;
import
com.google.gson.JsonSerializer
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.notification.NotificationInterface
;
import
org.apache.atlas.typesystem.IReferenceableInstance
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
java.lang.reflect.Type
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.LinkedList
;
...
...
@@ -36,9 +44,11 @@ import java.util.List;
*/
public
class
NotificationEntityChangeListener
implements
EntityChangeListener
{
private
static
final
Gson
GSON
=
new
GsonBuilder
().
registerTypeAdapter
(
Referenceable
.
class
,
new
ReferencableSerializer
()).
create
();
private
final
NotificationInterface
notificationInterface
;
private
final
TypeSystem
typeSystem
;
private
final
Gson
gson
=
new
Gson
();
// ----- Constructors ------------------------------------------------------
...
...
@@ -78,23 +88,37 @@ public class NotificationEntityChangeListener implements EntityChangeListener {
}
// ----- helper methods -------------------------------------------------
---
// ----- helper methods -------------------------------------------------
// send notification of entity change
private
void
notifyOfEntityEvent
(
Collection
<
ITypedReferenceableInstance
>
entityDefinitions
,
EntityNotification
.
OperationType
operationType
)
throws
AtlasException
{
List
<
String
>
messages
=
new
LinkedList
<>();
for
(
I
Typed
ReferenceableInstance
entityDefinition
:
entityDefinitions
)
{
for
(
IReferenceableInstance
entityDefinition
:
entityDefinitions
)
{
Referenceable
entity
=
new
Referenceable
(
entityDefinition
);
EntityNotificationImpl
notification
=
new
EntityNotificationImpl
(
entity
,
operationType
,
typeSystem
);
messages
.
add
(
gson
.
toJson
(
notification
));
messages
.
add
(
GSON
.
toJson
(
notification
));
}
notificationInterface
.
send
(
NotificationInterface
.
NotificationType
.
ENTITIES
,
messages
.
toArray
(
new
String
[
messages
.
size
()]));
}
// ----- inner class : ReferencableSerializer ---------------------------
private
static
class
ReferencableSerializer
implements
JsonSerializer
<
Referenceable
>
{
public
static
final
JsonParser
JSON_PARSER
=
new
JsonParser
();
@Override
public
JsonElement
serialize
(
Referenceable
referenceable
,
Type
type
,
JsonSerializationContext
jsonSerializationContext
)
{
return
JSON_PARSER
.
parse
(
InstanceSerialization
.
toJson
(
referenceable
,
true
)).
getAsJsonObject
();
}
}
}
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
5bc6f6bd
...
...
@@ -9,6 +9,7 @@ ATLAS-54 Rename configs in hive hook (shwethags)
ATLAS-3 Mixed Index creation fails with Date types (sumasai via shwethags)
ALL CHANGES:
ATLAS-296 IllegalArgumentException during hive HiveHookIT integration tests (tbeerbower via shwethags)
ATLAS-158 Provide Atlas Entity Change Notification (tbeerbower via shwethags)
ATALS-238 atlas_start.py- the Atlas server won’t restart after improper shutdown(ndjouri via sumasai)
ATLAS-293 UI Requires Internet Access For UI Facelift (darshankumar89 via shwethags)
...
...
This diff is collapsed.
Click to expand it.
typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
View file @
5bc6f6bd
...
...
@@ -42,7 +42,7 @@ public class Referenceable extends Struct implements IReferenceableInstance {
super
(
typeName
);
id
=
new
Id
(
typeName
);
this
.
traitNames
=
ImmutableList
.
copyOf
(
traitNames
);
ImmutableMap
.
Builder
<
String
,
IStruct
>
b
=
new
ImmutableMap
.
Builder
<
String
,
IStruct
>();
ImmutableMap
.
Builder
<
String
,
IStruct
>
b
=
new
ImmutableMap
.
Builder
<>();
for
(
String
t
:
traitNames
)
{
b
.
put
(
t
,
new
Struct
(
t
));
}
...
...
@@ -65,9 +65,9 @@ public class Referenceable extends Struct implements IReferenceableInstance {
/**
* Not public - only use during deserialization
* @param guid
* @param typeName
* @param values
* @param guid
the unique id
* @param typeName
the type name
* @param values
the entity attribute values
*/
@InterfaceAudience
.
Private
public
Referenceable
(
String
guid
,
String
typeName
,
Map
<
String
,
Object
>
values
,
List
<
String
>
_traitNames
,
...
...
@@ -79,13 +79,13 @@ public class Referenceable extends Struct implements IReferenceableInstance {
}
/**
* Construct a Referenceable from the given I
Typed
ReferenceableInstance.
* Construct a Referenceable from the given IReferenceableInstance.
*
* @param instance the
typed
referenceable instance to copy
* @param instance the referenceable instance to copy
*
* @throws AtlasException if the referenceable can not be created
*/
public
Referenceable
(
I
Typed
ReferenceableInstance
instance
)
throws
AtlasException
{
public
Referenceable
(
IReferenceableInstance
instance
)
throws
AtlasException
{
this
(
instance
.
getId
().
_getId
(),
instance
.
getTypeName
(),
instance
.
getValuesMap
(),
instance
.
getTraits
(),
getTraits
(
instance
));
}
...
...
@@ -114,11 +114,10 @@ public class Referenceable extends Struct implements IReferenceableInstance {
return
traits
.
get
(
typeName
);
}
private
static
Map
<
String
,
IStruct
>
getTraits
(
I
TypedReferenceableInstance
instance
)
{
private
static
Map
<
String
,
IStruct
>
getTraits
(
I
ReferenceableInstance
instance
)
throws
AtlasException
{
Map
<
String
,
IStruct
>
traits
=
new
HashMap
<>();
for
(
String
traitName
:
instance
.
getTraits
()
)
{
traits
.
put
(
traitName
,
instance
.
getTrait
(
traitName
));
traits
.
put
(
traitName
,
new
Struct
(
traitName
,
instance
.
getTrait
(
traitName
).
getValuesMap
()
));
}
return
traits
;
}
...
...
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