public class METSManifest extends Object
Manage the METS manifest document for METS importer classes,
such as the package importer org.dspace.content.packager.MetsSubmission
and the federated importer org.dspace.app.mets.FederatedMETSImport
It can parse the METS document, build an internal model, and give the importers access to that model. It also crosswalks all of the descriptive and administrative metadata in the METS manifest into the target DSpace Item, under control of the importer.
It reads the following DSpace Configuration entries:
mets.xsd.identifier = namespace xsd-URL
mets.xsd.dc = http://purl.org/dc/elements/1.1/ dc.xsd
MDTYPE (or OTHERMDTYPE)
By default, the crosswalk mechanism will look for a plugin with the
same name as the metadata type (e.g. "MODS",
"DC"). This example line invokes the QDC
plugin when MDTYPE="DC"
mets.submission.crosswalk.DC = QDC
mets.submission.crosswalk.mdType = pluginName
org.dspace.content.packager.MetsSubmission,
org.dspace.app.mets.FederatedMETSImport| Modifier and Type | Class and Description |
|---|---|
static interface |
METSManifest.Mdref
Callback interface to retrieve data streams in mdRef elements.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_METS_PREFIX
Prefix of DSpace configuration lines that map METS metadata type to
crosswalk plugin names.
|
static String |
MANIFEST_FILE
Canonical filename of METS manifest within a package or as a bitstream.
|
static org.jdom.Namespace |
metsNS
METS namespace -- includes "mets" prefix for use in XPaths
|
static org.jdom.Namespace |
xlinkNS
XLink namespace -- includes "xlink" prefix prefix for use in XPaths
|
| Modifier and Type | Method and Description |
|---|---|
static METSManifest |
create(InputStream is,
boolean validate,
String configName)
Create a new manifest object from a serialized METS XML document.
|
void |
crosswalkBitstream(Context context,
PackageParameters params,
Bitstream bitstream,
String fileId,
METSManifest.Mdref callback)
Crosswalk the metadata associated with a particular
file
element into the bitstream it corresponds to. |
void |
crosswalkItemDmd(Context context,
PackageParameters params,
DSpaceObject dso,
org.jdom.Element dmdSec,
METSManifest.Mdref callback)
Invokes appropriate crosswalks on Item-wide descriptive metadata.
|
void |
crosswalkObjectOtherAdminMD(Context context,
PackageParameters params,
DSpaceObject dso,
METSManifest.Mdref callback)
Crosswalk all technical and source metadata sections that belong
to the whole object.
|
boolean |
crosswalkObjectSourceMD(Context context,
PackageParameters params,
DSpaceObject dso,
METSManifest.Mdref callback)
Just crosswalk the sourceMD sections; used to set the handle and parent of AIP.
|
static String |
getBundleName(org.jdom.Element file)
Get the DSpace bundle name corresponding to the
USE
attribute of the file group enclosing this file element. |
String[] |
getChildMetsFilePaths()
Retrieve the file paths for the children objects' METS Manifest files.
|
List |
getChildObjDivs()
Get an array of child object
<div>s from the METS Manifest <structMap>. |
List<org.jdom.Element> |
getContentFiles()
Gets all
file elements which make up
the item's content. |
org.jdom.Element[] |
getDmdElements(String dmdList)
Gets all dmdSec elements from a space separated list
|
static String |
getFileName(org.jdom.Element file)
Get the "local" file name of this
file or mdRef element. |
org.jdom.Element[] |
getItemDmds()
Gets all dmdSec elements containing metadata for the DSpace Item.
|
org.jdom.Element[] |
getItemRightsMD()
Return rights metadata section(s) relevant to item as a whole.
|
InputStream |
getMdContentAsStream(org.jdom.Element mdSec,
METSManifest.Mdref callback)
Return contents of *md element as stream.
|
List<org.jdom.Element> |
getMdContentAsXml(org.jdom.Element mdSec,
METSManifest.Mdref callback)
Return contents of *md element as List of XML Element objects.
|
String |
getMdContentMimeType(org.jdom.Element mdSec)
Returns MIME type of metadata content, if available.
|
List |
getMdFiles()
Gets list of all
mdRef elements in the METS
document. |
String |
getMdType(org.jdom.Element mdSec)
Get the metadata type from within a *mdSec element.
|
org.jdom.Element |
getMets() |
InputStream |
getMetsAsStream()
Return entire METS document as an inputStream
|
String |
getObjID()
Return the OBJID attribute of the METS manifest.
|
org.jdom.Element |
getObjStructDiv()
Return the
<div> which describes this DSpace Object (and its contents)
from the <structMap>. |
String |
getOriginalFilePath(org.jdom.Element file)
Get the "original" file element for a derived file.
|
String |
getParentOwnerLink()
Return the reference to the Parent Object from the "Parent"
<structMap>. |
org.jdom.Element |
getPrimaryOrLogoBitstream()
Returns file element corresponding to primary bitstream.
|
String |
getProfile()
Gets name of the profile to which this METS document conforms.
|
public static final String MANIFEST_FILE
public static final String CONFIG_METS_PREFIX
public static final org.jdom.Namespace metsNS
public static final org.jdom.Namespace xlinkNS
public static METSManifest create(InputStream is, boolean validate, String configName) throws IOException, MetadataValidationException
is - input stream containing serialized XMLvalidate - if true, enable XML validation using schemas
in document. Also validates any sub-documents.MetadataValidationException - if there is any error parsing
or validating the METS.IOExceptionpublic String getProfile()
public String getObjID()
public List<org.jdom.Element> getContentFiles() throws MetadataValidationException
file elements which make up
the item's content.Elements.MetadataValidationExceptionpublic List getMdFiles() throws MetadataValidationException
mdRef elements in the METS
document. Used by ingester to e.g. check that all
required files are present.Elements.MetadataValidationExceptionpublic String getOriginalFilePath(org.jdom.Element file)
NOTE: This pattern of relating derived files through the GROUPID attribute is peculiar to the DSpace METS SIP profile, and may not be generally useful with other sorts of METS documents.
file - METS file element of derived filepublic static String getBundleName(org.jdom.Element file) throws MetadataValidationException
USE
attribute of the file group enclosing this file element.MetadataValidationException - when there is no USE attribute on the enclosing fileGrp.public static String getFileName(org.jdom.Element file) throws MetadataValidationException
file or mdRef element.
By "local" we mean the reference to the actual resource containing
the data for this file, e.g. a relative path within a Zip or tar archive
if the METS is serving as a manifest for that sort of package.file or mdRef element.MetadataValidationException - when there is not enough information to find a resource identifier.public org.jdom.Element getPrimaryOrLogoBitstream()
throws MetadataValidationException
div under
first structMap has an fptr.MetadataValidationExceptionpublic String getMdType(org.jdom.Element mdSec) throws MetadataValidationException
MetadataValidationExceptionpublic String getMdContentMimeType(org.jdom.Element mdSec) throws MetadataValidationException
MetadataValidationExceptionpublic List<org.jdom.Element> getMdContentAsXml(org.jdom.Element mdSec, METSManifest.Mdref callback) throws MetadataValidationException, PackageValidationException, IOException, SQLException, AuthorizeException
MetadataValidationException - if METS is invalid, or there is an error parsing the XML.PackageValidationExceptionIOExceptionSQLExceptionAuthorizeExceptionpublic InputStream getMdContentAsStream(org.jdom.Element mdSec, METSManifest.Mdref callback) throws MetadataValidationException, PackageValidationException, IOException, SQLException, AuthorizeException
MetadataValidationException - if METS format does not contain any metadata.PackageValidationExceptionIOExceptionSQLExceptionAuthorizeExceptionpublic org.jdom.Element getObjStructDiv()
throws MetadataValidationException
<div> which describes this DSpace Object (and its contents)
from the <structMap>. In all cases, this is the first <div>
in the first <structMap>.<div>MetadataValidationExceptionpublic List getChildObjDivs() throws MetadataValidationException
<div>s from the METS Manifest <structMap>.
These <div>s reference the location of any child objects METS manifests.Elements, each a <div>. May be empty but NOT null.MetadataValidationExceptionpublic String[] getChildMetsFilePaths() throws MetadataValidationException
<mptr> where @LOCTYPE=URLMetadataValidationExceptionpublic String getParentOwnerLink() throws MetadataValidationException
<structMap>.
This parent object is the owner of current object.MetadataValidationExceptionpublic org.jdom.Element[] getItemDmds()
throws MetadataValidationException
MetadataValidationException - if the METS is missing a reference to item-wide
DMDs in the correct place.public org.jdom.Element[] getDmdElements(String dmdList) throws MetadataValidationException
dmdList - space-separated list of DMDIDsMetadataValidationException - if the METS is missing a reference to item-wide
DMDs in the correct place.public org.jdom.Element[] getItemRightsMD()
throws MetadataValidationException
MetadataValidationException - if METS is invalid, e.g. referenced amdSec is missing.public void crosswalkItemDmd(Context context, PackageParameters params, DSpaceObject dso, org.jdom.Element dmdSec, METSManifest.Mdref callback) throws MetadataValidationException, PackageValidationException, CrosswalkException, IOException, SQLException, AuthorizeException
public void crosswalkObjectOtherAdminMD(Context context, PackageParameters params, DSpaceObject dso, METSManifest.Mdref callback) throws MetadataValidationException, PackageValidationException, CrosswalkException, IOException, SQLException, AuthorizeException
MetadataValidationException - if METS is invalid, e.g. referenced amdSec is missing.PackageValidationExceptionCrosswalkExceptionIOExceptionSQLExceptionAuthorizeExceptionpublic boolean crosswalkObjectSourceMD(Context context, PackageParameters params, DSpaceObject dso, METSManifest.Mdref callback) throws MetadataValidationException, PackageValidationException, CrosswalkException, IOException, SQLException, AuthorizeException
MetadataValidationExceptionPackageValidationExceptionCrosswalkExceptionIOExceptionSQLExceptionAuthorizeExceptionpublic void crosswalkBitstream(Context context, PackageParameters params, Bitstream bitstream, String fileId, METSManifest.Mdref callback) throws MetadataValidationException, PackageValidationException, CrosswalkException, IOException, SQLException, AuthorizeException
file
element into the bitstream it corresponds to.context - a dspace context.params - any PackageParameters which may affect how bitstreams are crosswalkedbitstream - bitstream target of the crosswalkfileId - value of ID attribute in the file element responsible
for the contents of that bitstream.callback - ???MetadataValidationExceptionPackageValidationExceptionCrosswalkExceptionIOExceptionSQLExceptionAuthorizeExceptionpublic org.jdom.Element getMets()
public InputStream getMetsAsStream()
Copyright © 2015 DuraSpace. All Rights Reserved.