DLESE Tools
v1.6.0

org.dlese.dpc.xml.maps
Class DleseXMLReader

java.lang.Object
  extended by org.dlese.dpc.xml.maps.DleseXMLReader
All Implemented Interfaces:
XMLMap

public class DleseXMLReader
extends Object
implements XMLMap

This class provides mapping between DLESE metadata values and the corresponding XML metadata record.

The accessor methods act as an interface with the XMLNode and XMLRecord classes. The XML processing details are handled by those classes, but the one requirement of this class is to have knowledge of the paths structure. Paths are used as keys into the XMLRecord map.

Version:
0.9b, 05/20/02
Author:
Dave Deniman

Field Summary
protected  boolean isValid
          boolean value indicates success of initialization
protected  HashMap map
          mapping of user-defined names to metadata values
protected  File xmlFile
          source XML file
protected  XMLRecord xmlRecord
          convenience abstraction of the XML DOM
 
Constructor Summary
protected DleseXMLReader()
          Default constructor is restricted to assure that a file directory is provided on object creation.
  DleseXMLReader(File xmlfile)
           
  DleseXMLReader(String filepath)
           
 
Method Summary
 void destroy()
          Releases all resources and calls finalize method.
protected  String getAccessionedDate()
          Retrieves the date the catalog record was created.
protected  List getAnnotations()
          Retrieves the list of lifecycle contributors to a resource from the current record.
protected  List getAudiences()
          Retrieves the list of intended audiences for a resource from the current record.
protected  String getComment(String key, String identifier)
          Retrieves a specific comment from the XML node identified by the key.
protected  String getCopyright()
          Retreives the copright information of a resource from the current record.
protected  String getCost()
          Retrieves the cost information of a resource from the current record.
protected  String getCreatedDate()
          Retrieves the date the catalog record was created.
protected  String getDescription()
          Retreives the description of a resource from the current record.
protected  List getGeographyStds()
          Retrieves the list of geography standards defined for the current resource.
protected  List getGeoReferences()
          Retrieves the list of georeferences for a resource from the current record.
protected  String getID()
          Retrieves the record ID from XML file.
protected  String getInformation()
          Retrieves the additional information from the footnote comment of the current record.
 String getInitErrorMsg()
          Gets a message describing the initialization error or empty string if no error occured.
 List getKeys()
          Retrieves a list the keys contained in the map.
protected  List getKeywords()
          Gets the keywords attribute of the DleseXMLReader object
protected  List getLifecycleContributors()
          Retrieves the list of lifecycle contributors to a resource from the current record.
protected  List getMetametadataContributors()
          Retrieves the list of metadata contributors for a resource from the current record.
protected  String getOtherTechnicalInfo()
          Gets the otherTechnicalInfo attribute of the DleseXMLReader object
protected  List getRelations()
          Retrieves the list of lifecycle contributors to a resource from the current record.
protected  List getResourceTypes()
          Retrieves the list of learning resource types for a resource from the current record.
protected  String getResourceURL()
          Retrieves the URL of the reource this record catalogs.
protected  List getScienceStds()
          Retrieves the list of intended audiences for a resource from the current record.
protected  String getStringValue(String key)
          Retrieves text content from the XML node identified by the key.
protected  List getSubjects()
          Retrieves the list of subjects specified for a resource from the current record.
protected  List getTechnicalFormats()
          Gets the technicalFormats attribute of the DleseXMLReader object
protected  List getTechnicalReqs()
          Retrieves the list of technical requirements for a resource from the current record.
protected  String getTitle()
          Retreives the resource title from the current record.
protected  List getURLs()
          Retrieves the list of subjects specified for a resource from the current record.
 Object getValue(String name)
          Getter method to retrieve a specific metadata value.
 List getValues()
          Retrieves the list of metadata values held in the map.
 boolean init()
          Creates XMLRecord and intializes local map.
protected  void insertToList(List list, Object o)
          Simple insertion routine for constructing an ordered list of Objects
protected  void insertToList(List list, String s)
          Simple insertion sort for building a sorted list of Strings.
 void setMap()
          After successful initialization, this method creates the map of actual name:value pairs defined within this specific XMLMap instance.
 void setValue(String name, Object xmlObject)
          Setter method for setting a specific metadata value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isValid

protected boolean isValid
boolean value indicates success of initialization


xmlFile

protected File xmlFile
source XML file


xmlRecord

protected XMLRecord xmlRecord
convenience abstraction of the XML DOM


map

protected HashMap map
mapping of user-defined names to metadata values

Constructor Detail

DleseXMLReader

protected DleseXMLReader()
Default constructor is restricted to assure that a file directory is provided on object creation.


DleseXMLReader

public DleseXMLReader(File xmlfile)
Parameters:
xmlfile -

DleseXMLReader

public DleseXMLReader(String filepath)
Parameters:
filepath - A qualified filepath to a well-formed XML file.
Method Detail

init

public boolean init()
Creates XMLRecord and intializes local map. If an error occurs then an error message may be obtained by immediately calling the getInitErrorMsg() method.

Specified by:
init in interface XMLMap
Returns:
true if successful, false otherwise.

getInitErrorMsg

public String getInitErrorMsg()
Gets a message describing the initialization error or empty string if no error occured.

Returns:
The initErrorMsg value

destroy

public void destroy()
Releases all resources and calls finalize method.

Specified by:
destroy in interface XMLMap

getValue

public Object getValue(String name)
Getter method to retrieve a specific metadata value.

Specified by:
getValue in interface XMLMap
Parameters:
name - the user-defined name identifying the specific value to retrieve.
Returns:
the requested value if it exists, null otherwise.

setValue

public void setValue(String name,
                     Object xmlObject)
Setter method for setting a specific metadata value.

Specified by:
setValue in interface XMLMap
Parameters:
name - the user-defined name identifying the specific value to update.
xmlObject - the value to assoicate with the specified name.

setMap

public void setMap()
After successful initialization, this method creates the map of actual name:value pairs defined within this specific XMLMap instance.

Specified by:
setMap in interface XMLMap

getKeys

public List getKeys()
Retrieves a list the keys contained in the map.

Specified by:
getKeys in interface XMLMap
Returns:
the list of keys used to hash the metadata values.

getValues

public List getValues()
Retrieves the list of metadata values held in the map.

Specified by:
getValues in interface XMLMap
Returns:
the list of values held in the map.

getComment

protected String getComment(String key,
                            String identifier)
Retrieves a specific comment from the XML node identified by the key. The comment is specified using an identifier, which may be any portion of the actual comment, or a label which is stored as part of the comment.

Parameters:
key - The path for the desired node.
identifier - A string used to identify the specific comment.
Returns:
The specificied comment.

getID

protected String getID()
Retrieves the record ID from XML file.

Returns:
id ID of record.

getResourceURL

protected String getResourceURL()
Retrieves the URL of the reource this record catalogs.

Returns:
The resource URL, as a string.

getCreatedDate

protected String getCreatedDate()
Retrieves the date the catalog record was created.

Returns:
The catalog record creation date, as a string.

getAccessionedDate

protected String getAccessionedDate()
Retrieves the date the catalog record was created.

Returns:
The catalog record creation date, as a string.

getInformation

protected String getInformation()
Retrieves the additional information from the footnote comment of the current record.

Returns:
The footnote comment.

getTitle

protected String getTitle()
Retreives the resource title from the current record.

Returns:
The resource title.

getDescription

protected String getDescription()
Retreives the description of a resource from the current record.

Returns:
The description as a string.

getCost

protected String getCost()
Retrieves the cost information of a resource from the current record.

Returns:
Cost information as a string.

getCopyright

protected String getCopyright()
Retreives the copright information of a resource from the current record.

Returns:
Copyright information as a string.

getOtherTechnicalInfo

protected String getOtherTechnicalInfo()
Gets the otherTechnicalInfo attribute of the DleseXMLReader object

Returns:
The otherTechnicalInfo value

getAudiences

protected List getAudiences()
Retrieves the list of intended audiences for a resource from the current record.

Returns:
List of strings of intended audiences.

getTechnicalFormats

protected List getTechnicalFormats()
Gets the technicalFormats attribute of the DleseXMLReader object

Returns:
The technicalFormats value

getSubjects

protected List getSubjects()
Retrieves the list of subjects specified for a resource from the current record.

Returns:
List of strings of specified subjects.

getURLs

protected List getURLs()
Retrieves the list of subjects specified for a resource from the current record.

Returns:
List of strings of specified subjects.

getTechnicalReqs

protected List getTechnicalReqs()
Retrieves the list of technical requirements for a resource from the current record.

Returns:
List of MeccaMain.TechnicalReq objects.

getResourceTypes

protected List getResourceTypes()
Retrieves the list of learning resource types for a resource from the current record.

Returns:
List of DleseRecord.ResourceType objects.

getMetametadataContributors

protected List getMetametadataContributors()
Retrieves the list of metadata contributors for a resource from the current record.

Returns:
List of DleseRecord.Contributor objects identifying the metadata contributors.

getLifecycleContributors

protected List getLifecycleContributors()
Retrieves the list of lifecycle contributors to a resource from the current record.

Returns:
List of DleseRecord.Contributor objects identifying the lifecycle contributors.

getAnnotations

protected List getAnnotations()
Retrieves the list of lifecycle contributors to a resource from the current record.

Returns:
List of DleseRecord.Contributor objects identifying the lifecycle contributors.

getRelations

protected List getRelations()
Retrieves the list of lifecycle contributors to a resource from the current record.

Returns:
List of DleseRecord.Contributor objects identifying the lifecycle contributors.

getGeoReferences

protected List getGeoReferences()
Retrieves the list of georeferences for a resource from the current record.

Returns:
List of DleseRecord.Contributor objects identifying the lifecycle contributors.

getKeywords

protected List getKeywords()
Gets the keywords attribute of the DleseXMLReader object

Returns:
The keywords value

getGeographyStds

protected List getGeographyStds()
Retrieves the list of geography standards defined for the current resource.

Returns:
List of strings of intended audiences.

getScienceStds

protected List getScienceStds()
Retrieves the list of intended audiences for a resource from the current record.

Returns:
List of strings of intended audiences.

getStringValue

protected String getStringValue(String key)
Retrieves text content from the XML node identified by the key.

Parameters:
key - The path for the desired node.
Returns:
The text content of the XML node, or an empty string if the node does not exist.

insertToList

protected void insertToList(List list,
                            String s)
Simple insertion sort for building a sorted list of Strings.

Parameters:
list - List to add an item to.
s - String to add to the list.

insertToList

protected void insertToList(List list,
                            Object o)
Simple insertion routine for constructing an ordered list of Objects

Parameters:
list - List to add an item to.
o - Object to add to the list.

DLESE Tools
v1.6.0