* is replaced with the new one.
*/
private void preIngestIfNeeded(boolean firstRun,
DOManager doManager,
RDFName objectName) throws Exception {
PID pid = new PID(objectName.uri.substring("info:fedora/".length()));
boolean exists = doManager.objectExists(pid.toString());
if (exists && firstRun) {
logger.info("Purging old system object: " + pid.toString());
Context context = ReadOnlyContext.getContext(null,
null,
null,
false);
DOWriter w = doManager.getWriter(USE_DEFINITIVE_STORE,
context,
pid.toString());
w.remove();
try {
w.commit("Purged by Fedora at startup (to be re-ingested)");
exists = false;
} finally {
doManager.releaseWriter(w);
}
}
if (!exists) {
logger.info("Ingesting new system object: " + pid.toString());
InputStream xml = getStream("org/fcrepo/server/resources/"
+ pid.toFilename() + ".xml");
Context context = ReadOnlyContext.getContext(null,
null,
null,
false);
DOWriter w = doManager.getIngestWriter(USE_DEFINITIVE_STORE,