diff --git a/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java b/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java index 04860d3d10b8..45fd490dd2d8 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java @@ -684,14 +684,13 @@ protected Mets makeManifest(Context context, DSpaceObject dso, { // Create the METS manifest in memory Mets mets = new Mets(); - String typeStr = Constants.typeText[dso.getType()]; - + // this ID should be globally unique mets.setID("dspace"+Utils.generateKey()); // identifies the object described by this document mets.setOBJID(makePersistentID(dso)); - mets.setTYPE("DSpace "+typeStr); + mets.setTYPE(getObjectTypeString(dso)); // this is the signature by which the ingester will recognize // a document it can expect to interpret. @@ -787,6 +786,7 @@ protected Mets makeManifest(Context context, DSpaceObject dso, primaryBitstreamID = bundles[i].getPrimaryBitstreamID(); } + // For each bitstream, add to METS manifest for (int bits = 0; bits < bitstreams.length; bits++) { // Check for authorization. Handle unauthorized @@ -821,7 +821,7 @@ else if (!(unauth != null && unauth.equalsIgnoreCase("zero"))) // if this is content, add to structmap too: if (isContentBundle) - div0.getContent().add(makeFileDiv(fileID, "DSpace Content Bitstream")); + div0.getContent().add(makeFileDiv(fileID, getObjectTypeString(bitstreams[bits]))); /* * If we're in THUMBNAIL or TEXT bundles, the bitstream is @@ -845,12 +845,9 @@ else if (!(unauth != null && unauth.equalsIgnoreCase("zero"))) } file.setGROUPID(groupID); file.setMIMETYPE(bitstreams[bits].getFormat().getMIMEType()); - - // FIXME: CREATED: no date - file.setSIZE(auth ? bitstreams[bits].getSize() : 0); - // FIXME: need to translate checksum and type to METS, if available. + // Translate checksum and type to METS String csType = bitstreams[bits].getChecksumAlgorithm(); String cs = bitstreams[bits].getChecksum(); if (auth && cs != null && csType != null) @@ -887,7 +884,7 @@ else if (dso.getType() == Constants.COLLECTION) { //add a child
for each item in collection Item item = ii.next(); - Div childDiv = makeChildDiv("DSpace Item", item, params); + Div childDiv = makeChildDiv(getObjectTypeString(item), item, params); if(childDiv!=null) div0.getContent().add(childDiv); } @@ -906,7 +903,7 @@ else if (dso.getType() == Constants.COMMUNITY) for (int i = 0; i < subcomms.length; ++i) { //add a child
for each subcommunity in this community - Div childDiv = makeChildDiv("DSpace Community", subcomms[i], params); + Div childDiv = makeChildDiv(getObjectTypeString(subcomms[i]), subcomms[i], params); if(childDiv!=null) div0.getContent().add(childDiv); } @@ -916,7 +913,7 @@ else if (dso.getType() == Constants.COMMUNITY) for (int i = 0; i < colls.length; ++i) { //add a child
for each collection in this community - Div childDiv = makeChildDiv("DSpace Collection", colls[i], params); + Div childDiv = makeChildDiv(getObjectTypeString(colls[i]), colls[i], params); if(childDiv!=null) div0.getContent().add(childDiv); } @@ -936,7 +933,7 @@ else if (dso.getType() == Constants.SITE) for (int i = 0; i < comms.length; ++i) { //add a child
for each top level community in this site - Div childDiv = makeChildDiv("DSpace Community", comms[i], params); + Div childDiv = makeChildDiv(getObjectTypeString(comms[i]), comms[i], params); if(childDiv!=null) div0.getContent().add(childDiv); } @@ -1003,7 +1000,7 @@ protected void addLogoBitstream(Bitstream logoBs, FileSec fileSec, Div div0, Pac file.setMIMETYPE(logoBs.getFormat().getMIMEType()); file.setSIZE(logoBs.getSize()); - // FIXME: need to translate checksum and type to METS, if available. + // Translate checksum and type to METS String csType = logoBs.getChecksumAlgorithm(); String cs = logoBs.getChecksum(); if (cs != null && csType != null) @@ -1018,6 +1015,8 @@ protected void addLogoBitstream(Bitstream logoBs, FileSec fileSec, Div div0, Pac log.warn("Cannot set bitstream checksum type="+csType+" in METS."); } } + + //Create with a pointing at bitstream FLocat flocat = new FLocat(); flocat.setLOCTYPE(Loctype.URL); flocat.setXlinkHref(makeBitstreamURL(logoBs, params)); @@ -1283,6 +1282,22 @@ else if(mdRef.getMDTYPE() != null && mdRef.getMDTYPE() == Mdtype.OTHER && } } + /** + * Build a string which will be used as the "Type" of this object in + * the METS manifest. + *

+ * Default format is "DSpace [Type-as-string]". + * + * @param dso DSpaceObject to create type-string for + * @return a string which will represent this object Type in METS + * @see org.dspace.core.Constants + */ + public String getObjectTypeString(DSpaceObject dso) + { + //Format: "DSpace " (e.g. "DSpace ITEM", "DSpace COLLECTION", etc) + return "DSpace " + Constants.typeText[dso.getType()]; + } + /** * Return identifier for bitstream in an Item; when making a package, * this is the archive member name (e.g. in Zip file). In a bare diff --git a/dspace-api/src/main/java/org/dspace/content/packager/DSpaceAIPIngester.java b/dspace-api/src/main/java/org/dspace/content/packager/DSpaceAIPIngester.java index 2c42cfa7b75c..af4361607481 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/DSpaceAIPIngester.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/DSpaceAIPIngester.java @@ -57,7 +57,6 @@ import org.dspace.content.NonUniqueMetadataException; import org.dspace.content.crosswalk.CrosswalkException; import org.dspace.content.crosswalk.MetadataValidationException; -import org.dspace.core.ConfigurationManager; import org.dspace.core.Context; import org.dspace.core.Constants; diff --git a/dspace-api/src/main/java/org/dspace/content/packager/DSpaceMETSDisseminator.java b/dspace-api/src/main/java/org/dspace/content/packager/DSpaceMETSDisseminator.java index 6c4b73f9a900..e57529c36197 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/DSpaceMETSDisseminator.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/DSpaceMETSDisseminator.java @@ -115,6 +115,7 @@ public class DSpaceMETSDisseminator * * @return string name of profile. */ + @Override public String getProfile() { return PROFILE_LABEL; @@ -128,6 +129,7 @@ public String getProfile() * @param bname name of DSpace bundle. * @return string name of fileGrp */ + @Override public String bundleToFileGrp(String bname) { if (bname.equals("ORIGINAL")) @@ -139,13 +141,14 @@ public String bundleToFileGrp(String bname) /** * Create metsHdr element - separate so subclasses can override. */ + @Override public MetsHdr makeMetsHdr(Context context, DSpaceObject dso, PackageParameters params) { MetsHdr metsHdr = new MetsHdr(); - metsHdr.setCREATEDATE(new Date()); // FIXME: CREATEDATE is now: - // maybe should be item create - // date? + + // FIXME: CREATEDATE is now: maybe should be item create? + metsHdr.setCREATEDATE(new Date()); // Agent Agent agent = new Agent(); @@ -168,6 +171,7 @@ public MetsHdr makeMetsHdr(Context context, DSpaceObject dso, * the name of a crosswalk plugin, optionally followed by colon and * its METS MDTYPE name. */ + @Override public String [] getDmdTypes(Context context, DSpaceObject dso, PackageParameters params) throws SQLException, IOException, AuthorizeException { @@ -190,6 +194,7 @@ public MetsHdr makeMetsHdr(Context context, DSpaceObject dso, * Default is PREMIS. This is both the name of the crosswalk plugin * and the METS MDTYPE. */ + @Override public String[] getTechMdTypes(Context context, DSpaceObject dso, PackageParameters params) throws SQLException, IOException, AuthorizeException { @@ -203,18 +208,21 @@ public String[] getTechMdTypes(Context context, DSpaceObject dso, PackageParamet return new String[0]; } + @Override public String[] getSourceMdTypes(Context context, DSpaceObject dso, PackageParameters params) throws SQLException, IOException, AuthorizeException { return new String[0]; } - + + @Override public String[] getDigiprovMdTypes(Context context, DSpaceObject dso, PackageParameters params) throws SQLException, IOException, AuthorizeException { return new String[0]; } + @Override public String makeBitstreamURL(Bitstream bitstream, PackageParameters params) { String base = "bitstream_"+String.valueOf(bitstream.getID()); @@ -226,6 +234,7 @@ public String makeBitstreamURL(Bitstream bitstream, PackageParameters params) * Add rights MD (licenses) for DSpace item. These * may include a deposit license, and Creative Commons. */ + @Override public String[] getRightsMdTypes(Context context, DSpaceObject dso, PackageParameters params) throws SQLException, IOException, AuthorizeException { @@ -246,6 +255,7 @@ else if (CreativeCommons.getLicenseTextBitstream(item) != null) } // This is where we'd elaborate on the default structMap; nothing to add, yet. + @Override public void addStructMap(Context context, DSpaceObject dso, PackageParameters params, Mets mets) throws SQLException, IOException, AuthorizeException, MetsException @@ -253,6 +263,7 @@ public void addStructMap(Context context, DSpaceObject dso, } // only exclude metadata bundles from package. + @Override public boolean includeBundle(Bundle bundle) { return ! PackageUtils.isMetaInfoBundle(bundle);