accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] mikewalch commented on a change in pull request #11: Fixes #10 - Update helloworld example to new Connector builder
Date Sat, 31 Mar 2018 16:00:31 GMT
mikewalch commented on a change in pull request #11: Fixes #10 - Update helloworld example
to new Connector builder
URL: https://github.com/apache/accumulo-examples/pull/11#discussion_r178435270
 
 

 ##########
 File path: src/main/java/org/apache/accumulo/examples/helloworld/ReadData.java
 ##########
 @@ -27,52 +26,29 @@
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.examples.cli.ClientOnRequiredTable;
-import org.apache.accumulo.examples.cli.ScannerOpts;
+import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.beust.jcommander.Parameter;
-
 /**
- * Reads all data between two rows; all data after a given row; or all data in a table, depending
on the number of arguments given.
+ * Reads all data between two rows
  */
 public class ReadData {
 
   private static final Logger log = LoggerFactory.getLogger(ReadData.class);
 
-  static class Opts extends ClientOnRequiredTable {
-    @Parameter(names = "--startKey")
-    String startKey;
-    @Parameter(names = "--endKey")
-    String endKey;
-  }
-
   public static void main(String[] args) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
-    Opts opts = new Opts();
-    ScannerOpts scanOpts = new ScannerOpts();
-    opts.parseArgs(ReadData.class.getName(), args, scanOpts);
-
-    Connector connector = opts.getConnector();
 
-    Scanner scan = connector.createScanner(opts.getTableName(), opts.auths);
-    scan.setBatchSize(scanOpts.scanBatchSize);
-    Key start = null;
-    if (opts.startKey != null)
-      start = new Key(new Text(opts.startKey));
-    Key end = null;
-    if (opts.endKey != null)
-      end = new Key(new Text(opts.endKey));
-    scan.setRange(new Range(start, end));
-    Iterator<Entry<Key,Value>> iter = scan.iterator();
+    Connector connector = Connector.builder().usingProperties("conf/accumulo-client.properties").build();
 
 Review comment:
   It would also make argument parsing tricky.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message