accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1339308 - in /accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce: AccumuloOutputFormat.java InputFormatBase.java
Date Wed, 16 May 2012 18:46:57 GMT
Author: vines
Date: Wed May 16 18:46:56 2012
New Revision: 1339308

URL: http://svn.apache.org/viewvc?rev=1339308&view=rev
Log:
ACCUMULO-489 - once more with feeling!

Modified:
    accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
    accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java

Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java?rev=1339308&r1=1339307&r2=1339308&view=diff
==============================================================================
--- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
(original)
+++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
Wed May 16 18:46:56 2012
@@ -108,11 +108,9 @@ public class AccumuloOutputFormat extend
    *          the output format will create new tables as necessary. Table names can only
be alpha-numeric and underscores.
    * @param defaultTable
    *          the table to use when the tablename is null in the write call
-   * @throws IOException
-   *           Thrown when there are issues creating the file distributed with the users
info
    * @deprecated Use {@link #setOutputInfo(Configuration,String,byte[],boolean,String)} instead
    */
-  public static void setOutputInfo(JobContext job, String user, byte[] passwd, boolean createTables,
String defaultTable) throws IOException {
+  public static void setOutputInfo(JobContext job, String user, byte[] passwd, boolean createTables,
String defaultTable) {
     setOutputInfo(job.getConfiguration(), user, passwd, createTables, defaultTable);
   }
   
@@ -129,10 +127,8 @@ public class AccumuloOutputFormat extend
    *          the output format will create new tables as necessary. Table names can only
be alpha-numeric and underscores.
    * @param defaultTable
    *          the table to use when the tablename is null in the write call
-   * @throws IOException
-   *           Thrown when there are issues creating the file distributed with the users
info
    */
-  public static void setOutputInfo(Configuration conf, String user, byte[] passwd, boolean
createTables, String defaultTable) throws IOException {
+  public static void setOutputInfo(Configuration conf, String user, byte[] passwd, boolean
createTables, String defaultTable) {
     if (conf.getBoolean(OUTPUT_INFO_HAS_BEEN_SET, false))
       throw new IllegalStateException("Output info can only be set once per job");
     conf.setBoolean(OUTPUT_INFO_HAS_BEEN_SET, true);
@@ -143,19 +139,23 @@ public class AccumuloOutputFormat extend
     if (defaultTable != null)
       conf.set(DEFAULT_TABLE_NAME, defaultTable);
     
-    FileSystem fs = FileSystem.get(conf);
-    Path file = new Path(fs.getWorkingDirectory(), conf.get("mapred.job.name") + System.currentTimeMillis()
+ ".pw");
-    conf.set(PASSWORD_PATH, file.toString());
-    FSDataOutputStream fos = fs.create(file, false);
-    fs.setPermission(file, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
-    fs.deleteOnExit(file);
-    
-    byte[] encodedPw = Base64.encodeBase64(passwd);
-    fos.writeInt(encodedPw.length);
-    fos.write(encodedPw);
-    fos.close();
-    
-    DistributedCache.addCacheFile(file.toUri(), conf);
+    try {
+      FileSystem fs = FileSystem.get(conf);
+      Path file = new Path(fs.getWorkingDirectory(), conf.get("mapred.job.name") + System.currentTimeMillis()
+ ".pw");
+      conf.set(PASSWORD_PATH, file.toString());
+      FSDataOutputStream fos = fs.create(file, false);
+      fs.setPermission(file, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
+      fs.deleteOnExit(file);
+      
+      byte[] encodedPw = Base64.encodeBase64(passwd);
+      fos.writeInt(encodedPw.length);
+      fos.write(encodedPw);
+      fos.close();
+      
+      DistributedCache.addCacheFile(file.toUri(), conf);
+    } catch (IOException ioe) {
+      throw new RuntimeException(ioe);
+    }
 
   }
   

Modified: accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java?rev=1339308&r1=1339307&r2=1339308&view=diff
==============================================================================
--- accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
(original)
+++ accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
Wed May 16 18:46:56 2012
@@ -194,10 +194,9 @@ public abstract class InputFormatBase<K,
   }
   
   /**
-   * @throws IOException
    * @deprecated Use {@link #setInputInfo(Configuration,String,byte[],String,Authorizations)}
instead
    */
-  public static void setInputInfo(JobContext job, String user, byte[] passwd, String table,
Authorizations auths) throws IOException {
+  public static void setInputInfo(JobContext job, String user, byte[] passwd, String table,
Authorizations auths) {
     setInputInfo(job.getConfiguration(), user, passwd, table, auths);
   }
   
@@ -214,9 +213,8 @@ public abstract class InputFormatBase<K,
    *          the table to read
    * @param auths
    *          the authorizations used to restrict data read
-   * @throws IOException
    */
-  public static void setInputInfo(Configuration conf, String user, byte[] passwd, String
table, Authorizations auths) throws IOException {
+  public static void setInputInfo(Configuration conf, String user, byte[] passwd, String
table, Authorizations auths) {
     if (conf.getBoolean(INPUT_INFO_HAS_BEEN_SET, false))
       throw new IllegalStateException("Input info can only be set once per job");
     conf.setBoolean(INPUT_INFO_HAS_BEEN_SET, true);
@@ -227,19 +225,24 @@ public abstract class InputFormatBase<K,
     if (auths != null && !auths.isEmpty())
       conf.set(AUTHORIZATIONS, auths.serialize());
     
-    FileSystem fs = FileSystem.get(conf);
-    Path file = new Path(fs.getWorkingDirectory(), conf.get("mapred.job.name") + System.currentTimeMillis()
+ ".pw");
-    conf.set(PASSWORD_PATH, file.toString());
-    FSDataOutputStream fos = fs.create(file, false);
-    fs.setPermission(file, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
-    fs.deleteOnExit(file);
+    try {
+      FileSystem fs = FileSystem.get(conf);
+      Path file = new Path(fs.getWorkingDirectory(), conf.get("mapred.job.name") + System.currentTimeMillis()
+ ".pw");
+      conf.set(PASSWORD_PATH, file.toString());
+      FSDataOutputStream fos = fs.create(file, false);
+      fs.setPermission(file, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
+      fs.deleteOnExit(file);
+      
+      byte[] encodedPw = Base64.encodeBase64(passwd);
+      fos.writeInt(encodedPw.length);
+      fos.write(encodedPw);
+      fos.close();
+      
+      DistributedCache.addCacheFile(file.toUri(), conf);
+    } catch (IOException ioe) {
+      throw new RuntimeException(ioe);
+    }
 
-    byte[] encodedPw = Base64.encodeBase64(passwd);
-    fos.writeInt(encodedPw.length);
-    fos.write(encodedPw);
-    fos.close();
-    
-    DistributedCache.addCacheFile(file.toUri(), conf);
   }
   
   /**



Mime
View raw message