private String getDefaultConfigValue(String key) { if (key == null) return null; String defaultValue = null; try { Property p = Property.getPropertyByKey(key); if (p == null) return defaultValue; defaultValue = defaultConfig.get(p); } catch (IllegalArgumentException e) { // ignore } return defaultValue; }
public String getTableConfig(String key) { Property property = Property.getPropertyByKey(key); if (property == null || property.isSensitive()) throw new RuntimeException("Unable to access the configuration value " + key); return tableConfig.get(property); }
private static void exportConfig(ServerContext context, Table.ID tableID, ZipOutputStream zipOut, DataOutputStream dataOut) throws AccumuloException, AccumuloSecurityException, IOException { DefaultConfiguration defaultConfig = DefaultConfiguration.getInstance(); Map<String,String> siteConfig = context.instanceOperations().getSiteConfiguration(); Map<String,String> systemConfig = context.instanceOperations().getSystemConfiguration(); TableConfiguration tableConfig = context.getServerConfFactory().getTableConfiguration(tableID); OutputStreamWriter osw = new OutputStreamWriter(dataOut, UTF_8); // only put props that are different than defaults and higher level configurations zipOut.putNextEntry(new ZipEntry(Constants.EXPORT_TABLE_CONFIG_FILE)); for (Entry<String,String> prop : tableConfig) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { Property key = Property.getPropertyByKey(prop.getKey()); if (key == null || !defaultConfig.get(key).equals(prop.getValue())) { if (!prop.getValue().equals(siteConfig.get(prop.getKey())) && !prop.getValue().equals(systemConfig.get(prop.getKey()))) { osw.append(prop.getKey() + "=" + prop.getValue() + "\n"); } } } } osw.flush(); } }
public static boolean isPropertyValid(String property, String value) { Property p = Property.getPropertyByKey(property); return (p == null || p.getType().isValidFormat(value)) && Property.isValidTablePropertyKey(property); }
public static boolean isPropertyValid(String property, String value) { Property p = Property.getPropertyByKey(property); return (p == null || p.getType().isValidFormat(value)) && Property.isValidTablePropertyKey(property); }
/** * This helper method provides an AccumuloConfiguration object constructed from the Accumulo * defaults, and overridden with Accumulo properties that have been stored in the Job's * configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @since 1.6.0 */ public static AccumuloConfiguration getAccumuloConfiguration(Class<?> implementingClass, Configuration conf) { String prefix = enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "."; ConfigurationCopy acuConf = new ConfigurationCopy(DefaultConfiguration.getInstance()); for (Entry<String,String> entry : conf) if (entry.getKey().startsWith(prefix)) { String propString = entry.getKey().substring(prefix.length()); Property prop = Property.getPropertyByKey(propString); if (prop != null) { acuConf.set(prop, entry.getValue()); } else if (Property.isValidTablePropertyKey(propString)) { acuConf.set(propString, entry.getValue()); } else { throw new IllegalArgumentException("Unknown accumulo file property " + propString); } } return acuConf; }
String key = entry.getKey(); log.info("{} = {}", key, (Property.isSensitive(key) ? "<hidden>" : entry.getValue())); Property prop = Property.getPropertyByKey(key); if (prop != null && conf.isPropertySet(prop, false)) { if (prop.isDeprecated()) {
String key = entry.getKey(); String value = entry.getValue(); Property prop = Property.getPropertyByKey(entry.getKey()); if (prop == null && Property.isValidPropertyKey(key)) continue; // unknown valid property (i.e. has proper prefix)
if (defaults.containsKey(key) && !Property.getPropertyByKey(key).isExperimental()) { printConfLine(output, "default", key, dfault); printed = true;
private String getDefaultConfigValue(String key) { if (null == key) return null; String defaultValue = null; try { Property p = Property.getPropertyByKey(key); if (null == p) return defaultValue; defaultValue = defaultConfig.get(p); } catch (IllegalArgumentException e) { // ignore } return defaultValue; }
public String getTableConfig(String key) { Property property = Property.getPropertyByKey(key); if (property == null || property.isSensitive()) throw new RuntimeException("Unable to access the configuration value " + key); return tableConfig.get(property); }
private static void exportConfig(Connector conn, String tableID, ZipOutputStream zipOut, DataOutputStream dataOut) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException { DefaultConfiguration defaultConfig = AccumuloConfiguration.getDefaultConfiguration(); Map<String,String> siteConfig = conn.instanceOperations().getSiteConfiguration(); Map<String,String> systemConfig = conn.instanceOperations().getSystemConfiguration(); TableConfiguration tableConfig = ServerConfiguration.getTableConfiguration(conn.getInstance(), tableID); OutputStreamWriter osw = new OutputStreamWriter(dataOut, UTF_8); // only put props that are different than defaults and higher level configurations zipOut.putNextEntry(new ZipEntry(Constants.EXPORT_TABLE_CONFIG_FILE)); for (Entry<String,String> prop : tableConfig) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { Property key = Property.getPropertyByKey(prop.getKey()); if (key == null || !defaultConfig.get(key).equals(prop.getValue())) { if (!prop.getValue().equals(siteConfig.get(prop.getKey())) && !prop.getValue().equals(systemConfig.get(prop.getKey()))) { osw.append(prop.getKey() + "=" + prop.getValue() + "\n"); } } } } osw.flush(); } }
public static boolean isPropertyValid(String property, String value) { Property p = Property.getPropertyByKey(property); if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidTablePropertyKey(property)) return false; return true; }
public static boolean isPropertyValid(String property, String value) { Property p = Property.getPropertyByKey(property); if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidTablePropertyKey(property)) return false; return true; }
public static boolean isPropertyValid(String property, String value) { Property p = Property.getPropertyByKey(property); if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidTablePropertyKey(property)) return false; return true; }
for (Entry<String,String> prop : tableConfig) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { Property key = Property.getPropertyByKey(prop.getKey());
/** * This helper method provides an AccumuloConfiguration object constructed from the Accumulo * defaults, and overridden with Accumulo properties that have been stored in the Job's * configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @since 1.6.0 */ public static AccumuloConfiguration getAccumuloConfiguration(Class<?> implementingClass, Configuration conf) { String prefix = enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "."; ConfigurationCopy acuConf = new ConfigurationCopy( AccumuloConfiguration.getDefaultConfiguration()); for (Entry<String,String> entry : conf) if (entry.getKey().startsWith(prefix)) { String propString = entry.getKey().substring(prefix.length()); Property prop = Property.getPropertyByKey(propString); if (prop != null) { acuConf.set(prop, entry.getValue()); } else if (Property.isValidTablePropertyKey(propString)) { acuConf.set(propString, entry.getValue()); } else { throw new IllegalArgumentException("Unknown accumulo file property " + propString); } } return acuConf; }
/** * This helper method provides an AccumuloConfiguration object constructed from the Accumulo * defaults, and overridden with Accumulo properties that have been stored in the Job's * configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @since 1.6.0 */ public static AccumuloConfiguration getAccumuloConfiguration(Class<?> implementingClass, Configuration conf) { String prefix = enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "."; ConfigurationCopy acuConf = new ConfigurationCopy(DefaultConfiguration.getInstance()); for (Entry<String,String> entry : conf) if (entry.getKey().startsWith(prefix)) { String propString = entry.getKey().substring(prefix.length()); Property prop = Property.getPropertyByKey(propString); if (prop != null) { acuConf.set(prop, entry.getValue()); } else if (Property.isValidTablePropertyKey(propString)) { acuConf.set(propString, entry.getValue()); } else { throw new IllegalArgumentException("Unknown accumulo file property " + propString); } } return acuConf; }
/** * This helper method provides an AccumuloConfiguration object constructed from the Accumulo * defaults, and overridden with Accumulo properties that have been stored in the Job's * configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @since 1.6.0 */ public static AccumuloConfiguration getAccumuloConfiguration(Class<?> implementingClass, Configuration conf) { String prefix = enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "."; ConfigurationCopy acuConf = new ConfigurationCopy(DefaultConfiguration.getInstance()); for (Entry<String,String> entry : conf) if (entry.getKey().startsWith(prefix)) { String propString = entry.getKey().substring(prefix.length()); Property prop = Property.getPropertyByKey(propString); if (prop != null) { acuConf.set(prop, entry.getValue()); } else if (Property.isValidTablePropertyKey(propString)) { acuConf.set(propString, entry.getValue()); } else { throw new IllegalArgumentException("Unknown accumulo file property " + propString); } } return acuConf; }
public static boolean setSystemProperty(String property, String value) throws KeeperException, InterruptedException { Property p = Property.getPropertyByKey(property); if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidZooPropertyKey(property)) return false; // create the zk node for this property and set it's data to the specified value String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property; ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(UTF_8), NodeExistsPolicy.OVERWRITE); return true; }