org.dspace.content.packager
Class AbstractMETSDisseminator

java.lang.Object
  extended by org.dspace.content.packager.AbstractMETSDisseminator
All Implemented Interfaces:
PackageDisseminator
Direct Known Subclasses:
DSpaceMETSDisseminator

public abstract class AbstractMETSDisseminator
extends Object
implements PackageDisseminator

Base class for disseminator of METS (Metadata Encoding & Transmission Standard) Package.
See http://www.loc.gov/standards/mets/

This is a generic packager framework intended to be subclassed to create packagers for more specific METS "profiles". METS is an abstract and flexible framework that can encompass many different kinds of metadata and inner package structures.

Package Parameters:
manifestOnly -- if true, generate a standalone XML document of the METS manifest instead of a complete package. Any other metadata (such as licenses) will be encoded inline. Default is false. unauthorized -- this determines what is done when the packager encounters a Bundle or Bitstream it is not authorized to read. By default, it just quits with an AuthorizeException. If this option is present, it must be one of the following values: skip -- simply exclude unreadable content from package. zero -- include unreadable bitstreams as 0-length files; unreadable Bundles will still cause authorize errors.

Version:
$Revision: 3761 $
Author:
Larry Stone, Robert Tansley

Field Summary
protected  Map extraFiles
          Table of files to add to package, such as mdRef'd metadata.
static String MANIFEST_FILE
          Filename of manifest, relative to package toplevel.
 
Constructor Summary
AbstractMETSDisseminator()
           
 
Method Summary
abstract  void addRightsMd(Context context, Item item, edu.harvard.hul.ois.mets.AmdSec amdSec)
          Add Rights metadata for the Item, in the form of (rightsMd elements) to the given metadata section.
abstract  void addStructMap(Context context, Item item, PackageParameters params, edu.harvard.hul.ois.mets.Mets mets)
          Add any additional structMap elements to the METS document, as required by this subclass.
abstract  String bundleToFileGrp(String bname)
          Returns fileGrp's USE attribute value corresponding to a DSpace bundle name.
 void disseminate(Context context, DSpaceObject dso, PackageParameters params, OutputStream pkg)
          Export the object (Item, Collection, or Community) to a package file on the indicated OutputStream.
protected static Bitstream findOriginalBitstream(Item item, Bitstream derived)
          For a bitstream that's a thumbnail or extracted text, find the corresponding bitstream it was derived from, in the ORIGINAL bundle.
protected  String gensym(String prefix)
          Make a new unique ID with specified prefix.
abstract  String[] getDmdTypes(PackageParameters params)
          Get the types of Item-wide DMD to include in package.
 String getMIMEType(PackageParameters params)
          Identifies the MIME-type of this package, e.g.
abstract  String getProfile()
          Returns name of METS profile to which this package conforms, e.g.
abstract  String getTechMdType(PackageParameters params)
          Get the type string of the technical metadata to create for each Bitstream in the Item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANIFEST_FILE

public static final String MANIFEST_FILE
Filename of manifest, relative to package toplevel.

See Also:
Constant Field Values

extraFiles

protected Map extraFiles
Table of files to add to package, such as mdRef'd metadata. Key is relative pathname of file, value is InputStream with contents to put in it. New map is created by disseminate().

Constructor Detail

AbstractMETSDisseminator

public AbstractMETSDisseminator()
Method Detail

gensym

protected String gensym(String prefix)
Make a new unique ID with specified prefix.

Parameters:
prefix - the prefix of the identifier, constrained to XML ID schema
Returns:
a new string identifier unique in this session (instance).

getMIMEType

public String getMIMEType(PackageParameters params)
Description copied from interface: PackageDisseminator
Identifies the MIME-type of this package, e.g. "application/zip". Required when sending the package via HTTP, to provide the Content-Type header.

Specified by:
getMIMEType in interface PackageDisseminator
Returns:
the MIME type (content-type header) of the package to be returned

disseminate

public void disseminate(Context context,
                        DSpaceObject dso,
                        PackageParameters params,
                        OutputStream pkg)
                 throws PackageValidationException,
                        CrosswalkException,
                        AuthorizeException,
                        SQLException,
                        IOException
Export the object (Item, Collection, or Community) to a package file on the indicated OutputStream. Gets an exception of the object cannot be packaged or there is a failure creating the package.

Specified by:
disseminate in interface PackageDisseminator
Parameters:
context - - DSpace context.
dso - - DSpace object (item, collection, etc)
pkg - - output stream on which to write package
params - Properties-style list of options specific to this packager
Throws:
PackageException - if package cannot be created or there is a fatal error in creating it.
PackageValidationException - if package cannot be created or there is a fatal error in creating it.
CrosswalkException
AuthorizeException
SQLException
IOException

findOriginalBitstream

protected static Bitstream findOriginalBitstream(Item item,
                                                 Bitstream derived)
                                          throws SQLException
For a bitstream that's a thumbnail or extracted text, find the corresponding bitstream it was derived from, in the ORIGINAL bundle.

Parameters:
item - the item we're dealing with
derived - the derived bitstream
Returns:
the corresponding original bitstream (or null)
Throws:
SQLException

getProfile

public abstract String getProfile()
Returns name of METS profile to which this package conforms, e.g. "DSpace METS DIP Profile 1.0"

Returns:
string name of profile.

bundleToFileGrp

public abstract String bundleToFileGrp(String bname)
Returns fileGrp's USE attribute value corresponding to a DSpace bundle name.

Parameters:
bname - name of DSpace bundle.
Returns:
string name of fileGrp

getDmdTypes

public abstract String[] getDmdTypes(PackageParameters params)
                              throws SQLException,
                                     IOException,
                                     AuthorizeException
Get the types of Item-wide DMD to include in package. Each element of the returned array is a String, which MAY be just a simple name, naming both the Crosswalk Plugin and the METS "MDTYPE", or a colon-separated pair consisting of the METS name followed by a colon and the Crosswalk Plugin name. E.g. the type string "DC:qualifiedDublinCore" tells it to create a METS section with MDTYPE="DC" and use the plugin named "qualifiedDublinCore" to obtain the data.

Parameters:
params - the PackageParameters passed to the disseminator.
Returns:
array of metadata type strings, never null.
Throws:
SQLException
IOException
AuthorizeException

getTechMdType

public abstract String getTechMdType(PackageParameters params)
                              throws SQLException,
                                     IOException,
                                     AuthorizeException
Get the type string of the technical metadata to create for each Bitstream in the Item. The type string may be a simple name or colon-separated compound as specified for getDmdTypes() above.

Parameters:
params - the PackageParameters passed to the disseminator.
Returns:
array of metadata type strings, never null.
Throws:
SQLException
IOException
AuthorizeException

addRightsMd

public abstract void addRightsMd(Context context,
                                 Item item,
                                 edu.harvard.hul.ois.mets.AmdSec amdSec)
                          throws SQLException,
                                 IOException,
                                 AuthorizeException,
                                 edu.harvard.hul.ois.mets.helper.MetsException
Add Rights metadata for the Item, in the form of (rightsMd elements) to the given metadata section.

Throws:
SQLException
IOException
AuthorizeException
edu.harvard.hul.ois.mets.helper.MetsException

addStructMap

public abstract void addStructMap(Context context,
                                  Item item,
                                  PackageParameters params,
                                  edu.harvard.hul.ois.mets.Mets mets)
                           throws SQLException,
                                  IOException,
                                  AuthorizeException,
                                  edu.harvard.hul.ois.mets.helper.MetsException
Add any additional structMap elements to the METS document, as required by this subclass. A simple default structure map which fulfills the minimal DSpace METS DIP/SIP requirements is already present, so this does not need to do anything.

Parameters:
mets - the METS document to which to add structMaps
Throws:
SQLException
IOException
AuthorizeException
edu.harvard.hul.ois.mets.helper.MetsException


Copyright © 2010 DuraSpace. All Rights Reserved.