String port = getServer().getParameter("fedoraServerPort");
if (port == null) {
throw new ModuleInitializationException("fedoraServerPort must be specified as primary server config element.",
getRole());
}
Module mgr = getServer().getModule("org.fcrepo.server.storage.DOManager");
if (mgr == null) {
throw new ModuleInitializationException("DOManager is required (for pidNamespace param), but isn't loaded.",
getRole());
}
String pidNamespace = mgr.getParameter("pidNamespace");
if (pidNamespace == null) {
throw new ModuleInitializationException("DOManager did not specify a pidNamespace, but this module requires that it does.",
getRole());
}
String aes = getParameter("adminEmails");
if (aes == null) {
throw new ModuleInitializationException("adminEmails must be specified.",
getRole());
}
HashSet<String> adminEmails = new HashSet<String>();
if (aes.indexOf(" ") == -1) {
adminEmails.add(aes);
} else {
String[] emails = aes.split(" ");
for (String element : emails) {
adminEmails.add(element);
}
}
HashSet<String> friends = new HashSet<String>();
if (getParameter("friends") != null) {
String f = getParameter("friends");
if (f.indexOf(" ") == -1) {
friends.add(f);
} else {
String[] fs = f.split(" ");
for (String element : fs) {
friends.add(element);
}
}
}
FieldSearch fieldSearch =
(FieldSearch) getServer()
.getModule("org.fcrepo.server.search.FieldSearch");
if (fieldSearch == null) {
throw new ModuleInitializationException("FieldSearch module was not loaded, but is required.",
getRole());
}
Module fsModule =
getServer().getModule("org.fcrepo.server.search.FieldSearch");
if (fsModule.getParameter("maxResults") == null) {
throw new ModuleInitializationException("maxResults parameter must be specified in FieldSearch module's configuration.",
getRole());
}
int maxResults = 0;
try {
maxResults = Integer.parseInt(fsModule.getParameter("maxResults"));
if (maxResults < 1) {
throw new NumberFormatException("");
}
} catch (NumberFormatException nfe) {
throw new ModuleInitializationException("maxResults specified in FieldSearch module's configuration must be a positive integer.",