org.apache.accumulo.core.client
Class Connector

java.lang.Object
  extended by org.apache.accumulo.core.client.Connector
Direct Known Subclasses:
ConnectorImpl, MockConnector

public class Connector
extends java.lang.Object

Connector facilitates connecting to an Accumulo instance. One of the main purposes of this class is to make it easy to connect to multiple Accumulo instances within the same JVM. Additionally, the Connector object enforces security on the client side, by forcing all API calls to be accompanied by user credentials. This Connector requires a master to be running to be instantiated, and for certain calls, such as getTables()


Constructor Summary
protected Connector()
           
 
Method Summary
 BatchDeleter createBatchDeleter(java.lang.String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency, int maxWriteThreads)
          Factory method to create a BatchDeleter connected to Accumulo.
 BatchScanner createBatchScanner(java.lang.String tableName, Authorizations authorizations, int numQueryThreads)
          Factory method to create a BatchScanner connected to Accumulo.
 BatchWriter createBatchWriter(java.lang.String tableName, long maxMemory, long maxLatency, int maxWriteThreads)
          Factory method to create a BatchWriter connected to Accumulo.
 MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads)
          Factory method to create a Multi-Table BatchWriter connected to Accumulo.
 Scanner createScanner(java.lang.String tableName, Authorizations authorizations)
          Factory method to create a Scanner connected to Accumulo.
 Instance getInstance()
          Accessor method for internal instance object.
 InstanceOperations instanceOperations()
          Retrieves a InstanceOperations object to modify instance configuration
 SecurityOperations securityOperations()
          Retrieves a SecurityOperations object to perform user security operations, such as creating users
 TableOperations tableOperations()
          Retrieves a TableOperations object to perform table functions, such as create and delete
 java.lang.String whoami()
          Get the current user for this connector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connector

protected Connector()
Method Detail

createBatchScanner

public BatchScanner createBatchScanner(java.lang.String tableName,
                                       Authorizations authorizations,
                                       int numQueryThreads)
                                throws TableNotFoundException
Factory method to create a BatchScanner connected to Accumulo.

Parameters:
tableName - the name of the table to query
authorizations - A set of authorization labels that will be checked against the column visibility of each key in order to filter data. The authorizations passed in must be a subset of the accumulo user's set of authorizations. If the accumulo user has authorizations (A1, A2) and authorizations (A2, A3) are passed, then an exception will be thrown.
numQueryThreads - the number of concurrent threads to spawn for querying
Returns:
BatchScanner object for configuring and querying
Throws:
TableNotFoundException - when the specified table doesn't exist

createBatchDeleter

public BatchDeleter createBatchDeleter(java.lang.String tableName,
                                       Authorizations authorizations,
                                       int numQueryThreads,
                                       long maxMemory,
                                       long maxLatency,
                                       int maxWriteThreads)
                                throws TableNotFoundException
Factory method to create a BatchDeleter connected to Accumulo.

Parameters:
tableName - the name of the table to query and delete from
authorizations - A set of authorization labels that will be checked against the column visibility of each key in order to filter data. The authorizations passed in must be a subset of the accumulo user's set of authorizations. If the accumulo user has authorizations (A1, A2) and authorizations (A2, A3) are passed, then an exception will be thrown.
numQueryThreads - the number of concurrent threads to spawn for querying
maxMemory - size in bytes of the maximum memory to batch before writing
maxLatency - size in milliseconds; set to 0 or Long.MAX_VALUE to allow the maximum time to hold a batch before writing
maxWriteThreads - the maximum number of threads to use for writing data to the tablet servers
Returns:
BatchDeleter object for configuring and deleting
Throws:
TableNotFoundException - when the specified table doesn't exist

createBatchWriter

public BatchWriter createBatchWriter(java.lang.String tableName,
                                     long maxMemory,
                                     long maxLatency,
                                     int maxWriteThreads)
                              throws TableNotFoundException
Factory method to create a BatchWriter connected to Accumulo.

Parameters:
tableName - the name of the table to insert data into
maxMemory - size in bytes of the maximum memory to batch before writing
maxLatency - size in milliseconds; set to 0 or Long.MAX_VALUE to allow the maximum time to hold a batch before writing
maxWriteThreads - the maximum number of threads to use for writing data to the tablet servers
Returns:
BatchWriter object for configuring and writing data to
Throws:
TableNotFoundException - when the specified table doesn't exist

createMultiTableBatchWriter

public MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory,
                                                         long maxLatency,
                                                         int maxWriteThreads)
Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables, which is good for ingesting data into multiple tables from the same source

Parameters:
maxMemory - size in bytes of the maximum memory to batch before writing
maxLatency - size in milliseconds; set to 0 or Long.MAX_VALUE to allow the maximum time to hold a batch before writing
maxWriteThreads - the maximum number of threads to use for writing data to the tablet servers
Returns:
MultiTableBatchWriter object for configuring and writing data to

createScanner

public Scanner createScanner(java.lang.String tableName,
                             Authorizations authorizations)
                      throws TableNotFoundException
Factory method to create a Scanner connected to Accumulo.

Parameters:
tableName - the name of the table to query data from
authorizations - A set of authorization labels that will be checked against the column visibility of each key in order to filter data. The authorizations passed in must be a subset of the accumulo user's set of authorizations. If the accumulo user has authorizations (A1, A2) and authorizations (A2, A3) are passed, then an exception will be thrown.
Returns:
Scanner object for configuring and querying data with
Throws:
TableNotFoundException - when the specified table doesn't exist

getInstance

public Instance getInstance()
Accessor method for internal instance object.

Returns:
the internal instance object

whoami

public java.lang.String whoami()
Get the current user for this connector

Returns:
the user name

tableOperations

public TableOperations tableOperations()
Retrieves a TableOperations object to perform table functions, such as create and delete

Returns:
an object to manipulate tables

securityOperations

public SecurityOperations securityOperations()
Retrieves a SecurityOperations object to perform user security operations, such as creating users

Returns:
an object to modify users and permissions

instanceOperations

public InstanceOperations instanceOperations()
Retrieves a InstanceOperations object to modify instance configuration

Returns:
an object to modify instance configuration


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.