logger.warn("ModuleConfiguration bean unavailable; getting Module bean");
levelValue = riModule.getParameter("level");
}
else {
logger.error("Cannot load ResourceIndex module definition from Spring config or Fedora config");
throw new ResourceIndexException("Cannot locate ResourceIndex module definition in Spring config or Fedora config");
}
}
else {
levelValue = m_riConfig.getParameter("level",Parameter.class).getValue();
}
int riLevel = Integer.parseInt(levelValue);
Map<String, String> aliasMap = new HashMap<String, String>();
Iterator<Parameter> it = m_riConfig.getParameters(Parameter.class).iterator();
Parameter p;
while (it.hasNext()) {
p = it.next();
String pName = p.getName();
String[] parts = pName.split(":");
if (parts.length == 2 && parts[0].equals("alias")) {
aliasMap.put(parts[1], p.getValue(p.getIsFilePath()));
}
}
System.out.println("Initializing triplestore interface...");
try {
if (m_conn instanceof MulgaraConnector){
String path = m_conn.getConfiguration().get("path");
dropIndex(path);
}
m_ri = new ResourceIndexImpl(m_conn, m_generator, riLevel, false);
m_ri.setAliasMap(aliasMap);
} catch (Exception e) {
logger.error("Failed to initialize new Resource Index",e);
e.printStackTrace(System.err);
throw new ResourceIndexException("Failed to initialize new Resource Index",
e);
}
}