keith-turner commented on a change in pull request #361: ACCUMULO-4784 - Create 
builder for Connector
URL: https://github.com/apache/accumulo/pull/361#discussion_r167733987
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/client/Connector.java
 ##########
 @@ -237,4 +284,272 @@ public abstract BatchDeleter createBatchDeleter(String 
tableName, Authorizations
    * @since 1.7.0
    */
   public abstract ReplicationOperations replicationOperations();
+
+  /**
+   * Builds ConnectionInfo after all options have been specified
+   *
+   * @since 2.0.0
+   */
+  public interface ConnInfoFactory {
+
+    /**
+     * Builds ConnectionInfo after all options have been specified
+     *
+     * @return ConnectionInfo
+     */
+    ConnectionInfo info();
+  }
+
+  /**
+   * Builds Connector
+   *
+   * @since 2.0.0
+   */
+  public interface ConnectorFactory extends ConnInfoFactory {
+
+    /**
+     * Builds Connector after all options have been specified
+     *
+     * @return Connector
+     */
+    Connector build() throws AccumuloException, AccumuloSecurityException;
+
+  }
+
+  /**
+   * Builder method for setting Accumulo instance and zookeepers
+   *
+   * @since 2.0.0
+   */
+  public interface InstanceArgs {
+    AuthenticationArgs forInstance(String instanceName, String zookeepers);
+  }
+
+  /**
+   * Builder methods for creating Connector using properties
+   *
+   * @since 2.0.0
+   */
+  public interface PropertyOptions extends InstanceArgs {
+
+    /**
+     * Build using properties file. An example properties file can be found at 
conf/accumulo-client.properties in the Accumulo tarball distribution.
+     *
+     * @param propertiesFile
+     *          Path to properties file
+     * @return this builder
+     */
+    ConnectorFactory usingProperties(String propertiesFile);
+
+    /**
+     * Build using Java properties object. A list of available properties can 
be found in the documentation on the project website 
(http://accumulo.apache.org)
+     * under 'Development' -> 'Client Properties'
+     *
+     * @param properties
+     *          Properties object
+     * @return this builder
+     */
+    ConnectorFactory usingProperties(Properties properties);
+  }
+
+  public interface ConnectionInfoOptions extends PropertyOptions {
+
+    /**
+     * Build using connection information
+     *
+     * @param connectionInfo
+     *          ConnectionInfo object
+     * @return this builder
+     */
+    ConnectorFactory usingConnectionInfo(ConnectionInfo connectionInfo);
+  }
+
+  /**
+   * Build methods for authentication
+   *
+   * @since 2.0.0
+   */
+  public interface AuthenticationArgs {
+
+    /**
+     * Build using password-based credentials
+     *
+     * @param username
+     *          User name
+     * @param password
+     *          Password
+     * @return this builder
+     */
+    ConnectionOptions usingPasswordCredentials(String username, CharSequence 
password);
+
+    /**
+     * Build using Kerberos credentials
+     *
+     * @param principal
+     *          Principal
+     * @param keyTabFile
+     *          Path to keytab file
+     * @return this builder
+     */
+    ConnectionOptions usingKerberosCredentials(String principal, String 
keyTabFile);
 
 Review comment:
   This could be `usingKerberos()`

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to