You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/10/28 17:35:53 UTC

[GitHub] [accumulo-website] milleruntime commented on a change in pull request #201: Update Tour for 2.0

milleruntime commented on a change in pull request #201: Update Tour for 2.0
URL: https://github.com/apache/accumulo-website/pull/201#discussion_r339699262
 
 

 ##########
 File path: tour/authorizations-code.md
 ##########
 @@ -5,51 +5,51 @@ title: Authorizations Code
 Below is a solution for the exercise.
 
 ```java
-static void exercise(MiniAccumuloCluster mac) throws Exception {
-    // Connect to Mini Accumulo as the root user and create a table called "GothamPD".
-    Connector conn = mac.getConnector("root", "tourguide");
-    conn.tableOperations().create("GothamPD");
+static void exercise(MiniAccumuloCluster mac, AccumuloClient client) throws Exception {
+    // create a table called "GothamPD".
+    client.tableOperations().create("GothamPD");
 
     // Create a "secretId" authorization & visibility
     final String secretId = "secretId";
     Authorizations auths = new Authorizations(secretId);
     ColumnVisibility colVis = new ColumnVisibility(secretId);
 
     // Create a user with the "secretId" authorization and grant him read permissions on our table
-    conn.securityOperations().createLocalUser("commissioner", new PasswordToken("gordonrocks"));
-    conn.securityOperations().changeUserAuthorizations("commissioner", auths);
-    conn.securityOperations().grantTablePermission("commissioner", "GothamPD", TablePermission.READ);
+    client.securityOperations().createLocalUser("commissioner", new PasswordToken("gordonrocks"));
+    client.securityOperations().changeUserAuthorizations("commissioner", auths);
+    client.securityOperations().grantTablePermission("commissioner", "GothamPD", TablePermission.READ);
 
     // Create 3 Mutation objects, securing the proper columns.
     Mutation mutation1 = new Mutation("id0001");
-    mutation1.put("hero","alias", "Batman");
-    mutation1.put("hero","name", colVis, "Bruce Wayne");
-    mutation1.put("hero","wearsCape?", "true");
+    mutation1.put("hero", "alias", "Batman");
+    mutation1.put("hero", "name", colVis, "Bruce Wayne");
+    mutation1.put("hero", "wearsCape?", "true");
     Mutation mutation2 = new Mutation("id0002");
-    mutation2.put("hero","alias", "Robin");
-    mutation2.put("hero","name", colVis,"Dick Grayson");
-    mutation2.put("hero","wearsCape?", "true");
+    mutation2.put("hero", "alias", "Robin");
+    mutation2.put("hero", "name", colVis, "Dick Grayson");
+    mutation2.put("hero", "wearsCape?", "true");
     Mutation mutation3 = new Mutation("id0003");
-    mutation3.put("villain","alias", "Joker");
-    mutation3.put("villain","name", "Unknown");
-    mutation3.put("villain","wearsCape?", "false");
+    mutation3.put("villain", "alias", "Joker");
+    mutation3.put("villain", "name", "Unknown");
+    mutation3.put("villain", "wearsCape?", "false");
 
     // Create a BatchWriter to the GothamPD table and add your mutations to it.
     // Once the BatchWriter is closed by the try w/ resources, data will be available to scans.
-    try (BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig())) {
+    try (BatchWriter writer = client.createBatchWriter("GothamPD", new BatchWriterConfig())) {
         writer.addMutation(mutation1);
         writer.addMutation(mutation2);
         writer.addMutation(mutation3);
     }
 
     // Read and print all rows of the commissioner can see. Pass Scanner proper authorizations
-    Connector commishConn = mac.getConnector("commissioner", "gordonrocks");
+    AccumuloClient commishConn = mac.createAccumuloClient("commissioner", new PasswordToken("gordonrocks"));
 
 Review comment:
   Yeah but then the tour would require a new developer to setup a running instance of Accumulo if they don't have one.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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