/** * Get the column name from a meta table key. Does not check if the metaTableKey is a valid * FijiTableAnnotator meta table key. This method is package private for testing. * * @param table HBaseFijiTable in which the column from the specified key lives. This will be used * for column name translation. * @param metaTableKey the meta table key from which to get the column name. * @return the column name stored in the given meta table key. * @throws NoSuchColumnException in case the column does not exist in the table. */ static FijiColumnName columnFromMetaTableKey( final HBaseFijiTable table, final String metaTableKey ) throws NoSuchColumnException { final HBaseColumnNameTranslator translator = table.getColumnNameTranslator(); // Everything between the prefix and the annotation key. final String hbaseColumnString = metaTableKey.substring(METATABLE_KEY_PREFIX.length(), metaTableKey.lastIndexOf('.')); // Everything before the first ':'. final String hbaseFamily = hbaseColumnString.substring(0, hbaseColumnString.indexOf(':')); // Everything after the first ':'. The +1 excludes the ':' itself. final String hbaseQualifier = hbaseColumnString.substring(hbaseColumnString.indexOf(':') + 1); final HBaseColumnName hbaseColumn = new HBaseColumnName(hbaseFamily, hbaseQualifier); return translator.toFijiColumnName(hbaseColumn); }
/** * Get the FijiColumnName encoded in the Key of a given KeyValue. * * @param kv KeyValue from which to get the encoded FijiColumnName. * @param translator for table. * @return the FijiColumnName encoded in the Key of a given KeyValue. */ private static FijiColumnName getKeyValueColumnName( final KeyValue kv, final HBaseColumnNameTranslator translator ) { final HBaseColumnName hBaseColumnName = new HBaseColumnName(kv.getFamily(), kv.getQualifier()); try { return translator.toFijiColumnName(hBaseColumnName); } catch (NoSuchColumnException nsce) { // This should not happen since it's only called on data returned by HBase. throw new IllegalStateException( String.format("Unknown column name in KeyValue: %s.", kv)); } }
fijiColumnName = columnNameTranslator.toFijiColumnName( new HBaseColumnName(familyEntry.getKey(), columnEntry.getKey())); } catch (NoSuchColumnException e) {
mLastQualifier = keyValue.getQualifier(); mLastColumn = mColumnTranslator.toFijiColumnName( new HBaseColumnName(keyValue.getFamily(), keyValue.getQualifier()));
next.getFamily(), next.getQualifier()); final FijiColumnName column = mColumnNameTranslator.toFijiColumnName(hbaseColumn);
try { mLastColumn = mColumnTranslator.toFijiColumnName( new HBaseColumnName(keyValue.getFamily(), keyValue.getQualifier())); } catch (NoSuchColumnException e) {
final HBaseColumnName hbaseColumn = new HBaseColumnName(kvs[i].getFamily(), kvs[i].getQualifier()); final FijiColumnName fijiColumn = translator.toFijiColumnName(hbaseColumn); qualifiers[i] = fijiColumn.getQualifier();