public class ItemExport
extends java.lang.Object
ItemExport creates the simple AIP package that the importer also uses. It consists of:
/exportdir/42/ (one directory per item) / dublin_core.xml - qualified dublin core in RDF schema / contents - text file, listing one file per line / file1 - files contained in the item / file2 / ...
issues -doesn't handle special characters in metadata (needs to turn &'s into &, etc.)
Modified by David Little, UCSD Libraries 12/21/04 to allow the registration of files (bitstreams) into DSpace.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COMPRESSED_EXPORT_MIME_TYPE
used for export download
|
| Constructor and Description |
|---|
ItemExport() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
assembleFileName(java.lang.String type,
EPerson eperson,
java.util.Date date)
Create a file name based on the date and eperson
|
static boolean |
canDownload(Context context,
java.lang.String fileName)
The file name of the export archive contains the eperson id of the person
who created it When requested for download this method can check if the
person requesting it is the same one that created it
|
static void |
createDownloadableExport(DSpaceObject dso,
Context context,
boolean migrate)
Convenience methot to create export a single Community, Collection, or
Item
|
static void |
createDownloadableExport(DSpaceObject dso,
Context context,
java.lang.String additionalEmail,
boolean migrate)
Convenience methot to create export a single Community, Collection, or
Item
|
static void |
createDownloadableExport(java.util.List<DSpaceObject> dsObjects,
Context context,
boolean migrate)
Convenience method to export a List of dspace objects (Community,
Collection or Item)
|
static void |
createDownloadableExport(java.util.List<DSpaceObject> dsObjects,
Context context,
java.lang.String additionalEmail,
boolean migrate)
Convenience method to export a List of dspace objects (Community,
Collection or Item)
|
static void |
deleteOldExportArchives()
A clean up method that is ran before a new export archive is created.
|
static void |
deleteOldExportArchives(int epersonID)
A clean up method that is ran before a new export archive is created.
|
static void |
emailErrorMessage(EPerson eperson,
java.lang.String error)
Since the archive is created in a new thread we are unable to communicate
with calling method about success or failure.
|
static void |
emailSuccessMessage(Context context,
EPerson eperson,
java.lang.String fileName)
Since the archive is created in a new thread we are unable to communicate
with calling method about success or failure.
|
static void |
exportAsZip(Context context,
ItemIterator items,
java.lang.String destDirName,
java.lang.String zipFileName,
int seqStart,
boolean migrate)
Method to perform an export and save it as a zip file.
|
static java.lang.String |
getExportDownloadDirectory(int ePersonID)
Use config file entry for org.dspace.app.itemexport.download.dir and id
of the eperson to create a download directory name
|
static java.io.InputStream |
getExportDownloadInputStream(java.lang.String fileName,
EPerson eperson)
Used to read the export archived.
|
static long |
getExportFileLastModified(java.lang.String fileName) |
static long |
getExportFileSize(java.lang.String fileName)
Get the file size of the export archive represented by the file name.
|
static java.util.List<java.lang.String> |
getExportsAvailable(EPerson eperson)
Reads the download directory for the eperson to see if any export
archives are available
|
static java.lang.String |
getExportWorkDirectory()
Returns config file entry for org.dspace.app.itemexport.work.dir
|
static void |
main(java.lang.String[] argv) |
static void |
zip(java.lang.String strSource,
java.lang.String target) |
public static final java.lang.String COMPRESSED_EXPORT_MIME_TYPE
public static void main(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionpublic static void exportAsZip(Context context, ItemIterator items, java.lang.String destDirName, java.lang.String zipFileName, int seqStart, boolean migrate) throws java.lang.Exception
context - The DSpace Contextitems - The items to exportdestDirName - The directory to save the export inzipFileName - The name to save the zip file asseqStart - The first number in the sequencemigrate - Whether to use the migrate option or notjava.lang.Exceptionpublic static void createDownloadableExport(DSpaceObject dso, Context context, boolean migrate) throws java.lang.Exception
dso - - the dspace object to exportcontext - - the dspace contextjava.lang.Exceptionpublic static void createDownloadableExport(java.util.List<DSpaceObject> dsObjects, Context context, boolean migrate) throws java.lang.Exception
dsObjects - - List containing dspace objectscontext - - the dspace contextjava.lang.Exceptionpublic static void createDownloadableExport(DSpaceObject dso, Context context, java.lang.String additionalEmail, boolean migrate) throws java.lang.Exception
dso - - the dspace object to exportcontext - - the dspace contextadditionalEmail - - cc email to usejava.lang.Exceptionpublic static void createDownloadableExport(java.util.List<DSpaceObject> dsObjects, Context context, java.lang.String additionalEmail, boolean migrate) throws java.lang.Exception
dsObjects - - List containing dspace objectscontext - - the dspace contextadditionalEmail - - cc email to usejava.lang.Exceptionpublic static java.lang.String assembleFileName(java.lang.String type,
EPerson eperson,
java.util.Date date)
throws java.lang.Exception
eperson - - eperson who requested export and will be able to download itdate - - the date the export process was createdjava.lang.Exceptionpublic static java.lang.String getExportDownloadDirectory(int ePersonID)
throws java.lang.Exception
ePersonID - - id of the eperson who requested export archivejava.lang.Exceptionpublic static java.lang.String getExportWorkDirectory()
throws java.lang.Exception
java.lang.Exceptionpublic static java.io.InputStream getExportDownloadInputStream(java.lang.String fileName,
EPerson eperson)
throws java.lang.Exception
fileName - the name of the file to downloadeperson - the eperson requesting the downloadjava.lang.Exceptionpublic static long getExportFileSize(java.lang.String fileName)
throws java.lang.Exception
fileName - name of the file to get the size.java.lang.Exceptionpublic static long getExportFileLastModified(java.lang.String fileName)
throws java.lang.Exception
java.lang.Exceptionpublic static boolean canDownload(Context context, java.lang.String fileName)
context - dspace contextfileName - the file name to check auths forpublic static java.util.List<java.lang.String> getExportsAvailable(EPerson eperson) throws java.lang.Exception
eperson - java.lang.Exceptionpublic static void deleteOldExportArchives(int epersonID)
throws java.lang.Exception
epersonID - - the id of the eperson to clean upjava.lang.Exceptionpublic static void deleteOldExportArchives()
throws java.lang.Exception
java.lang.Exceptionpublic static void emailSuccessMessage(Context context, EPerson eperson, java.lang.String fileName) throws javax.mail.MessagingException
context - - the current Contexteperson - - eperson to send the email tofileName - - the file name to be downloaded. It is added to the url in
the emailjavax.mail.MessagingExceptionpublic static void emailErrorMessage(EPerson eperson, java.lang.String error) throws javax.mail.MessagingException
eperson - - EPerson to send the error message toerror - - the error messagejavax.mail.MessagingExceptionpublic static void zip(java.lang.String strSource,
java.lang.String target)
throws java.lang.Exception
java.lang.ExceptionCopyright © 2013 DuraSpace. All Rights Reserved.