Author: elserj
Date: Fri Mar 8 02:34:28 2013
New Revision: 1454220
URL: http://svn.apache.org/r1454220
Log:
Make a maven archetype out of Instamo to make it even easier for users to
easily spin up Accumulo and start coding.
Added:
accumulo/contrib/instamo-archetype/
accumulo/contrib/instamo-archetype/trunk/
accumulo/contrib/instamo-archetype/trunk/pom.xml (with props)
accumulo/contrib/instamo-archetype/trunk/src/
accumulo/contrib/instamo-archetype/trunk/src/main/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
(with props)
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.classpath
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.project
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.jdt.core.prefs
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.m2e.core.prefs
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
(with props)
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/resources/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
accumulo/contrib/instamo-archetype/trunk/src/test/
accumulo/contrib/instamo-archetype/trunk/src/test/resources/
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/archetype.properties
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/goal.txt
Added: accumulo/contrib/instamo-archetype/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/pom.xml?rev=1454220&view=auto
==============================================================================
Binary file - no diff available.
Propchange: accumulo/contrib/instamo-archetype/trunk/pom.xml
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1454220&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.classpath
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.classpath?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.classpath
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.classpath
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,12 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes"
path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes"
path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/java"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.project
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.project?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.project
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.project
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,26 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>${artifactId}-archetype</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.jdt.core.prefs
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.jdt.core.prefs?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.jdt.core.prefs
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.jdt.core.prefs
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,6 @@
+#Fri Mar 01 21:44:42 EST 2013
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.m2e.core.prefs
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.m2e.core.prefs?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.m2e.core.prefs
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/.settings/org.eclipse.m2e.core.prefs
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,5 @@
+#Fri Mar 01 21:44:32 EST 2013
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,27 @@
+Instamo
+=======
+
+Introduction
+-----------
+
+Instamo makes it easy to write some code and run it against a local, transient
+[Accumulo](http://accumulo.apache.org) instance in minutes. No setup or
+installation is required. This is possible if Java and Maven are already
+installed by following the steps below.
+
+```
+vim src/main/java/${package}/AccumuloApp.java
+mvn package
+```
+
+Map Reduce
+----------
+
+Its possible to run local map reduce jobs against the MiniAccumuloCluster
+instance. There is an example of this in the src directory The following
+command will run the map reduce example.
+
+```
+mvn exec:exec
+```
+
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml?rev=1454220&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,60 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+
+public class AccumuloApp {
+
+ public static void run(String instanceName, String zookeepers, String
rootPassword, String args[]) throws Exception {
+ // edit this method to play with Accumulo
+
+ Instance instance = new ZooKeeperInstance(instanceName, zookeepers);
+
+ Connector conn = instance.getConnector("root", rootPassword);
+
+ conn.tableOperations().create("foo");
+
+ BatchWriter bw = conn.createBatchWriter("foo", new BatchWriterConfig());
+ Mutation m = new Mutation("r1");
+ m.put("cf1", "cq1", "v1");
+ m.put("cf1", "cq2", "v3");
+ bw.addMutation(m);
+ bw.close();
+
+ Scanner scanner = conn.createScanner("foo", Constants.NO_AUTHS);
+ for (Entry<Key,Value> entry : scanner) {
+ System.out.println(entry.getKey() + " " + entry.getValue());
+ }
+
+ conn.tableOperations().delete("foo");
+ }
+}
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,71 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import java.io.File;
+import java.util.UUID;
+
+import org.apache.accumulo.test.MiniAccumuloCluster;
+import org.apache.accumulo.test.continuous.ContinuousIngest;
+import org.apache.accumulo.test.continuous.ContinuousVerify;
+import org.apache.commons.io.FileUtils;
+
+/**
+ * An example of running local map reduce against MiniAccumuloCluster
+ */
+public class MapReduceExample {
+
+ public static void run(String instanceName, String zookeepers, String
rootPassword, String args[]) throws Exception {
+
+ // run continuous ingest to create data. This is not a map reduce job
+ ContinuousIngest.main(new String[] {"-i", instanceName, "-z", zookeepers,
"-u", "root", "-p", rootPassword, "--table", "ci", "--num", "5000000",
+ "--batchMemory", "1000000"});
+
+ String outputDir = FileUtils.getTempDirectoryPath() + File.separator +
"ci_verify" + UUID.randomUUID().toString();
+
+ try {
+ // run verify map reduce job locally. This jobs looks for holes in the
linked list create by continuous ingest
+ ContinuousVerify.main(new String[] {"-D", "mapred.job.tracker=local",
"-D", "fs.default.name=file:///", "-i", instanceName, "-z", zookeepers, "-u",
+ "root", "-p", rootPassword, "--table", "ci", "--output", outputDir,
"--maxMappers", "4", "--reducers", "1"});
+ } finally {
+ // delete output dir of mapreduce job
+ FileUtils.deleteQuietly(new File(outputDir));
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ File tmpDir = new File(FileUtils.getTempDirectory(), "macc-" +
UUID.randomUUID().toString());
+
+ try {
+ MiniAccumuloCluster la = new MiniAccumuloCluster(tmpDir, "pass1234");
+ la.start();
+
+ System.out.println("${symbol_escape}n ---- Running Mapred Against
Accumulo${symbol_escape}n");
+
+ run(la.getInstanceName(), la.getZooKeepers(), "pass1234", args);
+
+ System.out.println("${symbol_escape}n ---- Ran Mapred Against
Accumulo${symbol_escape}n");
+
+ la.stop();
+ } finally {
+ FileUtils.deleteQuietly(tmpDir);
+ }
+ }
+}
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,12 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+log4j.rootLogger=INFO, CA
+log4j.appender.CA=org.apache.log4j.ConsoleAppender
+log4j.appender.CA.layout=org.apache.log4j.PatternLayout
+log4j.appender.CA.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
+
+log4j.logger.org.apache.zookeeper=ERROR,CA
+log4j.logger.${groupId}.core.client.impl.ServerClient=ERROR
+log4j.logger.${groupId}.server.security.Auditor=off
+
Added:
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,60 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import org.apache.accumulo.test.MiniAccumuloCluster;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ * An example unit test that shows how to use MiniAccumuloCluster in a unit
test
+ */
+
+public class ExampleAccumuloUnitTest {
+
+ public static TemporaryFolder folder = new TemporaryFolder();
+
+ private static MiniAccumuloCluster accumulo;
+
+ @BeforeClass
+ public static void setupMiniCluster() throws Exception {
+
+ folder.create();
+
+ accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
+
+ accumulo.start();
+
+ }
+
+ @Test(timeout = 30000)
+ public void test() throws Exception {
+ AccumuloApp.run(accumulo.getInstanceName(), accumulo.getZooKeepers(),
"superSecret", new String[0]);
+ }
+
+ @AfterClass
+ public static void tearDownMiniCluster() throws Exception {
+ accumulo.stop();
+ folder.delete();
+ }
+
+}
Added:
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/archetype.properties
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/archetype.properties?rev=1454220&view=auto
==============================================================================
---
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/archetype.properties
(added)
+++
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/archetype.properties
Fri Mar 8 02:34:28 2013
@@ -0,0 +1,5 @@
+#Thu Mar 07 21:20:20 EST 2013
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
Added:
accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/goal.txt
URL:
http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/test/resources/projects/basic/goal.txt?rev=1454220&view=auto
==============================================================================
(empty)