Repository: incubator-fluo-website Updated Branches: refs/heads/fluo-tour 7dabafa65 -> 729a523d4
turned quickstart into fluo tour Project: http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/commit/729a523d Tree: http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/tree/729a523d Diff: http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/diff/729a523d Branch: refs/heads/fluo-tour Commit: 729a523d483476b7641d9bae09106ae9501d38a6 Parents: 7dabafa Author: Keith Turner <ke...@deenlo.com> Authored: Tue Sep 20 15:31:59 2016 -0400 Committer: Keith Turner <ktur...@apache.org> Committed: Wed Sep 21 13:32:58 2016 -0400 ---------------------------------------------------------------------- .gitignore | 6 +++ README.md | 13 ++++++ pom.xml | 77 ++++++++++++++++++++++++++++++++ src/main/java/ft/Main.java | 44 ++++++++++++++++++ src/main/resources/log4j.properties | 29 ++++++++++++ 5 files changed, 169 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/blob/729a523d/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93eea5d --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.classpath +.project +.settings +target +.idea +*.iml http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/blob/729a523d/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 56db76e..b463c11 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,17 @@ Fluo Tour --------- +This git repository provides a barebones Maven+Java environment for the [Fluo Tour][tour]. As you +go through the tour edit [Main.java] and use the following command to get all of the correct +dependencies on the classpath and execute Main. + +```bash +mvn -q clean compile exec:java +``` + +The command takes a bit to run because it starts a MiniAccumulo and MiniFluo +each time. + +[tour]: https://fluo.apache.org/tour +[Main.java]: src/main/java/ft/Main.java http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/blob/729a523d/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..855b2e1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.fluo</groupId> + <artifactId>fluo-tour</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>fluo-tour</name> + <url>https://fluo.apache.org/tour</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <accumulo.version>1.7.2</accumulo.version> + <fluo.version>1.0.0-incubating</fluo.version> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + <optimize>true</optimize> + <encoding>UTF-8</encoding> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.5.0</version> + <configuration> + <mainClass>ft.Main</mainClass> + <cleanupDaemonThreads>false</cleanupDaemonThreads> + </configuration> + </plugin> + </plugins> + </build> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-minicluster</artifactId> + <version>${accumulo.version}</version> + </dependency> + <dependency> + <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-core</artifactId> + <version>${accumulo.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.fluo</groupId> + <artifactId>fluo-api</artifactId> + <version>${fluo.version}</version> + </dependency> + <dependency> + <groupId>org.apache.fluo</groupId> + <artifactId>fluo-core</artifactId> + <version>${fluo.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.fluo</groupId> + <artifactId>fluo-mini</artifactId> + <version>${fluo.version}</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/blob/729a523d/src/main/java/ft/Main.java ---------------------------------------------------------------------- diff --git a/src/main/java/ft/Main.java b/src/main/java/ft/Main.java new file mode 100644 index 0000000..8925911 --- /dev/null +++ b/src/main/java/ft/Main.java @@ -0,0 +1,44 @@ +package ft; + +import java.nio.file.Files; +import java.nio.file.Paths; + +// Normally using * with imports is a bad practice, however in this case it makes experimenting with +// Fluo easier. +import org.apache.fluo.api.client.*; +import org.apache.fluo.api.config.*; +import org.apache.fluo.api.data.*; +import org.apache.fluo.api.mini.MiniFluo; +import org.apache.fluo.api.observer.*; + +public class Main { + public static void main(String[] args) throws Exception { + + String tmpDir = Files.createTempDirectory(Paths.get("target"), "mini").toString(); + // System.out.println("tmp dir : "+tmpDir); + + FluoConfiguration fluoConfig = new FluoConfiguration(); + fluoConfig.setApplicationName("class"); + fluoConfig.setMiniDataDir(tmpDir); + + preInit(fluoConfig); + + System.out.print("Starting MiniFluo ... "); + + try (MiniFluo mini = FluoFactory.newMiniFluo(fluoConfig); + FluoClient client = FluoFactory.newClient(mini.getClientConfiguration())) { + + System.out.println("started."); + + excercise(mini, client); + } + } + + private static void preInit(FluoConfiguration fluoConfig) { + //this method does not need to be changed for earlier excercises in tour + } + + private static void excercise(MiniFluo mini, FluoClient client) { + //TODO Do all Fluo Tour excercises + } +} http://git-wip-us.apache.org/repos/asf/incubator-fluo-website/blob/729a523d/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties new file mode 100644 index 0000000..1572708 --- /dev/null +++ b/src/main/resources/log4j.properties @@ -0,0 +1,29 @@ +# 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. + +log4j.rootLogger=INFO, CA +log4j.appender.CA=org.apache.log4j.ConsoleAppender +log4j.appender.CA.layout=org.apache.log4j.PatternLayout +log4j.appender.CA.layout.ConversionPattern=%d{ISO8601} [%c{2}] %-5p: %m%n + +log4j.logger.org.apache.fluo=WARN + +#uncomment the following to see all transaction activity +#log4j.logger.fluo.tx=TRACE + +log4j.logger.org.apache.zookeeper.ClientCnxn=FATAL +log4j.logger.org.apache.zookeeper.ZooKeeper=WARN +log4j.logger.org.apache.curator=WARN +log4j.logger.org.apache.accumulo=ERROR