|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.uiuc.ndiipp.hubandspoke.profile.METSProfile
edu.uiuc.ndiipp.hubandspoke.profile.HaSMETSProfile
public class HaSMETSProfile
This class represents a METS XML document that conforms to the UIUC Hub and Spoke METS profile. This is basically a wrapper around various XMLBeans class libraries for the different XML Schema used by the profile.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class edu.uiuc.ndiipp.hubandspoke.profile.METSProfile |
|---|
METSProfile.AMD_SECTION, METSProfile.DMDSecStatus, METSProfile.PackageType, METSProfile.PREMISAgentType, METSProfile.PREMISEventType, METSProfile.PREMISIdentifierType, METSProfile.PREMISLinkingAgentRole, METSProfile.PREMISObjectCategory, METSProfile.PREMISSwType, METSProfile.StructMapType, METSProfile.TechMDStatus |
| Field Summary |
|---|
| Fields inherited from class edu.uiuc.ndiipp.hubandspoke.profile.METSProfile |
|---|
AMD_NS, JHOVE_NS, METS_NS, MIX_NS, MODS_NS, PREMIS_NS, TEXTMD_NS, VMD_NS, XLINK_NS |
| Method Summary | |
|---|---|
gov.loc.mets.MetsMdSecType |
addAgentToEvent(gov.loc.premis.PremisEventDocument event,
gov.loc.premis.PremisAgentDocument agent,
METSProfile.PREMISLinkingAgentRole agentRole)
Associate the given PremisAgentDocument with the given PremisEventDocument using the given HaSMETSProfile.PREMISLinkingAgentRole. |
gov.loc.mets.MetsMdSecType |
addAlternateDmdSec(gov.loc.mets.MetsMdSecType.MdRef.MDTYPE.Enum type,
java.lang.String otherType,
java.io.File file)
Add a new alternate dmdSec to the document. |
gov.loc.mets.MetsMdSecType |
addAlternateDmdSec(gov.loc.mets.MetsMdSecType.MdWrap.MDTYPE.Enum type,
java.lang.String otherType,
org.w3c.dom.Node xmlAny)
Add a new alternate dmdSec to the document. |
gov.loc.mets.MetsMdSecType |
addEventToXmlObject(org.apache.xmlbeans.XmlObject mdSec,
gov.loc.premis.PremisEventDocument event)
Add the given PREMIS event as a new amdSec/digiprovMD element, also associate the given agents to the event |
gov.loc.mets.MetsMdSecType |
addEventToXmlObject(org.apache.xmlbeans.XmlObject mdSec,
gov.loc.premis.PremisEventDocument event,
gov.loc.premis.PremisAgentDocument[] agents,
METSProfile.PREMISLinkingAgentRole[] roles)
Add the given PREMIS event as a new amdSec/digiprovMD element, also associate the given agents to the event |
gov.loc.mets.MetsFileType |
addFile(java.io.File file)
Add a new file and associated technical metadata to the METS document |
void |
addNewChecksum(gov.loc.mets.MetsFileType file,
gov.loc.mets.MetsFileType.CHECKSUMTYPE.Enum cType,
java.lang.String cValue)
Add a new checksum to the file. |
void |
addNewPREMISObjectTechMDToAllFile()
Add Premis object techMD to each file in the METS document, unless it already has one |
gov.loc.mets.MetsMdSecType |
addNewPrimaryRepresentation(METSProfile.PREMISIdentifierType idType,
java.lang.String id)
Add a new PRIMARY_REPRESENTATION Premis Object techMD section to the document |
void |
addPremisObjectIdentifierToFile(gov.loc.mets.MetsFileType file,
METSProfile.PREMISIdentifierType idType,
java.lang.String idVal,
java.lang.String xlTitle)
Add an objectIdentifier to the files associated PREMIS object technical metadata |
gov.loc.mets.MetsMdSecType |
addTechMDXmlObjectToFile(gov.loc.mets.MetsFileType ft,
org.apache.xmlbeans.XmlObject xobj)
Add a techMD/mdWrap/xmlData/any section of the appropriate type and link it to the given file element via the file elements ADMID attribute. |
void |
associateAmdSecToXmlObject(gov.loc.mets.MetsMdSecType mdSec,
org.apache.xmlbeans.XmlObject xobj)
Associate the given MetsMdSecType with the given XmlObject via the ADMID attribute of the XmlObject |
gov.loc.mods.ModsModsDocument |
augmentAquiferModsDocument(gov.loc.mods.ModsModsDocument modsDoc)
Augment the ModsModsDocument so that it conforms to the Aquifer profile. |
void |
compareFiles(HaSMETSProfile mets)
Compares files with those from another METS documents, checking for differences in file name, size, and mime type. |
void |
convertPrimaryDmdSecToAquifer()
|
static gov.loc.mods.ModsModsDocument |
createBasicAquiferModsDocument(java.lang.String title,
gov.loc.mods.ModsResourceType.Enum resourceType,
gov.loc.mods.ModsPhysicalDescriptionType.DigitalOrigin.Enum digitalOrigin,
java.lang.String mimeType,
java.lang.String location)
Return a ModsModsDocument which is minimally compliant to the Aquifer MODS profile |
static gov.loc.premis.PremisEventDocument |
createBasicPremisEvent(METSProfile.PREMISEventType eventType,
java.lang.String eventDetail)
Returns a basic PremisEventDocument with the given params The eventIdentifierValue is just the current dateTime and the eventIdentifierType is 'LOCAL' |
static gov.loc.premis.PremisEventDocument |
createBasicPremisEvent(java.lang.String id,
METSProfile.PREMISEventType eventType,
java.lang.String eventDetail)
Returns a basic PremisEventDocument with the given params |
gov.loc.mets.MetsMdSecType[] |
getAllAmdSecMDs(org.apache.xmlbeans.XmlObject xobj)
If the given xobj has an ADMID attribute return all the MetsMdSecType elements that are referenced by that ADMID |
gov.loc.mets.MetsFileType[] |
getAllFiles()
Return an array of XMLBean FileType objects for all files |
gov.loc.mets.MetsMdSecType[] |
getAlternateDmdSecArray()
Returns the alternate dmdSec elements which has a STATUS='ALTERNATE_DMDSEC' attribute |
gov.loc.mets.MetsMdSecType |
getAlternateDmdSecArray(int i)
Returns a specific alternate dmdSec element which has a STATUS='ALTERNATE_DMDSEC' attribute |
java.net.URI |
getBaseURIMinusFile()
Return the base URI of the current METS file, minus the filename |
gov.loc.premis.PremisAgentDocument |
getDefaultHumanAgent()
Return the default PREMIS agent which represent the current human operator |
gov.loc.premis.PremisAgentDocument |
getDefaultSoftwareAgent()
Return the default PREMIS agent which represent this software |
java.io.InputStream |
getFileInputStream(gov.loc.mets.MetsFileType file)
Return an InputStream for the MetsFileType object, can accomodate either the FContent or FLocat sub-elements |
gov.loc.mets.MetsFileType[] |
getFiles(gov.loc.mets.MetsFileType.CHECKSUMTYPE.Enum algorithm,
java.lang.String digest)
Given the CHECKSUM of a file return the XMLBean FileType object(s) that reference that file |
gov.loc.mets.MetsFileType[] |
getFiles(java.lang.String ids)
Return an array of XMLBean FileType objects with a given ID(s) |
gov.loc.mets.MetsFileType.FLocat[] |
getFLocat(java.lang.String url)
Given the URL of a file return the MetsFileType.FLocat(s) that reference that file in the href |
org.apache.xmlbeans.XmlObject |
getMDSecXmlObject(gov.loc.mets.MetsMdSecType mdsec)
Return the xml which is either referenced or wrapped in the given mdSecType section. |
org.apache.xmlbeans.XmlID |
getNewID(java.lang.String prefix,
org.apache.xmlbeans.XmlObject xobj)
Get the next unassigned ID value that can be used in the METS file and assign it to an XmlObject |
METSProfile.PackageType |
getPackageType()
Return the OAIS package type represented by the current METS document |
gov.loc.mets.MetsMdSecType |
getPrimaryDmdSec()
Returns the primary dmdSec element which has a STATUS='PRIMARY_DMDSEC' attribute |
gov.loc.mets.MetsMdSecType |
getPrimaryRepresentation()
Returns the primary representation techMD element which has a STATUS='PRIMARY_REPRESENTATION' attribute |
gov.loc.mets.MetsStructMapType |
getPrimaryStructMap()
Returns the primary structMap element which has a TYPE='PRIMARY_STRUCTMAP' attribute |
gov.loc.mets.MetsMdSecType[] |
getSpecificAmdSecXmlData(org.apache.xmlbeans.XmlObject xobj,
METSProfile.AMD_SECTION amdSec,
javax.xml.namespace.QName qn)
Return the specific administrative metadata MetsMdSec which is referenced from the XmlObject and is of the appropriate type |
gov.loc.mets.MetsMdSecType[] |
getTechMDsForFile(gov.loc.mets.MetsFileType ft)
Return all the techMD sections associated with the given File |
org.apache.xmlbeans.XmlObject |
getXmlObject(java.lang.String id)
Return an XmlObject for a given ID attribute value; you should cast this to an XMLBean object of the appropriate type |
METSProfile.PackageType |
guessPackageType(HaSMETSAppender app)
Determine if the package is an AIP, SIP, or DIP by trying to validate it as if it was each type. |
boolean |
hasSpecificAmdSecXmlData(org.apache.xmlbeans.XmlObject xobj,
METSProfile.AMD_SECTION amdSec,
javax.xml.namespace.QName qn)
Test whether the given XmlObject references an administrative metadata section of the given type which wraps metadata of a given type |
java.net.URI |
resolveURIAgainstBaseURI(java.lang.String relativeURI)
Return a new URI which is the given relative URI string resolved against base URI for the METS document |
java.net.URI |
resolveURIAgainstBaseURI(java.net.URI relativeURI)
Return a new URI which is the given relative URI resolved against the base URI for the METS document |
void |
save(java.lang.String dest)
Save the METS document to the given destination file |
void |
saveFile(gov.loc.mets.MetsFileType file,
java.lang.String path)
Save the MetsFileType file to the given location |
void |
setBaseURI(java.net.URI baseURI)
Set the base URI of the current METS file. |
void |
setLabelFromPrimaryDmdSec()
Extracts the value of the MODS title element and sets it as the LABEL of the HaSMETSProfile |
org.w3c.dom.Node |
setMDSecXmlObject(gov.loc.mets.MetsMdSecType mdsec,
org.apache.xmlbeans.XmlObject xobj)
Set the xmlData of the given MetsMdSecType element to the given XmlObject. |
void |
setNewPrimaryID(java.lang.String idValue,
METSProfile.PREMISIdentifierType idType)
Use the given values to give the METS document a new identifier |
void |
setPackageType(METSProfile.PackageType packageType)
Set the OAI package type of the current METS document |
boolean |
validateProfile(METSProfile.PackageType pt)
Validate the METS document against the requirements of the METS HaS Profile |
boolean |
validateProfile(METSProfile.PackageType pt,
HaSMETSAppender app)
Validate the METS document against the requirements of the METS HaS Profile |
| Methods inherited from class edu.uiuc.ndiipp.hubandspoke.profile.METSProfile |
|---|
createBasicPremisObject, createPremisObjectFromFile, getBaseURI, getMetsDocument, newPREMISObjectTechMD, newPREMISObjectTechMD, newPREMISObjectTechMD |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static gov.loc.mods.ModsModsDocument createBasicAquiferModsDocument(java.lang.String title,
gov.loc.mods.ModsResourceType.Enum resourceType,
gov.loc.mods.ModsPhysicalDescriptionType.DigitalOrigin.Enum digitalOrigin,
java.lang.String mimeType,
java.lang.String location)
title - resourceType - digitalOrigin - mimeType - location -
public static gov.loc.premis.PremisEventDocument createBasicPremisEvent(METSProfile.PREMISEventType eventType,
java.lang.String eventDetail)
eventType - eventDetail -
public static gov.loc.premis.PremisEventDocument createBasicPremisEvent(java.lang.String id,
METSProfile.PREMISEventType eventType,
java.lang.String eventDetail)
id - eventType - eventDetail -
public gov.loc.mets.MetsMdSecType addAgentToEvent(gov.loc.premis.PremisEventDocument event,
gov.loc.premis.PremisAgentDocument agent,
METSProfile.PREMISLinkingAgentRole agentRole)
event - PremisEventDocumentagent - PremisAgentDocumentagentRole - HaSMETSProfile.PREMISLinkingAgentRole
public gov.loc.mets.MetsMdSecType addAlternateDmdSec(gov.loc.mets.MetsMdSecType.MdRef.MDTYPE.Enum type,
java.lang.String otherType,
java.io.File file)
type - the MetsMdSecType.MdRef.MDTYPE for newly added dmdSecotherType - if type is OTHER then set this to the other typefile - java.io.File representing MD to be referenced from a mdRef
element
public gov.loc.mets.MetsMdSecType addAlternateDmdSec(gov.loc.mets.MetsMdSecType.MdWrap.MDTYPE.Enum type,
java.lang.String otherType,
org.w3c.dom.Node xmlAny)
type - the MetsMdSecType.MdWrap.MDTYPE for newly added dmdSecotherType - if type is OTHER then set this to the other typexmlAny - a DOM Node containing the XML for the newly added dmdSec
public gov.loc.mets.MetsMdSecType addEventToXmlObject(org.apache.xmlbeans.XmlObject mdSec,
gov.loc.premis.PremisEventDocument event)
mdSec - the MetsMdSecType element to associate with the eventevent - the PremisEventDocument to use
public gov.loc.mets.MetsMdSecType addEventToXmlObject(org.apache.xmlbeans.XmlObject mdSec,
gov.loc.premis.PremisEventDocument event,
gov.loc.premis.PremisAgentDocument[] agents,
METSProfile.PREMISLinkingAgentRole[] roles)
mdSec - the MetsMdSecType element to associate with the eventevent - the PremisEventDocument to useagents - an array of PremisAgentDocument elements associated to the
eventroles - an array of HaSMETSProfile.PREMISLinkingAgentRole which are
associated with each agent
public gov.loc.mets.MetsFileType addFile(java.io.File file)
throws HaSMETSProfileException
file -
HaSMETSProfileException
public void addNewChecksum(gov.loc.mets.MetsFileType file,
gov.loc.mets.MetsFileType.CHECKSUMTYPE.Enum cType,
java.lang.String cValue)
throws HaSMETSProfileException
file - the file of interestcType - the checksum typecValue - the checksum value
HaSMETSProfileException
public void addNewPREMISObjectTechMDToAllFile()
throws HaSMETSProfileException
HaSMETSProfileException
public gov.loc.mets.MetsMdSecType addNewPrimaryRepresentation(METSProfile.PREMISIdentifierType idType,
java.lang.String id)
throws HaSMETSProfileException
idType - the type of id to use for the objectid - the id to use for the object
HaSMETSProfileException - if the document already has a PRIMARY_REPRESENTATION
public void addPremisObjectIdentifierToFile(gov.loc.mets.MetsFileType file,
METSProfile.PREMISIdentifierType idType,
java.lang.String idVal,
java.lang.String xlTitle)
throws HaSMETSProfileException
file - the file of interestidType - the type of the new identifieridVal - the value of the new identifier
HaSMETSProfileException - if the file does not have an associated premis techMD
public gov.loc.mets.MetsMdSecType addTechMDXmlObjectToFile(gov.loc.mets.MetsFileType ft,
org.apache.xmlbeans.XmlObject xobj)
throws HaSMETSProfileException
ft - the FileType element to attach the new techMD toxobj - the XmlObject to add under the xmlData section
HaSMETSProfileException - if an unexpected type of XmlObject is passed
public void associateAmdSecToXmlObject(gov.loc.mets.MetsMdSecType mdSec,
org.apache.xmlbeans.XmlObject xobj)
mdSec - xobj - public gov.loc.mods.ModsModsDocument augmentAquiferModsDocument(gov.loc.mods.ModsModsDocument modsDoc)
modsDoc - the ModsModsDocument to augment
public void compareFiles(HaSMETSProfile mets)
throws HaSMETSProfileException
mets - an EchoDep METS file
HaSMETSProfileException
public void convertPrimaryDmdSecToAquifer()
throws HaSMETSProfileException
HaSMETSProfileExceptionpublic gov.loc.mets.MetsMdSecType[] getAllAmdSecMDs(org.apache.xmlbeans.XmlObject xobj)
xobj - XmlObject
public gov.loc.mets.MetsFileType[] getAllFiles()
public gov.loc.mets.MetsMdSecType[] getAlternateDmdSecArray()
public gov.loc.mets.MetsMdSecType getAlternateDmdSecArray(int i)
i - the ordinal of the alternate dmdSec element to return
public java.net.URI getBaseURIMinusFile()
public gov.loc.premis.PremisAgentDocument getDefaultHumanAgent()
public gov.loc.premis.PremisAgentDocument getDefaultSoftwareAgent()
public java.io.InputStream getFileInputStream(gov.loc.mets.MetsFileType file)
throws HaSMETSProfileException
file - the MetsFileType object for the file of interest
HaSMETSProfileException - if the stream is not accessible
public gov.loc.mets.MetsFileType[] getFiles(gov.loc.mets.MetsFileType.CHECKSUMTYPE.Enum algorithm,
java.lang.String digest)
algorithm - CHECKSUM typedigest - CHECKSUM digest
public gov.loc.mets.MetsFileType[] getFiles(java.lang.String ids)
ids - one or more ID values separated by space
public gov.loc.mets.MetsFileType.FLocat[] getFLocat(java.lang.String url)
url - String for the URL, either relative or absolute
public org.apache.xmlbeans.XmlObject getMDSecXmlObject(gov.loc.mets.MetsMdSecType mdsec)
throws HaSMETSProfileException
NOTE: The returned object is a copy; therefore, if changes are made which must be reflected back in the METS document the setMDSecXmlObject method must be called.
mdsec - an MdSecType object representing the MetsMdSecType element
HaSMETSProfileException - if the xmlData cannot be parsed into a recognized type or if
the xml is not accessible
public org.apache.xmlbeans.XmlID getNewID(java.lang.String prefix,
org.apache.xmlbeans.XmlObject xobj)
getNewID in class METSProfileprefix - string that will be prepended to all ID values, if this is
null or empty string then the value "ID" will be usedxobj - the XmlObject to which the ID will be assigned
public METSProfile.PackageType getPackageType()
public gov.loc.mets.MetsMdSecType getPrimaryDmdSec()
throws HaSMETSProfileException
HaSMETSProfileException - if there is not exactly one primary dmdSec element
public gov.loc.mets.MetsMdSecType getPrimaryRepresentation()
throws HaSMETSProfileException
HaSMETSProfileException - if there is not exactly one primary representation techMD
element
public gov.loc.mets.MetsStructMapType getPrimaryStructMap()
throws HaSMETSProfileException
HaSMETSProfileException - if there is not exactly one primary structMap techMD element
public gov.loc.mets.MetsMdSecType[] getSpecificAmdSecXmlData(org.apache.xmlbeans.XmlObject xobj,
METSProfile.AMD_SECTION amdSec,
javax.xml.namespace.QName qn)
xobj - the XmlObject to testamdSec - the type of AMD_SECTION being looked forqn - the QName of the root element in the xmlData being looked for
public gov.loc.mets.MetsMdSecType[] getTechMDsForFile(gov.loc.mets.MetsFileType ft)
ft - the XMLBean FileType object for the file object
public org.apache.xmlbeans.XmlObject getXmlObject(java.lang.String id)
id - the id string
public METSProfile.PackageType guessPackageType(HaSMETSAppender app)
app - an HaSMETSAppender to which error messages will be added, may
be null
public boolean hasSpecificAmdSecXmlData(org.apache.xmlbeans.XmlObject xobj,
METSProfile.AMD_SECTION amdSec,
javax.xml.namespace.QName qn)
xobj - the XmlObject to testamdSec - the type of AMD_SECTION being looked forqn - the QName of the root element in the xmlData being looked for
public java.net.URI resolveURIAgainstBaseURI(java.lang.String relativeURI)
relativeURI - the relative URI to be resolved
public java.net.URI resolveURIAgainstBaseURI(java.net.URI relativeURI)
relativeURI - the relative URI to be resolved
public void save(java.lang.String dest)
dest -
public void saveFile(gov.loc.mets.MetsFileType file,
java.lang.String path)
throws HaSMETSProfileException
file - the MetsFileType to savepath - the location to save
HaSMETSProfileExceptionpublic void setBaseURI(java.net.URI baseURI)
baseURI - the URI to set
public void setLabelFromPrimaryDmdSec()
throws HaSMETSProfileException
HaSMETSProfileException
public org.w3c.dom.Node setMDSecXmlObject(gov.loc.mets.MetsMdSecType mdsec,
org.apache.xmlbeans.XmlObject xobj)
throws HaSMETSProfileException
mdsec - the MetsMdSecType object to which to add the XmlObjectxobj - the XmlObject to set
HaSMETSProfileException - if the techMD//xmlData section contains multiple children or
if the techMD//xmlData already contains an element which is
of a different type than that being set
public void setNewPrimaryID(java.lang.String idValue,
METSProfile.PREMISIdentifierType idType)
throws HaSMETSProfileException
idValue - String for the new ididType - HaSMETSProfile.PREMISIdentifierType
HaSMETSProfileException - if there is no Primary Representationpublic void setPackageType(METSProfile.PackageType packageType)
packageType - HaSMETSProfile.PackageType: SIP, DIP, AIPpublic boolean validateProfile(METSProfile.PackageType pt)
pt - the PackageType to assume for validation purposes
public boolean validateProfile(METSProfile.PackageType pt,
HaSMETSAppender app)
pt - the PackageType to assume for validation purposesapp - HaSMETSAppender which will accumulate the log events, may be
null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||