private int getRequiredInt(String name, int min, int max) throws ModuleInitializationException { try { int value = Integer.parseInt(getRequired(name)); if (value < min || value > max) { throw new ModuleInitializationException(name + " parameter is out of range, expected [" + min + "-" + max + "]", getRole()); } return value; } catch (NumberFormatException e) { throw new ModuleInitializationException(name + " parameter must be " + "an integer", getRole()); } }
private boolean getBoolean(String name, boolean defaultValue) throws ModuleInitializationException { String value = getParameter(name); if (value == null) { return defaultValue; } value = value.toLowerCase(); if (value.equals("true") || value.equals("yes") || value.equals("on")) { return true; } else if (value.equals("false") || value.equals("no") || value.equals("off")) { return false; } else { throw new ModuleInitializationException(name + " parameter, if " + "specified, must be a boolean (true or false)", getRole()); } }
private boolean getBoolean(String name, boolean defaultValue) throws ModuleInitializationException { String value = getParameter(name); if (value == null) { return defaultValue; } value = value.toLowerCase(); if (value.equals("true") || value.equals("yes") || value.equals("on")) { return true; } else if (value.equals("false") || value.equals("no") || value.equals("off")) { return false; } else { throw new ModuleInitializationException(name + " parameter, if " + "specified, must be a boolean (true or false)", getRole()); } }
private int getRequiredInt(String name, int min, int max) throws ModuleInitializationException { try { int value = Integer.parseInt(getRequired(name)); if (value < min || value > max) { throw new ModuleInitializationException(name + " parameter is out of range, expected [" + min + "-" + max + "]", getRole()); } return value; } catch (NumberFormatException e) { throw new ModuleInitializationException(name + " parameter must be " + "an integer", getRole()); } }
private String getRequired(String name) throws ModuleInitializationException { String value = getParameter(name); if (value != null) { return value; } else { throw new ModuleInitializationException(name + " parameter " + "is required", getRole()); } }
private String getRequired(String name) throws ModuleInitializationException { String value = getParameter(name); if (value != null) { return value; } else { throw new ModuleInitializationException(name + " parameter " + "is required", getRole()); } }
/** * Shutdown the RI module by closing the wrapped ResourceIndex. * * @throws ModuleShutdownException * if any error occurs while closing. */ @Override public void shutdownModule() throws ModuleShutdownException { if (_ri != null) { try { _ri.close(); } catch (TrippiException e) { throw new ModuleShutdownException("Error closing RI", getRole(), e); } } }
/** * Shutdown the RI module by closing the wrapped ResourceIndex. * * @throws ModuleShutdownException * if any error occurs while closing. */ @Override public void shutdownModule() throws ModuleShutdownException { if (_ri != null) { try { _ri.close(); } catch (TrippiException e) { throw new ModuleShutdownException("Error closing RI", getRole(), e); } } }
private TriplestoreConnector getConnector(Parameterized datastore) throws Exception { if (datastore == null) { throw new ModuleInitializationException("Specifed datastore " + "does not exist in fedora.fcfg", getRole()); } Map<String, String> config = datastore.getParameters(); // make sure path, if specified and relative, is translated // to an absolute path based on the value of FEDORA_HOME String path = config.get("path"); if (path != null) { config.put("path", datastore.getParameter("path", true)); } String className = config.get("connectorClassName"); if (className == null) { throw new ResourceIndexException("Required datastore parameter " + "is missing: connectorClassName"); } getServer().getStatusFile().append(ServerState.STARTING, "Initializing Triplestore"); return TriplestoreConnector.init(className, config); }
private TriplestoreConnector getConnector(Parameterized datastore) throws Exception { if (datastore == null) { throw new ModuleInitializationException("Specifed datastore " + "does not exist in fedora.fcfg", getRole()); } Map<String, String> config = datastore.getParameters(); // make sure path, if specified and relative, is translated // to an absolute path based on the value of FEDORA_HOME String path = config.get("path"); if (path != null) { config.put("path", datastore.getParameter("path", true)); } String className = config.get("connectorClassName"); if (className == null) { throw new ResourceIndexException("Required datastore parameter " + "is missing: connectorClassName"); } getServer().getStatusFile().append(ServerState.STARTING, "Initializing Triplestore"); return TriplestoreConnector.init(className, config); }