/** * Add supplied locality groups information to a NewTableConfiguration object. * * Used in conjunction with createtable shell command to allow locality groups to be configured * upon table creation. */ private NewTableConfiguration setLocalityForNewTable(CommandLine cl, NewTableConfiguration ntc) { HashMap<String,Set<Text>> localityGroupMap = new HashMap<>(); String[] options = cl.getOptionValues(createTableOptLocalityProps.getOpt()); for (String localityInfo : options) { final String parts[] = localityInfo.split("=", 2); if (parts.length < 2) throw new IllegalArgumentException("Missing '=' or there are spaces between entries"); final String groupName = parts[0]; final HashSet<Text> colFams = new HashSet<>(); for (String family : parts[1].split(",")) colFams.add(new Text(family.getBytes(Shell.CHARSET))); // check that group names are not duplicated on usage line if (localityGroupMap.put(groupName, colFams) != null) throw new IllegalArgumentException( "Duplicate locality group name found. Group names must be unique"); } ntc.setLocalityGroups(localityGroupMap); return ntc; }
ntc.setLocalityGroups(Collections.singletonMap(ColumnConstants.NOTIFY_LOCALITY_GROUP_NAME, Collections.singleton(new Text(ColumnConstants.NOTIFY_CF.toArray()))));