Interface ItemExportService
- All Known Implementing Classes:
ItemExportServiceImpl
public interface ItemExportService
Item exporter to create simple AIPs for DSpace content. Currently exports
individual items, or entire collections. For instructions on use, see
printUsage() method.
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.
- Author:
- David Little, Jay Paz
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionassembleFileName(String type, EPerson eperson, LocalDate date) Create a file name based on the date and epersonbooleancanDownload(Context context, 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 itvoidcreateDownloadableExport(List<DSpaceObject> dsObjects, Context context, boolean migrate) Convenience method to export a List of dspace objects (Community, Collection or Item)voidcreateDownloadableExport(List<DSpaceObject> dsObjects, Context context, String additionalEmail, boolean migrate) Convenience method to export a List of dspace objects (Community, Collection or Item)voidcreateDownloadableExport(DSpaceObject dso, Context context, boolean migrate) Convenience method to create export a single Community, Collection, or ItemvoidcreateDownloadableExport(DSpaceObject dso, Context context, String additionalEmail, boolean migrate) Convenience method to create export a single Community, Collection, or ItemvoidA clean up method that is ran before a new export archive is created.voiddeleteOldExportArchives(EPerson eperson) A clean up method that is ran before a new export archive is created.voidemailErrorMessage(EPerson eperson, String error) Since the archive is created in a new thread we are unable to communicate with calling method about success or failure.voidemailSuccessMessage(Context context, EPerson eperson, String fileName) Since the archive is created in a new thread we are unable to communicate with calling method about success or failure.voidexportAsZip(Context context, Iterator<Item> items, String destDirName, String zipFileName, int seqStart, boolean migrate, boolean excludeBitstreams) Method to perform an export and save it as a zip file.voidexportItem(Context c, Iterator<Item> i, String destDirName, int seqStart, boolean migrate, boolean excludeBitstreams) getExportDownloadDirectory(EPerson ePerson) Use config file entry for org.dspace.app.itemexport.download.dir and id of the eperson to create a download directory namegetExportDownloadInputStream(String fileName, EPerson eperson) Used to read the export archived.longgetExportFileLastModified(Context context, String fileName) Get the last modified date of the export archive represented by the file name.longgetExportFileSize(Context context, String fileName) Get the file size of the export archive represented by the file name.getExportsAvailable(EPerson eperson) Reads the download directory for the eperson to see if any export archives are availableReturns config file entry for org.dspace.app.itemexport.work.dirvoidsetHandler(DSpaceRunnableHandler handler) Set the DSpace Runnable HandlervoidZip source to target
-
Field Details
-
COMPRESSED_EXPORT_MIME_TYPE
used for export download- See Also:
-
-
Method Details
-
exportItem
void exportItem(Context c, Iterator<Item> i, String destDirName, int seqStart, boolean migrate, boolean excludeBitstreams) throws Exception - Throws:
Exception
-
exportAsZip
void exportAsZip(Context context, Iterator<Item> items, String destDirName, String zipFileName, int seqStart, boolean migrate, boolean excludeBitstreams) throws Exception Method to perform an export and save it as a zip file.- Parameters:
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 notexcludeBitstreams- Whether to exclude bitstreams or not- Throws:
Exception- if error
-
createDownloadableExport
Convenience method to create export a single Community, Collection, or Item- Parameters:
dso- - the dspace object to exportcontext- - the dspace contextmigrate- Whether to use the migrate option or not- Throws:
Exception- if error
-
createDownloadableExport
void createDownloadableExport(List<DSpaceObject> dsObjects, Context context, boolean migrate) throws Exception Convenience method to export a List of dspace objects (Community, Collection or Item)- Parameters:
dsObjects- - List containing dspace objectscontext- - the dspace contextmigrate- Whether to use the migrate option or not- Throws:
Exception- if error
-
createDownloadableExport
void createDownloadableExport(DSpaceObject dso, Context context, String additionalEmail, boolean migrate) throws Exception Convenience method to create export a single Community, Collection, or Item- Parameters:
dso- - the dspace object to exportcontext- - the dspace contextadditionalEmail- - cc email to usemigrate- Whether to use the migrate option or not- Throws:
Exception- if error
-
createDownloadableExport
void createDownloadableExport(List<DSpaceObject> dsObjects, Context context, String additionalEmail, boolean migrate) throws Exception Convenience method to export a List of dspace objects (Community, Collection or Item)- Parameters:
dsObjects- - List containing dspace objectscontext- - the dspace contextadditionalEmail- - cc email to usemigrate- Whether to use the migrate option or not- Throws:
Exception- if error
-
assembleFileName
Create a file name based on the date and eperson- Parameters:
type- Type of object (as string)eperson- - eperson who requested export and will be able to download itdate- - the date the export process was created- Returns:
- String representing the file name in the form of 'export_yyy_MMM_dd_count_epersonID'
- Throws:
Exception- if error
-
getExportDownloadDirectory
Use config file entry for org.dspace.app.itemexport.download.dir and id of the eperson to create a download directory name- Parameters:
ePerson- - the eperson who requested export archive- Returns:
- String representing a directory in the form of org.dspace.app.itemexport.download.dir/epersonID
- Throws:
Exception- if error
-
getExportWorkDirectory
Returns config file entry for org.dspace.app.itemexport.work.dir- Returns:
- String representing config file entry for org.dspace.app.itemexport.work.dir
- Throws:
Exception- if error
-
getExportDownloadInputStream
Used to read the export archived. Intended for download.- Parameters:
fileName- the name of the file to downloadeperson- the eperson requesting the download- Returns:
- an input stream of the file to be downloaded
- Throws:
Exception- if error
-
getExportFileSize
Get the file size of the export archive represented by the file name.- Parameters:
context- DSpace contextfileName- name of the file to get the size.- Returns:
- size as long
- Throws:
Exception- if error
-
getExportFileLastModified
Get the last modified date of the export archive represented by the file name.- Parameters:
context- DSpace contextfileName- name of the file to get the size.- Returns:
- date as long
- Throws:
Exception- if error- See Also:
-
canDownload
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- Parameters:
context- dspace contextfileName- the file name to check auths for- Returns:
- true if it is the same person false otherwise
-
getExportsAvailable
Reads the download directory for the eperson to see if any export archives are available- Parameters:
eperson- EPerson object- Returns:
- a list of file names representing export archives that have been processed
- Throws:
Exception- if error
-
deleteOldExportArchives
A clean up method that is ran before a new export archive is created. It uses the config file entry 'org.dspace.app.itemexport.life.span.hours' to determine if the current exports are too old and need pruging- Parameters:
eperson- - the eperson to clean up- Throws:
Exception- if error
-
deleteOldExportArchives
A clean up method that is ran before a new export archive is created. It uses the config file entry 'org.dspace.app.itemexport.life.span.hours' to determine if the current exports are too old and need purgeing Removes all old exports, not just those for the person doing the export.- Throws:
Exception- if error
-
emailSuccessMessage
void emailSuccessMessage(Context context, EPerson eperson, String fileName) throws jakarta.mail.MessagingException Since the archive is created in a new thread we are unable to communicate with calling method about success or failure. We accomplish this communication with email instead. Send a success email once the export archive is complete and ready for download- Parameters:
context- - the current Contexteperson- - eperson to send the email tofileName- - the file name to be downloaded. It is added to the url in the email- Throws:
jakarta.mail.MessagingException- if error
-
emailErrorMessage
Since the archive is created in a new thread we are unable to communicate with calling method about success or failure. We accomplish this communication with email instead. Send an error email if the export archive fails- Parameters:
eperson- - EPerson to send the error message toerror- - the error message- Throws:
jakarta.mail.MessagingException- if error
-
zip
Zip source to target- Parameters:
strSource- source filetarget- target file- Throws:
Exception- if error
-
setHandler
Set the DSpace Runnable Handler- Parameters:
handler-
-