@Override public void drop(String name, Audit audit) { if (_nameToUuid.remove(name) == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } // todo: doesn't remove any data }
@Override public Table getByUuid(long uuid) throws UnknownTableException, DroppedTableException { Table table = _uuidToTable.get(uuid); if (table == null) { throw new UnknownTableException(format("Unknown table: %s", uuid)); } return table; }
@Override public void drop(String name, Audit audit) { if (_nameToUuid.remove(name) == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } // todo: doesn't remove any data }
@Override public Table getByUuid(long uuid) throws UnknownTableException, DroppedTableException { Table table = _uuidToTable.get(uuid); if (table == null) { throw new UnknownTableException(format("Unknown table: %s", uuid)); } return table; }
@Override public Table get(String name) { Long tableUuid = _nameToUuid.get(name); if (tableUuid == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } return _uuidToTable.get(tableUuid); }
@Override public Table get(String name) { Long tableUuid = _nameToUuid.get(name); if (tableUuid == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } return _uuidToTable.get(tableUuid); }
@Override public Table getByUuid(long uuid) { Optional<Table> table = snapshot.getUnchecked(uuid); if (!table.isPresent()) { throw new UnknownTableException(format("Unknown table: %s", uuid)); } return table.get(); }
@Override public Table getByUuid(long uuid) { Optional<Table> table = snapshot.getUnchecked(uuid); if (!table.isPresent()) { throw new UnknownTableException(format("Unknown table: %s", uuid)); } return table.get(); }
@Override public Table get(String name) throws UnknownTableException { Table table = getTableFromCache(name); if (table == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } return table; }
@Override public Table get(String name) throws UnknownTableException { Table table = getInternal(name); if (table == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } return table; }
@Override public Table get(String name) throws UnknownTableException { Table table = getTableFromCache(name); if (table == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } return table; }
@Override public Table get(String name) throws UnknownTableException { Table table = getInternal(name); if (table == null) { throw new UnknownTableException(format("Unknown table: %s", name), name); } return table; }
private String getTableNameByUuid(long uuid) throws UnknownTableException { // Lookup the name of the table associated with this uuid. String key = TableUuidFormat.encode(uuid); Map<String, Object> json = _backingStore.get(_systemTableUuid, key, ReadConsistency.STRONG); String tableName; if (json == null || (tableName = (String) json.get("table")) == null) { throw new UnknownTableException(); } return tableName; }
private String getTableNameByUuid(long uuid) throws UnknownTableException { // Lookup the name of the table associated with this uuid. String key = TableUuidFormat.encode(uuid); Map<String, Object> json = _backingStore.get(_systemTableUuid, key, ReadConsistency.STRONG); String tableName; if (json == null || (tableName = (String) json.get("table")) == null) { throw new UnknownTableException(); } return tableName; }
@VisibleForTesting TableJson readTableJson(String table, boolean required) { TableJson json = new TableJson(_backingStore.get(_systemTable, table, ReadConsistency.STRONG)); if (required && json.isDropped()) { throw new UnknownTableException(format("Unknown table: %s", table), table); } return json; }
@VisibleForTesting TableJson readTableJson(String table, boolean required) { TableJson json = new TableJson(_backingStore.get(_systemTable, table, ReadConsistency.STRONG)); if (required && json.isDropped()) { throw new UnknownTableException(format("Unknown table: %s", table), table); } return json; }
/** * If a table exists but is empty then it will not be stashed. This method will surface this exception * only if the table exists. Otherwise it converts it to an UnknownTableException. */ private RuntimeException propagateTableNotStashed(TableNotStashedException e) throws TableNotStashedException, UnknownTableException { if (_dataStore.getTableExists(e.getTable())) { throw e; } throw new UnknownTableException(e.getTable()); } }
/** * If a table exists but is empty then it will not be stashed. This method will surface this exception * only if the table exists. Otherwise it converts it to an UnknownTableException. */ private RuntimeException propagateTableNotStashed(TableNotStashedException e) throws TableNotStashedException, UnknownTableException { if (_dataStore.getTableExists(e.getTable())) { throw e; } throw new UnknownTableException(e.getTable()); } }
return (RuntimeException) response.getEntity(UnknownTableException.class).initCause(e); } else { return (RuntimeException) new UnknownTableException().initCause(e);
return (RuntimeException) response.getEntity(UnknownTableException.class).initCause(e); } else { return (RuntimeException) new UnknownTableException().initCause(e);