You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sp...@apache.org on 2017/09/27 22:00:38 UTC
sentry git commit: SENTRY-1968: Remove
sentry-binding-hive-hmsfollower-v2 module after Hive 2.0 version bump (Sergio
Pena, reviewed by kalyan kumar kalvagadda)
Repository: sentry
Updated Branches:
refs/heads/master da1863f34 -> 1abb1f903
SENTRY-1968: Remove sentry-binding-hive-hmsfollower-v2 module after Hive 2.0 version bump (Sergio Pena, reviewed by kalyan kumar kalvagadda)
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/1abb1f90
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/1abb1f90
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/1abb1f90
Branch: refs/heads/master
Commit: 1abb1f90303342aa94f9752881330d5ea470491a
Parents: da1863f
Author: Sergio Pena <se...@cloudera.com>
Authored: Wed Sep 27 17:00:07 2017 -0500
Committer: Sergio Pena <se...@cloudera.com>
Committed: Wed Sep 27 17:00:07 2017 -0500
----------------------------------------------------------------------
sentry-binding/pom.xml | 4 +-
.../sentry-binding-hive-follower-v2/pom.xml | 65 --------
.../json/SentryJSONAddPartitionMessage.java | 48 ------
.../json/SentryJSONAlterPartitionMessage.java | 79 ----------
.../json/SentryJSONAlterTableMessage.java | 54 -------
.../json/SentryJSONCreateDatabaseMessage.java | 44 ------
.../json/SentryJSONCreateTableMessage.java | 44 ------
.../json/SentryJSONDropDatabaseMessage.java | 44 ------
.../json/SentryJSONDropPartitionMessage.java | 51 ------
.../json/SentryJSONDropTableMessage.java | 45 ------
.../json/SentryJSONMessageDeserializer.java | 154 -------------------
.../json/SentryJSONMessageFactory.java | 146 ------------------
sentry-provider/sentry-provider-db/pom.xml | 31 +---
13 files changed, 6 insertions(+), 803 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-binding/pom.xml b/sentry-binding/pom.xml
index 505ae98..338fd34 100644
--- a/sentry-binding/pom.xml
+++ b/sentry-binding/pom.xml
@@ -35,7 +35,7 @@ limitations under the License.
<module>sentry-binding-solr</module>
<module>sentry-binding-sqoop</module>
<module>sentry-binding-hive-conf</module>
-
+ <module>sentry-binding-hive-follower</module>
</modules>
<profiles>
@@ -46,7 +46,6 @@ limitations under the License.
</activation>
<modules>
<module>sentry-binding-hive</module>
- <module>sentry-binding-hive-follower</module>
</modules>
</profile>
<profile>
@@ -56,7 +55,6 @@ limitations under the License.
</activation>
<modules>
<module>sentry-binding-hive-v2</module>
- <module>sentry-binding-hive-follower-v2</module>
</modules>
</profile>
</profiles>
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/pom.xml b/sentry-binding/sentry-binding-hive-follower-v2/pom.xml
deleted file mode 100644
index bf7977c..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/pom.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-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.
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.sentry</groupId>
- <artifactId>sentry-binding</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>sentry-binding-hive-follower-v2</artifactId>
- <name>Hive follower v2 for Sentry</name>
-
- <dependencies>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-core</artifactId>
- <version>${datanucleus-core.version}</version>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-api-jdo</artifactId>
- <version>${datanucleus-api-jdo.version}</version>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-rdbms</artifactId>
- <version>${datanucleus-rdbms.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-exec</artifactId>
- <version>${hive.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hive.hcatalog</groupId>
- <artifactId>hive-hcatalog-server-extensions</artifactId>
- <version>${hive.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAddPartitionMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAddPartitionMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAddPartitionMessage.java
deleted file mode 100644
index 10d7a93..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAddPartitionMessage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONAddPartitionMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import java.util.List;
-import java.util.Map;
-
-public class SentryJSONAddPartitionMessage extends JSONAddPartitionMessage {
- @JsonProperty
- private List<String> locations;
-
- public SentryJSONAddPartitionMessage() {
- }
-
- public SentryJSONAddPartitionMessage(String server, String servicePrincipal, String db, String table,
- List<Map<String, String>> partitions, Long timestamp, List<String> locations) {
- super(server, servicePrincipal, db, table, partitions, timestamp);
- this.locations = locations;
- }
-
- public List<String> getLocations() {
- return locations;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterPartitionMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterPartitionMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterPartitionMessage.java
deleted file mode 100644
index 25de808..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterPartitionMessage.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableMap;
-import java.util.Collections;
-import org.apache.hive.hcatalog.messaging.json.JSONAlterPartitionMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import java.util.List;
-import java.util.Map;
-
-public class SentryJSONAlterPartitionMessage extends JSONAlterPartitionMessage {
- @JsonProperty
- private String newLocation;
- @JsonProperty
- private String oldLocation;
- @JsonProperty
- private List<String> newValues;
-
- public SentryJSONAlterPartitionMessage() {
- super("", "", "", "", ImmutableMap.<String, String>of(), null);
- }
-
- public SentryJSONAlterPartitionMessage(String server, String servicePrincipal,
- String db, String table,
- Map<String, String> values, List<String> newValues,
- Long timestamp, String oldlocation,
- String newLocation) {
- super(server, servicePrincipal, db, table, values, timestamp);
- this.newLocation = newLocation;
- this.oldLocation = oldlocation;
- this.newValues = newValues;
- }
-
- @VisibleForTesting
- public SentryJSONAlterPartitionMessage(String server, String servicePrincipal,
- String db, String table,
- Long timestamp, String oldlocation,
- String newLocation) {
- this(server, servicePrincipal, db, table,
- Collections.<String, String>emptyMap(), Collections.<String>emptyList(),
- timestamp, oldlocation, newLocation);
- }
-
- public String getNewLocation() {
- return newLocation;
- }
-
- public String getOldLocation() {
- return oldLocation;
- }
-
- public List<String> getNewValues() {
- return newValues;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterTableMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterTableMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterTableMessage.java
deleted file mode 100644
index 4670494..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONAlterTableMessage.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONAlterTableMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class SentryJSONAlterTableMessage extends JSONAlterTableMessage {
- @JsonProperty
- private String newLocation;
- @JsonProperty
- private String oldLocation;
-
- public SentryJSONAlterTableMessage() {
- super("", "", "", "", null);
- }
-
- public SentryJSONAlterTableMessage(String server, String servicePrincipal,
- String db, String table, Long timestamp,
- String oldLocation, String newLocation) {
- super(server, servicePrincipal, db, table, timestamp);
- this.newLocation = newLocation;
- this.oldLocation = oldLocation;
- }
-
- public String getNewLocation() {
- return newLocation;
- }
-
- public String getOldLocation() {
- return oldLocation;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateDatabaseMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateDatabaseMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateDatabaseMessage.java
deleted file mode 100644
index 8c62758..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateDatabaseMessage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONCreateDatabaseMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class SentryJSONCreateDatabaseMessage extends JSONCreateDatabaseMessage {
- @JsonProperty
- private String location;
-
- public SentryJSONCreateDatabaseMessage() {
- }
-
- public SentryJSONCreateDatabaseMessage(String server, String servicePrincipal, String db, Long timestamp, String location) {
- super(server, servicePrincipal, db, timestamp);
- this.location = location;
- }
-
- public String getLocation() {
- return location;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateTableMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateTableMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateTableMessage.java
deleted file mode 100644
index d15bc48..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONCreateTableMessage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONCreateTableMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class SentryJSONCreateTableMessage extends JSONCreateTableMessage {
- @JsonProperty
- private String location;
-
- public SentryJSONCreateTableMessage() {
- }
-
- public SentryJSONCreateTableMessage(String server, String servicePrincipal, String db, String table, Long timestamp, String location) {
- super(server, servicePrincipal, db, table, timestamp);
- this.location = location;
- }
-
- public String getLocation() {
- return location;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropDatabaseMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropDatabaseMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropDatabaseMessage.java
deleted file mode 100644
index c8e7c75..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropDatabaseMessage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONDropDatabaseMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class SentryJSONDropDatabaseMessage extends JSONDropDatabaseMessage {
- @JsonProperty
- private String location;
-
- public SentryJSONDropDatabaseMessage() {
- }
-
- public SentryJSONDropDatabaseMessage(String server, String servicePrincipal, String db, Long timestamp, String location) {
- super(server, servicePrincipal, db, timestamp);
- this.location = location;
- }
-
- public String getLocation() {
- return location;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropPartitionMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropPartitionMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropPartitionMessage.java
deleted file mode 100644
index d5f899c..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropPartitionMessage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONDropPartitionMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import java.util.List;
-import java.util.Map;
-
-public class SentryJSONDropPartitionMessage extends JSONDropPartitionMessage {
- @JsonProperty
- private List<String> locations;
-
- public SentryJSONDropPartitionMessage() {
- }
-
- public SentryJSONDropPartitionMessage(String server, String servicePrincipal,
- String db, String table,
- List<Map<String, String>> partitions,
- Long timestamp, List<String> locations) {
- super(server, servicePrincipal, db, table, partitions, timestamp);
- this.locations = locations;
- }
-
- public List<String> getLocations() {
- return locations;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropTableMessage.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropTableMessage.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropTableMessage.java
deleted file mode 100644
index e67f562..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONDropTableMessage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.json.JSONDropTableMessage;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-
-public class SentryJSONDropTableMessage extends JSONDropTableMessage {
- @JsonProperty
- private String location;
-
- public SentryJSONDropTableMessage() {
- }
-
- public SentryJSONDropTableMessage(String server, String servicePrincipal, String db, String table, Long timestamp, String location) {
- super(server, servicePrincipal, db, table, timestamp);
- this.location = location;
- }
-
- public String getLocation() {
- return location;
- }
-
- @Override
- public String toString() {
- return SentryJSONMessageDeserializer.serialize(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageDeserializer.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageDeserializer.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageDeserializer.java
deleted file mode 100644
index d11b261..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageDeserializer.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import org.apache.hive.hcatalog.messaging.*;
-import org.apache.hive.hcatalog.messaging.json.JSONInsertMessage;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.ObjectMapper;
-
-public class SentryJSONMessageDeserializer extends MessageDeserializer {
- private static ObjectMapper mapper = new ObjectMapper();
-
- static {
- mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- }
-
- public SentryJSONMessageDeserializer() {
- }
-
- /**
- * Method to de-serialize CreateDatabaseMessage instance.
- */
- @Override
- public SentryJSONCreateDatabaseMessage getCreateDatabaseMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONCreateDatabaseMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONCreateDatabaseMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize DropDatabaseMessage instance.
- */
- @Override
- public SentryJSONDropDatabaseMessage getDropDatabaseMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONDropDatabaseMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONDropDatabaseMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize CreateTableMessage instance.
- */
- @Override
- public SentryJSONCreateTableMessage getCreateTableMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONCreateTableMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONCreateTableMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize AlterTableMessage instance.
- */
- @Override
- public SentryJSONAlterTableMessage getAlterTableMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONAlterTableMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONAlterTableMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize DropTableMessage instance.
- */
- @Override
- public SentryJSONDropTableMessage getDropTableMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONDropTableMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONDropTableMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize AddPartitionMessage instance.
- */
- @Override
- public SentryJSONAddPartitionMessage getAddPartitionMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONAddPartitionMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONAddPartitionMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize AlterPartitionMessage instance.
- */
- @Override
- public SentryJSONAlterPartitionMessage getAlterPartitionMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONAlterPartitionMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONAlterPartitionMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize DropPartitionMessage instance.
- */
- @Override
- public SentryJSONDropPartitionMessage getDropPartitionMessage(String messageBody) {
- try {
- return mapper.readValue(messageBody, SentryJSONDropPartitionMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct SentryJSONDropPartitionMessage: ", e);
- }
- }
-
- /**
- * Method to de-serialize JSONInsertMessage instance.
- */
- @Override
- public InsertMessage getInsertMessage(String messageBody) {
- // Sentry would be not be interested in InsertMessage as these are generated when is data is
- // added inserted. This method is implemented for completeness. This is reason why, new sentry
- // JSON class is not defined for InsertMessage.
- try {
- return mapper.readValue(messageBody, JSONInsertMessage.class);
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not construct InsertMessage", e);
- }
- }
-
- public static String serialize(Object object) {
- try {
- return mapper.writeValueAsString(object);
- } catch (Exception exception) {
- throw new IllegalArgumentException("Could not serialize: ", exception);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageFactory.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageFactory.java b/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageFactory.java
deleted file mode 100644
index 19310b8..0000000
--- a/sentry-binding/sentry-binding-hive-follower-v2/src/main/java/org/apache/sentry/binding/metastore/messaging/json/SentryJSONMessageFactory.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * 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.sentry.binding.metastore.messaging.json;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hive.metastore.api.Database;
-import org.apache.hadoop.hive.metastore.api.Partition;
-import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hive.hcatalog.messaging.*;
-import org.apache.hive.hcatalog.messaging.json.JSONInsertMessage;
-
-import java.util.*;
-
-public class SentryJSONMessageFactory extends MessageFactory {
- private static final Log LOG = LogFactory.getLog(SentryJSONMessageFactory.class.getName());
- private static SentryJSONMessageDeserializer deserializer = new SentryJSONMessageDeserializer();
-
- public SentryJSONMessageFactory() {
- LOG.info("Using SentryJSONMessageFactory for building Notification log messages ");
- }
-
- public MessageDeserializer getDeserializer() {
- return deserializer;
- }
-
- public String getVersion() {
- return "0.1";
- }
-
- public String getMessageFormat() {
- return "json";
- }
-
- public SentryJSONCreateDatabaseMessage buildCreateDatabaseMessage(Database db) {
- return new SentryJSONCreateDatabaseMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, db.getName(),
- now(), db.getLocationUri());
- }
-
- public SentryJSONDropDatabaseMessage buildDropDatabaseMessage(Database db) {
- return new SentryJSONDropDatabaseMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, db.getName(),
- now(), db.getLocationUri());
- }
-
- public SentryJSONCreateTableMessage buildCreateTableMessage(Table table) {
- return new SentryJSONCreateTableMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
- table.getTableName(), now(), table.getSd().getLocation());
- }
-
- public SentryJSONAlterTableMessage buildAlterTableMessage(Table before, Table after) {
- return new SentryJSONAlterTableMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, before.getDbName(),
- before.getTableName(), now(), before.getSd().getLocation(), after.getSd().getLocation());
- }
-
- public SentryJSONDropTableMessage buildDropTableMessage(Table table) {
- return new SentryJSONDropTableMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
- table.getTableName(), now(), table.getSd().getLocation());
- }
-
- @Override
- public SentryJSONAlterPartitionMessage buildAlterPartitionMessage(Table table,
- Partition before, Partition after) {
- return new SentryJSONAlterPartitionMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL,
- before.getDbName(), before.getTableName(), getPartitionKeyValues(table, before),
- after.getValues(), now(), before.getSd().getLocation(), after.getSd().getLocation());
- }
-
- @Override
- public DropPartitionMessage buildDropPartitionMessage(Table table, Iterator<Partition> partitions) {
- return new SentryJSONDropPartitionMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL,
- table.getDbName(), table.getTableName(),getPartitionKeyValues(table, partitions),
- now(), getPartitionLocations(partitions));
- }
-
- @Override
- public InsertMessage buildInsertMessage(String db, String table, Map<String,String> partKeyVals,
- List<String> files) {
- // Sentry would be not be interested in InsertMessage as these are generated when is data is
- // added inserted. This method is implemented for completeness. This is reason why, new sentry
- // JSON class is not defined for InsertMessage.
- return new JSONInsertMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, db, table, partKeyVals,
- files, now());
- }
-
- @Override
- public AddPartitionMessage buildAddPartitionMessage(Table table,
- Iterator<Partition> partitionsIterator) {
- return new SentryJSONAddPartitionMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
- table.getTableName(), getPartitionKeyValues(table, partitionsIterator), now(),
- getPartitionLocations(partitionsIterator));
- }
-
- public AddPartitionMessage buildAddPartitionMessage(Table table,
- List<Partition> partitions) {
- return buildAddPartitionMessage (table, partitions.iterator());
- }
-
- private static List<Map<String, String>> getPartitionKeyValues(Table table,
- Iterator<Partition> partitions) {
- List<Map<String, String>> partitionList = Lists.newLinkedList();
- while(partitions.hasNext()) {
- partitionList.add(getPartitionKeyValues(table, partitions.next()));
- }
- return partitionList;
- }
-
- private List<String> getPartitionLocations(Iterator<Partition> partitionsIterator) {
- List<String> locations = Lists.newLinkedList();
- while(partitionsIterator.hasNext()) {
- locations.add(partitionsIterator.next().getSd().getLocation());
- }
- return locations;
- }
-
- private static Map<String, String> getPartitionKeyValues(Table table, Partition partition) {
- LinkedHashMap partitionKeys = new LinkedHashMap();
-
- for (int i = 0; i < table.getPartitionKeysSize(); ++i) {
- partitionKeys.put((table.getPartitionKeys().get(i)).getName(), partition.getValues().get(i));
- }
-
- return partitionKeys;
- }
-
- //This is private in parent class
- private long now() {
- return System.currentTimeMillis() / 1000L;
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/1abb1f90/sentry-provider/sentry-provider-db/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/pom.xml b/sentry-provider/sentry-provider-db/pom.xml
index 882a3ce..4481e08 100644
--- a/sentry-provider/sentry-provider-db/pom.xml
+++ b/sentry-provider/sentry-provider-db/pom.xml
@@ -137,6 +137,11 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-binding-hive-follower</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-hdfs-common</artifactId>
</dependency>
<dependency>
@@ -343,32 +348,6 @@ limitations under the License.
</build>
<profiles>
<profile>
- <id>hive-authz1</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.sentry</groupId>
- <artifactId>sentry-binding-hive-follower</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>hive-authz2</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.sentry</groupId>
- <artifactId>sentry-binding-hive-follower-v2</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </profile>
- <profile>
<id>thriftif</id>
<build>
<plugins>