RANGER-240 Support seamles upgrade and downgrade plugins so that prior releases 
are unaffected by class name changes

Hbase: Add a shell coprocessor with old class name
Hive: Add a shell class with old name
Knox: Rollback authorizer name changes made in Knox since it would require to 
user’s /etc/knox/conf which is a taboo!

Signed-off-by: Madhan Neethiraj <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/432b4b11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/432b4b11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/432b4b11

Branch: refs/heads/master
Commit: 432b4b11d632071bd69ae08fe00bc1d6be6bc84e
Parents: fb1a99a
Author: Alok Lal <[email protected]>
Authored: Thu Feb 12 13:49:33 2015 -0800
Committer: Madhan Neethiraj <[email protected]>
Committed: Thu Feb 12 14:11:34 2015 -0800

----------------------------------------------------------------------
 .../hbase/XaSecureAuthorizationCoprocessor.java | 33 ++++++++++++++++++++
 .../.settings/org.eclipse.core.resources.prefs  |  1 +
 .../XaSecureHiveAuthorizerFactory.java          | 33 ++++++++++++++++++++
 .../.settings/org.eclipse.core.resources.prefs  |  1 +
 .../RangerPDPKnoxDeploymentContributor.java     |  3 +-
 .../.settings/org.eclipse.wst.common.component  |  3 ++
 6 files changed, 73 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/432b4b11/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
----------------------------------------------------------------------
diff --git 
a/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
 
b/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
new file mode 100644
index 0000000..2a4f440
--- /dev/null
+++ 
b/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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 com.xasecure.authorization.hbase;
+
+import org.apache.ranger.authorization.hbase.RangerAuthorizationCoprocessor;
+
+/**
+ * This class exists only to provide for seamless upgrade/downgrade 
capabilities.  Coprocessor name is in hbase config files in /etc/.../conf which
+ * is not only out of bounds for any upgrade script but also must be of a form 
to allow for downgrad!  Thus when class names were changed XaSecure* -> Ranger* 
+ * this shell class serves to allow for seamles upgrade as well as downgrade.
+ * 
+ * This class is final because if one needs to customize coprocessor it is 
expected that RangerAuthorizationCoprocessor would be modified/extended as that 
is
+ * the "real" coprocessor!  This class, hence, should NEVER be more than an 
EMPTY shell!
+ */
+public final class XaSecureAuthorizationCoprocessor extends 
RangerAuthorizationCoprocessor {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/432b4b11/hive-agent/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/hive-agent/.settings/org.eclipse.core.resources.prefs 
b/hive-agent/.settings/org.eclipse.core.resources.prefs
index e9441bb..f9fe345 100644
--- a/hive-agent/.settings/org.eclipse.core.resources.prefs
+++ b/hive-agent/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,4 @@
 eclipse.preferences.version=1
 encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
 encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/432b4b11/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
----------------------------------------------------------------------
diff --git 
a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
 
b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
new file mode 100644
index 0000000..e941704
--- /dev/null
+++ 
b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizerFactory.java
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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 com.xasecure.authorization.hive.authorizer;
+
+import 
org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFactory;
+
+/**
+ * This class exists only to provide for seamless upgrade/downgrade 
capabilities.  Coprocessor name is in hbase config files in /etc/.../conf which
+ * is not only out of bounds for any upgrade script but also must be of a form 
to allow for downgrad!  Thus when class names were changed XaSecure* -> Ranger* 
+ * this shell class serves to allow for seamles upgrade as well as downgrade.
+ * 
+ * This class is final because if one needs to customize coprocessor it is 
expected that RangerAuthorizationCoprocessor would be modified/extended as that 
is
+ * the "real" coprocessor!  This class, hence, should NEVER be more than an 
EMPTY shell!
+ */
+public final class XaSecureHiveAuthorizerFactory extends 
RangerHiveAuthorizerFactory {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/432b4b11/knox-agent/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/knox-agent/.settings/org.eclipse.core.resources.prefs 
b/knox-agent/.settings/org.eclipse.core.resources.prefs
index d4a56c4..c698889 100644
--- a/knox-agent/.settings/org.eclipse.core.resources.prefs
+++ b/knox-agent/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,5 @@
 eclipse.preferences.version=1
 encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
 encoding/<project>=UTF-8
 encoding/resources=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/432b4b11/knox-agent/src/main/java/org/apache/ranger/authorization/knox/deploy/RangerPDPKnoxDeploymentContributor.java
----------------------------------------------------------------------
diff --git 
a/knox-agent/src/main/java/org/apache/ranger/authorization/knox/deploy/RangerPDPKnoxDeploymentContributor.java
 
b/knox-agent/src/main/java/org/apache/ranger/authorization/knox/deploy/RangerPDPKnoxDeploymentContributor.java
index 4e497c2..e927ba6 100644
--- 
a/knox-agent/src/main/java/org/apache/ranger/authorization/knox/deploy/RangerPDPKnoxDeploymentContributor.java
+++ 
b/knox-agent/src/main/java/org/apache/ranger/authorization/knox/deploy/RangerPDPKnoxDeploymentContributor.java
@@ -40,7 +40,8 @@ public class RangerPDPKnoxDeploymentContributor extends 
ProviderDeploymentContri
 
   @Override
   public String getName() {
-    return "RangerPDPKnox";
+       // This MUST match a corresponding change in the topology file.  For 
upgrade purposes this name remains as is, i.e. XASecure* and not Ranger*.
+    return "XASecurePDPKnox";
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/432b4b11/security-admin/.settings/org.eclipse.wst.common.component
----------------------------------------------------------------------
diff --git a/security-admin/.settings/org.eclipse.wst.common.component 
b/security-admin/.settings/org.eclipse.wst.common.component
index ab287e8..703c05f 100644
--- a/security-admin/.settings/org.eclipse.wst.common.component
+++ b/security-admin/.settings/org.eclipse.wst.common.component
@@ -7,6 +7,9 @@
         <dependent-module archiveName="lookup-client-0.4.0.jar" 
deploy-path="/WEB-INF/lib" 
handle="module:/resource/lookup-client/lookup-client">
             <dependency-type>uses</dependency-type>
         </dependent-module>
+        <dependent-module archiveName="ranger-util-0.4.0.jar" 
deploy-path="/WEB-INF/lib" handle="module:/resource/ranger-util/ranger-util">
+            <dependency-type>uses</dependency-type>
+        </dependent-module>
         <dependent-module archiveName="unixauthclient-0.4.0.jar" 
deploy-path="/WEB-INF/lib" 
handle="module:/resource/unixauthclient/unixauthclient">
             <dependency-type>uses</dependency-type>
         </dependent-module>

Reply via email to