public void visit(State state, Properties props) throws Exception {
// reset any previous setting
Object lastSetting = state.getMap().get(LAST_SETTING);
if (lastSetting != null) {
int choice = Integer.parseInt(lastSetting.toString());
Property property = settings[choice].property;
log.debug("Setting " + property.getKey() + " back to " + property.getDefaultValue());
state.getConnector().instanceOperations().setProperty(property.getKey(), property.getDefaultValue());
}
lastSetting = state.getMap().get(LAST_TABLE_SETTING);
if (lastSetting != null) {
String parts[] = lastSetting.toString().split(",");
String table = parts[0];
int choice = Integer.parseInt(parts[1]);
Property property = tableSettings[choice].property;
if (state.getConnector().tableOperations().exists(table)) {
log.debug("Setting " + property.getKey() + " on " + table + " back to " + property.getDefaultValue());
try {
state.getConnector().tableOperations().setProperty(table, property.getKey(), property.getDefaultValue());
} catch (AccumuloException ex) {
if (ex.getCause() instanceof ThriftTableOperationException) {
ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause();
if (ttoe.type == TableOperationExceptionType.NOTFOUND)
return;
}
throw ex;
}
}
}
lastSetting = state.getMap().get(LAST_NAMESPACE_SETTING);
if (lastSetting != null) {
String parts[] = lastSetting.toString().split(",");
String namespace = parts[0];
int choice = Integer.parseInt(parts[1]);
Property property = tableSettings[choice].property;
if (state.getConnector().namespaceOperations().exists(namespace)) {
log.debug("Setting " + property.getKey() + " on " + namespace + " back to " + property.getDefaultValue());
try {
state.getConnector().namespaceOperations().setProperty(namespace, property.getKey(), property.getDefaultValue());
} catch (AccumuloException ex) {
if (ex.getCause() instanceof ThriftTableOperationException) {
ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause();
if (ttoe.type == TableOperationExceptionType.NAMESPACE_NOTFOUND)
return;