throw new AttributeNotFoundException(
"Attribute name cannot be null");
}
if (value == null) {
throw new InvalidAttributeValueException(
"Attribute value for attribute " +
name + " cannot be null");
}
try {
if (name.equals(ATT_SET_READ_ONLY)) {
openConfig.setReadOnly(((Boolean) value).booleanValue());
} else if (name.equals(ATT_SET_TRANSACTIONAL)) {
openConfig.setTransactional(((Boolean) value).booleanValue());
} else if (name.equals(ATT_SET_SERIALIZABLE)) {
openConfig.setTxnSerializableIsolation(
((Boolean) value).booleanValue());
} else {
/* Set the specified attribute if the environment is open. */
if (targetEnv != null) {
EnvironmentMutableConfig config =
targetEnv.getMutableConfig();
if (name.equals(ATT_CACHE_SIZE)) {
config.setCacheSize(((Long) value).longValue());
targetEnv.setMutableConfig(config);
} else if (name.equals(ATT_CACHE_PERCENT)) {
config.setCachePercent(((Integer) value).intValue());
targetEnv.setMutableConfig(config);
} else {
throw new AttributeNotFoundException("attribute " +
name +
" is not valid.");
}
} else {
throw new AttributeNotFoundException("attribute " +
name +
" is not valid.");
}
}
} catch (NumberFormatException e) {
throw new InvalidAttributeValueException("attribute name=" + name);
} catch (DatabaseException e) {
throw new InvalidAttributeValueException("attribute name=" + name +
e.getMessage());
}
}