accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] milleruntime closed pull request #35: ACCUMULO-4734 Content for getting-started and basic-read-write
Date Thu, 01 Jan 1970 00:00:00 GMT
milleruntime closed pull request #35: ACCUMULO-4734 Content for getting-started and basic-read-write
URL: https://github.com/apache/accumulo-website/pull/35
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/_data/tour.yml b/_data/tour.yml
index d84b5bb..b0d8ccc 100644
--- a/_data/tour.yml
+++ b/_data/tour.yml
@@ -1,6 +1,8 @@
 docs:
  - getting-started
  - basic-read-write
+ - data-model
+ - authorizations
  - batch-scanner
  - conditional-writer
  - using-iterators
diff --git a/tour/authorizations.md b/tour/authorizations.md
new file mode 100644
index 0000000..91d7cbc
--- /dev/null
+++ b/tour/authorizations.md
@@ -0,0 +1,9 @@
+---
+title: Authorizations
+---
+
+
+X. Build and run to make sure everything is peachy.
+```commandline
+mvn -q clean compile exec:java
+```
\ No newline at end of file
diff --git a/tour/basic-read-write.md b/tour/basic-read-write.md
index 6eb1c5c..69ecbad 100644
--- a/tour/basic-read-write.md
+++ b/tour/basic-read-write.md
@@ -1,5 +1,61 @@
 ---
-title: Basic Reading & Writing
+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.  
 
-Talk about reading and writing.
+Copy and paste the code below into the _exercise_  method.
+```java
+        // 1. Start by connecting to Mini Accumulo as the root user and create a table called
"superheroes".
+        Connector conn = mac.getConnector("root", "tourguide");
+        conn.tableOperations().create("superheroes");
+
+        // 2. Create a Mutation object to write to a row
+        Mutation mutation = new Mutation("hero023948092");
+        // A Mutation is an object that holds all changes to a row in a table.  Each row
has a unique row ID.
+
+        // 3. Create key/value pairs for Batman.  Put them in the "HeroAttribute" family.
+        mutation.put("HeroAttribute","name", "Batman");
+        mutation.put("HeroAttribute","real-name", "Bruce Wayne");
+        mutation.put("HeroAttribute","wearsCape?", "true");
+        mutation.put("HeroAttribute","flies?","false");
+
+        // 4. Create a BatchWriter to the superhero table and add your mutation to it.  Try
w/ resources will close for us.
+        try(BatchWriter writer = conn.createBatchWriter("superheroes", new BatchWriterConfig()))
{
+            writer.addMutation(mutation);
+        } catch(TableNotFoundException | MutationsRejectedException e) {
+            System.out.println("Error in the BatchWriter:");
+            e.printStackTrace();
+        }
+
+        // 5. Read and print all rows of the "superheroes" table. Try w/ resources will close
for us.
+        try(Scanner scan = conn.createScanner("superheroes", Authorizations.EMPTY)) {
+            System.out.println("superheroes table contents:");
+            // 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());
+            }
+        } catch(TableNotFoundException e) {
+            System.out.println("Error performing scan:");
+            e.printStackTrace();
+        }
+```
+
+Build and run your code
+```commandline
+mvn -q clean compile exec:java
+``` 
+
+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.
+
+### 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
+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
diff --git a/tour/data-model.md b/tour/data-model.md
new file mode 100644
index 0000000..ae92601
--- /dev/null
+++ b/tour/data-model.md
@@ -0,0 +1,9 @@
+---
+title: Data Model
+---
+
+
+X. Build and run to make sure everything is peachy.
+```commandline
+mvn -q clean compile exec:java
+```
\ No newline at end of file
diff --git a/tour/getting-started.md b/tour/getting-started.md
index 0b076c1..c4f758d 100644
--- a/tour/getting-started.md
+++ b/tour/getting-started.md
@@ -2,4 +2,29 @@
 title: Getting Started
 ---
 
-Talk about how to get 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:
+```commandline
+git clone -b tour https://github.com/apache/accumulo-website.git tour
+cd tour
+```
+2. Open Main.java in your favorite editor.
+```commandline
+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.
+
+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");
+}
+```
+4. Build and run to make sure everything is cool.
+```commandline
+mvn -q clean compile exec:java
+```
\ No newline at end of file
diff --git a/tour/index.md b/tour/index.md
index 9217637..2aac4f2 100644
--- a/tour/index.md
+++ b/tour/index.md
@@ -9,13 +9,12 @@ skiph1fortitle: true
 {% assign first_url = tour_pages[0] | prepend: '/tour/' | append: '/' %}
 {% assign first_page = site.pages | where:'url',first_url | first %}
 
-Welcome to the Accumulo tour! The tour offers a hands on introduction to Accumulo, broken
down into
-independent steps and an exercise. The exercise gives you a chance to apply what you have
learned.
-The tour starts with a [{{ first_page.title }}]({{ first_url }}) page that will help you
set up
-the exercise on your machine.
+Welcome to the Accumulo tour! The tour offers a hands on introduction to the Accumulo Java
API, broken down into
+independent steps and exercises. The exercises give you a chance to apply what you have learned
by writing code on your
+own. The answers to an exercise are typically provided in the next step.  The tour starts
with a 
+[{{ first_page.title }}]({{ first_url }}) page that will help you get set up.
 
-We recommend following the tour in order. However, all pages are listed below for review.
 When on a
-tour page, the left and right keys on the keyboard can be used to navigate. If you have any
questions
+When on a tour page, the left and right keys on the keyboard can be used to navigate. If
you have any questions
 or suggestions while going through the tour, please send an email to our [mailing list][mlist]
 or [create an issue][issue].
 


 

----------------------------------------------------------------
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