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
f379c9ff
Commit
f379c9ff
authored
Mar 17, 2017
by
ashutoshm
Committed by
Madhan Neethiraj
Mar 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1666: updated exception handling to avoid use of generic exceptions
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
1612b305
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
221 additions
and
66 deletions
+221
-66
FalconBridge.java
...ain/java/org/apache/atlas/falcon/bridge/FalconBridge.java
+4
-6
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+21
-13
HiveHook.java
...ge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+54
-16
SqoopHook.java
.../src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java
+9
-4
StormAtlasHook.java
...main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
+1
-0
StormTopologyUtil.java
...n/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
+1
-1
AtlasErrorCode.java
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+11
-2
AtlasHookException.java
...c/main/java/org/apache/atlas/hook/AtlasHookException.java
+43
-0
QuickStart.java
...p/src/main/java/org/apache/atlas/examples/QuickStart.java
+39
-9
AbstractParam.java
.../main/java/org/apache/atlas/web/params/AbstractParam.java
+3
-1
BooleanParam.java
...c/main/java/org/apache/atlas/web/params/BooleanParam.java
+6
-2
DateTimeParam.java
.../main/java/org/apache/atlas/web/params/DateTimeParam.java
+3
-1
AtlasLdapAuthenticationProvider.java
...e/atlas/web/security/AtlasLdapAuthenticationProvider.java
+6
-7
ActiveInstanceState.java
...ava/org/apache/atlas/web/service/ActiveInstanceState.java
+8
-2
EmbeddedServer.java
...ain/java/org/apache/atlas/web/service/EmbeddedServer.java
+7
-1
SetupSteps.java
.../src/main/java/org/apache/atlas/web/setup/SetupSteps.java
+5
-1
No files found.
addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/bridge/FalconBridge.java
View file @
f379c9ff
...
@@ -73,8 +73,7 @@ public class FalconBridge {
...
@@ -73,8 +73,7 @@ public class FalconBridge {
* @param cluster ClusterEntity
* @param cluster ClusterEntity
* @return cluster instance reference
* @return cluster instance reference
*/
*/
public
static
Referenceable
createClusterEntity
(
final
org
.
apache
.
falcon
.
entity
.
v0
.
cluster
.
Cluster
cluster
)
public
static
Referenceable
createClusterEntity
(
final
org
.
apache
.
falcon
.
entity
.
v0
.
cluster
.
Cluster
cluster
)
{
throws
Exception
{
LOG
.
info
(
"Creating cluster Entity : {}"
,
cluster
.
getName
());
LOG
.
info
(
"Creating cluster Entity : {}"
,
cluster
.
getName
());
Referenceable
clusterRef
=
new
Referenceable
(
FalconDataTypes
.
FALCON_CLUSTER
.
getName
());
Referenceable
clusterRef
=
new
Referenceable
(
FalconDataTypes
.
FALCON_CLUSTER
.
getName
());
...
@@ -97,7 +96,7 @@ public class FalconBridge {
...
@@ -97,7 +96,7 @@ public class FalconBridge {
return
clusterRef
;
return
clusterRef
;
}
}
private
static
Referenceable
createFeedEntity
(
Feed
feed
,
Referenceable
clusterReferenceable
)
throws
Exception
{
private
static
Referenceable
createFeedEntity
(
Feed
feed
,
Referenceable
clusterReferenceable
)
{
LOG
.
info
(
"Creating feed dataset: {}"
,
feed
.
getName
());
LOG
.
info
(
"Creating feed dataset: {}"
,
feed
.
getName
());
Referenceable
feedEntity
=
new
Referenceable
(
FalconDataTypes
.
FALCON_FEED
.
getName
());
Referenceable
feedEntity
=
new
Referenceable
(
FalconDataTypes
.
FALCON_FEED
.
getName
());
...
@@ -338,8 +337,7 @@ public class FalconBridge {
...
@@ -338,8 +337,7 @@ public class FalconBridge {
return
entities
;
return
entities
;
}
}
private
static
Referenceable
createHiveDatabaseInstance
(
String
clusterName
,
String
dbName
)
private
static
Referenceable
createHiveDatabaseInstance
(
String
clusterName
,
String
dbName
)
{
throws
Exception
{
Referenceable
dbRef
=
new
Referenceable
(
HiveDataTypes
.
HIVE_DB
.
getName
());
Referenceable
dbRef
=
new
Referenceable
(
HiveDataTypes
.
HIVE_DB
.
getName
());
dbRef
.
set
(
AtlasConstants
.
CLUSTER_NAME_ATTRIBUTE
,
clusterName
);
dbRef
.
set
(
AtlasConstants
.
CLUSTER_NAME_ATTRIBUTE
,
clusterName
);
dbRef
.
set
(
AtlasClient
.
NAME
,
dbName
);
dbRef
.
set
(
AtlasClient
.
NAME
,
dbName
);
...
@@ -349,7 +347,7 @@ public class FalconBridge {
...
@@ -349,7 +347,7 @@ public class FalconBridge {
}
}
private
static
List
<
Referenceable
>
createHiveTableInstance
(
String
clusterName
,
String
dbName
,
private
static
List
<
Referenceable
>
createHiveTableInstance
(
String
clusterName
,
String
dbName
,
String
tableName
)
throws
Exception
{
String
tableName
)
{
List
<
Referenceable
>
entities
=
new
ArrayList
<>();
List
<
Referenceable
>
entities
=
new
ArrayList
<>();
Referenceable
dbRef
=
createHiveDatabaseInstance
(
clusterName
,
dbName
);
Referenceable
dbRef
=
createHiveDatabaseInstance
(
clusterName
,
dbName
);
entities
.
add
(
dbRef
);
entities
.
add
(
dbRef
);
...
...
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
View file @
f379c9ff
...
@@ -18,16 +18,15 @@
...
@@ -18,16 +18,15 @@
package
org
.
apache
.
atlas
.
hive
.
bridge
;
package
org
.
apache
.
atlas
.
hive
.
bridge
;
import
java.util.ArrayList
;
import
com.google.common.annotations.VisibleForTesting
;
import
java.util.Date
;
import
com.sun.jersey.api.client.ClientResponse
;
import
java.util.List
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasConstants
;
import
org.apache.atlas.AtlasConstants
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.hive.hook.HiveHook
;
import
org.apache.atlas.hive.hook.HiveHook
;
import
org.apache.atlas.hive.model.HiveDataTypes
;
import
org.apache.atlas.hive.model.HiveDataTypes
;
import
org.apache.atlas.hook.AtlasHookException
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Struct
;
import
org.apache.atlas.typesystem.Struct
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
...
@@ -55,8 +54,9 @@ import org.apache.hadoop.security.UserGroupInformation;
...
@@ -55,8 +54,9 @@ import org.apache.hadoop.security.UserGroupInformation;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
com.google.common.annotations.VisibleForTesting
;
import
java.util.ArrayList
;
import
com.sun.jersey.api.client.ClientResponse
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* A Bridge Utility that imports metadata from the Hive Meta Store
* A Bridge Utility that imports metadata from the Hive Meta Store
...
@@ -420,7 +420,7 @@ public class HiveMetaStoreBridge {
...
@@ -420,7 +420,7 @@ public class HiveMetaStoreBridge {
* @throws Exception
* @throws Exception
*/
*/
public
Referenceable
createTableInstance
(
Referenceable
dbReference
,
Table
hiveTable
)
public
Referenceable
createTableInstance
(
Referenceable
dbReference
,
Table
hiveTable
)
throws
Exception
{
throws
AtlasHook
Exception
{
return
createOrUpdateTableInstance
(
dbReference
,
null
,
hiveTable
);
return
createOrUpdateTableInstance
(
dbReference
,
null
,
hiveTable
);
}
}
...
@@ -429,7 +429,7 @@ public class HiveMetaStoreBridge {
...
@@ -429,7 +429,7 @@ public class HiveMetaStoreBridge {
}
}
private
Referenceable
createOrUpdateTableInstance
(
Referenceable
dbReference
,
Referenceable
tableReference
,
private
Referenceable
createOrUpdateTableInstance
(
Referenceable
dbReference
,
Referenceable
tableReference
,
final
Table
hiveTable
)
throws
Exception
{
final
Table
hiveTable
)
throws
AtlasHook
Exception
{
LOG
.
info
(
"Importing objects from {}.{}"
,
hiveTable
.
getDbName
(),
hiveTable
.
getTableName
());
LOG
.
info
(
"Importing objects from {}.{}"
,
hiveTable
.
getDbName
(),
hiveTable
.
getTableName
());
if
(
tableReference
==
null
)
{
if
(
tableReference
==
null
)
{
...
@@ -494,7 +494,8 @@ public class HiveMetaStoreBridge {
...
@@ -494,7 +494,8 @@ public class HiveMetaStoreBridge {
return
entityQualifiedName
+
"_storage"
;
return
entityQualifiedName
+
"_storage"
;
}
}
private
Referenceable
registerTable
(
Referenceable
dbReference
,
Table
table
)
throws
Exception
{
private
Referenceable
registerTable
(
Referenceable
dbReference
,
Table
table
)
throws
AtlasHookException
{
try
{
String
dbName
=
table
.
getDbName
();
String
dbName
=
table
.
getDbName
();
String
tableName
=
table
.
getTableName
();
String
tableName
=
table
.
getTableName
();
LOG
.
info
(
"Attempting to register table [{}]"
,
tableName
);
LOG
.
info
(
"Attempting to register table [{}]"
,
tableName
);
...
@@ -510,6 +511,9 @@ public class HiveMetaStoreBridge {
...
@@ -510,6 +511,9 @@ public class HiveMetaStoreBridge {
updateInstance
(
tableReference
);
updateInstance
(
tableReference
);
}
}
return
tableReference
;
return
tableReference
;
}
catch
(
Exception
e
)
{
throw
new
AtlasHookException
(
"HiveMetaStoreBridge.getStorageDescQFName() failed."
,
e
);
}
}
}
private
void
updateInstance
(
Referenceable
referenceable
)
throws
AtlasServiceException
{
private
void
updateInstance
(
Referenceable
referenceable
)
throws
AtlasServiceException
{
...
@@ -523,7 +527,7 @@ public class HiveMetaStoreBridge {
...
@@ -523,7 +527,7 @@ public class HiveMetaStoreBridge {
}
}
public
Referenceable
fillStorageDesc
(
StorageDescriptor
storageDesc
,
String
tableQualifiedName
,
public
Referenceable
fillStorageDesc
(
StorageDescriptor
storageDesc
,
String
tableQualifiedName
,
String
sdQualifiedName
,
Id
tableId
)
throws
Exception
{
String
sdQualifiedName
,
Id
tableId
)
throws
AtlasHook
Exception
{
LOG
.
debug
(
"Filling storage descriptor information for {}"
,
storageDesc
);
LOG
.
debug
(
"Filling storage descriptor information for {}"
,
storageDesc
);
Referenceable
sdReferenceable
=
new
Referenceable
(
HiveDataTypes
.
HIVE_STORAGEDESC
.
getName
());
Referenceable
sdReferenceable
=
new
Referenceable
(
HiveDataTypes
.
HIVE_STORAGEDESC
.
getName
());
...
@@ -590,7 +594,7 @@ public class HiveMetaStoreBridge {
...
@@ -590,7 +594,7 @@ public class HiveMetaStoreBridge {
return
String
.
format
(
"%s.%s@%s"
,
tableName
,
colName
.
toLowerCase
(),
clusterName
);
return
String
.
format
(
"%s.%s@%s"
,
tableName
,
colName
.
toLowerCase
(),
clusterName
);
}
}
public
List
<
Referenceable
>
getColumns
(
List
<
FieldSchema
>
schemaList
,
Referenceable
tableReference
)
throws
Exception
{
public
List
<
Referenceable
>
getColumns
(
List
<
FieldSchema
>
schemaList
,
Referenceable
tableReference
)
throws
AtlasHook
Exception
{
List
<
Referenceable
>
colList
=
new
ArrayList
<>();
List
<
Referenceable
>
colList
=
new
ArrayList
<>();
int
columnPosition
=
0
;
int
columnPosition
=
0
;
for
(
FieldSchema
fs
:
schemaList
)
{
for
(
FieldSchema
fs
:
schemaList
)
{
...
@@ -612,8 +616,8 @@ public class HiveMetaStoreBridge {
...
@@ -612,8 +616,8 @@ public class HiveMetaStoreBridge {
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
AtlasHook
Exception
{
try
{
Configuration
atlasConf
=
ApplicationProperties
.
get
();
Configuration
atlasConf
=
ApplicationProperties
.
get
();
String
[]
atlasEndpoint
=
atlasConf
.
getStringArray
(
ATLAS_ENDPOINT
);
String
[]
atlasEndpoint
=
atlasConf
.
getStringArray
(
ATLAS_ENDPOINT
);
if
(
atlasEndpoint
==
null
||
atlasEndpoint
.
length
==
0
){
if
(
atlasEndpoint
==
null
||
atlasEndpoint
.
length
==
0
){
...
@@ -641,4 +645,8 @@ public class HiveMetaStoreBridge {
...
@@ -641,4 +645,8 @@ public class HiveMetaStoreBridge {
HiveMetaStoreBridge
hiveMetaStoreBridge
=
new
HiveMetaStoreBridge
(
atlasConf
,
new
HiveConf
(),
atlasClient
);
HiveMetaStoreBridge
hiveMetaStoreBridge
=
new
HiveMetaStoreBridge
(
atlasConf
,
new
HiveConf
(),
atlasClient
);
hiveMetaStoreBridge
.
importHiveMetadata
(
failOnError
);
hiveMetaStoreBridge
.
importHiveMetadata
(
failOnError
);
}
}
catch
(
Exception
e
)
{
throw
new
AtlasHookException
(
"HiveMetaStoreBridge.main() failed."
,
e
);
}
}
}
}
addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
View file @
f379c9ff
This diff is collapsed.
Click to expand it.
addons/sqoop-bridge/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java
View file @
f379c9ff
...
@@ -25,6 +25,7 @@ import org.apache.atlas.AtlasConstants;
...
@@ -25,6 +25,7 @@ import org.apache.atlas.AtlasConstants;
import
org.apache.atlas.hive.bridge.HiveMetaStoreBridge
;
import
org.apache.atlas.hive.bridge.HiveMetaStoreBridge
;
import
org.apache.atlas.hive.model.HiveDataTypes
;
import
org.apache.atlas.hive.model.HiveDataTypes
;
import
org.apache.atlas.hook.AtlasHook
;
import
org.apache.atlas.hook.AtlasHook
;
import
org.apache.atlas.hook.AtlasHookException
;
import
org.apache.atlas.notification.hook.HookNotification
;
import
org.apache.atlas.notification.hook.HookNotification
;
import
org.apache.atlas.sqoop.model.SqoopDataTypes
;
import
org.apache.atlas.sqoop.model.SqoopDataTypes
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
...
@@ -71,8 +72,7 @@ public class SqoopHook extends SqoopJobDataPublisher {
...
@@ -71,8 +72,7 @@ public class SqoopHook extends SqoopJobDataPublisher {
org
.
apache
.
hadoop
.
conf
.
Configuration
.
addDefaultResource
(
"sqoop-site.xml"
);
org
.
apache
.
hadoop
.
conf
.
Configuration
.
addDefaultResource
(
"sqoop-site.xml"
);
}
}
public
Referenceable
createHiveDatabaseInstance
(
String
clusterName
,
String
dbName
)
public
Referenceable
createHiveDatabaseInstance
(
String
clusterName
,
String
dbName
)
{
throws
Exception
{
Referenceable
dbRef
=
new
Referenceable
(
HiveDataTypes
.
HIVE_DB
.
getName
());
Referenceable
dbRef
=
new
Referenceable
(
HiveDataTypes
.
HIVE_DB
.
getName
());
dbRef
.
set
(
AtlasConstants
.
CLUSTER_NAME_ATTRIBUTE
,
clusterName
);
dbRef
.
set
(
AtlasConstants
.
CLUSTER_NAME_ATTRIBUTE
,
clusterName
);
dbRef
.
set
(
AtlasClient
.
NAME
,
dbName
);
dbRef
.
set
(
AtlasClient
.
NAME
,
dbName
);
...
@@ -82,7 +82,7 @@ public class SqoopHook extends SqoopJobDataPublisher {
...
@@ -82,7 +82,7 @@ public class SqoopHook extends SqoopJobDataPublisher {
}
}
public
Referenceable
createHiveTableInstance
(
String
clusterName
,
Referenceable
dbRef
,
public
Referenceable
createHiveTableInstance
(
String
clusterName
,
Referenceable
dbRef
,
String
tableName
,
String
dbName
)
throws
Exception
{
String
tableName
,
String
dbName
)
{
Referenceable
tableRef
=
new
Referenceable
(
HiveDataTypes
.
HIVE_TABLE
.
getName
());
Referenceable
tableRef
=
new
Referenceable
(
HiveDataTypes
.
HIVE_TABLE
.
getName
());
tableRef
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
tableRef
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
HiveMetaStoreBridge
.
getTableQualifiedName
(
clusterName
,
dbName
,
tableName
));
HiveMetaStoreBridge
.
getTableQualifiedName
(
clusterName
,
dbName
,
tableName
));
...
@@ -173,7 +173,8 @@ public class SqoopHook extends SqoopJobDataPublisher {
...
@@ -173,7 +173,8 @@ public class SqoopHook extends SqoopJobDataPublisher {
}
}
@Override
@Override
public
void
publish
(
SqoopJobDataPublisher
.
Data
data
)
throws
Exception
{
public
void
publish
(
SqoopJobDataPublisher
.
Data
data
)
throws
AtlasHookException
{
try
{
Configuration
atlasProperties
=
ApplicationProperties
.
get
();
Configuration
atlasProperties
=
ApplicationProperties
.
get
();
String
clusterName
=
atlasProperties
.
getString
(
ATLAS_CLUSTER_NAME
,
DEFAULT_CLUSTER_NAME
);
String
clusterName
=
atlasProperties
.
getString
(
ATLAS_CLUSTER_NAME
,
DEFAULT_CLUSTER_NAME
);
...
@@ -188,4 +189,8 @@ public class SqoopHook extends SqoopJobDataPublisher {
...
@@ -188,4 +189,8 @@ public class SqoopHook extends SqoopJobDataPublisher {
new
HookNotification
.
EntityCreateRequest
(
AtlasHook
.
getUser
(),
dbStoreRef
,
dbRef
,
hiveTableRef
,
procRef
);
new
HookNotification
.
EntityCreateRequest
(
AtlasHook
.
getUser
(),
dbStoreRef
,
dbRef
,
hiveTableRef
,
procRef
);
AtlasHook
.
notifyEntities
(
Arrays
.
asList
(
message
),
maxRetries
);
AtlasHook
.
notifyEntities
(
Arrays
.
asList
(
message
),
maxRetries
);
}
}
catch
(
Exception
e
)
{
throw
new
AtlasHookException
(
"SqoopHook.publish() failed."
,
e
);
}
}
}
}
addons/storm-bridge-shim/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
View file @
f379c9ff
...
@@ -34,6 +34,7 @@ import java.util.Map;
...
@@ -34,6 +34,7 @@ import java.util.Map;
public
class
StormAtlasHook
implements
ISubmitterHook
{
public
class
StormAtlasHook
implements
ISubmitterHook
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
StormAtlasHook
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
StormAtlasHook
.
class
);
private
static
final
String
ATLAS_PLUGIN_TYPE
=
"storm"
;
private
static
final
String
ATLAS_PLUGIN_TYPE
=
"storm"
;
private
static
final
String
ATLAS_STORM_HOOK_IMPL_CLASSNAME
=
"org.apache.atlas.storm.hook.StormAtlasHook"
;
private
static
final
String
ATLAS_STORM_HOOK_IMPL_CLASSNAME
=
"org.apache.atlas.storm.hook.StormAtlasHook"
;
...
...
addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
View file @
f379c9ff
...
@@ -42,7 +42,7 @@ public final class StormTopologyUtil {
...
@@ -42,7 +42,7 @@ public final class StormTopologyUtil {
private
StormTopologyUtil
()
{
private
StormTopologyUtil
()
{
}
}
public
static
Set
<
String
>
getTerminalUserBoltNames
(
StormTopology
topology
)
throws
Exception
{
public
static
Set
<
String
>
getTerminalUserBoltNames
(
StormTopology
topology
)
{
Set
<
String
>
terminalBolts
=
new
HashSet
<>();
Set
<
String
>
terminalBolts
=
new
HashSet
<>();
Set
<
String
>
inputs
=
new
HashSet
<>();
Set
<
String
>
inputs
=
new
HashSet
<>();
for
(
Map
.
Entry
<
String
,
Bolt
>
entry
:
topology
.
get_bolts
().
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Bolt
>
entry
:
topology
.
get_bolts
().
entrySet
())
{
...
...
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
View file @
f379c9ff
...
@@ -67,7 +67,8 @@ public enum AtlasErrorCode {
...
@@ -67,7 +67,8 @@ public enum AtlasErrorCode {
INSTANCE_LINEAGE_INVALID_PARAMS
(
400
,
"ATLAS-400-00-026"
,
"Invalid lineage query parameters passed {0}: {1}"
),
INSTANCE_LINEAGE_INVALID_PARAMS
(
400
,
"ATLAS-400-00-026"
,
"Invalid lineage query parameters passed {0}: {1}"
),
ATTRIBUTE_UPDATE_NOT_SUPPORTED
(
400
,
"ATLAS-400-00-027"
,
"{0}.{1} : attribute update not supported"
),
ATTRIBUTE_UPDATE_NOT_SUPPORTED
(
400
,
"ATLAS-400-00-027"
,
"{0}.{1} : attribute update not supported"
),
INVALID_VALUE
(
400
,
"ATLAS-400-00-028"
,
"invalid value: {0}"
),
INVALID_VALUE
(
400
,
"ATLAS-400-00-028"
,
"invalid value: {0}"
),
BAD_REQUEST
(
400
,
"ATLAS-400-00-020"
,
"{0}"
),
BAD_REQUEST
(
400
,
"ATLAS-400-00-029"
,
"{0}"
),
PARAMETER_PARSING_FAILED
(
400
,
"ATLAS-400-00-02A"
,
"Parameter parsing failed at: {0}"
),
// All Not found enums go here
// All Not found enums go here
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS-404-00-001"
,
"Given typename {0} was invalid"
),
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS-404-00-001"
,
"Given typename {0} was invalid"
),
...
@@ -96,7 +97,15 @@ public enum AtlasErrorCode {
...
@@ -96,7 +97,15 @@ public enum AtlasErrorCode {
NOTIFICATION_FAILED
(
500
,
"ATLAS-500-00-007"
,
"Failed to notify for change {0}"
),
NOTIFICATION_FAILED
(
500
,
"ATLAS-500-00-007"
,
"Failed to notify for change {0}"
),
GREMLIN_GROOVY_SCRIPT_ENGINE_FAILED
(
500
,
"ATLAS-500-00-008"
,
"scriptEngine cannot be initialized for: {0}"
),
GREMLIN_GROOVY_SCRIPT_ENGINE_FAILED
(
500
,
"ATLAS-500-00-008"
,
"scriptEngine cannot be initialized for: {0}"
),
JSON_ERROR_OBJECT_MAPPER_NULL_RETURNED
(
500
,
"ATLAS-500-00-009"
,
"ObjectMapper.readValue returned NULL for class: {0}"
),
JSON_ERROR_OBJECT_MAPPER_NULL_RETURNED
(
500
,
"ATLAS-500-00-009"
,
"ObjectMapper.readValue returned NULL for class: {0}"
),
GREMLIN_SCRIPT_EXECUTION_FAILED
(
500
,
"ATLAS-500-00-00A"
,
"Script execution failed for: {0}"
);
GREMLIN_SCRIPT_EXECUTION_FAILED
(
500
,
"ATLAS-500-00-00A"
,
"Script execution failed for: {0}"
),
CURATOR_FRAMEWORK_UPDATE
(
500
,
"ATLAS-500-00-00B"
,
"ActiveInstanceState.update resulted in exception."
),
QUICK_START
(
500
,
"ATLAS-500-00-00C"
,
"Failed to run QuickStart: {0}"
),
EMBEDDED_SERVER_START
(
500
,
"ATLAS-500-00-00D"
,
"EmbeddedServer.Start: failed!"
),
STORM_TOPOLOGY_UTIL
(
500
,
"ATLAS-500-00-00E"
,
"StormToplogyUtil: {0}"
),
SQOOP_HOOK
(
500
,
"ATLAS-500-00-00F"
,
"SqoopHook: {0}"
),
HIVE_HOOK
(
500
,
"ATLAS-500-00-010"
,
"HiveHook: {0}"
),
HIVE_HOOK_METASTORE_BRIDGE
(
500
,
"ATLAS-500-00-011"
,
"HiveHookMetaStoreBridge: {0}"
);
private
String
errorCode
;
private
String
errorCode
;
private
String
errorMessage
;
private
String
errorMessage
;
...
...
notification/src/main/java/org/apache/atlas/hook/AtlasHookException.java
0 → 100644
View file @
f379c9ff
/**
* 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
.
hook
;
/**
* Exception class for Atlas Hooks.
*/
public
class
AtlasHookException
extends
Exception
{
public
AtlasHookException
()
{
}
public
AtlasHookException
(
String
message
)
{
super
(
message
);
}
public
AtlasHookException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
AtlasHookException
(
Throwable
cause
)
{
super
(
cause
);
}
public
AtlasHookException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
webapp/src/main/java/org/apache/atlas/examples/QuickStart.java
View file @
f379c9ff
...
@@ -24,7 +24,9 @@ import com.google.common.collect.ImmutableList;
...
@@ -24,7 +24,9 @@ import com.google.common.collect.ImmutableList;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.TypesDef
;
import
org.apache.atlas.typesystem.TypesDef
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
...
@@ -323,7 +325,8 @@ public class QuickStart {
...
@@ -323,7 +325,8 @@ public class QuickStart {
}
}
Id
database
(
String
name
,
String
description
,
String
owner
,
String
locationUri
,
String
...
traitNames
)
Id
database
(
String
name
,
String
description
,
String
owner
,
String
locationUri
,
String
...
traitNames
)
throws
Exception
{
throws
AtlasBaseException
{
try
{
Referenceable
referenceable
=
new
Referenceable
(
DATABASE_TYPE
,
traitNames
);
Referenceable
referenceable
=
new
Referenceable
(
DATABASE_TYPE
,
traitNames
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
"description"
,
description
);
referenceable
.
set
(
"description"
,
description
);
...
@@ -332,10 +335,12 @@ public class QuickStart {
...
@@ -332,10 +335,12 @@ public class QuickStart {
referenceable
.
set
(
"createTime"
,
System
.
currentTimeMillis
());
referenceable
.
set
(
"createTime"
,
System
.
currentTimeMillis
());
return
createInstance
(
referenceable
);
return
createInstance
(
referenceable
);
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
String
.
format
(
"%s database entity creation failed"
,
name
));
}
}
}
Referenceable
rawStorageDescriptor
(
String
location
,
String
inputFormat
,
String
outputFormat
,
boolean
compressed
)
Referenceable
rawStorageDescriptor
(
String
location
,
String
inputFormat
,
String
outputFormat
,
boolean
compressed
)
{
throws
Exception
{
Referenceable
referenceable
=
new
Referenceable
(
STORAGE_DESC_TYPE
);
Referenceable
referenceable
=
new
Referenceable
(
STORAGE_DESC_TYPE
);
referenceable
.
set
(
"location"
,
location
);
referenceable
.
set
(
"location"
,
location
);
referenceable
.
set
(
"inputFormat"
,
inputFormat
);
referenceable
.
set
(
"inputFormat"
,
inputFormat
);
...
@@ -345,7 +350,8 @@ public class QuickStart {
...
@@ -345,7 +350,8 @@ public class QuickStart {
return
referenceable
;
return
referenceable
;
}
}
Referenceable
rawColumn
(
String
name
,
String
dataType
,
String
comment
,
String
...
traitNames
)
throws
Exception
{
Referenceable
rawColumn
(
String
name
,
String
dataType
,
String
comment
,
String
...
traitNames
)
throws
AtlasBaseException
{
try
{
Referenceable
referenceable
=
new
Referenceable
(
COLUMN_TYPE
,
traitNames
);
Referenceable
referenceable
=
new
Referenceable
(
COLUMN_TYPE
,
traitNames
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
"dataType"
,
dataType
);
referenceable
.
set
(
"dataType"
,
dataType
);
...
@@ -353,9 +359,14 @@ public class QuickStart {
...
@@ -353,9 +359,14 @@ public class QuickStart {
return
referenceable
;
return
referenceable
;
}
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
String
.
format
(
"%s, column entity creation failed"
,
name
));
}
}
Id
table
(
String
name
,
String
description
,
Id
dbId
,
Referenceable
sd
,
String
owner
,
String
tableType
,
Id
table
(
String
name
,
String
description
,
Id
dbId
,
Referenceable
sd
,
String
owner
,
String
tableType
,
List
<
Referenceable
>
columns
,
String
...
traitNames
)
throws
Exception
{
List
<
Referenceable
>
columns
,
String
...
traitNames
)
throws
AtlasBaseException
{
try
{
Referenceable
referenceable
=
new
Referenceable
(
TABLE_TYPE
,
traitNames
);
Referenceable
referenceable
=
new
Referenceable
(
TABLE_TYPE
,
traitNames
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
name
);
referenceable
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
name
);
...
@@ -370,11 +381,15 @@ public class QuickStart {
...
@@ -370,11 +381,15 @@ public class QuickStart {
referenceable
.
set
(
"columns"
,
columns
);
referenceable
.
set
(
"columns"
,
columns
);
return
createInstance
(
referenceable
);
return
createInstance
(
referenceable
);
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
String
.
format
(
"%s table entity creation failed"
,
name
));
}
}
}
Id
loadProcess
(
String
name
,
String
description
,
String
user
,
List
<
Id
>
inputTables
,
List
<
Id
>
outputTables
,
Id
loadProcess
(
String
name
,
String
description
,
String
user
,
List
<
Id
>
inputTables
,
List
<
Id
>
outputTables
,
String
queryText
,
String
queryPlan
,
String
queryId
,
String
queryGraph
,
String
...
traitNames
)
String
queryText
,
String
queryPlan
,
String
queryId
,
String
queryGraph
,
String
...
traitNames
)
throws
Exception
{
throws
AtlasBaseException
{
try
{
Referenceable
referenceable
=
new
Referenceable
(
LOAD_PROCESS_TYPE
,
traitNames
);
Referenceable
referenceable
=
new
Referenceable
(
LOAD_PROCESS_TYPE
,
traitNames
);
// super type attributes
// super type attributes
referenceable
.
set
(
AtlasClient
.
NAME
,
name
);
referenceable
.
set
(
AtlasClient
.
NAME
,
name
);
...
@@ -393,9 +408,13 @@ public class QuickStart {
...
@@ -393,9 +408,13 @@ public class QuickStart {
referenceable
.
set
(
"queryGraph"
,
queryGraph
);
referenceable
.
set
(
"queryGraph"
,
queryGraph
);
return
createInstance
(
referenceable
);
return
createInstance
(
referenceable
);
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
String
.
format
(
"%s process entity creation failed"
,
name
));
}
}
}
Id
view
(
String
name
,
Id
dbId
,
List
<
Id
>
inputTables
,
String
...
traitNames
)
throws
Exception
{
Id
view
(
String
name
,
Id
dbId
,
List
<
Id
>
inputTables
,
String
...
traitNames
)
throws
AtlasBaseException
{
try
{
Referenceable
referenceable
=
new
Referenceable
(
VIEW_TYPE
,
traitNames
);
Referenceable
referenceable
=
new
Referenceable
(
VIEW_TYPE
,
traitNames
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
"name"
,
name
);
referenceable
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
name
);
referenceable
.
set
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
name
);
...
@@ -404,13 +423,20 @@ public class QuickStart {
...
@@ -404,13 +423,20 @@ public class QuickStart {
referenceable
.
set
(
INPUT_TABLES_ATTRIBUTE
,
inputTables
);
referenceable
.
set
(
INPUT_TABLES_ATTRIBUTE
,
inputTables
);
return
createInstance
(
referenceable
);
return
createInstance
(
referenceable
);
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
String
.
format
(
"%s Id creation"
,
name
));
}
}
}
private
void
verifyTypesCreated
()
throws
Exception
{
private
void
verifyTypesCreated
()
throws
AtlasBaseException
{
try
{
List
<
String
>
types
=
metadataServiceClient
.
listTypes
();
List
<
String
>
types
=
metadataServiceClient
.
listTypes
();
for
(
String
type
:
TYPES
)
{
for
(
String
type
:
TYPES
)
{
assert
types
.
contains
(
type
);
assert
types
.
contains
(
type
);
}
}
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
"view creation failed."
);
}
}
}
private
String
[]
getDSLQueries
()
{
private
String
[]
getDSLQueries
()
{
...
@@ -461,7 +487,8 @@ public class QuickStart {
...
@@ -461,7 +487,8 @@ public class QuickStart {
"from DataSet"
,
"from Process"
,};
"from DataSet"
,
"from Process"
,};
}
}
private
void
search
()
throws
Exception
{
private
void
search
()
throws
AtlasBaseException
{
try
{
for
(
String
dslQuery
:
getDSLQueries
())
{
for
(
String
dslQuery
:
getDSLQueries
())
{
JSONArray
results
=
metadataServiceClient
.
search
(
dslQuery
,
10
,
0
);
JSONArray
results
=
metadataServiceClient
.
search
(
dslQuery
,
10
,
0
);
if
(
results
!=
null
)
{
if
(
results
!=
null
)
{
...
@@ -470,5 +497,8 @@ public class QuickStart {
...
@@ -470,5 +497,8 @@ public class QuickStart {
System
.
out
.
println
(
"query ["
+
dslQuery
+
"] failed, results:"
+
results
);
System
.
out
.
println
(
"query ["
+
dslQuery
+
"] failed, results:"
+
results
);
}
}
}
}
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
"one or more dsl queries failed"
);
}
}
}
}
}
webapp/src/main/java/org/apache/atlas/web/params/AbstractParam.java
View file @
f379c9ff
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
package
org
.
apache
.
atlas
.
web
.
params
;
package
org
.
apache
.
atlas
.
web
.
params
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
javax.ws.rs.WebApplicationException
;
import
javax.ws.rs.WebApplicationException
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
...
@@ -100,7 +102,7 @@ public abstract class AbstractParam<T> {
...
@@ -100,7 +102,7 @@ public abstract class AbstractParam<T> {
* @return {@code input}, parsed as an instance of {@code T}
* @return {@code input}, parsed as an instance of {@code T}
* @throws Exception if there is an error parsing the input
* @throws Exception if there is an error parsing the input
*/
*/
protected
abstract
T
parse
(
String
input
)
throws
Exception
;
protected
abstract
T
parse
(
String
input
)
throws
AtlasBase
Exception
;
/**
/**
* Returns the underlying value.
* Returns the underlying value.
...
...
webapp/src/main/java/org/apache/atlas/web/params/BooleanParam.java
View file @
f379c9ff
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
package
org
.
apache
.
atlas
.
web
.
params
;
package
org
.
apache
.
atlas
.
web
.
params
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
/**
/**
* A parameter encapsulating boolean values. If the query parameter value is {@code "true"},
* A parameter encapsulating boolean values. If the query parameter value is {@code "true"},
* regardless of case, the returned value is {@link Boolean#TRUE}. If the query parameter value is
* regardless of case, the returned value is {@link Boolean#TRUE}. If the query parameter value is
...
@@ -36,13 +39,13 @@ public class BooleanParam extends AbstractParam<Boolean> {
...
@@ -36,13 +39,13 @@ public class BooleanParam extends AbstractParam<Boolean> {
}
}
@Override
@Override
protected
Boolean
parse
(
String
input
)
throws
Exception
{
protected
Boolean
parse
(
String
input
)
throws
AtlasBase
Exception
{
if
(
"true"
.
equalsIgnoreCase
(
input
))
{
if
(
"true"
.
equalsIgnoreCase
(
input
))
{
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
if
(
"false"
.
equalsIgnoreCase
(
input
))
{
if
(
"false"
.
equalsIgnoreCase
(
input
))
{
return
Boolean
.
FALSE
;
return
Boolean
.
FALSE
;
}
}
throw
new
Exception
(
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
PARAMETER_PARSING_FAILED
,
"Boolean.parse: input="
+
input
);
}
}
}
}
\ No newline at end of file
webapp/src/main/java/org/apache/atlas/web/params/DateTimeParam.java
View file @
f379c9ff
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
org
.
apache
.
atlas
.
web
.
params
;
package
org
.
apache
.
atlas
.
web
.
params
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTimeZone
;
import
org.joda.time.DateTimeZone
;
...
@@ -32,7 +33,7 @@ public class DateTimeParam extends AbstractParam<DateTime> {
...
@@ -32,7 +33,7 @@ public class DateTimeParam extends AbstractParam<DateTime> {
}
}
@Override
@Override
protected
DateTime
parse
(
String
input
)
throws
Exception
{
protected
DateTime
parse
(
String
input
)
throws
AtlasBase
Exception
{
return
new
DateTime
(
input
,
DateTimeZone
.
UTC
);
return
new
DateTime
(
input
,
DateTimeZone
.
UTC
);
}
}
}
}
\ No newline at end of file
webapp/src/main/java/org/apache/atlas/web/security/AtlasLdapAuthenticationProvider.java
View file @
f379c9ff
...
@@ -18,15 +18,11 @@
...
@@ -18,15 +18,11 @@
package
org
.
apache
.
atlas
.
web
.
security
;
package
org
.
apache
.
atlas
.
web
.
security
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
import
javax.annotation.PostConstruct
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.web.model.User
;
import
org.apache.atlas.web.model.User
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.commons.configuration.ConfigurationConverter
;
import
org.apache.commons.configuration.ConfigurationConverter
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.ldap.core.support.LdapContextSource
;
import
org.springframework.ldap.core.support.LdapContextSource
;
...
@@ -41,7 +37,10 @@ import org.springframework.security.ldap.authentication.LdapAuthenticationProvid
...
@@ -41,7 +37,10 @@ import org.springframework.security.ldap.authentication.LdapAuthenticationProvid
import
org.springframework.security.ldap.search.FilterBasedLdapUserSearch
;
import
org.springframework.security.ldap.search.FilterBasedLdapUserSearch
;
import
org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator
;
import
org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.apache.commons.lang.StringUtils
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.Properties
;
@Component
@Component
public
class
AtlasLdapAuthenticationProvider
extends
public
class
AtlasLdapAuthenticationProvider
extends
...
@@ -87,7 +86,7 @@ public class AtlasLdapAuthenticationProvider extends
...
@@ -87,7 +86,7 @@ public class AtlasLdapAuthenticationProvider extends
}
}
private
Authentication
getLdapBindAuthentication
(
private
Authentication
getLdapBindAuthentication
(
Authentication
authentication
)
throws
Exception
{
Authentication
authentication
)
{
try
{
try
{
if
(
isDebugEnabled
)
{
if
(
isDebugEnabled
)
{
LOG
.
debug
(
"==> AtlasLdapAuthenticationProvider getLdapBindAuthentication"
);
LOG
.
debug
(
"==> AtlasLdapAuthenticationProvider getLdapBindAuthentication"
);
...
...
webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceState.java
View file @
f379c9ff
...
@@ -20,7 +20,9 @@ package org.apache.atlas.web.service;
...
@@ -20,7 +20,9 @@ package org.apache.atlas.web.service;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.ha.HAConfiguration
;
import
org.apache.atlas.ha.HAConfiguration
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.curator.framework.CuratorFramework
;
import
org.apache.curator.framework.CuratorFramework
;
...
@@ -81,11 +83,12 @@ public class ActiveInstanceState {
...
@@ -81,11 +83,12 @@ public class ActiveInstanceState {
* @throws Exception
* @throws Exception
* @param serverId ID of this server instance
* @param serverId ID of this server instance
*/
*/
public
void
update
(
String
serverId
)
throws
Exception
{
public
void
update
(
String
serverId
)
throws
AtlasBaseException
{
try
{
CuratorFramework
client
=
curatorFactory
.
clientInstance
();
CuratorFramework
client
=
curatorFactory
.
clientInstance
();
String
atlasServerAddress
=
HAConfiguration
.
getBoundAddressForId
(
configuration
,
serverId
);
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
=
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
=
HAConfiguration
.
getZookeeperProperties
(
configuration
);
HAConfiguration
.
getZookeeperProperties
(
configuration
);
String
atlasServerAddress
=
HAConfiguration
.
getBoundAddressForId
(
configuration
,
serverId
);
List
<
ACL
>
acls
=
Arrays
.
asList
(
List
<
ACL
>
acls
=
Arrays
.
asList
(
new
ACL
[]{
AtlasZookeeperSecurityProperties
.
parseAcl
(
zookeeperProperties
.
getAcl
(),
new
ACL
[]{
AtlasZookeeperSecurityProperties
.
parseAcl
(
zookeeperProperties
.
getAcl
(),
ZooDefs
.
Ids
.
OPEN_ACL_UNSAFE
.
get
(
0
))});
ZooDefs
.
Ids
.
OPEN_ACL_UNSAFE
.
get
(
0
))});
...
@@ -98,6 +101,9 @@ public class ActiveInstanceState {
...
@@ -98,6 +101,9 @@ public class ActiveInstanceState {
}
}
client
.
setData
().
forPath
(
getZnodePath
(
zookeeperProperties
),
client
.
setData
().
forPath
(
getZnodePath
(
zookeeperProperties
),
atlasServerAddress
.
getBytes
(
Charset
.
forName
(
"UTF-8"
)));
atlasServerAddress
.
getBytes
(
Charset
.
forName
(
"UTF-8"
)));
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CURATOR_FRAMEWORK_UPDATE
,
e
,
"forPath: getZnodePath"
);
}
}
}
private
String
getZnodePath
(
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
)
{
private
String
getZnodePath
(
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
)
{
...
...
webapp/src/main/java/org/apache/atlas/web/service/EmbeddedServer.java
View file @
f379c9ff
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
org
.
apache
.
atlas
.
web
.
service
;
package
org
.
apache
.
atlas
.
web
.
service
;
import
org.apache.atlas.AtlasConfiguration
;
import
org.apache.atlas.AtlasConfiguration
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.eclipse.jetty.server.Connector
;
import
org.eclipse.jetty.server.Connector
;
import
org.eclipse.jetty.server.HttpConfiguration
;
import
org.eclipse.jetty.server.HttpConfiguration
;
import
org.eclipse.jetty.server.HttpConnectionFactory
;
import
org.eclipse.jetty.server.HttpConnectionFactory
;
...
@@ -88,9 +90,13 @@ public class EmbeddedServer {
...
@@ -88,9 +90,13 @@ public class EmbeddedServer {
return
connector
;
return
connector
;
}
}
public
void
start
()
throws
Exception
{
public
void
start
()
throws
AtlasBaseException
{
try
{
server
.
start
();
server
.
start
();
server
.
join
();
server
.
join
();
}
catch
(
Exception
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
EMBEDDED_SERVER_START
,
e
);
}
}
}
public
void
stop
()
{
public
void
stop
()
{
...
...
webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
View file @
f379c9ff
...
@@ -119,11 +119,15 @@ public class SetupSteps {
...
@@ -119,11 +119,15 @@ public class SetupSteps {
}
}
private
void
clearSetupInProgress
(
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
)
private
void
clearSetupInProgress
(
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
)
throws
Exception
{
throws
Setup
Exception
{
CuratorFramework
client
=
curatorFactory
.
clientInstance
();
CuratorFramework
client
=
curatorFactory
.
clientInstance
();
String
path
=
lockPath
(
zookeeperProperties
);
String
path
=
lockPath
(
zookeeperProperties
);
try
{
client
.
delete
().
forPath
(
path
);
client
.
delete
().
forPath
(
path
);
LOG
.
info
(
"Deleted lock path after completing setup {}"
,
path
);
LOG
.
info
(
"Deleted lock path after completing setup {}"
,
path
);
}
catch
(
Exception
e
)
{
throw
new
SetupException
(
String
.
format
(
"SetupSteps.clearSetupInProgress: Failed to get Zookeeper node patH: %s"
,
path
),
e
);
}
}
}
private
String
lockPath
(
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
)
{
private
String
lockPath
(
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
)
{
...
...
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