@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || !(obj instanceof VolumeChooserEnvironment)) { return false; } VolumeChooserEnvironment other = (VolumeChooserEnvironment) obj; return getScope() == other.getScope() && Objects.equals(getTableId(), other.getTableId()); }
private VolumeChooser getVolumeChooserForTable(VolumeChooserEnvironment env, ServerConfigurationFactory confFactory) { log.trace("Looking up property {} for table id: {}", TABLE_VOLUME_CHOOSER, env.getTableId()); final TableConfiguration tableConf = confFactory.getTableConfiguration(env.getTableId()); String clazz = tableConf.get(TABLE_VOLUME_CHOOSER); // fall back to global default scope, so setting only one default is necessary, rather than a // separate default for TABLE scope than other scopes if (clazz == null || clazz.isEmpty()) { clazz = confFactory.getSystemConfiguration().get(DEFAULT_SCOPED_VOLUME_CHOOSER); } if (clazz == null || clazz.isEmpty()) { String msg = "Property " + TABLE_VOLUME_CHOOSER + " or " + DEFAULT_SCOPED_VOLUME_CHOOSER + " must be a valid " + VolumeChooser.class.getSimpleName() + " to use the " + getClass().getSimpleName(); throw new VolumeChooserException(msg); } String context = getTableContext(tableConf); // can be null return createVolumeChooser(context, clazz, TABLE_VOLUME_CHOOSER, env.getTableId(), tableSpecificChooserCache); }
private String[] getPreferredVolumesForTable(VolumeChooserEnvironment env, ServerConfigurationFactory confFactory, String[] options) { log.trace("Looking up property {} + for Table id: {}", TABLE_PREFERRED_VOLUMES, env.getTableId()); final TableConfiguration tableConf = confFactory.getTableConfiguration(env.getTableId()); String preferredVolumes = tableConf.get(TABLE_PREFERRED_VOLUMES); // fall back to global default scope, so setting only one default is necessary, rather than a // separate default for TABLE scope than other scopes if (preferredVolumes == null || preferredVolumes.isEmpty()) { preferredVolumes = confFactory.getSystemConfiguration().get(DEFAULT_SCOPED_PREFERRED_VOLUMES); } // throw an error if volumes not specified or empty if (preferredVolumes == null || preferredVolumes.isEmpty()) { String msg = "Property " + TABLE_PREFERRED_VOLUMES + " or " + DEFAULT_SCOPED_PREFERRED_VOLUMES + " must be a subset of " + Arrays.toString(options) + " to use the " + getClass().getSimpleName(); throw new VolumeChooserException(msg); } return parsePreferred(TABLE_PREFERRED_VOLUMES, preferredVolumes, options); }
serverConfs = localConf; TableConfiguration tableConf = localConf.getTableConfiguration(env.getTableId()); final Map<String,String> props = new HashMap<>(); tableConf.getProperties(props, PREFERRED_VOLUMES_FILTER); log.trace("In custom chooser"); log.trace("Volumes: " + volumes); log.trace("TableID: " + env.getTableId());
serverConfs = localConf; final TableConfiguration tableConf = localConf.getTableConfiguration(env.getTableId()); chooser = tableSpecificChooser.get(env.getTableId()); if (chooser == null) { VolumeChooser temp = Property.createTableInstanceFromPropertyName(tableConf, Property.TABLE_VOLUME_CHOOSER, VolumeChooser.class, fallbackVolumeChooser); chooser = tableSpecificChooser.putIfAbsent(env.getTableId(), temp); if (chooser == null) { chooser = temp; VolumeChooser last = tableSpecificChooser.replace(env.getTableId(), temp); if (chooser.equals(last)) { chooser = temp;