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

java.lang.Object
  extended by org.apache.accumulo.core.client.admin.TableOperationsHelper
      extended by org.apache.accumulo.core.client.mock.MockTableOperations
All Implemented Interfaces:
TableOperations

public class MockTableOperations
extends TableOperationsHelper


Method Summary
 void addAggregators(String tableName, List<? extends PerColumnIteratorConfig> aggregators)
          Deprecated. since 1.4 TableOperationsHelper.attachIterator(String, IteratorSetting)
 void addSplits(String tableName, SortedSet<org.apache.hadoop.io.Text> partitionKeys)
           
 void clearLocatorCache(String tableName)
          Clears the tablet locator cache for a specified table
 void clone(String srcTableName, String newTableName, boolean flush, Map<String,String> propertiesToSet, Set<String> propertiesToExclude)
          Clone a table from an existing table.
 void compact(String tableName, org.apache.hadoop.io.Text start, org.apache.hadoop.io.Text end, boolean flush, boolean wait)
          Starts a full major compaction of the tablets in the range (start, end].
 void create(String tableName)
          Create a table with no special configuration
 void create(String tableName, boolean versioningIter)
           
 void create(String tableName, boolean versioningIter, TimeType timeType)
           
 void delete(String tableName)
          Delete a table
 void deleteRows(String tableName, org.apache.hadoop.io.Text start, org.apache.hadoop.io.Text end)
          Delete rows between (start, end]
 boolean exists(String tableName)
          A method to check if a table exists in Accumulo.
 void flush(String tableName)
          Initiate a flush of a tables data that is in memory
 void flush(String tableName, org.apache.hadoop.io.Text start, org.apache.hadoop.io.Text end, boolean wait)
          Flush a tables data that is currently in memory.
 Map<String,Set<org.apache.hadoop.io.Text>> getLocalityGroups(String tableName)
          Gets the locality groups currently set for a table.
 org.apache.hadoop.io.Text getMaxRow(String tableName, Authorizations auths, org.apache.hadoop.io.Text startRow, boolean startInclusive, org.apache.hadoop.io.Text endRow, boolean endInclusive)
          Finds the max row within a given range.
 Iterable<Map.Entry<String,String>> getProperties(String tableName)
          Gets properties of a table
 Collection<org.apache.hadoop.io.Text> getSplits(String tableName)
           
 Collection<org.apache.hadoop.io.Text> getSplits(String tableName, int maxSplits)
           
 void importDirectory(String tableName, String dir, String failureDir, boolean setTime)
          Bulk import all the files in a directory into a table.
 BulkImportHelper.AssignmentStats importDirectory(String tableName, String dir, String failureDir, int numThreads, int numAssignThreads, boolean disableGC)
           
 SortedSet<String> list()
           
 void merge(String tableName, org.apache.hadoop.io.Text start, org.apache.hadoop.io.Text end)
          Merge tablets between (start, end]
 void offline(String tableName)
           
 void online(String tableName)
           
 void removeProperty(String tableName, String property)
          Removes a property from a table
 void rename(String oldTableName, String newTableName)
          Rename a table
 void setLocalityGroups(String tableName, Map<String,Set<org.apache.hadoop.io.Text>> groups)
          Sets a tables locality groups.
 void setProperty(String tableName, String property, String value)
          Sets a property on a table
 Set<Range> splitRangeByTablets(String tableName, Range range, int maxSplits)
           
 Map<String,String> tableIdMap()
          Get a mapping of table name to internal table id.
 
Methods inherited from class org.apache.accumulo.core.client.admin.TableOperationsHelper
attachIterator, attachIterator, checkIteratorConflicts, getIteratorSetting, listIterators, removeIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

list

public SortedSet<String> list()

exists

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

Parameters:
tableName - the name of the table
Returns:
true if the table exists

create

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

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(String tableName,
                   boolean versioningIter)
            throws AccumuloException,
                   AccumuloSecurityException,
                   TableExistsException
Parameters:
tableName - the name of the table
versioningIter - Enables/disables the versioning iterator, which will limit the number of Key versions kept.
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(String tableName,
                   boolean versioningIter,
                   TimeType timeType)
            throws AccumuloException,
                   AccumuloSecurityException,
                   TableExistsException
Parameters:
tableName - the name of the table
versioningIter - Enables/disables the versioning iterator, which will limit the number of Key versions kept.
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(String tableName,
                           List<? extends PerColumnIteratorConfig> aggregators)
                    throws AccumuloSecurityException,
                           TableNotFoundException,
                           AccumuloException
Deprecated. since 1.4 TableOperationsHelper.attachIterator(String, IteratorSetting)

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(String tableName,
                      SortedSet<org.apache.hadoop.io.Text> partitionKeys)
               throws TableNotFoundException,
                      AccumuloException,
                      AccumuloSecurityException
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 Collection<org.apache.hadoop.io.Text> getSplits(String tableName)
                                                throws TableNotFoundException
Parameters:
tableName - the name of the table
Returns:
the split points (end-row names) for the table's current split profile
Throws:
TableNotFoundException - if the table does not exist

getSplits

public Collection<org.apache.hadoop.io.Text> getSplits(String tableName,
                                                       int maxSplits)
                                                throws TableNotFoundException
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
Throws:
TableNotFoundException

delete

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

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(String oldTableName,
                   String newTableName)
            throws AccumuloSecurityException,
                   TableNotFoundException,
                   AccumuloException,
                   TableExistsException
Description copied from interface: TableOperations
Rename a table

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(String tableName)
           throws AccumuloException,
                  AccumuloSecurityException
Description copied from interface: TableOperations
Initiate a flush of a tables data that is in memory

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(String tableName,
                        String property,
                        String value)
                 throws AccumuloException,
                        AccumuloSecurityException
Description copied from interface: TableOperations
Sets a property on a table

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(String tableName,
                           String property)
                    throws AccumuloException,
                           AccumuloSecurityException
Description copied from interface: TableOperations
Removes a property from a table

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 Iterable<Map.Entry<String,String>> getProperties(String tableName)
                                                 throws TableNotFoundException
Description copied from interface: TableOperations
Gets properties of a table

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(String tableName,
                              Map<String,Set<org.apache.hadoop.io.Text>> groups)
                       throws AccumuloException,
                              AccumuloSecurityException,
                              TableNotFoundException
Description copied from interface: TableOperations
Sets a tables locality groups. A tables locality groups can be changed at any time.

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 Map<String,Set<org.apache.hadoop.io.Text>> getLocalityGroups(String tableName)
                                                             throws AccumuloException,
                                                                    TableNotFoundException
Description copied from interface: TableOperations
Gets the locality groups currently set for a table.

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 Set<Range> splitRangeByTablets(String tableName,
                                      Range range,
                                      int maxSplits)
                               throws AccumuloException,
                                      AccumuloSecurityException,
                                      TableNotFoundException
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(String tableName,
                                                        String dir,
                                                        String failureDir,
                                                        int numThreads,
                                                        int numAssignThreads,
                                                        boolean disableGC)
                                                 throws IOException,
                                                        AccumuloException,
                                                        AccumuloSecurityException
Throws:
IOException
AccumuloException
AccumuloSecurityException

importDirectory

public void importDirectory(String tableName,
                            String dir,
                            String failureDir,
                            boolean setTime)
                     throws IOException,
                            AccumuloException,
                            AccumuloSecurityException,
                            TableNotFoundException
Description copied from interface: TableOperations
Bulk import all the files in a directory into a table.

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, must exist and be empty
setTime - override the time values in the input files, and use the current time for all mutations
Throws:
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
TableNotFoundException - when the table no longer exists

offline

public void offline(String tableName)
             throws AccumuloSecurityException,
                    AccumuloException
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(String tableName)
            throws AccumuloSecurityException,
                   AccumuloException
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(String tableName)
                       throws TableNotFoundException
Description copied from interface: TableOperations
Clears the tablet locator cache for a specified table

Parameters:
tableName - the name of the table
Throws:
TableNotFoundException - if table does not exist

tableIdMap

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

Returns:
the map from table name to internal table id

merge

public void merge(String tableName,
                  org.apache.hadoop.io.Text start,
                  org.apache.hadoop.io.Text end)
           throws AccumuloException,
                  AccumuloSecurityException,
                  TableNotFoundException
Description copied from interface: TableOperations
Merge tablets between (start, end]

Parameters:
tableName - the table to merge
start - first tablet to be merged contains the row after this row, null means the first tablet
end - last tablet to be merged contains this row, null means the last tablet
Throws:
AccumuloException
AccumuloSecurityException
TableNotFoundException

deleteRows

public void deleteRows(String tableName,
                       org.apache.hadoop.io.Text start,
                       org.apache.hadoop.io.Text end)
                throws AccumuloException,
                       AccumuloSecurityException,
                       TableNotFoundException
Description copied from interface: TableOperations
Delete rows between (start, end]

Parameters:
tableName - the table to merge
start - delete rows after this, null means the first row of the table
end - last row to be deleted, inclusive, null means the last row of the table
Throws:
AccumuloException
AccumuloSecurityException
TableNotFoundException

compact

public void compact(String tableName,
                    org.apache.hadoop.io.Text start,
                    org.apache.hadoop.io.Text end,
                    boolean flush,
                    boolean wait)
             throws AccumuloSecurityException,
                    TableNotFoundException,
                    AccumuloException
Description copied from interface: TableOperations
Starts a full major compaction of the tablets in the range (start, end]. The compaction is preformed even for tablets that have only one file.

Parameters:
tableName - the table to compact
start - first tablet to be compacted contains the row after this row, null means the first tablet in table
end - last tablet to be merged contains this row, null means the last tablet in table
flush - when true, table memory is flushed before compaction starts
wait - when true, the call will not return until compactions are finished
Throws:
AccumuloSecurityException
TableNotFoundException
AccumuloException

clone

public void clone(String srcTableName,
                  String newTableName,
                  boolean flush,
                  Map<String,String> propertiesToSet,
                  Set<String> propertiesToExclude)
           throws AccumuloException,
                  AccumuloSecurityException,
                  TableNotFoundException,
                  TableExistsException
Description copied from interface: TableOperations
Clone a table from an existing table. The cloned table will have the same data as the source table it was created from. After cloning, the two tables can mutate independently. Initially the cloned table should not use any extra space, however as the source table and cloned table major compact extra space will be used by the clone. Initially the cloned table is only readable and writable by the user who created it.

Parameters:
srcTableName - the table to clone
newTableName - the name of the clone
flush - determines if memory is flushed in the source table before cloning.
propertiesToSet - the sources tables properties are copied, this allows overriding of those properties
propertiesToExclude - do not copy these properties from the source table, just revert to system defaults
Throws:
AccumuloException
AccumuloSecurityException
TableNotFoundException
TableExistsException

flush

public void flush(String tableName,
                  org.apache.hadoop.io.Text start,
                  org.apache.hadoop.io.Text end,
                  boolean wait)
           throws AccumuloException,
                  AccumuloSecurityException,
                  TableNotFoundException
Description copied from interface: TableOperations
Flush a tables data that is currently in memory.

Parameters:
tableName - the name of the table
wait - if true the call will not return until all data present in memory when the call was is flushed if false will initiate a flush of data in memory, but will not wait for it to complete
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
TableNotFoundException

getMaxRow

public org.apache.hadoop.io.Text getMaxRow(String tableName,
                                           Authorizations auths,
                                           org.apache.hadoop.io.Text startRow,
                                           boolean startInclusive,
                                           org.apache.hadoop.io.Text endRow,
                                           boolean endInclusive)
                                    throws TableNotFoundException,
                                           AccumuloException,
                                           AccumuloSecurityException
Description copied from interface: TableOperations
Finds the max row within a given range. To find the max row in a table, pass null for start and end row.

auths - find the max row that can seen with these auths
startRow - row to start looking at, null means -Infinity
startInclusive - determines if the start row is included
endRow - row to stop looking at, null means Infinity
endInclusive - determines if the end row is included
Returns:
The max row in the range, or null if there is no visible data in the range.
Throws:
TableNotFoundException
AccumuloException
AccumuloSecurityException


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