throws AttributeNotFoundException,
MBeanException {
/* Sanity check. */
if (attributeName == null) {
throw new AttributeNotFoundException
("Attribute name cannot be null");
}
/* These attributes are available regardless of environment state. */
try {
if (attributeName.equals(ATT_ENV_HOME)) {
return environmentHome.getCanonicalPath();
} else if (attributeName.equals(ATT_OPEN)) {
boolean envIsOpen = (targetEnv != null);
resetIfOpenStateChanged(envIsOpen);
return new Boolean(envIsOpen);
} else if (attributeName.equals(ATT_SET_READ_ONLY)) {
return new Boolean(openConfig.getReadOnly());
} else if (attributeName.equals(ATT_SET_TRANSACTIONAL)) {
return new Boolean(openConfig.getTransactional());
} else if (attributeName.equals(ATT_SET_SERIALIZABLE)) {
return new Boolean(openConfig.getTxnSerializableIsolation());
} else {
/* The rest are JE environment attributes. */
if (targetEnv != null) {
EnvironmentConfig config = targetEnv.getConfig();
if (attributeName.equals(ATT_IS_READ_ONLY)) {
return new Boolean(config.getReadOnly());
} else if (attributeName.equals(ATT_IS_TRANSACTIONAL)) {
return new Boolean(config.getTransactional());
} else if (attributeName.equals(ATT_CACHE_SIZE)) {
return new Long(config.getCacheSize());
} else if (attributeName.equals(ATT_CACHE_PERCENT)) {
return new Integer(config.getCachePercent());
} else if (attributeName.equals(ATT_LOCK_TIMEOUT)) {
return new Long(config.getLockTimeout());
} else if (attributeName.equals(ATT_IS_SERIALIZABLE)) {
return new
Boolean(config.getTxnSerializableIsolation());
} else if (attributeName.equals(ATT_TXN_TIMEOUT)) {
return new Long(config.getTxnTimeout());
} else {
throw new AttributeNotFoundException
("attribute " + attributeName + " is not valid.");
}
}
return null;
}