@Test public void testGetIndices() throws Exception { MockIndex ix1 = new MockIndex("foo", 0, true, "a".getBytes(), "b".getBytes(), "c", "d"); MockIndex ix2 = new MockIndex("bar", 0, true, "e".getBytes(), "f".getBytes(), "g", "h"); Configuration conf = CConfiguration.getDefault(); Client client = new Client(conf); client.addIndex(ix1); client.addIndex(ix2); Assert.assertNotNull(client.getIndices()); }
public Index[] getIndices() { String[] indexNames = this.configuration.getStrings(INDEXES_CONF_KEY); int arrayLength = indexNames == null ? 0 : indexNames.length; Index[] indices = new Index[arrayLength]; for (int i = 0; i < arrayLength; i++) { String name = indexNames[i]; Class<?> indexClass = configuration.getClass(indexClassConfKey(name), null); Configuration indexConf = ConfUtils.unpackConfigurationInPrefix( indexConfPrefix(name), configuration); Index index; try { index = Index.class.cast(indexClass.newInstance()); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } index.setConf(indexConf); indices[i] = index; } return indices; }
Client { public Index[] getIndices() { String[] indexNames = this.configuration.getStrings(INDEXES_CONF_KEY); int arrayLength = indexNames == null ? 0 : indexNames.length; Index[] indices = new Index[arrayLength]; for (int i = 0; i < arrayLength; i++) { String name = indexNames[i]; Class<?> indexClass = configuration.getClass(indexClassConfKey(name), null); Configuration indexConf = ConfUtils.unpackConfigurationInPrefix( indexConfPrefix(name), configuration); Index index; try { index = Index.class.cast(indexClass.newInstance()); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } index.setConf(indexConf); indices[i] = index; } return indices; } }
Client { public Index[] getIndices() { String[] indexNames = this.configuration.getStrings(INDEXES_CONF_KEY); int arrayLength = indexNames == null ? 0 : indexNames.length; Index[] indices = new Index[arrayLength]; for (int i = 0; i < arrayLength; i++) { String name = indexNames[i]; Class<?> indexClass = configuration.getClass(indexClassConfKey(name), null); Configuration indexConf = ConfUtils.unpackConfigurationInPrefix( indexConfPrefix(name), configuration); Index index; try { index = Index.class.cast(indexClass.newInstance()); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } index.setConf(indexConf); indices[i] = index; } return indices; } Client(Configuration conf); }
Client { public Index[] getIndices() { String[] indexNames = this.configuration.getStrings(INDEXES_CONF_KEY); int arrayLength = indexNames == null ? 0 : indexNames.length; Index[] indices = new Index[arrayLength]; for (int i = 0; i < arrayLength; i++) { String name = indexNames[i]; Class<?> indexClass = configuration.getClass(indexClassConfKey(name), null); Configuration indexConf = ConfUtils.unpackConfigurationInPrefix( indexConfPrefix(name), configuration); Index index; try { index = Index.class.cast(indexClass.newInstance()); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } index.setConf(indexConf); indices[i] = index; } return indices; } Client(Configuration conf); void put(String tableName, Put put); HashMap<String, Index> getIndexMap(); Iterator<Result> query(Constraint query); Index[] getIndices(); Index[] getIndicesForTable(String tableName); Index getIndexByName(String string); Index[] getIndicesForColumn(String table, byte[] family,
      byte[] qualifier); void addIndex(Index index); Configuration getConf(); static void setDatabase(DatabaseAdapter db, Configuration conf); static void setDatabaseAdapter(Configuration conf,
      Class<? extends DatabaseAdapter> adapterClass); boolean tableExists(String tableName); boolean verify(); }
Client { public Index[] getIndices() { String[] indexNames = this.configuration.getStrings(INDEXES_CONF_KEY); int arrayLength = indexNames == null ? 0 : indexNames.length; Index[] indices = new Index[arrayLength]; for (int i = 0; i < arrayLength; i++) { String name = indexNames[i]; Class<?> indexClass = configuration.getClass(indexClassConfKey(name), null); Configuration indexConf = ConfUtils.unpackConfigurationInPrefix( indexConfPrefix(name), configuration); Index index; try { index = Index.class.cast(indexClass.newInstance()); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } index.setConf(indexConf); indices[i] = index; } return indices; } Client(Configuration conf); void put(String tableName, Put put); HashMap<String, Index> getIndexMap(); Iterator<Result> query(Constraint query); Index[] getIndices(); Index[] getIndicesForTable(String tableName); Index getIndexByName(String string); Index[] getIndicesForColumn(String table, byte[] family,
      byte[] qualifier); void addIndex(Index index); Configuration getConf(); static void setDatabase(DatabaseAdapter db, Configuration conf); static void setDatabaseAdapter(Configuration conf,
      Class<? extends DatabaseAdapter> adapterClass); boolean tableExists(String tableName); boolean verify();  }