org.dspace.content.packager
Class DSpaceAIPIngester

java.lang.Object
  extended by org.dspace.content.packager.AbstractPackageIngester
      extended by org.dspace.content.packager.AbstractMETSIngester
          extended by org.dspace.content.packager.DSpaceAIPIngester
All Implemented Interfaces:
PackageIngester

public class DSpaceAIPIngester
extends AbstractMETSIngester

Subclass of the METS packager framework to ingest a DSpace Archival Information Package (AIP). The AIP is intended to be, foremost, a _complete_ and _accurate_ representation of one object in the DSpace object model. An AIP contains all of the information needed to restore the object precisely in another DSpace archive instance.

This ingester recognizes two distinct types of AIPs: "Manifest-Only" and "External". The Manifest-Only AIP, which is selected by specifying a PackageParameters key "manifestOnly" with the value "true", refers to all its contents by reference only. For Community or Collection AIPs this means all references to their child objects are just via Handles. For Item AIPs all Bitreams are just referenced by their asset store location instead of finding them in the "package". The Manifest-Only AIP package format is simply a METS XML document serialized into a file.

An "external" AIP (the default), is a conventional Zip-file based package that includes copies of all bitstreams referenced by the object as well as a serialized METS XML document in the path "mets.xml". Configuration keys: # instructs which xwalk plugin to use for a given type of metadata mets.dspaceAIP.ingest.crosswalk.{mdSecName} = {pluginName} mets.dspaceAIP.ingest.crosswalk.DC = QDC mets.dspaceAIP.ingest.crosswalk.DSpaceDepositLicense = NULLSTREAM # Option to save METS manifest in the item: (default is false) mets.default.ingest.preserveManifest = false

Version:
$Revision: 1.1 $
Author:
Larry Stone, Tim Donohue
See Also:
AbstractMETSIngester, AbstractPackageIngester, PackageIngester, METSManifest

Nested Class Summary
 
Nested classes/interfaces inherited from class org.dspace.content.packager.AbstractMETSIngester
AbstractMETSIngester.MdrefManager
 
Constructor Summary
DSpaceAIPIngester()
           
 
Method Summary
 void addLicense(Context context, Item item, String license, Collection collection, PackageParameters params)
          Ignore license when restoring an manifest-only AIP, since it should be a bitstream in the AIP already.
protected static void createMissingMetadataFields(Context context, Item item)
          Verifies that all the unsaved, crosswalked metadata fields that have been added to an Item actually exist in our Database.
 void crosswalkObjectDmd(Context context, DSpaceObject dso, METSManifest manifest, AbstractMETSIngester.MdrefManager callback, org.jdom.Element[] dmds, PackageParameters params)
          Choose DMD section(s) to crosswalk.
 void finishBitstream(Context context, Bitstream bs, org.jdom.Element mfile, METSManifest manifest, PackageParameters params)
          Nothing extra to do to bitstream after ingestion.
 void finishObject(Context context, DSpaceObject dso, PackageParameters params)
          Last change to fix up a DSpace Object.
 String getConfigurationName()
          Name used to distinguish DSpace Configuration entries for this subclass.
 int getObjectType(METSManifest manifest)
          Return the type of DSpaceObject in this package; it is in the TYPE attribute of the mets:mets element.
 String getParameterHelp()
          Returns a user help string which should describe the additional valid command-line options that this packager implementation will accept when using the -o or --option flags with the Packager script.
 
Methods inherited from class org.dspace.content.packager.AbstractMETSIngester
addBitstreams, addContainerLogo, addManifestBitstream, addTemplateItem, decodeHandleURN, getFileInputStream, getManifestBitstreamFormat, getObjectHandle, getParentObject, ingest, ingestObject, parsePackage, preserveManifest, removeObject, replace, replaceObject, useCollectionTemplate
 
Methods inherited from class org.dspace.content.packager.AbstractPackageIngester
addPackageReference, addToIngestedList, getIngestedList, getPackageReferences, ingestAll, replaceAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSpaceAIPIngester

public DSpaceAIPIngester()
Method Detail

crosswalkObjectDmd

public void crosswalkObjectDmd(Context context,
                               DSpaceObject dso,
                               METSManifest manifest,
                               AbstractMETSIngester.MdrefManager callback,
                               org.jdom.Element[] dmds,
                               PackageParameters params)
                        throws CrosswalkException,
                               PackageValidationException,
                               AuthorizeException,
                               SQLException,
                               IOException
Choose DMD section(s) to crosswalk.

The algorithm is:
1. Use whatever the dmd parameter specifies as the primary DMD.
2. If (1) is unspecified, find DIM (preferably) or MODS as primary DMD.
3. If (1) or (2) succeeds, crosswalk it and ignore all other DMDs with same GROUPID
4. Crosswalk remaining DMDs not eliminated already.

Specified by:
crosswalkObjectDmd in class AbstractMETSIngester
Parameters:
context - the DSpace context
manifest - the METSManifest
callback - the MdrefManager (manages all external metadata files referenced by METS mdref elements)
dmds - array of Elements, each a METS dmdSec that applies to the Item as a whole.
Throws:
CrosswalkException
PackageValidationException
AuthorizeException
SQLException
IOException

addLicense

public void addLicense(Context context,
                       Item item,
                       String license,
                       Collection collection,
                       PackageParameters params)
                throws PackageValidationException,
                       AuthorizeException,
                       SQLException,
                       IOException
Ignore license when restoring an manifest-only AIP, since it should be a bitstream in the AIP already. Otherwise: Check item for license first; then, take deposit license supplied by explicit argument next, else use collection's default deposit license. Normally the rightsMD crosswalks should provide a license.

Specified by:
addLicense in class AbstractMETSIngester
Parameters:
context - the DSpace context
license - optional user-supplied Deposit License text (may be null)
collection - DSpace Collection to which the item is being submitted.
Throws:
PackageValidationException
AuthorizeException
SQLException
IOException

finishObject

public void finishObject(Context context,
                         DSpaceObject dso,
                         PackageParameters params)
                  throws PackageValidationException,
                         CrosswalkException,
                         AuthorizeException,
                         SQLException,
                         IOException
Last change to fix up a DSpace Object.

For AIPs, if the object is an Item, we may want to make sure all of its metadata fields already exist in the database (otherwise, the database will throw errors when we attempt to save/update the Item)

Specified by:
finishObject in class AbstractMETSIngester
Parameters:
context - DSpace Context
dso - DSpace object
params - Packager Parameters
Throws:
PackageValidationException
CrosswalkException
AuthorizeException
SQLException
IOException

finishBitstream

public void finishBitstream(Context context,
                            Bitstream bs,
                            org.jdom.Element mfile,
                            METSManifest manifest,
                            PackageParameters params)
                     throws MetadataValidationException,
                            SQLException,
                            AuthorizeException,
                            IOException
Nothing extra to do to bitstream after ingestion.

Specified by:
finishBitstream in class AbstractMETSIngester
Throws:
MetadataValidationException
SQLException
AuthorizeException
IOException

getObjectType

public int getObjectType(METSManifest manifest)
                  throws PackageValidationException
Return the type of DSpaceObject in this package; it is in the TYPE attribute of the mets:mets element.

Specified by:
getObjectType in class AbstractMETSIngester
Returns:
one of the object types in Constants.
Throws:
PackageValidationException

getConfigurationName

public String getConfigurationName()
Name used to distinguish DSpace Configuration entries for this subclass.

Specified by:
getConfigurationName in class AbstractMETSIngester

createMissingMetadataFields

protected static void createMissingMetadataFields(Context context,
                                                  Item item)
                                           throws PackageValidationException,
                                                  AuthorizeException,
                                                  IOException,
                                                  SQLException
Verifies that all the unsaved, crosswalked metadata fields that have been added to an Item actually exist in our Database. If they don't exist, they are created within the proper database tables.

This method must be called *before* item.update(), as the call to update() will throw a SQLException when attempting to save any fields which don't already exist in the database.

NOTE: This will NOT create a missing Metadata Schema (e.g. "dc" schema), as we do not have enough info to create schemas on the fly.

Parameters:
context - - DSpace Context
item - - Item whose unsaved metadata fields we are testing
Throws:
AuthorizeException - if a metadata field doesn't exist and current user is not authorized to create it (i.e. not an Admin)
PackageValidationException - if a metadata schema doesn't exist, as we cannot autocreate a schema
IOException
SQLException

getParameterHelp

public String getParameterHelp()
Returns a user help string which should describe the additional valid command-line options that this packager implementation will accept when using the -o or --option flags with the Packager script.

Specified by:
getParameterHelp in interface PackageIngester
Overrides:
getParameterHelp in class AbstractMETSIngester
Returns:
a string describing additional command-line options available with this packager


Copyright © 2012 DuraSpace. All Rights Reserved.