You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2012/08/27 05:50:47 UTC

svn commit: r1377563 - in /incubator/oozie/trunk: core/pom.xml core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java pom.xml release-log.txt

Author: virag
Date: Mon Aug 27 03:50:47 2012
New Revision: 1377563

URL: http://svn.apache.org/viewvc?rev=1377563&view=rev
Log:
OOZIE-961 Load Hbase credentials in Oozie (virag)

Added:
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
Modified:
    incubator/oozie/trunk/core/pom.xml
    incubator/oozie/trunk/pom.xml
    incubator/oozie/trunk/release-log.txt

Modified: incubator/oozie/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/pom.xml?rev=1377563&r1=1377562&r2=1377563&view=diff
==============================================================================
--- incubator/oozie/trunk/core/pom.xml (original)
+++ incubator/oozie/trunk/core/pom.xml Mon Aug 27 03:50:47 2012
@@ -37,6 +37,12 @@
     <dependencies>
 
         <dependency>
+            <groupId>org.apache.hbase</groupId>
+            <artifactId>hbase</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.oozie</groupId>
             <artifactId>oozie-hadoop-test</artifactId>
             <scope>test</scope>

Added: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java?rev=1377563&view=auto
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java (added)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java Mon Aug 27 03:50:47 2012
@@ -0,0 +1,73 @@
+/**
+ * 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.oozie.action.hadoop;
+
+import java.util.Map;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.oozie.action.ActionExecutor.Context;
+import org.apache.oozie.action.hadoop.Credentials;
+import org.apache.oozie.action.hadoop.CredentialsProperties;
+import org.apache.oozie.util.XLog;
+import org.apache.hadoop.security.UserGroupInformation;
+
+
+/**
+ * Hbase Credentials implementation to store in jobConf
+ * The jobConf is used further to pass credentials to the tasks while running
+ * Oozie server should be configured to use this Credentials class by including it via property 'oozie.credentials.credentialclasses'
+ *
+ */
+public class HbaseCredentials extends Credentials {
+
+
+    /* (non-Javadoc)
+     * @see org.apache.oozie.action.hadoop.Credentials#addtoJobConf(org.apache.hadoop.mapred.JobConf, org.apache.oozie.action.hadoop.CredentialsProperties, org.apache.oozie.action.ActionExecutor.Context)
+     */
+    @Override
+    public void addtoJobConf(JobConf jobConf, CredentialsProperties props, Context context) throws Exception {
+        try {
+            // Create configuration using hbase-site.xml/hbase-default.xml
+            Configuration hbaseConf = HBaseConfiguration.create();
+            // copy conf from hbaseConf to jobConf without overriding the
+            // already existing values of jobConf
+            injectConf(hbaseConf, jobConf);
+            String user = context.getWorkflow().getUser();
+            UserGroupInformation ugi =  UserGroupInformation.createProxyUser(user, UserGroupInformation.getLoginUser());
+            User u = User.create(ugi);
+            u.obtainAuthTokenForJob(jobConf);
+        }
+        catch (Exception e) {
+            XLog.getLog(getClass()).warn("Exception in receiving hbase credentials", e);
+            throw e;
+        }
+    }
+
+    private void injectConf(Configuration srcConf, Configuration destConf) {
+        for (Map.Entry<String, String> entry : srcConf) {
+            String name = entry.getKey();
+            if (destConf.get(name) == null) {
+                String value = entry.getValue();
+                destConf.set(name, value);
+            }
+        }
+    }
+}

Modified: incubator/oozie/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/pom.xml?rev=1377563&r1=1377562&r2=1377563&view=diff
==============================================================================
--- incubator/oozie/trunk/pom.xml (original)
+++ incubator/oozie/trunk/pom.xml Mon Aug 27 03:50:47 2012
@@ -83,6 +83,7 @@
          <sqoop.version>1.5.0-incubating-SNAPSHOT</sqoop.version>
          <streaming.version>${hadoop.version}</streaming.version>
          <distcp.version>${hadooplib.version}</distcp.version>
+         <hbase.version>0.94.0</hbase.version>
     </properties>
 
     <modules>
@@ -324,6 +325,12 @@
             </dependency>
 
             <dependency>
+                <groupId>org.apache.hbase</groupId>
+                <artifactId>hbase</artifactId>
+                <version>${hbase.version}</version>
+            </dependency>
+
+            <dependency>
                 <groupId>org.apache.pig</groupId>
                 <artifactId>pig</artifactId>
                 <version>${pig.version}</version>

Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1377563&r1=1377562&r2=1377563&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Mon Aug 27 03:50:47 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.3.0 release (trunk - unreleased)
 
+OOZIE-961 Load Hbase credentials in Oozie (virag)
 OOZIE-963 Add new EL function to replace all instances of a sub-string with another one (kamrul via virag)
 OOZIE-969 Unit tests in TestStatusTransitService failing due to change in CoordKillX (mona via virag)
 OOZIE-965 Allow the timezone attribute in coordinator jobs to use a format like GMT-#### (rkanter via tucu)