public SiteConfiguration(URL accumuloPropsLocation, Map<String,String> overrides) { config = createMap(accumuloPropsLocation, overrides); ConfigSanityCheck.validate(config.entrySet()); }
log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); verifyValidClassName(key, cryptoStrategy, CryptoService.class); checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000));
private static void checkTimeDuration(Property prop, String value, CheckTimeDuration chk) { verifyPropertyTypes(PropertyType.TIMEDURATION, prop); if (!chk.check(ConfigurationTypeHelper.getTimeInMillis(value))) fatal(PREFIX + chk.getDescription(prop)); }
log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000));
/** * Verifies a configured option is a legal class and has a required base class. * * @param confOption * The Property key name * @param className * The Property value, the string representation of a class to be loaded * @param requiredBaseClass * The base class required for the className */ private static void verifyValidClassName(String confOption, String className, Class<?> requiredBaseClass) { try { ConfigurationTypeHelper.getClassInstance(null, className, requiredBaseClass); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IOException e) { fatal(confOption + " has an invalid class name: " + className); } catch (ClassCastException e) { fatal(confOption + " must implement " + requiredBaseClass + ", but the configured class does not: " + className); } } }
private static void verifyPropertyTypes(PropertyType type, Property... properties) { for (Property prop : properties) if (prop.getType() != type) fatal("Unexpected property type (" + prop.getType() + " != " + type + ")"); }
@Override public NamespaceConfiguration getNamespaceConfiguration(Namespace.ID namespaceId) { NamespaceConfiguration conf; // can't hold the lock during the construction and validation of the config, // which may result in creating multiple objects for the same id, but that's ok. synchronized (namespaceConfigs) { conf = namespaceConfigs.get(instanceID).get(namespaceId); } if (conf == null) { // changed - include instance in constructor call conf = new NamespaceConfiguration(namespaceId, context, getSystemConfiguration()); conf.setZooCacheFactory(zcf); ConfigSanityCheck.validate(conf); synchronized (namespaceConfigs) { namespaceConfigs.get(instanceID).put(namespaceId, conf); } } return conf; }
private static void checkTimeDuration(Property prop, String value, CheckTimeDuration chk) { verifyPropertyTypes(PropertyType.TIMEDURATION, prop); if (!chk.check(AccumuloConfiguration.getTimeInMillis(value))) fatal(PREFIX + chk.getDescription(prop)); }
private static void verifyPropertyTypes(PropertyType type, Property... properties) { for (Property prop : properties) if (prop.getType() != type) fatal("Unexpected property type (" + prop.getType() + " != " + type + ")"); }
public NamespaceConfiguration getNamespaceConfigurationForTable(Table.ID tableId) { NamespaceConfiguration conf; synchronized (tableParentConfigs) { conf = tableParentConfigs.get(instanceID).get(tableId); } // can't hold the lock during the construction and validation of the config, // which may result in creating multiple objects for the same id, but that's ok. if (conf == null) { Namespace.ID namespaceId; try { namespaceId = Tables.getNamespaceId(context, tableId); } catch (TableNotFoundException e) { throw new RuntimeException(e); } conf = new NamespaceConfiguration(namespaceId, context, getSystemConfiguration()); ConfigSanityCheck.validate(conf); synchronized (tableParentConfigs) { tableParentConfigs.get(instanceID).put(tableId, conf); } } return conf; }
ConfigSanityCheck.validate(conf); synchronized (tableConfigs) { Map<Table.ID,TableConfiguration> configs = tableConfigs.get(instanceID);
/** * Gets an instance of this class. A new instance is only created on the first call. * * @throws RuntimeException * if the configuration is invalid */ synchronized public static SiteConfiguration getInstance() { if (instance == null) { instance = new SiteConfiguration(); ConfigSanityCheck.validate(instance); } return instance; }
public static TableConfiguration getTableConfiguration(Instance instance, String tableId) { checkPermissions(); synchronized (tableInstances) { TableConfiguration conf = tableInstances.get(tableId); if (conf == null) { conf = new TableConfiguration(instance.getInstanceID(), tableId, getSystemConfiguration(instance)); ConfigSanityCheck.validate(conf); tableInstances.put(tableId, conf); } return conf; } }
@Override public NamespaceConfiguration getNamespaceConfiguration(String namespaceId) { checkPermissions(); NamespaceConfiguration conf; // can't hold the lock during the construction and validation of the config, // which may result in creating multiple objects for the same id, but that's ok. synchronized (namespaceConfigs) { conf = namespaceConfigs.get(instanceID).get(namespaceId); } if (conf == null) { // changed - include instance in constructor call conf = new NamespaceConfiguration(namespaceId, instance, getConfiguration()); conf.setZooCacheFactory(zcf); ConfigSanityCheck.validate(conf); synchronized (namespaceConfigs) { namespaceConfigs.get(instanceID).put(namespaceId, conf); } } return conf; }
public NamespaceConfiguration getNamespaceConfigurationForTable(String tableId) { checkPermissions(); NamespaceConfiguration conf; synchronized (tableParentConfigs) { conf = tableParentConfigs.get(instanceID).get(tableId); } // can't hold the lock during the construction and validation of the config, // which may result in creating multiple objects for the same id, but that's ok. if (conf == null) { String namespaceId; try { namespaceId = Tables.getNamespaceId(instance, tableId); } catch (TableNotFoundException e) { throw new RuntimeException(e); } conf = new NamespaceConfiguration(namespaceId, instance, getConfiguration()); ConfigSanityCheck.validate(conf); synchronized (tableParentConfigs) { tableParentConfigs.get(instanceID).put(tableId, conf); } } return conf; }
ConfigSanityCheck.validate(conf); synchronized (tableConfigs) { Map<String,TableConfiguration> configs = tableConfigs.get(instanceID);