Class Tables
- java.lang.Object
-
- org.apache.accumulo.core.clientImpl.Tables
-
public class Tables extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
VALID_NAME_REGEX
-
Constructor Summary
Constructors Constructor Description Tables()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TableId
_getTableId(ClientContext context, String tableName)
Lookup table ID in ZK.static void
clearCache(ClientContext context)
static void
clearCacheByPath(ClientContext context, String zooPath)
Clears the zoo cache from instance/root/{PATH}static boolean
exists(ClientContext context, TableId tableId)
static Map<TableId,String>
getIdToNameMap(ClientContext context)
static NamespaceId
getNamespaceId(ClientContext context, TableId tableId)
Returns the namespace id for a given table ID.static Map<String,TableId>
getNameToIdMap(ClientContext context)
static String
getPrintableTableInfoFromId(ClientContext context, TableId tableId)
static String
getPrintableTableInfoFromName(ClientContext context, String tableName)
static TableId
getTableId(ClientContext context, String tableName)
Lookup table ID in ZK.static String
getTableName(ClientContext context, TableId tableId)
static String
getTableOfflineMsg(ClientContext context, TableId tableId)
static TableState
getTableState(ClientContext context, TableId tableId)
static TableState
getTableState(ClientContext context, TableId tableId, boolean clearCachedState)
Get the current state of the table using the tableid.static String
qualified(String tableName)
static String
qualified(String tableName, String defaultNamespace)
static Pair<String,String>
qualify(String tableName)
static Pair<String,String>
qualify(String tableName, String defaultNamespace)
-
-
-
Field Detail
-
VALID_NAME_REGEX
public static final String VALID_NAME_REGEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTableId
public static TableId getTableId(ClientContext context, String tableName) throws TableNotFoundException
Lookup table ID in ZK. Throw TableNotFoundException if not found. Also wraps NamespaceNotFoundException in TableNotFoundException if namespace is not found.- Throws:
TableNotFoundException
-
_getTableId
public static TableId _getTableId(ClientContext context, String tableName) throws NamespaceNotFoundException, TableNotFoundException
Lookup table ID in ZK. If not found, clears cache and tries again.
-
getTableName
public static String getTableName(ClientContext context, TableId tableId) throws TableNotFoundException
- Throws:
TableNotFoundException
-
getTableOfflineMsg
public static String getTableOfflineMsg(ClientContext context, TableId tableId)
-
getNameToIdMap
public static Map<String,TableId> getNameToIdMap(ClientContext context)
-
getIdToNameMap
public static Map<TableId,String> getIdToNameMap(ClientContext context)
-
exists
public static boolean exists(ClientContext context, TableId tableId)
-
clearCache
public static void clearCache(ClientContext context)
-
clearCacheByPath
public static void clearCacheByPath(ClientContext context, String zooPath)
Clears the zoo cache from instance/root/{PATH}- Parameters:
context
- The Accumulo client contextzooPath
- A zookeeper path
-
getPrintableTableInfoFromId
public static String getPrintableTableInfoFromId(ClientContext context, TableId tableId)
-
getPrintableTableInfoFromName
public static String getPrintableTableInfoFromName(ClientContext context, String tableName)
-
getTableState
public static TableState getTableState(ClientContext context, TableId tableId)
-
getTableState
public static TableState getTableState(ClientContext context, TableId tableId, boolean clearCachedState)
Get the current state of the table using the tableid. The boolean clearCache, if true will clear the table state in zookeeper before fetching the state. Added with ACCUMULO-4574.- Parameters:
context
- the Accumulo client contexttableId
- the table idclearCachedState
- if true clear the table state in zookeeper before checking status- Returns:
- the table state.
-
getNamespaceId
public static NamespaceId getNamespaceId(ClientContext context, TableId tableId) throws TableNotFoundException
Returns the namespace id for a given table ID.- Parameters:
context
- The Accumulo client contexttableId
- The tableId- Returns:
- The namespace id which this table resides in.
- Throws:
IllegalArgumentException
- if the table doesn't exist in ZooKeeperTableNotFoundException
-
-