mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
AIP Work -- Minor tweaks to AIP METS generation, so that METS manifest is generated the same each time & so that it includes DSpace software version information. In other words, if the DSpace Object is unchanged & DSpace software version is unchanged, then the METS manifest should be unchanged (i.e. identical checksums). Previously, the METS manifest would change each time it was generated as it included a timestamp of when it was generated, etc. (NOTE: Once METS AIP is compressed into a ZIP, the checksum of the ZIP will still change each time, as the ZIP format contains a timestamp based on when the compressed file(s) were generated. Not sure if there's any way around that.)
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5352 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -84,6 +84,7 @@ import java.io.FileOutputStream;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import org.dspace.app.util.Util;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.authorize.AuthorizeManager;
|
import org.dspace.authorize.AuthorizeManager;
|
||||||
import org.dspace.content.Bitstream;
|
import org.dspace.content.Bitstream;
|
||||||
@@ -286,7 +287,7 @@ public abstract class AbstractMETSDisseminator
|
|||||||
// map of extra streams to put in Zip (these are located during makeManifest())
|
// map of extra streams to put in Zip (these are located during makeManifest())
|
||||||
MdStreamCache extraStreams = new MdStreamCache();
|
MdStreamCache extraStreams = new MdStreamCache();
|
||||||
ZipOutputStream zip = new ZipOutputStream(pkg);
|
ZipOutputStream zip = new ZipOutputStream(pkg);
|
||||||
zip.setComment("METS archive created by DSpace METSDisseminationCrosswalk");
|
zip.setComment("METS archive created by DSpace " + Util.getSourceVersion());
|
||||||
Mets manifest = makeManifest(context, dso, params, extraStreams);
|
Mets manifest = makeManifest(context, dso, params, extraStreams);
|
||||||
|
|
||||||
// copy extra (metadata, license, etc) bitstreams into zip, update manifest
|
// copy extra (metadata, license, etc) bitstreams into zip, update manifest
|
||||||
@@ -714,7 +715,7 @@ public abstract class AbstractMETSDisseminator
|
|||||||
Mets mets = new Mets();
|
Mets mets = new Mets();
|
||||||
|
|
||||||
// this ID should be globally unique
|
// this ID should be globally unique
|
||||||
mets.setID("dspace"+Utils.generateKey());
|
mets.setID("dspace" + dso.hashCode());
|
||||||
|
|
||||||
// identifies the object described by this document
|
// identifies the object described by this document
|
||||||
mets.setOBJID(makePersistentID(dso));
|
mets.setOBJID(makePersistentID(dso));
|
||||||
|
@@ -42,11 +42,11 @@ package org.dspace.content.packager;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.dspace.app.util.Util;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.content.Bitstream;
|
import org.dspace.content.Bitstream;
|
||||||
import org.dspace.content.Bundle;
|
import org.dspace.content.Bundle;
|
||||||
@@ -188,13 +188,15 @@ public class DSpaceAIPDisseminator
|
|||||||
{
|
{
|
||||||
MetsHdr metsHdr = new MetsHdr();
|
MetsHdr metsHdr = new MetsHdr();
|
||||||
|
|
||||||
// date the METS package/manifest was created.
|
// Note: we specifically do not add a CREATEDATE to <metsHdr>
|
||||||
metsHdr.setCREATEDATE(new Date());
|
// as for AIPs we want md5 checksums to be identical if no content
|
||||||
|
// has changed. Adding a CREATEDATE changes checksum each time.
|
||||||
|
|
||||||
|
// Add a LASTMODDATE for items
|
||||||
if (dso.getType() == Constants.ITEM)
|
if (dso.getType() == Constants.ITEM)
|
||||||
metsHdr.setLASTMODDATE(((Item)dso).getLastModified());
|
metsHdr.setLASTMODDATE(((Item)dso).getLastModified());
|
||||||
|
|
||||||
// Agent - name custodian, the DSpace Archive, by handle.
|
// Agent Custodian - name custodian, the DSpace Archive, by handle.
|
||||||
Agent agent = new Agent();
|
Agent agent = new Agent();
|
||||||
agent.setROLE(Role.CUSTODIAN);
|
agent.setROLE(Role.CUSTODIAN);
|
||||||
agent.setTYPE(Type.OTHER);
|
agent.setTYPE(Type.OTHER);
|
||||||
@@ -204,6 +206,18 @@ public class DSpaceAIPDisseminator
|
|||||||
.add(new PCData(Site.getSiteHandle()));
|
.add(new PCData(Site.getSiteHandle()));
|
||||||
agent.getContent().add(name);
|
agent.getContent().add(name);
|
||||||
metsHdr.getContent().add(agent);
|
metsHdr.getContent().add(agent);
|
||||||
|
|
||||||
|
// Agent Creator - name creator, which is a specific version of DSpace.
|
||||||
|
Agent agentCreator = new Agent();
|
||||||
|
agentCreator.setROLE(Role.CREATOR);
|
||||||
|
agentCreator.setTYPE(Type.OTHER);
|
||||||
|
agentCreator.setOTHERTYPE("DSpace Software");
|
||||||
|
Name creatorName = new Name();
|
||||||
|
creatorName.getContent()
|
||||||
|
.add(new PCData("DSpace " + Util.getSourceVersion()));
|
||||||
|
agentCreator.getContent().add(creatorName);
|
||||||
|
metsHdr.getContent().add(agentCreator);
|
||||||
|
|
||||||
return metsHdr;
|
return metsHdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user