/** * Get the Cassandra Fiji Partitions for the given cluster. * * @param htable An open connection to the HBase table. * @return The collection of Fiji partitions. * @throws IOException if a remote or network exception occurs. */ public static Collection<HBaseFijiPartition> getPartitions( final HTable htable ) throws IOException { final ImmutableList.Builder<HBaseFijiPartition> partitions = ImmutableList.builder(); NavigableMap<HRegionInfo, ServerName> regionLocations = htable.getRegionLocations(); for (Map.Entry<HRegionInfo, ServerName> regionLocation : regionLocations.entrySet()) { partitions.add( new HBaseFijiPartition( InetAddress.getByName(regionLocation.getValue().getHostname()), regionLocation.getKey().getStartKey(), regionLocation.getKey().getEndKey())); } return partitions.build(); } }