Package org.dspace.app.itemimport
Class ItemImport
java.lang.Object
org.dspace.scripts.DSpaceRunnable<ItemImportScriptConfiguration>
org.dspace.app.itemimport.ItemImport
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ItemImportCLI
Import items into DSpace. The conventional use is upload files by copying
them. DSpace writes the item's bitstreams into its assetstore. Metadata is
also loaded to the DSpace database.
A second use assumes the bitstream files already exist in a storage resource accessible to DSpace. In this case the bitstreams are 'registered'. That is, the metadata is loaded to the DSpace database and DSpace is given the location of the file which is subsumed into DSpace.
The distinction is controlled by the format of lines in the 'contents' file. See comments in processContentsFile() below.
Modified by David Little, UCSD Libraries 12/21/04 to allow the registration of files (bitstreams) into DSpace.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.dspace.scripts.DSpaceRunnable
DSpaceRunnable.StepResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]protected static final CollectionServiceprotected Stringprotected booleanprotected Stringprotected static final EPersonServiceprotected static final HandleServiceprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected Stringstatic Stringstatic Stringprotected booleanprotected Stringstatic Stringprotected booleanprotected booleanprotected booleanprotected Fileprotected Fileprotected booleanprotected Stringprotected booleanFields inherited from class org.dspace.scripts.DSpaceRunnable
commandLine, handler, helpCommandLine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method will return the Configuration that the implementing DSpaceRunnable usesvoidThis method has to be included in every script and this will be the main execution block for the script that'll contain all the logic neededprotected voidprocess(Context context, ItemImportService itemImportService, List<Collection> collections) Process the importprotected voidreadMapfile(Context context) Read the mapfileprotected voidreadZip(Context context, ItemImportService itemImportService) Read the ZIP archive in SAF formatprotected voidsetEPerson(Context context) Set the eperson in the contextprotected voidSet the mapfile optionvoidsetup()This method has to be included in every script and handles the setup of the script by parsing the CommandLine and setting the variablesprotected voidsetZip()Set the zip optionprotected voidValidate the optionsprotected voidvalidateZip(InputStream inputStream) Confirm that the zip file has the correct MIME typeMethods inherited from class org.dspace.scripts.DSpaceRunnable
getEpersonIdentifier, getFileNamesFromInputStreamOptions, initialize, printHelp, run, setEpersonIdentifier
-
Field Details
-
TEMP_DIR
-
MAPFILE_FILENAME
-
MAPFILE_BITSTREAM_TYPE
-
template
protected boolean template -
command
-
sourcedir
-
mapfile
-
eperson
-
collections
-
isTest
protected boolean isTest -
isExcludeContent
protected boolean isExcludeContent -
isResume
protected boolean isResume -
useWorkflow
protected boolean useWorkflow -
useWorkflowSendEmail
protected boolean useWorkflowSendEmail -
isQuiet
protected boolean isQuiet -
commandLineCollections
protected boolean commandLineCollections -
zip
protected boolean zip -
remoteUrl
protected boolean remoteUrl -
zipfilename
-
zipvalid
protected boolean zipvalid -
help
protected boolean help -
workDir
-
workFile
-
collectionService
-
epersonService
-
handleService
-
-
Constructor Details
-
ItemImport
public ItemImport()
-
-
Method Details
-
getScriptConfiguration
Description copied from class:DSpaceRunnableThis method will return the Configuration that the implementing DSpaceRunnable uses- Specified by:
getScriptConfigurationin classDSpaceRunnable<ItemImportScriptConfiguration>- Returns:
- The
ScriptConfigurationthat this implementing DspaceRunnable uses
-
setup
public void setup() throws org.apache.commons.cli.ParseExceptionDescription copied from class:DSpaceRunnableThis method has to be included in every script and handles the setup of the script by parsing the CommandLine and setting the variables- Specified by:
setupin classDSpaceRunnable<ItemImportScriptConfiguration>- Throws:
org.apache.commons.cli.ParseException- If something goes wrong
-
internalRun
Description copied from class:DSpaceRunnableThis method has to be included in every script and this will be the main execution block for the script that'll contain all the logic needed- Specified by:
internalRunin classDSpaceRunnable<ItemImportScriptConfiguration>- Throws:
Exception- If something goes wrong
-
validate
Validate the options- Parameters:
context-
-
process
protected void process(Context context, ItemImportService itemImportService, List<Collection> collections) throws Exception Process the import- Parameters:
context-itemImportService-collections-- Throws:
Exception
-
readZip
Read the ZIP archive in SAF format- Parameters:
context-itemImportService-- Throws:
Exception
-
validateZip
Confirm that the zip file has the correct MIME type- Parameters:
inputStream-
-
readMapfile
Read the mapfile- Parameters:
context-
-
setMapFile
Set the mapfile option- Throws:
IOException
-
setZip
protected void setZip()Set the zip option -
setEPerson
Set the eperson in the context- Parameters:
context-- Throws:
SQLException
-