fluo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [1/2] incubator-fluo git commit: fixes #723 renamed InitOpts and improved its Javadoc
Date Mon, 25 Jul 2016 18:56:06 GMT
Repository: incubator-fluo
Updated Branches:
  refs/heads/master aa5c76615 -> b30c9d76f


fixes #723 renamed InitOpts and improved its Javadoc


Project: http://git-wip-us.apache.org/repos/asf/incubator-fluo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fluo/commit/0e1a601f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fluo/tree/0e1a601f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fluo/diff/0e1a601f

Branch: refs/heads/master
Commit: 0e1a601fa11cf7410bd2c9b58496774f4e799dc7
Parents: 6c988a7
Author: Keith Turner <kturner@apache.org>
Authored: Mon Jul 25 12:37:20 2016 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Mon Jul 25 12:37:20 2016 -0400

----------------------------------------------------------------------
 .../org/apache/fluo/api/client/FluoAdmin.java   | 31 ++++++++++++--------
 .../fluo/cluster/runner/ClusterAppRunner.java   |  2 +-
 .../apache/fluo/core/client/FluoAdminImpl.java  |  3 +-
 .../org/apache/fluo/integration/ITBaseImpl.java |  5 ++--
 .../org/apache/fluo/integration/ITBaseMini.java |  5 ++--
 .../integration/client/FluoAdminImplIT.java     | 10 ++++---
 .../java/org/apache/fluo/mini/MiniFluoImpl.java |  4 +--
 7 files changed, 35 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/api/src/main/java/org/apache/fluo/api/client/FluoAdmin.java
----------------------------------------------------------------------
diff --git a/modules/api/src/main/java/org/apache/fluo/api/client/FluoAdmin.java b/modules/api/src/main/java/org/apache/fluo/api/client/FluoAdmin.java
index f988a07..70a5381 100644
--- a/modules/api/src/main/java/org/apache/fluo/api/client/FluoAdmin.java
+++ b/modules/api/src/main/java/org/apache/fluo/api/client/FluoAdmin.java
@@ -25,11 +25,14 @@ import org.apache.fluo.api.config.FluoConfiguration;
 public interface FluoAdmin extends AutoCloseable {
 
   /**
-   * Specifies Fluo initialization options such as clearing Zookeeper or existing Accumulo
table.
+   * Specifies destructive Fluo initialization options that can not be set using
+   * {@link FluoConfiguration}. The reason the options in this class are not supported in
+   * {@link FluoConfiguration} is that allowing them to be saved in a config file may lead
to
+   * inadvertent clearing of a Fluo instance.
    *
    * @since 1.0.0
    */
-  class InitOpts {
+  class InitializationOptions {
 
     private boolean clearZookeeper = false;
     private boolean clearTable = false;
@@ -38,7 +41,7 @@ public interface FluoAdmin extends AutoCloseable {
      * Clears zookeeper root (if exists) specified by
      * {@value FluoConfiguration#CLIENT_ZOOKEEPER_CONNECT_PROP}. Default is false.
      */
-    public InitOpts setClearZookeeper(boolean clearZookeeper) {
+    public InitializationOptions setClearZookeeper(boolean clearZookeeper) {
       this.clearZookeeper = clearZookeeper;
       return this;
     }
@@ -51,7 +54,7 @@ public interface FluoAdmin extends AutoCloseable {
      * Clears accumulo table (if exists) specified by
      * {@value FluoConfiguration#ADMIN_ACCUMULO_TABLE_PROP}. Default is false.
      */
-    public InitOpts setClearTable(boolean clearTable) {
+    public InitializationOptions setClearTable(boolean clearTable) {
       this.clearTable = clearTable;
       return this;
     }
@@ -65,7 +68,7 @@ public interface FluoAdmin extends AutoCloseable {
    * Exception that is thrown if Fluo application was already initialized. An application
is already
    * initialized if a directory with same name as application exists at the chroot directory
set by
    * the property fluo.client.zookeeper.connect. If this directory can be cleared, set
-   * {@link InitOpts#setClearTable(boolean)} to true
+   * {@link InitializationOptions#setClearTable(boolean)} to true
    *
    * @since 1.0.0
    */
@@ -84,8 +87,8 @@ public interface FluoAdmin extends AutoCloseable {
 
   /**
    * Exception that is thrown if Accumulo table (set by fluo.admin.accumulo.table) exists
during
-   * initialization. If this table can be cleared, set {@link InitOpts#setClearZookeeper(boolean)}
-   * to true
+   * initialization. If this table can be cleared, set
+   * {@link InitializationOptions#setClearZookeeper(boolean)} to true
    *
    * @since 1.0.0
    */
@@ -108,19 +111,21 @@ public interface FluoAdmin extends AutoCloseable {
    * {@value org.apache.fluo.api.config.FluoConfiguration#OBSERVER_PREFIX} and
    * {@value org.apache.fluo.api.config.FluoConfiguration#TRANSACTION_PREFIX} prefixes. Throws
    * {@link AlreadyInitializedException} if Fluo application was already initialized in Zookeeper.
-   * If you want to initialize Zookeeper again, set {@link InitOpts#setClearZookeeper(boolean)}
to
-   * true. Throws {@link TableExistsException} if Accumulo table exists. If you want to clear
table,
-   * set {@link InitOpts#setClearTable(boolean)} to true.
+   * If you want to initialize Zookeeper again, set
+   * {@link InitializationOptions#setClearZookeeper(boolean)} to true. Throws
+   * {@link TableExistsException} if Accumulo table exists. If you want to clear table, set
+   * {@link InitializationOptions#setClearTable(boolean)} to true.
    */
-  void initialize(InitOpts opts) throws AlreadyInitializedException, TableExistsException;
+  void initialize(InitializationOptions opts) throws AlreadyInitializedException,
+      TableExistsException;
 
   /**
    * Updates shared configuration in Zookeeper. Shared configuration consists of properties
with
    * {@value org.apache.fluo.api.config.FluoConfiguration#APP_PREFIX},
    * {@value org.apache.fluo.api.config.FluoConfiguration#OBSERVER_PREFIX} and
    * {@value org.apache.fluo.api.config.FluoConfiguration#TRANSACTION_PREFIX} prefixes. This
method
-   * is called if a user has previously called {@link #initialize(InitOpts)} but wants changes
to
-   * shared configuration updated in Zookeeper.
+   * is called if a user has previously called {@link #initialize(InitializationOptions)}
but wants
+   * changes to shared configuration updated in Zookeeper.
    * 
    * <p>
    * During this method Observers are reinitialized using configuration passed to FluoAdmin
and not

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/cluster/src/main/java/org/apache/fluo/cluster/runner/ClusterAppRunner.java
----------------------------------------------------------------------
diff --git a/modules/cluster/src/main/java/org/apache/fluo/cluster/runner/ClusterAppRunner.java
b/modules/cluster/src/main/java/org/apache/fluo/cluster/runner/ClusterAppRunner.java
index 9e764d4..fbfb91c 100644
--- a/modules/cluster/src/main/java/org/apache/fluo/cluster/runner/ClusterAppRunner.java
+++ b/modules/cluster/src/main/java/org/apache/fluo/cluster/runner/ClusterAppRunner.java
@@ -133,7 +133,7 @@ public abstract class ClusterAppRunner extends AppRunner {
         System.exit(-1);
       }
 
-      FluoAdmin.InitOpts initOpts = new FluoAdmin.InitOpts();
+      FluoAdmin.InitializationOptions initOpts = new FluoAdmin.InitializationOptions();
 
       if (commandOpts.getUpdate()) {
         System.out.println("Updating configuration for the Fluo '" + config.getApplicationName()

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java b/modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java
index 1bbab42..aa6a217 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java
@@ -86,7 +86,8 @@ public class FluoAdminImpl implements FluoAdmin {
   }
 
   @Override
-  public void initialize(InitOpts opts) throws AlreadyInitializedException, TableExistsException
{
+  public void initialize(InitializationOptions opts) throws AlreadyInitializedException,
+      TableExistsException {
     Preconditions.checkArgument(!ZookeeperUtil.parseRoot(config.getInstanceZookeepers())
         .equals("/"), "The Zookeeper connection string (set by 'fluo.client.zookeeper.connect')
"
         + " must have a chroot suffix.");

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseImpl.java
----------------------------------------------------------------------
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseImpl.java
b/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseImpl.java
index 3a541d9..14d5efd 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseImpl.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseImpl.java
@@ -18,7 +18,7 @@ package org.apache.fluo.integration;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.fluo.api.client.FluoAdmin;
-import org.apache.fluo.api.client.FluoAdmin.InitOpts;
+import org.apache.fluo.api.client.FluoAdmin.InitializationOptions;
 import org.apache.fluo.api.client.FluoFactory;
 import org.apache.fluo.api.config.FluoConfiguration;
 import org.apache.fluo.core.impl.Environment;
@@ -80,7 +80,8 @@ public class ITBaseImpl extends ITBase {
     config.setMiniStartAccumulo(false);
 
     try (FluoAdmin admin = FluoFactory.newAdmin(config)) {
-      InitOpts opts = new InitOpts().setClearZookeeper(true).setClearTable(true);
+      InitializationOptions opts =
+          new InitializationOptions().setClearZookeeper(true).setClearTable(true);
       admin.initialize(opts);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseMini.java
----------------------------------------------------------------------
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseMini.java
b/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseMini.java
index 0721475..0d28381 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseMini.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/ITBaseMini.java
@@ -18,7 +18,7 @@ package org.apache.fluo.integration;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.fluo.api.client.FluoAdmin;
-import org.apache.fluo.api.client.FluoAdmin.InitOpts;
+import org.apache.fluo.api.client.FluoAdmin.InitializationOptions;
 import org.apache.fluo.api.client.FluoFactory;
 import org.apache.fluo.api.config.FluoConfiguration;
 import org.apache.fluo.api.config.SimpleConfiguration;
@@ -58,7 +58,8 @@ public class ITBaseMini extends ITBase {
     config.setTransactionRollbackTime(1, TimeUnit.SECONDS);
 
     try (FluoAdmin admin = FluoFactory.newAdmin(config)) {
-      InitOpts opts = new InitOpts().setClearZookeeper(true).setClearTable(true);
+      InitializationOptions opts =
+          new InitializationOptions().setClearZookeeper(true).setClearTable(true);
       admin.initialize(opts);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
----------------------------------------------------------------------
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
b/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
index 51efbba..4a28236 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
@@ -19,7 +19,7 @@ import org.apache.curator.framework.CuratorFramework;
 import org.apache.fluo.accumulo.util.ZookeeperUtil;
 import org.apache.fluo.api.client.FluoAdmin;
 import org.apache.fluo.api.client.FluoAdmin.AlreadyInitializedException;
-import org.apache.fluo.api.client.FluoAdmin.InitOpts;
+import org.apache.fluo.api.client.FluoAdmin.InitializationOptions;
 import org.apache.fluo.api.client.FluoAdmin.TableExistsException;
 import org.apache.fluo.core.client.FluoAdminImpl;
 import org.apache.fluo.core.util.CuratorUtil;
@@ -40,7 +40,8 @@ public class FluoAdminImplIT extends ITBaseImpl {
 
     try (FluoAdmin admin = new FluoAdminImpl(config)) {
 
-      InitOpts opts = new InitOpts().setClearZookeeper(true).setClearTable(true);
+      InitializationOptions opts =
+          new InitializationOptions().setClearZookeeper(true).setClearTable(true);
 
       admin.initialize(opts);
       admin.initialize(opts);
@@ -76,7 +77,8 @@ public class FluoAdminImplIT extends ITBaseImpl {
     // stop oracle to avoid spurious exceptions when initializing
     oserver.stop();
 
-    InitOpts opts = new InitOpts().setClearZookeeper(true).setClearTable(true);
+    InitializationOptions opts =
+        new InitializationOptions().setClearZookeeper(true).setClearTable(true);
 
     for (String host : new String[] {"localhost", "localhost/", "localhost:9999", "localhost:9999/"})
{
       config.setInstanceZookeepers(host);
@@ -98,7 +100,7 @@ public class FluoAdminImplIT extends ITBaseImpl {
     String longPath = "/very/long/path";
     config.setInstanceZookeepers(zk + longPath);
 
-    InitOpts opts = new InitOpts();
+    InitializationOptions opts = new InitializationOptions();
     opts.setClearZookeeper(true).setClearTable(true);
 
     try (FluoAdmin admin = new FluoAdminImpl(config)) {

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/0e1a601f/modules/mini/src/main/java/org/apache/fluo/mini/MiniFluoImpl.java
----------------------------------------------------------------------
diff --git a/modules/mini/src/main/java/org/apache/fluo/mini/MiniFluoImpl.java b/modules/mini/src/main/java/org/apache/fluo/mini/MiniFluoImpl.java
index 6a6ff40..59f82c8 100644
--- a/modules/mini/src/main/java/org/apache/fluo/mini/MiniFluoImpl.java
+++ b/modules/mini/src/main/java/org/apache/fluo/mini/MiniFluoImpl.java
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.minicluster.MiniAccumuloCluster;
 import org.apache.accumulo.minicluster.MiniAccumuloConfig;
 import org.apache.fluo.api.client.FluoAdmin;
-import org.apache.fluo.api.client.FluoAdmin.InitOpts;
+import org.apache.fluo.api.client.FluoAdmin.InitializationOptions;
 import org.apache.fluo.api.client.FluoFactory;
 import org.apache.fluo.api.config.FluoConfiguration;
 import org.apache.fluo.api.config.SimpleConfiguration;
@@ -129,7 +129,7 @@ public class MiniFluoImpl implements MiniFluo {
         config.setAccumuloTable("fluo");
       }
 
-      InitOpts opts = new InitOpts();
+      InitializationOptions opts = new InitializationOptions();
       try (FluoAdmin admin = FluoFactory.newAdmin(config)) {
         admin.initialize(opts);
       }


Mime
View raw message