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