Adding another minor option to the AIP Disseminator (DS-466). There's now also an 'updatedAfter' flag, which allows for a very basic form of 'incremental backup'. When this flag is used, an ISO-8601 date must be specified. When used, the AIP Disseminator will only export Item AIPs for items that have changed since that date (it will still always export all Community & Collection AIPs, as there's no last-modified date for them). This new option has also been already documented in the AIP Backup & Restore docs at: https://wiki.duraspace.org/display/DSDOC/AipBackupRestore

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5696 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Tim Donohue
2010-10-29 22:09:22 +00:00
parent f8a3c11540
commit cc48236063
2 changed files with 92 additions and 61 deletions

View File

@@ -114,6 +114,9 @@ public abstract class AbstractPackageDisseminator
//try to disseminate the first object using provided PackageDisseminator //try to disseminate the first object using provided PackageDisseminator
disseminate(context, dso, params, pkgFile); disseminate(context, dso, params, pkgFile);
//check if package was disseminated
if(pkgFile.exists())
{
//add to list of successfully disseminated packages //add to list of successfully disseminated packages
addToPackageList(pkgFile); addToPackageList(pkgFile);
@@ -181,6 +184,7 @@ public abstract class AbstractPackageDisseminator
break; break;
}//end switch }//end switch
}//end if not an Item }//end if not an Item
}//end if pkgFile exists
//return list of all successfully disseminated packages //return list of all successfully disseminated packages
return getPackageList(); return getPackageList();

View File

@@ -76,6 +76,9 @@ import edu.harvard.hul.ois.mets.Type;
import edu.harvard.hul.ois.mets.helper.MetsException; import edu.harvard.hul.ois.mets.helper.MetsException;
import edu.harvard.hul.ois.mets.helper.PCData; import edu.harvard.hul.ois.mets.helper.PCData;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException;
import java.util.Date;
import org.dspace.core.Utils;
/** /**
* Subclass of the METS packager framework to disseminate a DSpace * Subclass of the METS packager framework to disseminate a DSpace
@@ -155,9 +158,33 @@ public class DSpaceAIPDisseminator extends AbstractMETSDisseminator
//Before disseminating anything, save the passed in PackageParameters, so they can be used by all methods //Before disseminating anything, save the passed in PackageParameters, so they can be used by all methods
disseminateParams = params; disseminateParams = params;
boolean disseminate = true; //by default, always disseminate
//if user specified to only disseminate objects updated *after* a specific date
// (Note: this only works for Items right now, as DSpace doesn't store a
// last modified date for Collections or Communities)
if(disseminateParams.containsKey("updatedAfter") && dso.getType()==Constants.ITEM)
{
Date afterDate = Utils.parseISO8601Date(disseminateParams.getProperty("updatedAfter"));
//if null is returned, we couldn't parse the date!
if(afterDate==null)
throw new IOException("Invalid date passed in via 'updatedAfter' option. Date must be in ISO-8601 format, and include both a day and time (e.g. 2010-01-01T00:00:00).");
//check when this item was last modified.
Item i = (Item) dso;
if(i.getLastModified().after(afterDate))
disseminate = true;
else
disseminate = false;
}
if(disseminate)
{
//just do a normal dissemination as specified by AbstractMETSDisseminator //just do a normal dissemination as specified by AbstractMETSDisseminator
super.disseminate(context, dso, params, pkgFile); super.disseminate(context, dso, params, pkgFile);
} }
}
/** /**
* Return identifier string for the METS profile this produces. * Return identifier string for the METS profile this produces.