[DS-2034] Check for null (unset) properties and replace with an indicator

This commit is contained in:
Mark H. Wood
2014-08-27 15:36:26 -04:00
parent 498d0e4e2e
commit 77db25cc25

View File

@@ -473,63 +473,73 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
} }
} }
} }
private static final String T_UNSET = "UNSET";
/**
* Guarantee a non-null String.
*
* @param value candidate string.
* @return {@code value} or a constant indicating an unset value.
*/
private static String notnull(String value) { return null == value ? T_UNSET : value; }
/** /**
* List important DSpace configuration parameters. * List important DSpace configuration parameters.
*/ */
private void addDSpaceConfiguration(Division div) throws WingException private void addDSpaceConfiguration(Division div) throws WingException
{ {
// LIST: DSpace // LIST: DSpace
List dspace = div.addList("dspace"); List dspace = div.addList("dspace");
dspace.setHead(T_DSPACE_HEAD); dspace.setHead(T_DSPACE_HEAD);
dspace.addLabel(T_DSPACE_VERSION); dspace.addLabel(T_DSPACE_VERSION);
dspace.addItem(Util.getSourceVersion()); dspace.addItem(Util.getSourceVersion());
dspace.addLabel(T_DSPACE_DIR); dspace.addLabel(T_DSPACE_DIR);
dspace.addItem(ConfigurationManager.getProperty("dspace.dir")); dspace.addItem(notnull(ConfigurationManager.getProperty("dspace.dir")));
dspace.addLabel(T_DSPACE_URL); dspace.addLabel(T_DSPACE_URL);
dspace.addItem(ConfigurationManager.getProperty("dspace.url")); dspace.addItem(notnull(ConfigurationManager.getProperty("dspace.url")));
dspace.addLabel(T_DSPACE_HOST_NAME); dspace.addLabel(T_DSPACE_HOST_NAME);
dspace.addItem(ConfigurationManager.getProperty("dspace.hostname")); dspace.addItem(notnull(ConfigurationManager.getProperty("dspace.hostname")));
dspace.addLabel(T_DSPACE_NAME); dspace.addLabel(T_DSPACE_NAME);
dspace.addItem(ConfigurationManager.getProperty("dspace.name")); dspace.addItem(notnull(ConfigurationManager.getProperty("dspace.name")));
dspace.addLabel(T_DB_NAME); dspace.addLabel(T_DB_NAME);
dspace.addItem(ConfigurationManager.getProperty("db.name")); dspace.addItem(notnull(ConfigurationManager.getProperty("db.name")));
dspace.addLabel(T_DB_URL); dspace.addLabel(T_DB_URL);
dspace.addItem(ConfigurationManager.getProperty("db.url")); dspace.addItem(notnull(ConfigurationManager.getProperty("db.url")));
dspace.addLabel(T_DB_DRIVER); dspace.addLabel(T_DB_DRIVER);
dspace.addItem(ConfigurationManager.getProperty("db.driver")); dspace.addItem(notnull(ConfigurationManager.getProperty("db.driver")));
dspace.addLabel(T_DB_MAX_CONN);
dspace.addItem(ConfigurationManager.getProperty("db.maxconnections"));
dspace.addLabel(T_DB_MAX_CONN);
dspace.addItem(notnull(ConfigurationManager.getProperty("db.maxconnections")));
dspace.addLabel(T_DB_MAX_WAIT); dspace.addLabel(T_DB_MAX_WAIT);
dspace.addItem(ConfigurationManager.getProperty("db.maxwait")); dspace.addItem(notnull(ConfigurationManager.getProperty("db.maxwait")));
dspace.addLabel(T_DB_MAX_IDLE); dspace.addLabel(T_DB_MAX_IDLE);
dspace.addItem(ConfigurationManager.getProperty("db.maxidle")); dspace.addItem(notnull(ConfigurationManager.getProperty("db.maxidle")));
dspace.addLabel(T_MAIL_SERVER); dspace.addLabel(T_MAIL_SERVER);
dspace.addItem(ConfigurationManager.getProperty("mail.server")); dspace.addItem(notnull(ConfigurationManager.getProperty("mail.server")));
dspace.addLabel(T_MAIL_FROM_ADDRESS); dspace.addLabel(T_MAIL_FROM_ADDRESS);
dspace.addItem(ConfigurationManager.getProperty("mail.from.address")); dspace.addItem(notnull(ConfigurationManager.getProperty("mail.from.address")));
dspace.addLabel(T_FEEDBACK_RECIPIENT); dspace.addLabel(T_FEEDBACK_RECIPIENT);
dspace.addItem(ConfigurationManager.getProperty("feedback.recipient")); dspace.addItem(notnull(ConfigurationManager.getProperty("feedback.recipient")));
dspace.addLabel(T_MAIL_ADMIN); dspace.addLabel(T_MAIL_ADMIN);
dspace.addItem(ConfigurationManager.getProperty("mail.admin")); dspace.addItem(notnull(ConfigurationManager.getProperty("mail.admin")));
} }
/** /**
* Add a section that allows administrators to activate or deactivate system-wide alerts. * Add a section that allows administrators to activate or deactivate system-wide alerts.
*/ */