accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwa...@apache.org
Subject [accumulo-website] 05/07: ACCUMULO-4734 Changes from review of tour (#43)
Date Wed, 06 Dec 2017 16:20:47 GMT
This is an automated email from the ASF dual-hosted git repository.

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo-website.git

commit f2250803cd248137b900705803e44b508fa4574a
Author: Mike Walch <mwalch@apache.org>
AuthorDate: Fri Dec 1 14:58:34 2017 -0500

    ACCUMULO-4734 Changes from review of tour (#43)
---
 _config.yml                 |  1 +
 tour/authorizations-code.md | 91 ++++++++++++++++++++++++---------------------
 tour/authorizations.md      | 47 ++++++++++++-----------
 tour/basic-read-write.md    | 73 +++++++++++++++++++-----------------
 tour/batch-scanner-code.md  | 75 +++++++++++++++++++++----------------
 tour/batch-scanner.md       | 49 ++++++++++++------------
 tour/data-model-code.md     | 78 ++++++++++++++++++++------------------
 tour/getting-started.md     | 16 ++++----
 tour/ranges-splits.md       | 17 +++++----
 9 files changed, 241 insertions(+), 206 deletions(-)

diff --git a/_config.yml b/_config.yml
index 3ad02d8..3a2ab10 100644
--- a/_config.yml
+++ b/_config.yml
@@ -17,6 +17,7 @@ exclude: [vendor]
 latest_minor_release: 1.8
 latest_release: 1.8.1
 num_home_posts: 5
+javadoc_core: "https://static.javadoc.io/org.apache.accumulo/accumulo-core/1.8.1"
 
 # Build settings
 markdown: kramdown
diff --git a/tour/authorizations-code.md b/tour/authorizations-code.md
index 04ea47b..9858780 100644
--- a/tour/authorizations-code.md
+++ b/tour/authorizations-code.md
@@ -1,64 +1,69 @@
 ---
 title: Authorizations Code
 ---
+
+Below is a solution for the exercise.
+
 ```java
-        // start writing your code here
-        // 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) 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");
 
-        // Create a "secretIdentity" authorization & visibility
-        final String secId = "secretIdentity";
-        Authorizations auths = new Authorizations(secId);
-        ColumnVisibility visibility = new ColumnVisibility(secId);
+    // Create a "secretId" authorization & visibility
+    final String secretId = "secretId";
+    Authorizations auths = new Authorizations(secretId);
+    ColumnVisibility colVis = new ColumnVisibility(secretId);
 
-        // Create a user with the "secretIdentity" authorization and grant him read permissions
on our table
-        conn.securityOperations().createLocalUser("commissioner", new PasswordToken("gordanrocks"));
-        conn.securityOperations().changeUserAuthorizations("commissioner", auths);
-        conn.securityOperations().grantTablePermission("commissioner", "GothamPD", TablePermission.READ);
+    // Create a user with the "secretId" authorization and grant him read permissions on
our table
+    conn.securityOperations().createLocalUser("commissioner", new PasswordToken("gordanrocks"));
+    conn.securityOperations().changeUserAuthorizations("commissioner", auths);
+    conn.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", visibility, "Bruce Wayne");
-        mutation1.put("hero","wearsCape?", "true");
-        Mutation mutation2 = new Mutation("id0002");
-        mutation2.put("hero","alias", "Robin");
-        mutation2.put("hero","name", visibility,"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");
+    // 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");
+    Mutation mutation2 = new Mutation("id0002");
+    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");
 
-        // 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()))
{
-            writer.addMutation(mutation1);
-            writer.addMutation(mutation2);
-            writer.addMutation(mutation3);
-        }
+    // 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()))
{
+        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", "gordanrocks");
-        try(Scanner scan = commishConn.createScanner("GothamPD", auths)) {
-            System.out.println("Gotham Police Department Persons of Interest:");
-            for (Map.Entry<Key, Value> entry : scan) {
-                System.out.printf("Key : %-60s  Value : %s\n", entry.getKey(), entry.getValue());
-            }
+    // Read and print all rows of the commissioner can see. Pass Scanner proper authorizations
+    Connector commishConn = mac.getConnector("commissioner", "gordanrocks");
+    try (Scanner scan = commishConn.createScanner("GothamPD", auths)) {
+        System.out.println("Gotham Police Department Persons of Interest:");
+        for (Map.Entry<Key, Value> entry : scan) {
+            System.out.printf("Key : %-60s  Value : %s\n", entry.getKey(), entry.getValue());
         }
+    }
+}
 ```
 
-The code above will print (timestamp will differ):
+The solution above will print (timestamp will differ):
+
 ```commandline
 Gotham Police Department Persons of Interest:
 Key : id0001 hero:alias [] 1511900180231 false                      Value : Batman
-Key : id0001 hero:name [secretIdentity] 1511900180231 false         Value : Bruce Wayne
+Key : id0001 hero:name [secretId] 1511900180231 false               Value : Bruce Wayne
 Key : id0001 hero:wearsCape? [] 1511900180231 false                 Value : true
 Key : id0002 hero:alias [] 1511900180231 false                      Value : Robin
-Key : id0002 hero:name [secretIdentity] 1511900180231 false         Value : Dick Grayson
+Key : id0002 hero:name [secretId] 1511900180231 false               Value : Dick Grayson
 Key : id0002 hero:wearsCape? [] 1511900180231 false                 Value : true
 Key : id0003 villain:alias [] 1511900180231 false                   Value : Joker
 Key : id0003 villain:name [] 1511900180231 false                    Value : Unknown
 Key : id0003 villain:wearsCape? [] 1511900180231 false              Value : false
-```
\ No newline at end of file
+```
diff --git a/tour/authorizations.md b/tour/authorizations.md
index ac45ffe..8dbb8c8 100644
--- a/tour/authorizations.md
+++ b/tour/authorizations.md
@@ -1,46 +1,51 @@
 ---
 title: Authorizations
 ---
-Authorizations are a set of Strings that enable a user to read protected data. A column visibility
is a boolean expression 
-that is evaluated using the authorizations provided by a scanner. If it evaluates to true,
then the data is visible. 
+
+[Authorizations] are a set of Strings that enable a user to read protected data. Users are
granted authorizations
+and choose which ones to use when scanning a table. The chosen authorizations are evaluated
against the [ColumnVisibility]
+of each Accumulo key in the scan. If the boolean expression of the ColumnVisibility evaluates
to true, the data will be
+visible to the user.
 
 For example:
-* Bob scans with authorizations = { IT, User }
-* Tina scans with authorizations = { Admin, IT, User }
-* Row1:family1:qualifier1 has Visibility = { Admin && IT && User }
-* Bob will **not** see Row1:family1:qualifier1
-* Tina will see Row1:family1:qualifier1
+* Bob has authorizations `User, Manager`
+* Tina has authorizations `User, Admin`
+* The key `row1:family1:qualifier1` has visibility `Admin && User`
+* When Bob scans with all of his authorizations, he will **not** see `row1:family1:qualifier1`
+* When Tina scans with all of her authorizations, she will see `row1:family1:qualifier1`
 
 We now want to secure our secret identities of the heroes so that only users with the proper
authorizations can read their names.
 
 1. Using the code from the previous exercise, add the following to the beginning of the _exercise_
method (after we get the Connector).
 ```java
-        // Create a "secretIdentity" authorization & visibility
-        final String secId = "secretIdentity";
-        Authorizations auths = new Authorizations(secId);
-        ColumnVisibility visibility = new ColumnVisibility(secId);
+        // Create a "secretId" authorization & visibility
+        final String secretId = "secretId";
+        Authorizations auths = new Authorizations(secretId);
+        ColumnVisibility colVis = new ColumnVisibility(secretId);
         
-        // Create a user with the "secretIdentity" authorization and grant him read permissions
on our table
+        // Create a user with the "secretId" authorization and grant him read permissions
on our table
         conn.securityOperations().createLocalUser("commissioner", new PasswordToken("gordanrocks"));
         conn.securityOperations().changeUserAuthorizations("commissioner", auths);
         conn.securityOperations().grantTablePermission("commissioner", "GothamPD", TablePermission.READ);
-``` 
+```
 
-2. The Mutation API allows you to set the visibility on a column. Find the proper method
for setting a column visibility in 
-the [Mutation API][mut] and modify the code so the visibility created above will secure the
two "name" columns. 
+2. The [Mutation] API allows you to set the `secretId` visibility on a column. Find the proper
method for setting a column visibility in
+the Mutation API and modify the code so the `colVis` variable created above secures the "name"
columns.
 
 3. Build and run.  What data do you see?
-* You should see all of the data except the secret identities of Batman and Robin.  This
is because the Scanner was created
- from the root user Connector.  
-* Replace the _Authorizations.EMPTY_ in the Scanner with the _auths_ created above and run
it again.
+* You should see all of the data except the secret identities of Batman and Robin. This is
because the Scanner was created
+ from the root user which doesn't have the `secretId` authorization.
+* Replace the `Authorizations.EMPTY` in the Scanner with the `auths` variable created above
and run it again.
 * This should result in an error since the root user doesn't have the authorizations we tried
to pass to the Scanner.
 
 4. Get a connector for the "commissioner" and from it create a Scanner with the authorizations
needed to view the secret identities.
 
 5. Build and run.  You should see all the rows in the GothamPD table printed, including these
secured key/value pairs:
 ```commandline
-Key : id0001 hero:name [secretIdentity] 1511900180231 false         Value : Bruce Wayne
-Key : id0002 hero:name [secretIdentity] 1511900180231 false         Value : Dick Grayson
+Key : id0001 hero:name [secretId] 1511900180231 false         Value : Bruce Wayne
+Key : id0002 hero:name [secretId] 1511900180231 false         Value : Dick Grayson
 ```
 
-[mut]: https://accumulo.apache.org/1.8/apidocs/org/apache/accumulo/core/data/Mutation.html
\ No newline at end of file
+[Authorizations]: {{ site.javadoc_core }}/org/apache/accumulo/core/security/Authorizations.html
+[ColumnVisibility]: {{ site.javadoc_core }}/org/apache/accumulo/core/security/ColumnVisibility.html
+[Mutation]: {{ site.javadoc_core }}/org/apache/accumulo/core/data/Mutation.html
diff --git a/tour/basic-read-write.md b/tour/basic-read-write.md
index a9f1451..028bbf0 100644
--- a/tour/basic-read-write.md
+++ b/tour/basic-read-write.md
@@ -1,53 +1,58 @@
 ---
 title: Writing and Reading
 ---
-Accumulo is a big data key/value store.  Writing data to Accumulo is flexible and fast. 
Like any database, Accumulo stores
-data in tables and rows.  Each row in an Accumulo table can hold many key/value pairs.  
+Accumulo is a big key/value store.  Writing data to Accumulo is flexible and fast.  Like
any database, Accumulo stores
+data in tables and rows.  Each row in an Accumulo table can hold many key/value pairs. Our
next exercise shows how to
+write and read from a table.
 
-Here are the steps for writing to a table and then reading from it. Copy and paste the code
below into the _exercise_  method.  Note each step is commented. 
 ```java
-        // 1. Connect to Mini Accumulo as the root user and create a table called "GothamPD".
-        Connector conn = mac.getConnector("root", "tourguide");
-        conn.tableOperations().create("GothamPD");
-
-        // 2. Create a Mutation object to hold all changes to a row in a table.  Each row
has a unique row ID.
-        Mutation mutation = new Mutation("id0001");
-
-        // 3. Create key/value pairs for Batman.  Put them in the "hero" family.
-        mutation.put("hero","alias", "Batman");
-        mutation.put("hero","name", "Bruce Wayne");
-        mutation.put("hero","wearsCape?", "true");
-
-        // 4. Create a BatchWriter to the GothamPD table and add your mutation to it.  Try
w/ resources will close for us.
-        try(BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig()))
{
-            writer.addMutation(mutation);
-        }
-
-        // 5. Read and print all rows of the "GothamPD" table. Try w/ resources will close
for us.
-        try(Scanner scan = conn.createScanner("GothamPD", Authorizations.EMPTY)) {
-            System.out.println("Gotham Police Department Persons of Interest:");
-            // A Scanner is an extension of java.lang.Iterable so behaves just like one.
-            for (Map.Entry<Key, Value> entry : scan) {
-                System.out.println("Key:" + entry.getKey());
-                System.out.println("Value:" + entry.getValue());
-            }
+static void exercise(MiniAccumuloCluster mac) {
+    // Connect to Mini Accumulo as the root user and create a table called "GothamPD".
+    Connector conn = mac.getConnector("root", "tourguide");
+    conn.tableOperations().create("GothamPD");
+
+    // Create a Mutation object to hold all changes to a row in a table.  Each row has a
unique row ID.
+    Mutation mutation = new Mutation("id0001");
+
+    // Create key/value pairs for Batman.  Put them in the "hero" family.
+    mutation.put("hero","alias", "Batman");
+    mutation.put("hero","name", "Bruce Wayne");
+    mutation.put("hero","wearsCape?", "true");
+
+    // Create a BatchWriter to the GothamPD table and add your mutation to it. Try w/ resources
will close for us.
+    try (BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig()))
{
+        writer.addMutation(mutation);
+    }
+
+    // Read and print all rows of the "GothamPD" table. Try w/ resources will close for us.
+    try (Scanner scan = conn.createScanner("GothamPD", Authorizations.EMPTY)) {
+        System.out.println("Gotham Police Department Persons of Interest:");
+        // A Scanner is an extension of java.lang.Iterable so behaves just like one.
+        for (Map.Entry<Key, Value> entry : scan) {
+            System.out.printf("Key : %-50s  Value : %s\n", entry.getKey(), entry.getValue());
         }
+    }
+}
 ```
 
-Build and run your code
+Copy this code into your `exercise` method and run it using the command below.
+
 ```commandline
 mvn -q clean compile exec:java
 ``` 
 
-Good job!  That is all it takes to write and read from Accumulo.  
+Good job! That is all it takes to write and read from Accumulo.
 
 Notice a lot of other information was printed from the Keys we created. Accumulo is flexible
because hidden within its 
-Key is a rich data model that can be broken up into different parts.  We will cover the [Data
Model][dmodel] in the next lesson.
+[Key] is a rich data model that can be broken up into different parts.  We will cover the
[Data Model][dmodel] in the next lesson.
+
+### But wait... I thought Accumulo was all about Security?
 
-### But wait... I thought Accumulo was all about Security?  
-Spoiler Alert: it is!  Did you notice the _Authorizations.EMPTY_ we passed to the Scanner
on step 5?  The data
+Spoiler Alert: it is!  Did you notice the `Authorizations.EMPTY` we passed in when creating
a [Scanner]?  The data
 we created in this first lesson was not secured with Authorizations so the Scanner didn't
require any Authorizations 
 to read it.  More to come later in the [Authorizations][auths] lesson! 
 
 [dmodel]: /tour/data-model
-[auths]: /tour/authorizations
\ No newline at end of file
+[auths]: /tour/authorizations
+[Key]: {{ site.javadoc_core }}/org/apache/accumulo/core/data/Key.html
+[Scanner]: {{ site.javadoc_core }}/org/apache/accumulo/core/client/Scanner.html
diff --git a/tour/batch-scanner-code.md b/tour/batch-scanner-code.md
index bb06de4..bc7722c 100644
--- a/tour/batch-scanner-code.md
+++ b/tour/batch-scanner-code.md
@@ -1,42 +1,51 @@
 ---
 title: Batch Scanner Code
 ---
+
+Below is a solution to the exercise.
+
 ```java
-        // Connect to Mini Accumulo as the root user and create a table called "GothamPD".
-        Connector conn = mac.getConnector("root", "tourguide");
-        conn.tableOperations().create("GothamPD");
-
-        // Generate 10,000 rows of henchman data
-        try(BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig()))
{
-            for(int i = 0; i < 10_000; i++) {
-                Mutation m = new Mutation(String.format("id%04d", i));
-                m.put("villain", "alias", "henchman" + i);
-                m.put("villain", "yearsOfService", "" + (new Random().nextInt(50)));
-                m.put("villain", "wearsCape?", "false");
-                writer.addMutation(m);
-            }
+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");
+
+    // Generate 10,000 rows of henchman data
+    try(BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig()))
{
+        for(int i = 0; i < 10_000; i++) {
+            Mutation m = new Mutation(String.format("id%04d", i));
+            m.put("villain", "alias", "henchman" + i);
+            m.put("villain", "yearsOfService", "" + (new Random().nextInt(50)));
+            m.put("villain", "wearsCape?", "false");
+            writer.addMutation(m);
         }
+    }
+
+    // 1. Create a BatchScanner with 5 query threads
+    try(BatchScanner batchScanner = conn.createBatchScanner("GothamPD", Authorizations.EMPTY,
5)) {
+        // 2. Create a collection of 2 sample ranges and set it to the batchScanner
+        List ranges = new ArrayList<Range>();
+        ranges.add(new Range("id1000", "id1999"));
+        ranges.add(new Range("id9000", "id9999"));
+        batchScanner.setRanges(ranges);
 
-        // 1. Create a BatchScanner with 5 query threads
-        try(BatchScanner batchScanner = conn.createBatchScanner("GothamPD", Authorizations.EMPTY,
5)) {
-            // 2. Create a collection of 2 sample ranges and set it to the batchScanner
-            List ranges = new ArrayList<Range>();
-            ranges.add(new Range("id1000", "id1999"));
-            ranges.add(new Range("id9000", "id9999"));
-            batchScanner.setRanges(ranges);
-
-            // 3. Fetch just the columns we want
-            batchScanner.fetchColumn(new Text("villain"), new Text("yearsOfService"));
-
-            // 4. Calculate average years of service
-            Long totalYears = 0L;
-            Long entriesRead = 0L;
-            for (Map.Entry<Key, Value> entry : batchScanner) {
-                totalYears += Long.valueOf(entry.getValue().toString());
-                entriesRead++;
-            }
-            System.out.println("Out of " + entriesRead + " entries, average years of a henchman:
" + totalYears / entriesRead);
+        // 3. Fetch just the columns we want
+        batchScanner.fetchColumn(new Text("villain"), new Text("yearsOfService"));
+
+        // 4. Calculate average years of service
+        Long totalYears = 0L;
+        Long entriesRead = 0L;
+        for (Map.Entry<Key, Value> entry : batchScanner) {
+            totalYears += Long.valueOf(entry.getValue().toString());
+            entriesRead++;
         }
+        System.out.println("The average years of service of " + entriesRead + " villians
is " + totalYears / entriesRead);
+    }
+}
 ```
 
-The average years of a henchman should be 24.
\ No newline at end of file
+Running the solution above should print output similar to below:
+
+```
+The average years of service of 2000 villians is 24
+```
diff --git a/tour/batch-scanner.md b/tour/batch-scanner.md
index 21a15f3..a388ce6 100644
--- a/tour/batch-scanner.md
+++ b/tour/batch-scanner.md
@@ -4,35 +4,38 @@ title: Batch Scanner
 Running on a single thread, a Scanner will retrieve a single Range of data and return Keys
in sorted order. A [BatchScanner] 
 will retrieve multiple Ranges of data using multiple threads.  A BatchScanner can be more
efficient but does not guarantee Keys will be returned in sorted order.
 
-For this exercise, we need to generate a bunch of data to test BatchScanner.  Copy the code
below into the _exercise_ method.
+For this exercise, we need to generate a bunch of data to test BatchScanner.  Copy the code
below into your `exercise` method.
 ```java
-        // Connect to Mini Accumulo as the root user and create a table called "GothamPD".
-        Connector conn = mac.getConnector("root", "tourguide");
-        conn.tableOperations().create("GothamPD");
-
-        // Generate 10,000 rows of henchman data, each with a different number yearsOfService
-        try(BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig()))
{
-            for(int i = 0; i < 10_000; i++) {
-                Mutation m = new Mutation(String.format("id%04d", i));
-                m.put("villain", "alias", "henchman" + i);
-                m.put("villain", "yearsOfService", "" + (new Random().nextInt(50)));
-                m.put("villain", "wearsCape?", "false");
-                writer.addMutation(m);
-            }
+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");
+
+    // Generate 10,000 rows of henchman data, each with a different number yearsOfService
+    try (BatchWriter writer = conn.createBatchWriter("GothamPD", new BatchWriterConfig()))
{
+        for (int i = 0; i < 10_000; i++) {
+            Mutation m = new Mutation(String.format("id%04d", i));
+            m.put("villain", "alias", "henchman" + i);
+            m.put("villain", "yearsOfService", "" + (new Random().nextInt(50)));
+            m.put("villain", "wearsCape?", "false");
+            writer.addMutation(m);
         }
+    }
+}
 ```
-We want to calculate the average years of service of a sample of the henchman data.  A BatchScanner
would be good for this task because we 
-don't need the returned keys to be sorted.  Follow these steps to efficiently scan the table
with 10,000 entries.
+
+We want to calculate the average years of service from a sample of 2000 villians. A BatchScanner
would be good for this task because we
+don't need the returned keys to be sorted. Follow these steps to efficiently scan the table
with 10,000 entries.
 
 1. After the above code, create a BatchScanner with 5 query threads.  Similar to a Scanner,
use the [createBatchScanner] method.
 
-2. Create an ArrayList of 2 sample Ranges (id1000 to id1999 and id9000 to id9999) and set
the ranges of the BatchScanner using _setRanges_.
+2. Create an ArrayList of 2 sample Ranges (`id1000` to `id1999` and `id9000` to `id9999`)
and set the ranges of the [BatchScanner] using `setRanges`.
 
-3. We can make the scan more efficient by only bringing back the columns we want.  Use [fetchColumn]
to get the "villain" family 
-and "yearsOfService" qualifier.
+3. We can make the scan more efficient by only bringing back the columns we want.  Use [fetchColumn]
to get the `villain` family
+and `yearsOfService` qualifier.
 
-4. Finally, use the BatchScanner to calculate the average years of service of the henchmen.
+4. Finally, use the BatchScanner to calculate the average years of service of 2000 villians.
 
-[BatchScanner]: https://accumulo.apache.org/1.8/apidocs/org/apache/accumulo/core/client/BatchScanner.html
-[createBatchScanner]: https://accumulo.apache.org/1.8/apidocs/org/apache/accumulo/core/client/Connector.html#createBatchScanner(java.lang.String,%20org.apache.accumulo.core.security.Authorizations,%20int)
-[fetchColumn]: https://accumulo.apache.org/1.8/apidocs/org/apache/accumulo/core/client/ScannerBase.html#fetchColumn(org.apache.hadoop.io.Text,%20org.apache.hadoop.io.Text)
\ No newline at end of file
+[BatchScanner]: {{ site.javadoc_core }}/org/apache/accumulo/core/client/BatchScanner.html
+[createBatchScanner]: {{ site.javadoc_core }}/org/apache/accumulo/core/client/Connector.html#createBatchScanner(java.lang.String,%20org.apache.accumulo.core.security.Authorizations,%20int)
+[fetchColumn]: {{ site.javadoc_core }}/org/apache/accumulo/core/client/ScannerBase.html#fetchColumn(org.apache.hadoop.io.Text,%20org.apache.hadoop.io.Text)
diff --git a/tour/data-model-code.md b/tour/data-model-code.md
index 4a0d0e8..31c9da5 100644
--- a/tour/data-model-code.md
+++ b/tour/data-model-code.md
@@ -2,45 +2,49 @@
 title: Data Model Code
 ---
 
+Below is the solution for the exercise.
+
 ```java
-        // Connect to Mini Accumulo as the root user and create a table called "GothamPD".
-        Connector conn = mac.getConnector("root", "tourguide");
-        conn.tableOperations().create("GothamPD");
-
-        // Create a row for Batman
-        Mutation mutation1 = new Mutation("id0001");
-        mutation1.put("hero","alias", "Batman");
-        mutation1.put("hero","name", "Bruce Wayne");
-        mutation1.put("hero","wearsCape?", "true");
-
-        // Create a row for Robin
-        Mutation mutation2 = new Mutation("id0002");
-        mutation2.put("hero","alias", "Robin");
-        mutation2.put("hero","name", "Dick Grayson");
-        mutation2.put("hero","wearsCape?", "true");
-
-        // Create a row for Joker
-        Mutation mutation3 = new Mutation("id0003");
-        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()))
{
-            writer.addMutation(mutation1);
-            writer.addMutation(mutation2);
-            writer.addMutation(mutation3);
-        }
+static void exercise(MiniAccumuloCluster mac) {
+    // Connect to Mini Accumulo as the root user and create a table called "GothamPD".
+    Connector conn = mac.getConnector("root", "tourguide");
+    conn.tableOperations().create("GothamPD");
+
+    // Create a row for Batman
+    Mutation mutation1 = new Mutation("id0001");
+    mutation1.put("hero","alias", "Batman");
+    mutation1.put("hero","name", "Bruce Wayne");
+    mutation1.put("hero","wearsCape?", "true");
+
+    // Create a row for Robin
+    Mutation mutation2 = new Mutation("id0002");
+    mutation2.put("hero","alias", "Robin");
+    mutation2.put("hero","name", "Dick Grayson");
+    mutation2.put("hero","wearsCape?", "true");
+
+    // Create a row for Joker
+    Mutation mutation3 = new Mutation("id0003");
+    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()))
{
+        writer.addMutation(mutation1);
+        writer.addMutation(mutation2);
+        writer.addMutation(mutation3);
+    }
 
-        // Read and print all rows of the "GothamPD" table. Try w/ resources will close for
us.
-        try(Scanner scan = conn.createScanner("GothamPD", Authorizations.EMPTY)) {
-            System.out.println("Gotham Police Department Persons of Interest:");
-            // A Scanner is an extension of java.lang.Iterable so behaves just like one.
-            for (Map.Entry<Key, Value> entry : scan) {
-                System.out.printf("Key : %30s  Value : %s\n", entry.getKey(), entry.getValue());
-            }
+    // Read and print all rows of the "GothamPD" table. Try w/ resources will close for us.
+    try (Scanner scan = conn.createScanner("GothamPD", Authorizations.EMPTY)) {
+        System.out.println("Gotham Police Department Persons of Interest:");
+        // A Scanner is an extension of java.lang.Iterable so behaves just like one.
+        for (Map.Entry<Key, Value> entry : scan) {
+            System.out.printf("Key : %-50s  Value : %s\n", entry.getKey(), entry.getValue());
         }
+    }
+}
 ```
 
 The code above will print (timestamp will differ):
@@ -55,4 +59,4 @@ Key : id0002 hero:wearsCape? [] 1511306370025 false       Value : true
 Key : id0003 villain:alias [] 1511306370025 false         Value : Joker
 Key : id0003 villain:name [] 1511306370025 false          Value : Unknown
 Key : id0003 villain:wearsCape? [] 1511306370025 false    Value : false
-``` 
\ No newline at end of file
+``` 
diff --git a/tour/getting-started.md b/tour/getting-started.md
index 50bc980..b443cb4 100644
--- a/tour/getting-started.md
+++ b/tour/getting-started.md
@@ -4,7 +4,7 @@ title: Getting Started
 
 First make sure you have Java, Maven and Git installed on your machine.  Oh you are already
rocking? OK let's go!
 
-1. Clone the tour onto your machine:
+1. Clone the code repository for the tour onto your machine:
 ```commandline
 git clone -b tour https://github.com/apache/accumulo-website.git tour
 cd tour
@@ -15,15 +15,15 @@ vim ./src/main/java/tour/Main.java
 ```
 Notice the main method creates a MiniAccumuloCluster with a root password of "tourguide".
 MiniAccumuloCluster is a mini
 version of Accumulo that runs on your local filesystem.  It should only be used for development
purposes but will work
-great here on the tour.  Files and logs used by MiniAccumuloCluster can be seen in the _target/mac######_
directory. 
+great here on the tour.  Files and logs used by MiniAccumuloCluster can be seen in the `target/mac######`
directory. 
 
 3. Modify the _exercise_ method to print a hello message. You will put your code in this
method for each lesson.
-```java
-private static void exercise(MiniAccumuloCluster mac) {
-    // start writing your code here
-    System.out.println("Hello world");
-}
-```
+    ```java
+    static void exercise(MiniAccumuloCluster mac) {
+        // start writing your code here
+        System.out.println("Hello world");
+    }
+    ```
 4. Build and run to make sure everything is cool.
 ```commandline
 mvn -q clean compile exec:java
diff --git a/tour/ranges-splits.md b/tour/ranges-splits.md
index 3f3bb41..07386d4 100644
--- a/tour/ranges-splits.md
+++ b/tour/ranges-splits.md
@@ -2,21 +2,23 @@
 title: Ranges and Splits
 ---
 
-A Range is a specified group of Keys. There are many different ways to create a Range.  Here
are a few examples:
+A [Range] is a specified group of Keys. There are many different ways to create a Range.
 Here are a few examples:
+
 ```java
-new Range(Key startKey, Key endKey)  // Creates a range from startKey inclusive to endKey
inclusive.
-new Range(CharSequence row)  // Creates a range that covers an entire row.
-new Range(CharSequence startRow, CharSequence endRow) // Creates a range from startRow inclusive
to endRow inclusive.
+Range r1 = new Range(startKey, endKey);  // Creates a range from startKey inclusive to endKey
inclusive.
+Range r2 = new Range(row);               // Creates a range that covers an entire row.
+Range r3 = new Range(startRow, endRow);  // Creates a range from startRow inclusive to endRow
inclusive.
 ```
 
 A Scanner by default will scan all Keys in a table but this can be inefficient. It is a good
practice to set a range on a Scanner.
+
 ```java
 scanner.setRange(new Range("id0000", "id0010"));  // returns rows from id0000 to id0010
 ```
 
 As your data grows larger, Accumulo will split tables into smaller pieces called Tablets.
 Tablets can then be distributed across multiple Tablet Servers.  
-By default a table will get split into Tablets on row boundaries, guaranteeing an entire
row to be on one Tablet Server.  We have the ability to 
-tell Accumulo where to split tables by setting split points. This is done using _addSplits_
in the [TableOperations] API.  The image below 
+By default, a table will get split into Tablets on row boundaries, guaranteeing an entire
row to be on one Tablet Server.  We have the ability to 
+tell Accumulo where to split tables by setting split points. This is done using `addSplits`
in the [TableOperations] API.  The image below 
 demonstrates how Accumulo splits data.  
 
 ![data distribution]({{ site.url }}/images/docs/data_distribution.png)
@@ -33,4 +35,5 @@ Knowing these terms are critical when working closely with Accumulo.  Iterators
 When working with large amounts of data across many Tablet Servers, a simple Scanner might
not do the trick. Next lesson we learn about the power of 
 the multi-threaded BatchScanner!  
 
-[TableOperations]: https://accumulo.apache.org/1.8/apidocs/org/apache/accumulo/core/client/admin/TableOperations.html
+[Range]: {{ site.javadoc_core }}/org/apache/accumulo/core/data/Range.html
+[TableOperations]: {{ site.javadoc_core }}/org/apache/accumulo/core/client/admin/TableOperations.html

-- 
To stop receiving notification emails like this one, please contact
"commits@accumulo.apache.org" <commits@accumulo.apache.org>.

Mime
View raw message