//
// get and validate maxResults
//
if (getParameter("maxResults") == null) {
throw new ModuleInitializationException("maxResults parameter must be specified.",
getRole());
}
int maxResults = 0;
try {
maxResults = Integer.parseInt(getParameter("maxResults"));
if (maxResults < 1) {
throw new NumberFormatException("");
}
} catch (NumberFormatException nfe) {
throw new ModuleInitializationException("maxResults must be a positive integer.",
getRole());
}
//
// get and validate maxSecondsPerSession
//
if (getParameter("maxSecondsPerSession") == null) {
throw new ModuleInitializationException("maxSecondsPerSession parameter must be specified.",
getRole());
}
int maxSecondsPerSession = 0;
try {
maxSecondsPerSession =
Integer.parseInt(getParameter("maxSecondsPerSession"));
if (maxSecondsPerSession < 1) {
throw new NumberFormatException("");
}
} catch (NumberFormatException nfe) {
throw new ModuleInitializationException("maxSecondsPerSession must be a positive integer.",
getRole());
}
//
// get indexDCFields parameter (default to true if unspecified)
//
boolean indexDCFields = true;
String indexDCFieldsValue = getParameter("indexDCFields");
if (indexDCFieldsValue != null) {
String val = indexDCFieldsValue.trim().toLowerCase();
if (val.equals("false") || val.equals("no")) {
indexDCFields = false;
} else if (!val.equals("true") && !val.equals("yes")) {
throw new ModuleInitializationException("indexDCFields param "
+ "was not a boolean", getRole());
}
}
//
// get connectionPool from ConnectionPoolManager
//
ConnectionPoolManager cpm =
(ConnectionPoolManager) getServer()
.getModule("org.fcrepo.server.storage.ConnectionPoolManager");
if (cpm == null) {
throw new ModuleInitializationException("ConnectionPoolManager module was required, but apparently has "
+ "not been loaded.",
getRole());
}
String cPoolName = getParameter("connectionPool");
ConnectionPool cPool = null;
try {
if (cPoolName == null) {
logger.debug("connectionPool unspecified; using default from "
+ "ConnectionPoolManager.");
cPool = cpm.getPool();
} else {
logger.debug("connectionPool specified: " + cPoolName);
cPool = cpm.getPool(cPoolName);
}
} catch (ConnectionPoolNotFoundException cpnfe) {
throw new ModuleInitializationException("Could not find requested "
+ "connectionPool.", getRole());
}
//
// get the doManager
//
DOManager doManager =
(DOManager) getServer()
.getModule("org.fcrepo.server.storage.DOManager");
if (doManager == null) {
throw new ModuleInitializationException("DOManager module was required, but apparently has "
+ "not been loaded.",
getRole());
}
//
// things look ok...get the wrapped instance