You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2019/10/31 17:11:08 UTC
[accumulo-website] branch tour updated: Update for 2.0 (#202)
This is an automated email from the ASF dual-hosted git repository.
mmiller pushed a commit to branch tour
in repository https://gitbox.apache.org/repos/asf/accumulo-website.git
The following commit(s) were added to refs/heads/tour by this push:
new 63ae613 Update for 2.0 (#202)
63ae613 is described below
commit 63ae613c7632c9c29f055dfda9f3b73f0bada2f3
Author: Mike Miller <mm...@apache.org>
AuthorDate: Thu Oct 31 13:10:58 2019 -0400
Update for 2.0 (#202)
* Update version to 2.0 and maven exec plugin
* Use properties to create client
---
README.md | 7 ++-----
pom.xml | 12 ++++++++----
src/main/java/tour/Main.java | 14 +++++++++++---
3 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index b160b04..72c7849 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ go through the tour edit [Main.java] and use the following maven command to run
will execute Main.java with all of the correct dependencies on the classpath.
```commandline
-mvn -q clean compile exec:java
+mvn -q clean compile exec:exec
```
The above command will compile the project and run a MiniAccumuloCluster.
@@ -18,10 +18,7 @@ development purposes. Files and logs used by MiniAccumuloCluster can be seen in
target/mac########
```
-The version of Accumulo is defined in pom.xml and the tour should work with the Accumulo versions:
-* 1.8.*
-* 1.9.*
-* 2.0.*
+This tour is designed for Accumulo version 2.*
Running _mvn clean_ will remove any files created by previous runs.
diff --git a/pom.xml b/pom.xml
index 3571145..8813d13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
<name>accumulo-tour</name>
<properties>
- <accumulo.version>1.8.1</accumulo.version>
+ <accumulo.version>2.0.0</accumulo.version>
<java.version>1.8</java.version>
</properties>
@@ -29,15 +29,19 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.5.0</version>
+ <version>1.6.0</version>
<configuration>
- <mainClass>tour.Main</mainClass>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath/>
+ <argument>tour.Main</argument>
+ </arguments>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</build>
-
<dependencies>
<dependency>
<groupId>org.apache.accumulo</groupId>
diff --git a/src/main/java/tour/Main.java b/src/main/java/tour/Main.java
index 83ed452..a72ea37 100644
--- a/src/main/java/tour/Main.java
+++ b/src/main/java/tour/Main.java
@@ -3,12 +3,16 @@ package tour;
// Classes you will use along the tour
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Properties;
import java.util.Random;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.function.Function;
+
+import org.apache.accumulo.core.client.Accumulo;
+import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
@@ -42,14 +46,18 @@ public class Main {
System.out.println("Running the Accumulo tour. Having fun yet?");
Path tempDir = Files.createTempDirectory(Paths.get("target"), "mac");
- MiniAccumuloCluster mac = new MiniAccumuloCluster(tempDir.toFile(), "tourguide");
+ MiniAccumuloCluster mac = new MiniAccumuloCluster(tempDir.toFile(), "tourpass");
+ Properties properties = mac.getClientProperties();
mac.start();
- exercise(mac);
+
+ try (AccumuloClient client = Accumulo.newClient().from(properties).build()) {
+ exercise(client);
+ }
mac.stop();
}
- static void exercise(MiniAccumuloCluster mac) throws Exception{
+ static void exercise(AccumuloClient client) throws Exception{
// start writing your code here
}