Updated Branches:
  refs/heads/ACCUMULO-1854-multi-aif 921617d4d -> c50a22296


ACCUMULO-1854 Add helper method to extract AOF configuration entries
from a Configuration object.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4111d1ed
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4111d1ed
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4111d1ed

Branch: refs/heads/ACCUMULO-1854-multi-aif
Commit: 4111d1ede797addb29ba1983f751f197cb42deca
Parents: 921617d
Author: Josh Elser <els...@apache.org>
Authored: Wed Nov 6 14:08:23 2013 -0500
Committer: Josh Elser <els...@apache.org>
Committed: Wed Nov 6 14:08:23 2013 -0500

----------------------------------------------------------------------
 .../client/mapreduce/AccumuloOutputFormat.java  | 22 +++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4111d1ed/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
----------------------------------------------------------------------
diff --git 
a/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
 
b/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
index 9b9041a..66e85fd 100644
--- 
a/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
+++ 
b/src/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
@@ -19,6 +19,9 @@ package org.apache.accumulo.core.client.mapreduce;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.accumulo.core.client.AccumuloException;
@@ -112,6 +115,20 @@ public class AccumuloOutputFormat extends 
OutputFormat<Text,Mutation> {
     NUM_CONFIGURATIONS_PROCESSED.set(0);
   }
   
+  public static Map<String,String> getRelevantEntries(Configuration conf) {
+    ArgumentChecker.notNull(conf);
+    
+    HashMap<String,String> confEntries = new HashMap<String,String>();
+    for (Entry<String,String> entry : conf) {
+      final String key = entry.getKey();
+      if (0 == key.indexOf(PREFIX)) {
+        confEntries.put(key, entry.getValue());
+      }
+    }
+    
+    return confEntries;
+  }
+  
   /**
    * Configure the output format.
    * 
@@ -612,8 +629,10 @@ public class AccumuloOutputFormat extends 
OutputFormat<Text,Mutation> {
     final Configuration conf = job.getConfiguration();
     
     if (0 == sequencesToCheck) {
+      log.debug("No configurations loaded, checking the default");
       checkConfiguration(conf, sequencesToCheck);
     } else {
+      log.debug(sequencesToCheck + " configurations loaded");
       for (int i = 1; i <= sequencesToCheck; i++) {
         checkConfiguration(conf, i);
       }
@@ -621,8 +640,9 @@ public class AccumuloOutputFormat extends 
OutputFormat<Text,Mutation> {
   }
   
   private void checkConfiguration(Configuration conf, int sequence) throws 
IOException {
-    if (!conf.getBoolean(merge(OUTPUT_INFO_HAS_BEEN_SET, sequence), false))
+    if (!conf.getBoolean(merge(OUTPUT_INFO_HAS_BEEN_SET, sequence), false)) {
       throw new IOException("Output info for sequence " + sequence + " has not 
been set.");
+    }
     if (!conf.getBoolean(merge(INSTANCE_HAS_BEEN_SET, sequence), false))
       throw new IOException("Instance info for sequence " + sequence + " has 
not been set.");
     try {

Reply via email to