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
d67b0498
Commit
d67b0498
authored
Sep 16, 2017
by
Zsombor Gegesy
Committed by
Madhan Neethiraj
Sep 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2140: Throwing overly generic exceptions, or unnecessarily exceptions
Change-Id: I9df89ebca2e281768d3353bd691ea7eafca96f47 Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
45b84fa2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
46 deletions
+50
-46
FalconBridge.java
...ain/java/org/apache/atlas/falcon/bridge/FalconBridge.java
+14
-11
FalconHook.java
...rc/main/java/org/apache/atlas/falcon/hook/FalconHook.java
+7
-5
FalconEventPublisher.java
...g/apache/atlas/falcon/publisher/FalconEventPublisher.java
+1
-1
StormAtlasHook.java
...main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
+12
-13
StormTopologyUtil.java
...n/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
+3
-5
AtlasPluginClassLoader.java
...ache/atlas/plugin/classloader/AtlasPluginClassLoader.java
+10
-9
AtlasPluginClassLoaderUtil.java
.../atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
+3
-2
No files found.
addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/bridge/FalconBridge.java
View file @
d67b0498
...
@@ -27,6 +27,7 @@ import org.apache.atlas.hive.model.HiveDataTypes;
...
@@ -27,6 +27,7 @@ import org.apache.atlas.hive.model.HiveDataTypes;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.falcon.FalconException
;
import
org.apache.falcon.entity.CatalogStorage
;
import
org.apache.falcon.entity.CatalogStorage
;
import
org.apache.falcon.entity.FeedHelper
;
import
org.apache.falcon.entity.FeedHelper
;
import
org.apache.falcon.entity.FileSystemStorage
;
import
org.apache.falcon.entity.FileSystemStorage
;
...
@@ -47,6 +48,7 @@ import org.apache.hadoop.fs.Path;
...
@@ -47,6 +48,7 @@ import org.apache.hadoop.fs.Path;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -123,7 +125,7 @@ public class FalconBridge {
...
@@ -123,7 +125,7 @@ public class FalconBridge {
return
feedEntity
;
return
feedEntity
;
}
}
public
static
List
<
Referenceable
>
createFeedCreationEntity
(
Feed
feed
,
ConfigurationStore
falconStore
)
throws
Exception
{
public
static
List
<
Referenceable
>
createFeedCreationEntity
(
Feed
feed
,
ConfigurationStore
falconStore
)
throws
FalconException
,
URISyntax
Exception
{
LOG
.
info
(
"Creating feed : {}"
,
feed
.
getName
());
LOG
.
info
(
"Creating feed : {}"
,
feed
.
getName
());
List
<
Referenceable
>
entities
=
new
ArrayList
<>();
List
<
Referenceable
>
entities
=
new
ArrayList
<>();
...
@@ -198,17 +200,18 @@ public class FalconBridge {
...
@@ -198,17 +200,18 @@ public class FalconBridge {
}
}
/**
/**
* + * Creates process entity
* Creates process entity
* + *
*
* + * @param process process entity
* @param process process entity
* + * @param falconStore config store
* @param falconStore config store
* + * @param user falcon user
* @param user falcon user
* + * @param timestamp timestamp of entity
* @param timestamp timestamp of entity
* + * @return process instance reference
* @return process instance reference
* +
*
* @throws FalconException if retrieving from the configuration store fail
*/
*/
public
static
List
<
Referenceable
>
createProcessEntity
(
org
.
apache
.
falcon
.
entity
.
v0
.
process
.
Process
process
,
public
static
List
<
Referenceable
>
createProcessEntity
(
org
.
apache
.
falcon
.
entity
.
v0
.
process
.
Process
process
,
ConfigurationStore
falconStore
)
throws
Exception
{
ConfigurationStore
falconStore
)
throws
Falcon
Exception
{
LOG
.
info
(
"Creating process Entity : {}"
,
process
.
getName
());
LOG
.
info
(
"Creating process Entity : {}"
,
process
.
getName
());
// The requirement is for each cluster, create a process entity with name
// The requirement is for each cluster, create a process entity with name
...
@@ -288,7 +291,7 @@ public class FalconBridge {
...
@@ -288,7 +291,7 @@ public class FalconBridge {
}
}
private
static
List
<
Referenceable
>
getInputEntities
(
org
.
apache
.
falcon
.
entity
.
v0
.
cluster
.
Cluster
cluster
,
private
static
List
<
Referenceable
>
getInputEntities
(
org
.
apache
.
falcon
.
entity
.
v0
.
cluster
.
Cluster
cluster
,
Feed
feed
)
throws
Exception
{
Feed
feed
)
throws
URISyntax
Exception
{
org
.
apache
.
falcon
.
entity
.
v0
.
feed
.
Cluster
feedCluster
=
FeedHelper
.
getCluster
(
feed
,
cluster
.
getName
());
org
.
apache
.
falcon
.
entity
.
v0
.
feed
.
Cluster
feedCluster
=
FeedHelper
.
getCluster
(
feed
,
cluster
.
getName
());
if
(
feedCluster
!=
null
)
{
if
(
feedCluster
!=
null
)
{
...
...
addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
View file @
d67b0498
...
@@ -27,6 +27,7 @@ import org.apache.atlas.hook.AtlasHook;
...
@@ -27,6 +27,7 @@ import org.apache.atlas.hook.AtlasHook;
import
org.apache.atlas.kafka.NotificationProvider
;
import
org.apache.atlas.kafka.NotificationProvider
;
import
org.apache.atlas.notification.hook.HookNotification
;
import
org.apache.atlas.notification.hook.HookNotification
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.falcon.FalconException
;
import
org.apache.falcon.entity.store.ConfigurationStore
;
import
org.apache.falcon.entity.store.ConfigurationStore
;
import
org.apache.falcon.entity.v0.feed.Feed
;
import
org.apache.falcon.entity.v0.feed.Feed
;
import
org.apache.falcon.entity.v0.process.Process
;
import
org.apache.falcon.entity.v0.process.Process
;
...
@@ -34,6 +35,7 @@ import org.apache.hadoop.util.ShutdownHookManager;
...
@@ -34,6 +35,7 @@ import org.apache.hadoop.util.ShutdownHookManager;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
...
@@ -120,7 +122,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
...
@@ -120,7 +122,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
}
}
@Override
@Override
public
void
publish
(
final
Data
data
)
throws
Exception
{
public
void
publish
(
final
Data
data
)
{
final
FalconEvent
event
=
data
.
getEvent
();
final
FalconEvent
event
=
data
.
getEvent
();
try
{
try
{
if
(
sync
)
{
if
(
sync
)
{
...
@@ -147,7 +149,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
...
@@ -147,7 +149,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
return
HOOK_NUM_RETRIES
;
return
HOOK_NUM_RETRIES
;
}
}
private
void
fireAndForget
(
FalconEvent
event
)
throws
Exception
{
private
void
fireAndForget
(
FalconEvent
event
)
throws
FalconException
,
URISyntax
Exception
{
LOG
.
info
(
"Entered Atlas hook for Falcon hook operation {}"
,
event
.
getOperation
());
LOG
.
info
(
"Entered Atlas hook for Falcon hook operation {}"
,
event
.
getOperation
());
List
<
HookNotification
.
HookNotificationMessage
>
messages
=
new
ArrayList
<>();
List
<
HookNotification
.
HookNotificationMessage
>
messages
=
new
ArrayList
<>();
...
@@ -163,7 +165,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
...
@@ -163,7 +165,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
notifyEntities
(
messages
);
notifyEntities
(
messages
);
}
}
private
List
<
Referenceable
>
createEntities
(
FalconEvent
event
,
String
user
)
throws
Exception
{
private
List
<
Referenceable
>
createEntities
(
FalconEvent
event
,
String
user
)
throws
FalconException
,
URISyntax
Exception
{
List
<
Referenceable
>
entities
=
new
ArrayList
<>();
List
<
Referenceable
>
entities
=
new
ArrayList
<>();
switch
(
event
.
getOperation
())
{
switch
(
event
.
getOperation
())
{
...
@@ -190,7 +192,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
...
@@ -190,7 +192,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
return
entities
;
return
entities
;
}
}
private
static
Operation
getOperation
(
final
FalconEvent
.
OPERATION
op
)
throws
Exception
{
private
static
Operation
getOperation
(
final
FalconEvent
.
OPERATION
op
)
throws
Falcon
Exception
{
switch
(
op
)
{
switch
(
op
)
{
case
ADD_CLUSTER:
case
ADD_CLUSTER:
case
ADD_FEED:
case
ADD_FEED:
...
@@ -203,7 +205,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
...
@@ -203,7 +205,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
return
Operation
.
UPDATE
;
return
Operation
.
UPDATE
;
default
:
default
:
throw
new
Exception
(
"Falcon operation "
+
op
+
" is not valid or supported"
);
throw
new
Falcon
Exception
(
"Falcon operation "
+
op
+
" is not valid or supported"
);
}
}
}
}
}
}
...
...
addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/publisher/FalconEventPublisher.java
View file @
d67b0498
...
@@ -37,5 +37,5 @@ public interface FalconEventPublisher {
...
@@ -37,5 +37,5 @@ public interface FalconEventPublisher {
}
}
}
}
void
publish
(
final
Data
data
)
throws
Exception
;
void
publish
(
final
Data
data
);
}
}
addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
View file @
d67b0498
...
@@ -75,11 +75,10 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -75,11 +75,10 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
* @param topologyInfo topology info
* @param topologyInfo topology info
* @param stormConf configuration
* @param stormConf configuration
* @param stormTopology a storm topology
* @param stormTopology a storm topology
* @throws IllegalAccessException
*/
*/
@Override
@Override
public
void
notify
(
TopologyInfo
topologyInfo
,
Map
stormConf
,
public
void
notify
(
TopologyInfo
topologyInfo
,
Map
stormConf
,
StormTopology
stormTopology
)
throws
IllegalAccessException
{
StormTopology
stormTopology
)
{
LOG
.
info
(
"Collecting metadata for a new storm topology: {}"
,
topologyInfo
.
get_name
());
LOG
.
info
(
"Collecting metadata for a new storm topology: {}"
,
topologyInfo
.
get_name
());
try
{
try
{
...
@@ -105,7 +104,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -105,7 +104,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
}
}
}
}
private
Referenceable
createTopologyInstance
(
TopologyInfo
topologyInfo
,
Map
stormConf
)
throws
Exception
{
private
Referenceable
createTopologyInstance
(
TopologyInfo
topologyInfo
,
Map
stormConf
)
{
Referenceable
topologyReferenceable
=
new
Referenceable
(
Referenceable
topologyReferenceable
=
new
Referenceable
(
StormDataTypes
.
STORM_TOPOLOGY
.
getName
());
StormDataTypes
.
STORM_TOPOLOGY
.
getName
());
topologyReferenceable
.
set
(
"id"
,
topologyInfo
.
get_id
());
topologyReferenceable
.
set
(
"id"
,
topologyInfo
.
get_id
());
...
@@ -125,7 +124,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -125,7 +124,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
private
List
<
Referenceable
>
addTopologyDataSets
(
StormTopology
stormTopology
,
private
List
<
Referenceable
>
addTopologyDataSets
(
StormTopology
stormTopology
,
Referenceable
topologyReferenceable
,
Referenceable
topologyReferenceable
,
String
topologyOwner
,
String
topologyOwner
,
Map
stormConf
)
throws
Exception
{
Map
stormConf
)
{
List
<
Referenceable
>
dependentEntities
=
new
ArrayList
<>();
List
<
Referenceable
>
dependentEntities
=
new
ArrayList
<>();
// add each spout as an input data set
// add each spout as an input data set
addTopologyInputs
(
topologyReferenceable
,
addTopologyInputs
(
topologyReferenceable
,
...
@@ -138,7 +137,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -138,7 +137,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
private
void
addTopologyInputs
(
Referenceable
topologyReferenceable
,
private
void
addTopologyInputs
(
Referenceable
topologyReferenceable
,
Map
<
String
,
SpoutSpec
>
spouts
,
Map
<
String
,
SpoutSpec
>
spouts
,
Map
stormConf
,
Map
stormConf
,
String
topologyOwner
,
List
<
Referenceable
>
dependentEntities
)
throws
IllegalAccessException
{
String
topologyOwner
,
List
<
Referenceable
>
dependentEntities
)
{
final
ArrayList
<
Referenceable
>
inputDataSets
=
new
ArrayList
<>();
final
ArrayList
<
Referenceable
>
inputDataSets
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
SpoutSpec
>
entry
:
spouts
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
SpoutSpec
>
entry
:
spouts
.
entrySet
())
{
Serializable
instance
=
Utils
.
javaDeserialize
(
Serializable
instance
=
Utils
.
javaDeserialize
(
...
@@ -156,7 +155,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -156,7 +155,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
private
void
addTopologyOutputs
(
Referenceable
topologyReferenceable
,
private
void
addTopologyOutputs
(
Referenceable
topologyReferenceable
,
StormTopology
stormTopology
,
String
topologyOwner
,
StormTopology
stormTopology
,
String
topologyOwner
,
Map
stormConf
,
List
<
Referenceable
>
dependentEntities
)
throws
Exception
{
Map
stormConf
,
List
<
Referenceable
>
dependentEntities
)
{
final
ArrayList
<
Referenceable
>
outputDataSets
=
new
ArrayList
<>();
final
ArrayList
<
Referenceable
>
outputDataSets
=
new
ArrayList
<>();
Map
<
String
,
Bolt
>
bolts
=
stormTopology
.
get_bolts
();
Map
<
String
,
Bolt
>
bolts
=
stormTopology
.
get_bolts
();
...
@@ -177,7 +176,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -177,7 +176,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
private
Referenceable
createDataSet
(
String
name
,
String
topologyOwner
,
private
Referenceable
createDataSet
(
String
name
,
String
topologyOwner
,
Serializable
instance
,
Serializable
instance
,
Map
stormConf
,
List
<
Referenceable
>
dependentEntities
)
throws
IllegalAccessException
{
Map
stormConf
,
List
<
Referenceable
>
dependentEntities
)
{
Map
<
String
,
String
>
config
=
StormTopologyUtil
.
getFieldValues
(
instance
,
true
,
null
);
Map
<
String
,
String
>
config
=
StormTopologyUtil
.
getFieldValues
(
instance
,
true
,
null
);
String
clusterName
=
null
;
String
clusterName
=
null
;
...
@@ -265,7 +264,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -265,7 +264,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
private
ArrayList
<
Referenceable
>
createTopologyGraph
(
StormTopology
stormTopology
,
private
ArrayList
<
Referenceable
>
createTopologyGraph
(
StormTopology
stormTopology
,
Map
<
String
,
SpoutSpec
>
spouts
,
Map
<
String
,
SpoutSpec
>
spouts
,
Map
<
String
,
Bolt
>
bolts
)
throws
Exception
{
Map
<
String
,
Bolt
>
bolts
)
{
// Add graph of nodes in the topology
// Add graph of nodes in the topology
final
Map
<
String
,
Referenceable
>
nodeEntities
=
new
HashMap
<>();
final
Map
<
String
,
Referenceable
>
nodeEntities
=
new
HashMap
<>();
addSpouts
(
spouts
,
nodeEntities
);
addSpouts
(
spouts
,
nodeEntities
);
...
@@ -279,7 +278,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -279,7 +278,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
}
}
private
void
addSpouts
(
Map
<
String
,
SpoutSpec
>
spouts
,
private
void
addSpouts
(
Map
<
String
,
SpoutSpec
>
spouts
,
Map
<
String
,
Referenceable
>
nodeEntities
)
throws
IllegalAccessException
{
Map
<
String
,
Referenceable
>
nodeEntities
)
{
for
(
Map
.
Entry
<
String
,
SpoutSpec
>
entry
:
spouts
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
SpoutSpec
>
entry
:
spouts
.
entrySet
())
{
final
String
spoutName
=
entry
.
getKey
();
final
String
spoutName
=
entry
.
getKey
();
Referenceable
spoutReferenceable
=
createSpoutInstance
(
Referenceable
spoutReferenceable
=
createSpoutInstance
(
...
@@ -289,7 +288,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -289,7 +288,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
}
}
private
Referenceable
createSpoutInstance
(
String
spoutName
,
private
Referenceable
createSpoutInstance
(
String
spoutName
,
SpoutSpec
stormSpout
)
throws
IllegalAccessException
{
SpoutSpec
stormSpout
)
{
Referenceable
spoutReferenceable
=
new
Referenceable
(
StormDataTypes
.
STORM_SPOUT
.
getName
());
Referenceable
spoutReferenceable
=
new
Referenceable
(
StormDataTypes
.
STORM_SPOUT
.
getName
());
spoutReferenceable
.
set
(
AtlasClient
.
NAME
,
spoutName
);
spoutReferenceable
.
set
(
AtlasClient
.
NAME
,
spoutName
);
...
@@ -304,7 +303,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -304,7 +303,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
}
}
private
void
addBolts
(
Map
<
String
,
Bolt
>
bolts
,
private
void
addBolts
(
Map
<
String
,
Bolt
>
bolts
,
Map
<
String
,
Referenceable
>
nodeEntities
)
throws
IllegalAccessException
{
Map
<
String
,
Referenceable
>
nodeEntities
)
{
for
(
Map
.
Entry
<
String
,
Bolt
>
entry
:
bolts
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Bolt
>
entry
:
bolts
.
entrySet
())
{
Referenceable
boltInstance
=
createBoltInstance
(
entry
.
getKey
(),
entry
.
getValue
());
Referenceable
boltInstance
=
createBoltInstance
(
entry
.
getKey
(),
entry
.
getValue
());
nodeEntities
.
put
(
entry
.
getKey
(),
boltInstance
);
nodeEntities
.
put
(
entry
.
getKey
(),
boltInstance
);
...
@@ -312,7 +311,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -312,7 +311,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
}
}
private
Referenceable
createBoltInstance
(
String
boltName
,
private
Referenceable
createBoltInstance
(
String
boltName
,
Bolt
stormBolt
)
throws
IllegalAccessException
{
Bolt
stormBolt
)
{
Referenceable
boltReferenceable
=
new
Referenceable
(
StormDataTypes
.
STORM_BOLT
.
getName
());
Referenceable
boltReferenceable
=
new
Referenceable
(
StormDataTypes
.
STORM_BOLT
.
getName
());
boltReferenceable
.
set
(
AtlasClient
.
NAME
,
boltName
);
boltReferenceable
.
set
(
AtlasClient
.
NAME
,
boltName
);
...
@@ -328,7 +327,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
...
@@ -328,7 +327,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
}
}
private
void
addGraphConnections
(
StormTopology
stormTopology
,
private
void
addGraphConnections
(
StormTopology
stormTopology
,
Map
<
String
,
Referenceable
>
nodeEntities
)
throws
Exception
{
Map
<
String
,
Referenceable
>
nodeEntities
)
{
// adds connections between spouts and bolts
// adds connections between spouts and bolts
Map
<
String
,
Set
<
String
>>
adjacencyMap
=
Map
<
String
,
Set
<
String
>>
adjacencyMap
=
StormTopologyUtil
.
getAdjacencyMap
(
stormTopology
,
true
);
StormTopologyUtil
.
getAdjacencyMap
(
stormTopology
,
true
);
...
...
addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
View file @
d67b0498
...
@@ -69,8 +69,7 @@ public final class StormTopologyUtil {
...
@@ -69,8 +69,7 @@ public final class StormTopologyUtil {
}
}
public
static
Map
<
String
,
Set
<
String
>>
getAdjacencyMap
(
StormTopology
topology
,
public
static
Map
<
String
,
Set
<
String
>>
getAdjacencyMap
(
StormTopology
topology
,
boolean
removeSystemComponent
)
boolean
removeSystemComponent
)
{
throws
Exception
{
Map
<
String
,
Set
<
String
>>
adjacencyMap
=
new
HashMap
<>();
Map
<
String
,
Set
<
String
>>
adjacencyMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Bolt
>
entry
:
topology
.
get_bolts
().
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Bolt
>
entry
:
topology
.
get_bolts
().
entrySet
())
{
...
@@ -129,8 +128,7 @@ public final class StormTopologyUtil {
...
@@ -129,8 +128,7 @@ public final class StormTopologyUtil {
public
static
Map
<
String
,
String
>
getFieldValues
(
Object
instance
,
public
static
Map
<
String
,
String
>
getFieldValues
(
Object
instance
,
boolean
prependClassName
,
boolean
prependClassName
,
Set
<
Object
>
objectsToSkip
)
Set
<
Object
>
objectsToSkip
)
{
throws
IllegalAccessException
{
if
(
objectsToSkip
==
null
)
{
if
(
objectsToSkip
==
null
)
{
objectsToSkip
=
new
HashSet
<>();
objectsToSkip
=
new
HashSet
<>();
}
}
...
@@ -213,7 +211,7 @@ public final class StormTopologyUtil {
...
@@ -213,7 +211,7 @@ public final class StormTopologyUtil {
private
static
String
getString
(
Object
instance
,
private
static
String
getString
(
Object
instance
,
boolean
wrapWithQuote
,
boolean
wrapWithQuote
,
Set
<
Object
>
objectsToSkip
)
throws
IllegalAccessException
{
Set
<
Object
>
objectsToSkip
)
{
if
(
instance
==
null
)
{
if
(
instance
==
null
)
{
return
null
;
return
null
;
}
else
if
(
instance
.
getClass
().
isPrimitive
()
||
isWrapperType
(
instance
.
getClass
()))
{
}
else
if
(
instance
.
getClass
().
isPrimitive
()
||
isWrapperType
(
instance
.
getClass
()))
{
...
...
plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java
View file @
d67b0498
...
@@ -22,10 +22,12 @@ import org.slf4j.Logger;
...
@@ -22,10 +22,12 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.net.URLClassLoader
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
...
@@ -39,12 +41,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
...
@@ -39,12 +41,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
private
final
MyClassLoader
componentClassLoader
;
private
final
MyClassLoader
componentClassLoader
;
private
AtlasPluginClassLoader
(
String
pluginType
,
Class
<?>
pluginClass
)
throws
Exception
{
private
AtlasPluginClassLoader
(
String
pluginType
,
Class
<?>
pluginClass
)
throws
URISyntax
Exception
{
this
(
AtlasPluginClassLoaderUtil
.
getPluginImplLibPath
(
pluginType
,
pluginClass
));
this
(
AtlasPluginClassLoaderUtil
.
getPluginImplLibPath
(
pluginType
,
pluginClass
));
}
}
//visible for testing
//visible for testing
AtlasPluginClassLoader
(
String
libraryPath
)
throws
Exception
{
AtlasPluginClassLoader
(
String
libraryPath
)
{
super
(
AtlasPluginClassLoaderUtil
.
getFilesInDirectories
(
new
String
[]{
libraryPath
}),
null
);
super
(
AtlasPluginClassLoaderUtil
.
getFilesInDirectories
(
new
String
[]{
libraryPath
}),
null
);
componentClassLoader
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
MyClassLoader
>()
{
componentClassLoader
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
MyClassLoader
>()
{
...
@@ -54,18 +56,17 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
...
@@ -54,18 +56,17 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
});
});
}
}
public
static
AtlasPluginClassLoader
getInstance
(
final
String
pluginType
,
final
Class
<?>
pluginClass
)
public
static
AtlasPluginClassLoader
getInstance
(
final
String
pluginType
,
final
Class
<?>
pluginClass
)
throws
PrivilegedActionException
{
throws
Exception
{
AtlasPluginClassLoader
ret
=
me
;
AtlasPluginClassLoader
ret
=
me
;
if
(
ret
==
null
)
{
if
(
ret
==
null
)
{
synchronized
(
AtlasPluginClassLoader
.
class
)
{
synchronized
(
AtlasPluginClassLoader
.
class
)
{
ret
=
me
;
ret
=
me
;
if
(
ret
==
null
)
{
if
(
ret
==
null
)
{
me
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
AtlasPluginClassLoader
>()
{
me
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
AtlasPluginClassLoader
>()
{
public
AtlasPluginClassLoader
run
()
throws
Exception
{
public
AtlasPluginClassLoader
run
()
throws
URISyntax
Exception
{
return
new
AtlasPluginClassLoader
(
pluginType
,
pluginClass
);
return
new
AtlasPluginClassLoader
(
pluginType
,
pluginClass
);
}
}
});
});
ret
=
me
;
ret
=
me
;
}
}
}
}
...
...
plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
View file @
d67b0498
...
@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
...
@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
import
java.io.File
;
import
java.io.File
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
...
@@ -40,7 +41,7 @@ final class AtlasPluginClassLoaderUtil {
...
@@ -40,7 +41,7 @@ final class AtlasPluginClassLoaderUtil {
private
AtlasPluginClassLoaderUtil
(){
}
private
AtlasPluginClassLoaderUtil
(){
}
public
static
URL
[]
getFilesInDirectories
(
String
[]
libDirs
)
throws
Exception
{
public
static
URL
[]
getFilesInDirectories
(
String
[]
libDirs
)
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasPluginClassLoaderUtil.getFilesInDirectories()"
);
LOG
.
debug
(
"==> AtlasPluginClassLoaderUtil.getFilesInDirectories()"
);
}
}
...
@@ -95,7 +96,7 @@ final class AtlasPluginClassLoaderUtil {
...
@@ -95,7 +96,7 @@ final class AtlasPluginClassLoaderUtil {
}
}
}
}
public
static
String
getPluginImplLibPath
(
String
pluginType
,
Class
<?>
pluginClass
)
throws
Exception
{
public
static
String
getPluginImplLibPath
(
String
pluginType
,
Class
<?>
pluginClass
)
throws
URISyntax
Exception
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class ({})"
,
pluginClass
.
getName
());
LOG
.
debug
(
"==> AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class ({})"
,
pluginClass
.
getName
());
}
}
...
...
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