// Insert in JCR repository
wfResultItem.addLogInfo("STEP 4: Insert in JCR repository. initial digital object: " + dgoA.toString());
// Manage the Digital Object Data Registry:
wfResultItem.addLogInfo("Initialize JCR repository instance.");
JcrDigitalObjectManagerImpl dodm =
(JcrDigitalObjectManagerImpl) JcrDigitalObjectManagerImpl.getInstance();
DigitalObject dgoB = dodm.store(PERMANENT_URI_PATH, dgoA, true);
wfResultItem.addLogInfo("Completed storing in JCR repository: " + dgoB.toString());
wfResultItem.addLogInfo(new Message("JCRinsert", new Parameter("Digital Object", dgoB.getTitle()), new Parameter(
"Result", dgoB.getPermanentUri().toString())));
// Enrich digital object with format information from identification service
if (types != null) {
wfResultItem.addLogInfo("Identified formats count: " + types.length);
for (int i=0; i<types.length; i++) {
wfResultItem.addLogInfo("type[" + i + "]: " + types[i]);
}
if (types[0] != null) {
List<Property> pList = new ArrayList<Property>();
Property pIdentificationContent = new Property.Builder(URI.create("Identify"))
.name("content by reference")
.value(types[0].toString())
.description("This is a format for initial document identified by identification service")
.unit("URI")
.type("digital object format")
.build();
pList.add(pIdentificationContent);
Event eIdentifyFormat = new Event(
IDENTIFICATION_EVENT, System.currentTimeMillis() + "", new Double(DURATION),
new Agent("http://testbed-dev.planets-project.ait.ac.at:80/pserv-pc-droid/Droid?wsdl"
, identify.NAME, identify.QNAME.toString()),
pList);
dgoB = addEvent(dgoB, eIdentifyFormat, URI.create(types[0]));
List<Property> pMigrationList = new ArrayList<Property>();
Property pMigrationContent = new Property.Builder(URI.create("Migrate"))
.name("content by reference")
.value(types[0].toString())
.description("This is a migration event")
.unit("URI")
.type("digital object format")
.build();
pMigrationList.add(pMigrationContent);
Event eMigration = new Event(
MIGRATION_EVENT, System.currentTimeMillis() + "", new Double(DURATION),
new Agent(migrationEndpoint, migrate.NAME, migrate.QNAME.toString()),
pMigrationList);
dgoB = addEvent(dgoB, eMigration, null);
// add create SIP event
List<Property> pSipList = new ArrayList<Property>();
Property pSipContent = new Property.Builder(URI.create("CreateSIP"))
.name("SIP message")
.value(types[0].toString())
.description("This is a SIP message creation")
.unit("file")
.type("ZIP format")
.build();
pSipList.add(pSipContent);
Event eSip = new Event(
SIP_CREATION_EVENT, System.currentTimeMillis() + "", new Double(DURATION),
new Agent("ZIP file", "The SIP message creation", "ZIP"),
pSipList);
dgoB = addEvent(dgoB, eSip, null);
}
}
// Update digital object in JCR repository
wfResultItem.addLogInfo("STEP 5: Update digital object in JCR repository. initial digital object: " +
dgoB.toString());
dgoB = dodm.updateDigitalObject(dgoB, false);
wfResultItem.addLogInfo("Completed update in JCR repository. result digital object: " + dgoB.toString());
// Create SIP message (ZIP archive) and send it back to the initial repository
wfResultItem.addLogInfo(
"STEP 6: Send enriched digital object back to the initial repository as SIP. Create ZIP archive.");