org.apache.accumulo.core.client.mock
Class MockTableOperations

java.lang.Object
  extended by org.apache.accumulo.core.client.admin.TableOperations
      extended by org.apache.accumulo.core.client.mock.MockTableOperations

public class MockTableOperations
extends TableOperations


Method Summary
 void addAggregators(java.lang.String tableName, java.util.List<AggregatorConfiguration> aggregators)
           
 void addSplits(java.lang.String tableName, java.util.SortedSet<org.apache.hadoop.io.Text> partitionKeys)
           
 void clearLocatorCache(java.lang.String tableName)
          Clears the tablet locator cache for a specified table
 void create(java.lang.String tableName)
          Create a table with no special configuration
 void create(java.lang.String tableName, TimeType timeType)
           
 void delete(java.lang.String tableName)
          Delete a table
 boolean exists(java.lang.String tableName)
          A method to check if a table exists in Accumulo.
 void flush(java.lang.String tableName)
          Flush a table
 java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.io.Text>> getLocalityGroups(java.lang.String tableName)
          Gets the locality groups currently set for a table.
 java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> getProperties(java.lang.String tableName)
          Gets properties of a table
 java.util.Collection<org.apache.hadoop.io.Text> getSplits(java.lang.String tableName)
           
 java.util.Collection<org.apache.hadoop.io.Text> getSplits(java.lang.String tableName, int maxSplits)
           
 BulkImportHelper.AssignmentStats importDirectory(java.lang.String tableName, java.lang.String dir, java.lang.String failureDir, int numThreads, int numAssignThreads, boolean disableGC)
           
 java.util.SortedSet<java.lang.String> list()
          Retrieve a list of tables in Accumulo.
 void offline(java.lang.String tableName)
           
 void online(java.lang.String tableName)
           
 void removeProperty(java.lang.String tableName, java.lang.String property)
          Removes a property from a table
 void rename(java.lang.String oldTableName, java.lang.String newTableName)
          Rename a table
 void setLocalityGroups(java.lang.String tableName, java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.io.Text>> groups)
          Sets a tables locality groups.
 void setProperty(java.lang.String tableName, java.lang.String property, java.lang.String value)
          Sets a property on a table
 java.util.Set<Range> splitRangeByTablets(java.lang.String tableName, Range range, int maxSplits)
           
 java.util.Map<java.lang.String,java.lang.String> tableIdMap()
          Get a mapping of table name to internal table id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

list

public java.util.SortedSet<java.lang.String> list()
Description copied from class: TableOperations
Retrieve a list of tables in Accumulo.

Overrides:
list in class TableOperations
Returns:
List of tables in accumulo

exists

public boolean exists(java.lang.String tableName)
Description copied from class: TableOperations
A method to check if a table exists in Accumulo.

Overrides:
exists in class TableOperations
Parameters:
tableName - the name of the table
Returns:
true if the table exists

create

public void create(java.lang.String tableName)
            throws AccumuloException,
                   AccumuloSecurityException,
                   TableExistsException
Description copied from class: TableOperations
Create a table with no special configuration

Overrides:
create in class TableOperations
Parameters:
tableName - the name of the table
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
TableExistsException - if the table already exists

create

public void create(java.lang.String tableName,
                   TimeType timeType)
            throws AccumuloException,
                   AccumuloSecurityException,
                   TableExistsException
Overrides:
create in class TableOperations
Parameters:
tableName - the name of the table
timeType - specifies logical or real-time based time recording for entries in the table
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
TableExistsException - if the table already exists

addAggregators

public void addAggregators(java.lang.String tableName,
                           java.util.List<AggregatorConfiguration> aggregators)
                    throws AccumuloSecurityException,
                           TableNotFoundException,
                           AccumuloException
Overrides:
addAggregators in class TableOperations
Parameters:
tableName - the name of the table
aggregators - List of aggregators to add
Throws:
AccumuloSecurityException - if insufficient permissions to do action
TableNotFoundException - if table does not exist
AccumuloException - if a general error occurs

addSplits

public void addSplits(java.lang.String tableName,
                      java.util.SortedSet<org.apache.hadoop.io.Text> partitionKeys)
               throws TableNotFoundException,
                      AccumuloException,
                      AccumuloSecurityException
Overrides:
addSplits in class TableOperations
Parameters:
tableName - the name of the table
partitionKeys - a sorted set of row key values to pre-split the table on
Throws:
TableNotFoundException - if the table does not exist
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission

getSplits

public java.util.Collection<org.apache.hadoop.io.Text> getSplits(java.lang.String tableName)
Overrides:
getSplits in class TableOperations
Parameters:
tableName - the name of the table
Returns:
the split points (end-row names) for the table's current split profile

getSplits

public java.util.Collection<org.apache.hadoop.io.Text> getSplits(java.lang.String tableName,
                                                                 int maxSplits)
Overrides:
getSplits in class TableOperations
Parameters:
tableName - the name of the table
maxSplits - specifies the maximum number of splits to return
Returns:
the split points (end-row names) for the table's current split profile, grouped into fewer splits so as not to exceed maxSplits

delete

public void delete(java.lang.String tableName)
            throws AccumuloException,
                   AccumuloSecurityException,
                   TableNotFoundException
Description copied from class: TableOperations
Delete a table

Overrides:
delete in class TableOperations
Parameters:
tableName - the name of the table
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
TableNotFoundException - if the table does not exist

rename

public void rename(java.lang.String oldTableName,
                   java.lang.String newTableName)
            throws AccumuloSecurityException,
                   TableNotFoundException,
                   AccumuloException,
                   TableExistsException
Description copied from class: TableOperations
Rename a table

Overrides:
rename in class TableOperations
Parameters:
oldTableName - the old table name
newTableName - the new table name
Throws:
AccumuloSecurityException - if the user does not have permission
TableNotFoundException - if the old table name does not exist
AccumuloException - if a general error occurs
TableExistsException - if the new table name already exists

flush

public void flush(java.lang.String tableName)
           throws AccumuloException,
                  AccumuloSecurityException
Description copied from class: TableOperations
Flush a table

Overrides:
flush in class TableOperations
Parameters:
tableName - the name of the table
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission

setProperty

public void setProperty(java.lang.String tableName,
                        java.lang.String property,
                        java.lang.String value)
                 throws AccumuloException,
                        AccumuloSecurityException
Description copied from class: TableOperations
Sets a property on a table

Overrides:
setProperty in class TableOperations
Parameters:
tableName - the name of the table
property - the name of a per-table property
value - the value to set a per-table property to
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission

removeProperty

public void removeProperty(java.lang.String tableName,
                           java.lang.String property)
                    throws AccumuloException,
                           AccumuloSecurityException
Description copied from class: TableOperations
Removes a property from a table

Overrides:
removeProperty in class TableOperations
Parameters:
tableName - the name of the table
property - the name of a per-table property
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission

getProperties

public java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> getProperties(java.lang.String tableName)
                                                                                         throws TableNotFoundException
Description copied from class: TableOperations
Gets properties of a table

Overrides:
getProperties in class TableOperations
Parameters:
tableName - the name of the table
Returns:
all properties visible by this table (system and per-table properties)
Throws:
TableNotFoundException - if the table does not exist

setLocalityGroups

public void setLocalityGroups(java.lang.String tableName,
                              java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.io.Text>> groups)
                       throws AccumuloException,
                              AccumuloSecurityException,
                              TableNotFoundException
Description copied from class: TableOperations
Sets a tables locality groups. A tables locality groups can be changed at any time.

Overrides:
setLocalityGroups in class TableOperations
Parameters:
tableName - the name of the table
groups - mapping of locality group names to column families in the locality group
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
TableNotFoundException - if the table does not exist

getLocalityGroups

public java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.io.Text>> getLocalityGroups(java.lang.String tableName)
                                                                                           throws AccumuloException,
                                                                                                  TableNotFoundException
Description copied from class: TableOperations
Gets the locality groups currently set for a table.

Overrides:
getLocalityGroups in class TableOperations
Parameters:
tableName - the name of the table
Returns:
mapping of locality group names to column families in the locality group
Throws:
AccumuloException - if a general error occurs
TableNotFoundException - if the table does not exist

splitRangeByTablets

public java.util.Set<Range> splitRangeByTablets(java.lang.String tableName,
                                                Range range,
                                                int maxSplits)
                                         throws AccumuloException,
                                                AccumuloSecurityException,
                                                TableNotFoundException
Overrides:
splitRangeByTablets in class TableOperations
Parameters:
tableName - the name of the table
range - a range to split
maxSplits - the maximum number of splits
Returns:
the range, split into smaller ranges that fall on boundaries of the table's split points as evenly as possible
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
TableNotFoundException - if the table does not exist

importDirectory

public BulkImportHelper.AssignmentStats importDirectory(java.lang.String tableName,
                                                        java.lang.String dir,
                                                        java.lang.String failureDir,
                                                        int numThreads,
                                                        int numAssignThreads,
                                                        boolean disableGC)
                                                 throws java.io.IOException,
                                                        AccumuloException,
                                                        AccumuloSecurityException
Overrides:
importDirectory in class TableOperations
Parameters:
tableName - the name of the table
dir - the HDFS directory to find files for importing
failureDir - the HDFS directory to place files that failed to be imported
numThreads - the number of threads to use to process the files
numAssignThreads - the number of threads to use when assigning the files
disableGC - prevents the garbage collector from cleaning up files that were bulk imported
Returns:
the statistics for the operation
Throws:
java.io.IOException - when there is an error reading/writing to HDFS
AccumuloException - when there is a general accumulo error
AccumuloSecurityException - when the user does not have the proper permissions

offline

public void offline(java.lang.String tableName)
             throws AccumuloSecurityException,
                    AccumuloException
Overrides:
offline in class TableOperations
Parameters:
tableName - the table to take offline
Throws:
AccumuloSecurityException - when the user does not have the proper permissions
AccumuloException - when there is a general accumulo error

online

public void online(java.lang.String tableName)
            throws AccumuloSecurityException,
                   AccumuloException
Overrides:
online in class TableOperations
Parameters:
tableName - the table to take online
Throws:
AccumuloSecurityException - when the user does not have the proper permissions
AccumuloException - when there is a general accumulo error

clearLocatorCache

public void clearLocatorCache(java.lang.String tableName)
                       throws TableNotFoundException
Description copied from class: TableOperations
Clears the tablet locator cache for a specified table

Overrides:
clearLocatorCache in class TableOperations
Parameters:
tableName - the name of the table
Throws:
TableNotFoundException - if table does not exist

tableIdMap

public java.util.Map<java.lang.String,java.lang.String> tableIdMap()
Description copied from class: TableOperations
Get a mapping of table name to internal table id.

Overrides:
tableIdMap in class TableOperations
Returns:
the map from table name to internal table id


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