org.dspace.app.xmlui.objectmanager
Class AbstractAdapter

java.lang.Object
  extended by org.dspace.app.xmlui.objectmanager.AbstractAdapter
Direct Known Subclasses:
ContainerAdapter, ItemAdapter, RepositoryAdapter

public abstract class AbstractAdapter
extends Object

This is the abstract adapter containing all the common elements between the three types of adapters: item, container, and repository. Each adapter translate a given type of DSpace object into a METS document for rendering into the DRI document. This class provides the chasses for those unique parts of the document to be build upon, there are seven rendering methods that may be overriden for each section of the METS document. Header Descriptive Section Administrative Section File Section Structure Map Structural Link Behavioral Section

Author:
Scott Phillips

Field Summary
protected  ContentHandler contentHandler
          The SAX handlers for content and lexical events.
protected  String contextPath
          The contextPath of this webapplication, used for generateing urls.
static Namespace DIM
           
static String DIM_URI
           
protected  LexicalHandler lexicalHandler
           
static Namespace METS
           
static String[] METS_DEFINED_TYPES
          The METS defined types of Metadata, if a format is not listed here then it should use the string "OTHER" and provide additional attributes describing the metadata type
static String METS_URI
          Namespace declaration for METS & XLINK
protected  NamespaceSupport namespaces
           
static Namespace XLINK
           
static String XLINK_URI
           
static Namespace XSI
           
static String XSI_URI
           
 
Constructor Summary
AbstractAdapter(String contextPath)
          Construct a new adapter, implementers must use call this method so the approprate internal values are insured to be set correctly.
 
Method Summary
protected  void endElement(Namespace namespace, String name)
          Send the SAX events to end this element.
 DisseminationCrosswalk getDisseminationCrosswalk(String crosswalkName)
          Return a dissemination crosswalk for the given name.
protected  String getGenericID(String prefix)
          Generate a unique METS id.
protected abstract  String getMETSID()
           
protected abstract  String getMETSLabel()
           
protected abstract  String getMETSOBJEDIT()
           
protected abstract  String getMETSOBJID()
           
protected abstract  String getMETSProfile()
           
 boolean isDefinedMETStype(String metadataType)
          Determine if the provided metadata type is a stardard METS defined type.
protected  void renderAdministrativeSection()
           
protected  void renderBehavioralSection()
           
protected  void renderDescriptiveSection()
           
protected  void renderExtraSections()
           
protected  void renderFile(Item item, Bitstream bitstream, String fileID, String groupID)
          Generate a METS file element for a given bitstream.
protected  void renderFile(Item item, Bitstream bitstream, String fileID, String groupID, String admID)
          Generate a METS file element for a given bitstream.
protected  void renderFileSection()
           
protected  void renderHeader()
          Each of the METS sections
 void renderMETS(ContentHandler contentHandler, LexicalHandler lexicalHandler)
          Render the complete METS document.
protected  void renderStructuralLink()
           
protected  void renderStructureMap()
           
protected  void sendCharacters(String characters)
          Send the SAX event for these plain characters, not wrapped in any elements.
 void setAmdTypes(String amdSec, String mdTypes)
          Store information about what will be rendered in the METS administrative metadata section.
 void setDigiProvMDTypes(String digiprovMDTypes)
          A comma seperated list of METS digital provenance metadata formats to render.
 void setDmdTypes(String dmdTypes)
          A comma seperated list of METS descriptive metadata formats to render.
 void setFileGrpTypes(String fileGrpTypes)
          A comma seperated list of METS fileGrps to render.
 void setRightsMDTypes(String rightsMDTypes)
          A comma seperated list of METS intellectual property rights metadata formats to render.
 void setSections(String sections)
          A comma seperated list of METS sections to render.
 void setSourceMDTypes(String sourceMDTypes)
          A comma seperated list of METS source metadata formats to render.
 void setStructTypes(String structTypes)
          A comma seperated list of METS structural types to render.
 void setTechMDTypes(String techMDTypes)
          A comma seperated list of METS technical metadata formats to render.
protected  void startElement(Namespace namespace, String name, AttributeMap... attributes)
          Send the SAX events to start this element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METS_URI

public static final String METS_URI
Namespace declaration for METS & XLINK

See Also:
Constant Field Values

METS

public static final Namespace METS

XLINK_URI

public static final String XLINK_URI
See Also:
Constant Field Values

XLINK

public static final Namespace XLINK

XSI_URI

public static final String XSI_URI
See Also:
Constant Field Values

XSI

public static final Namespace XSI

DIM_URI

public static final String DIM_URI
See Also:
Constant Field Values

DIM

public static final Namespace DIM

contextPath

protected String contextPath
The contextPath of this webapplication, used for generateing urls.


contentHandler

protected ContentHandler contentHandler
The SAX handlers for content and lexical events. Also the support element for namespaces which knows the prefixes for each declared namespace.


lexicalHandler

protected LexicalHandler lexicalHandler

namespaces

protected NamespaceSupport namespaces

METS_DEFINED_TYPES

public static String[] METS_DEFINED_TYPES
The METS defined types of Metadata, if a format is not listed here then it should use the string "OTHER" and provide additional attributes describing the metadata type

Constructor Detail

AbstractAdapter

public AbstractAdapter(String contextPath)
Construct a new adapter, implementers must use call this method so the approprate internal values are insured to be set correctly.

Parameters:
contextPath - The contextPath of this web application.
Method Detail

setSections

public void setSections(String sections)
A comma seperated list of METS sections to render. If no value is provided then all METS sections are rendered.

Parameters:
sections - Comma seperated list of METS sections.

setDmdTypes

public void setDmdTypes(String dmdTypes)
A comma seperated list of METS descriptive metadata formats to render. If no value is provided then only the DIM format is used.

Parameters:
sections - Comma seperated list of METS metadata types.

setAmdTypes

public void setAmdTypes(String amdSec,
                        String mdTypes)
Store information about what will be rendered in the METS administrative metadata section. HashMap format: keys = amdSec, value = List of mdTypes

Parameters:
amdSec - Section of where this administrative metadata will be rendered
mdTypes - Comma seperated list of METS metadata types.

setTechMDTypes

public void setTechMDTypes(String techMDTypes)
A comma seperated list of METS technical metadata formats to render.

Parameters:
techMDTypes - Comma seperated list of METS metadata types.

setRightsMDTypes

public void setRightsMDTypes(String rightsMDTypes)
A comma seperated list of METS intellectual property rights metadata formats to render.

Parameters:
rightsMDTypes - Comma seperated list of METS metadata types.

setSourceMDTypes

public void setSourceMDTypes(String sourceMDTypes)
A comma seperated list of METS source metadata formats to render.

Parameters:
sourceMDTypes - Comma seperated list of METS metadata types.

setDigiProvMDTypes

public void setDigiProvMDTypes(String digiprovMDTypes)
A comma seperated list of METS digital provenance metadata formats to render.

Parameters:
digiprovMDTypes - Comma seperated list of METS metadata types.

setFileGrpTypes

public void setFileGrpTypes(String fileGrpTypes)
A comma seperated list of METS fileGrps to render. If no value is provided then all groups are rendered.

Parameters:
sections - Comma seperated list of METS file groups.

setStructTypes

public void setStructTypes(String structTypes)
A comma seperated list of METS structural types to render. If no value is provided then only the DIM format is used.

Parameters:
sections - Comma seperated list of METS structure types.

getMETSOBJID

protected abstract String getMETSOBJID()
                                throws WingException
Returns:
the URL for this item in the interface
Throws:
WingException

getMETSOBJEDIT

protected abstract String getMETSOBJEDIT()
Returns:
Return the URL for editing this item

getMETSID

protected abstract String getMETSID()
                             throws WingException
Returns:
the METS ID of the mets document.
Throws:
WingException

getMETSProfile

protected abstract String getMETSProfile()
                                  throws WingException
Returns:
The Profile this METS document conforms too.
Throws:
WingException

getMETSLabel

protected abstract String getMETSLabel()
                                throws WingException
Returns:
The label of this METS document.
Throws:
WingException

renderMETS

public void renderMETS(ContentHandler contentHandler,
                       LexicalHandler lexicalHandler)
                throws WingException,
                       SAXException,
                       CrosswalkException,
                       IOException,
                       SQLException
Render the complete METS document.

Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderHeader

protected void renderHeader()
                     throws WingException,
                            SAXException,
                            CrosswalkException,
                            IOException,
                            SQLException
Each of the METS sections

Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderDescriptiveSection

protected void renderDescriptiveSection()
                                 throws WingException,
                                        SAXException,
                                        CrosswalkException,
                                        IOException,
                                        SQLException
Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderAdministrativeSection

protected void renderAdministrativeSection()
                                    throws WingException,
                                           SAXException,
                                           CrosswalkException,
                                           IOException,
                                           SQLException
Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderFileSection

protected void renderFileSection()
                          throws WingException,
                                 SAXException,
                                 CrosswalkException,
                                 IOException,
                                 SQLException
Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderStructureMap

protected void renderStructureMap()
                           throws WingException,
                                  SAXException,
                                  CrosswalkException,
                                  IOException,
                                  SQLException
Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderStructuralLink

protected void renderStructuralLink()
                             throws WingException,
                                    SAXException,
                                    CrosswalkException,
                                    IOException,
                                    SQLException
Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderBehavioralSection

protected void renderBehavioralSection()
                                throws WingException,
                                       SAXException,
                                       CrosswalkException,
                                       IOException,
                                       SQLException
Throws:
WingException
SAXException
CrosswalkException
IOException
SQLException

renderExtraSections

protected void renderExtraSections()
                            throws WingException,
                                   SAXException,
                                   CrosswalkException,
                                   SQLException,
                                   IOException
Throws:
WingException
SAXException
CrosswalkException
SQLException
IOException

renderFile

protected void renderFile(Item item,
                          Bitstream bitstream,
                          String fileID,
                          String groupID)
                   throws SAXException
Generate a METS file element for a given bitstream.

Parameters:
item - If the bitstream is associated with an item provid the item otherwise leave null.
bitstream - The bitstream to build a file element for.
fileID - The unique file id for this file.
groupID - The group id for this file, if it is derived from another file then they should share the same groupID.
Throws:
SAXException

renderFile

protected void renderFile(Item item,
                          Bitstream bitstream,
                          String fileID,
                          String groupID,
                          String admID)
                   throws SAXException
Generate a METS file element for a given bitstream.

Parameters:
item - If the bitstream is associated with an item provid the item otherwise leave null.
bitstream - The bitstream to build a file element for.
fileID - The unique file id for this file.
groupID - The group id for this file, if it is derived from another file then they should share the same groupID.
admID - The IDs of the administrative metadata sections which pertain to this file
Throws:
SAXException

getGenericID

protected String getGenericID(String prefix)
Generate a unique METS id. For consistancy, all prefixs should probably end in an underscore, "_".

Parameters:
prefix - Prefix to prepend to the id for readability.
Returns:
A unique METS id.

getDisseminationCrosswalk

public DisseminationCrosswalk getDisseminationCrosswalk(String crosswalkName)
                                                 throws WingException
Return a dissemination crosswalk for the given name.

Parameters:
crosswalkName -
Returns:
The crosswalk or throw an exception if not found.
Throws:
WingException

isDefinedMETStype

public boolean isDefinedMETStype(String metadataType)
Determine if the provided metadata type is a stardard METS defined type. If it is not, use the other string.

Parameters:
metadataType - type name
Returns:
True if METS defined

startElement

protected void startElement(Namespace namespace,
                            String name,
                            AttributeMap... attributes)
                     throws SAXException
Send the SAX events to start this element.

Parameters:
contentHandler - (Required) The registered contentHandler where SAX events should be routed too.
namespaces - (Required) SAX Helper class to keep track of namespaces able to determine the correct prefix for a given namespace URI.
namespace - (Required) The namespace of this element.
name - (Required) The local name of this element.
attributes - (May be null) Attributes for this element
Throws:
SAXException

sendCharacters

protected void sendCharacters(String characters)
                       throws SAXException
Send the SAX event for these plain characters, not wrapped in any elements.

Parameters:
contentHandler - (Required) The registered contentHandler where SAX events should be routed too.
characters - (May be null) Characters to send.
Throws:
SAXException

endElement

protected void endElement(Namespace namespace,
                          String name)
                   throws SAXException
Send the SAX events to end this element.

Parameters:
contentHandler - (Required) The registered contentHandler where SAX events should be routed too.
namespaces - (Required) SAX Helper class to keep track of namespaces able to determine the correct prefix for a given namespace URI.
namespace - (Required) The namespace of this element.
name - (Required) The local name of this element.
Throws:
SAXException


Copyright © 2010 The DSpace Foundation. All Rights Reserved.