fedora.server.journal.xmlhelpers
Class AbstractXmlReader

java.lang.Object
  extended by fedora.server.journal.xmlhelpers.AbstractXmlReader
All Implemented Interfaces:
JournalConstants
Direct Known Subclasses:
BindingMapXmlReader, ContextXmlReader, JournalReader

public abstract class AbstractXmlReader
extends java.lang.Object
implements JournalConstants

Title: AbstractXmlReader

Description: An abstract base class that provides some useful methods for the XML reader classes.

Version:
$Id: AbstractXmlReader.java 5025 2006-09-01 22:08:17 +0000 (Fri, 01 Sep 2006) cwilper $
Author:
jblake@cs.cornell.edu

Field Summary
 
Fields inherited from interface fedora.server.journal.JournalConstants
ARGUMENT_NAME_ALT_IDS, ARGUMENT_NAME_BDEF_PID, ARGUMENT_NAME_BINDING_MAP, ARGUMENT_NAME_BMECH_PID, ARGUMENT_NAME_CHECKSUM, ARGUMENT_NAME_CHECKSUM_TYPE, ARGUMENT_NAME_CONTEXT, ARGUMENT_NAME_CONTROL_GROUP, ARGUMENT_NAME_DISSEMINATOR_ID, ARGUMENT_NAME_DISSEMINATOR_LABEL, ARGUMENT_NAME_DISSEMINATOR_STATE, ARGUMENT_NAME_DS_CONTENT, ARGUMENT_NAME_DS_ID, ARGUMENT_NAME_DS_LABEL, ARGUMENT_NAME_DS_LOCATION, ARGUMENT_NAME_DS_STATE, ARGUMENT_NAME_ENCODING, ARGUMENT_NAME_END_DATE, ARGUMENT_NAME_FORCE, ARGUMENT_NAME_FORMAT, ARGUMENT_NAME_FORMAT_URI, ARGUMENT_NAME_IN, ARGUMENT_NAME_LABEL, ARGUMENT_NAME_LOCATION, ARGUMENT_NAME_LOG_MESSAGE, ARGUMENT_NAME_MIME_TYPE, ARGUMENT_NAME_NAMESPACE, ARGUMENT_NAME_NEW_PID, ARGUMENT_NAME_NUM_PIDS, ARGUMENT_NAME_OWNERID, ARGUMENT_NAME_PID, ARGUMENT_NAME_SERIALIZATION, ARGUMENT_NAME_START_DATE, ARGUMENT_NAME_STATE, ARGUMENT_NAME_VERSION_DATE, ARGUMENT_NAME_VERSIONABLE, ARGUMENT_TYPE_BINDING_MAP, ARGUMENT_TYPE_BOOLEAN, ARGUMENT_TYPE_DATE, ARGUMENT_TYPE_INTEGER, ARGUMENT_TYPE_NULL, ARGUMENT_TYPE_STREAM, ARGUMENT_TYPE_STRING, ARGUMENT_TYPE_STRINGARRAY, CONTEXT_MAPNAME_ACTION, CONTEXT_MAPNAME_ENVIRONMENT, CONTEXT_MAPNAME_RECOVERY, CONTEXT_MAPNAME_RESOURCE, CONTEXT_MAPNAME_SUBJECT, DEFAULT_AGE_LIMIT, DEFAULT_FILENAME_PREFIX, DEFAULT_SIZE_LIMIT, DOCUMENT_ENCODING, DOCUMENT_VERSION, FORMAT_JOURNAL_FILENAME_TIMESTAMP, METHOD_ADD_DATASTREAM, METHOD_ADD_DISSEMINATOR, METHOD_GET_NEXT_PID, METHOD_INGEST_OBJECT, METHOD_MODIFY_DATASTREAM_BY_REFERENCE, METHOD_MODIFY_DATASTREAM_BY_VALUE, METHOD_MODIFY_DISSEMINATOR, METHOD_MODIFY_OBJECT, METHOD_PURGE_DATASTREAM, METHOD_PURGE_DISSEMINATOR, METHOD_PURGE_OBJECT, METHOD_PUT_TEMP_STREAM, METHOD_SET_DATASTREAM_STATE, METHOD_SET_DATASTREAM_VERSIONABLE, METHOD_SET_DISSEMINATOR_STATE, PARAMETER_IGNORE_HASH, PARAMETER_JOURNAL_FILE_AGE_LIMIT, PARAMETER_JOURNAL_FILE_SIZE_LIMIT, PARAMETER_JOURNAL_FILENAME_PREFIX, PARAMETER_JOURNAL_MODE, PARAMETER_JOURNAL_READER_CLASSNAME, PARAMETER_JOURNAL_RECOVERY_LOG_CLASSNAME, PARAMETER_JOURNAL_WRITER_CLASSNAME, PARAMETER_RECOVERY_LOG_FILENAME, PARAMETER_RECOVERY_LOG_LEVEL, PASSWORD_CIPHER_TYPE, QNAME_ATTR_BIND_KEY_NAME, QNAME_ATTR_BIND_LABEL, QNAME_ATTR_CLIENT_IP, QNAME_ATTR_DATASTREAM_ID, QNAME_ATTR_DS_BIND_MAP_ID, QNAME_ATTR_DS_BIND_MAP_LABEL, QNAME_ATTR_DS_BIND_MECHANISM_PID, QNAME_ATTR_LOGIN_ID, QNAME_ATTR_METHOD, QNAME_ATTR_NAME, QNAME_ATTR_PASSWORD_TYPE, QNAME_ATTR_REPOSITORY_HASH, QNAME_ATTR_SEQ_NO, QNAME_ATTR_STATE, QNAME_ATTR_TIMESTAMP, QNAME_ATTR_TYPE, QNAME_ATTR_USERID, QNAME_TAG_ARGUMENT, QNAME_TAG_ARRAYELEMENT, QNAME_TAG_CONTEXT, QNAME_TAG_DS_BINDING, QNAME_TAG_DS_BINDING_MAP, QNAME_TAG_JOURNAL, QNAME_TAG_JOURNAL_ENTRY, QNAME_TAG_MULTI_VALUE_MAP, QNAME_TAG_MULTI_VALUE_MAP_KEY, QNAME_TAG_MULTI_VALUE_MAP_VALUE, QNAME_TAG_NOOP, QNAME_TAG_NOW, QNAME_TAG_PASSWORD, SYSTEM_PROPERTY_PREFIX, TIMESTAMP_FORMAT, VALUE_FALSE, VALUE_JOURNAL_MODE_NORMAL, VALUE_JOURNAL_MODE_RECOVER, VALUE_RECOVERY_LOG_LEVEL_HIGH, VALUE_RECOVERY_LOG_LEVEL_LOW, VALUE_RECOVERY_LOG_LEVEL_MEDIUM, VALUE_TRUE
 
Constructor Summary
AbstractXmlReader()
           
 
Method Summary
protected  void advancePastWhitespace(javax.xml.stream.XMLEventReader reader)
          Advance past any white space.
protected  JournalException getNotCharactersException(javax.xml.namespace.QName tagName, javax.xml.stream.events.XMLEvent event)
          If we encounter an unexpected event when reading the journal file, create an exception with all of the pertinent information.
protected  JournalException getNotEndTagException(javax.xml.namespace.QName tagName, javax.xml.stream.events.XMLEvent event)
          Complain when we were expecting a end tag, and didn't find it.
protected  JournalException getNotNextMemberOrEndOfGroupException(javax.xml.namespace.QName groupTagName, javax.xml.namespace.QName memberTagName, javax.xml.stream.events.XMLEvent event)
          While traversing a group of member tags, we expected either the start of another member tag, or the end of the group.
protected  JournalException getNotStartTagException(javax.xml.namespace.QName tagName, javax.xml.stream.events.XMLEvent event)
          Complain when we were expecting a start tag, and didn't find it.
protected  java.lang.String getOptionalAttributeValue(javax.xml.stream.events.StartElement start, javax.xml.namespace.QName attributeName)
          Get the value of a given attribute from this start tag, or null if the attribute is not there.
protected  java.lang.String getRequiredAttributeValue(javax.xml.stream.events.StartElement start, javax.xml.namespace.QName attributeName)
          Get the value of a given attribute from this start tag, or complain if it's not there.
protected  boolean isEndTagEvent(javax.xml.stream.events.XMLEvent event, javax.xml.namespace.QName tagName)
          Test an event to see whether it is an end tag with the expected name.
protected  boolean isStartTagEvent(javax.xml.stream.events.XMLEvent event, javax.xml.namespace.QName tagName)
          Test an event to see whether it is an start tag with the expected name.
protected  java.lang.String readCharactersUntilEndTag(javax.xml.stream.XMLEventReader reader, javax.xml.namespace.QName tagName)
          Loop through a series of character events, accumulating the data into a String.
protected  javax.xml.stream.events.XMLEvent readStartTag(javax.xml.stream.XMLEventReader reader, javax.xml.namespace.QName tagName)
          Read the next event and complain if it is not the Start Tag that we expected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlReader

public AbstractXmlReader()
Method Detail

advancePastWhitespace

protected void advancePastWhitespace(javax.xml.stream.XMLEventReader reader)
                              throws javax.xml.stream.XMLStreamException
Advance past any white space. Leave the reader positioned before the next tag (or non-white-space event).

Throws:
javax.xml.stream.XMLStreamException

readStartTag

protected javax.xml.stream.events.XMLEvent readStartTag(javax.xml.stream.XMLEventReader reader,
                                                        javax.xml.namespace.QName tagName)
                                                 throws javax.xml.stream.XMLStreamException,
                                                        JournalException
Read the next event and complain if it is not the Start Tag that we expected.

Throws:
javax.xml.stream.XMLStreamException
JournalException

isStartTagEvent

protected boolean isStartTagEvent(javax.xml.stream.events.XMLEvent event,
                                  javax.xml.namespace.QName tagName)
Test an event to see whether it is an start tag with the expected name.


isEndTagEvent

protected boolean isEndTagEvent(javax.xml.stream.events.XMLEvent event,
                                javax.xml.namespace.QName tagName)
Test an event to see whether it is an end tag with the expected name.


getRequiredAttributeValue

protected java.lang.String getRequiredAttributeValue(javax.xml.stream.events.StartElement start,
                                                     javax.xml.namespace.QName attributeName)
                                              throws JournalException
Get the value of a given attribute from this start tag, or complain if it's not there.

Throws:
JournalException

getOptionalAttributeValue

protected java.lang.String getOptionalAttributeValue(javax.xml.stream.events.StartElement start,
                                                     javax.xml.namespace.QName attributeName)
Get the value of a given attribute from this start tag, or null if the attribute is not there.


readCharactersUntilEndTag

protected java.lang.String readCharactersUntilEndTag(javax.xml.stream.XMLEventReader reader,
                                                     javax.xml.namespace.QName tagName)
                                              throws javax.xml.stream.XMLStreamException,
                                                     JournalException
Loop through a series of character events, accumulating the data into a String. The character events should be terminated by an EndTagEvent with the expected tag name.

Throws:
javax.xml.stream.XMLStreamException
JournalException

getNotStartTagException

protected JournalException getNotStartTagException(javax.xml.namespace.QName tagName,
                                                   javax.xml.stream.events.XMLEvent event)
Complain when we were expecting a start tag, and didn't find it.


getNotEndTagException

protected JournalException getNotEndTagException(javax.xml.namespace.QName tagName,
                                                 javax.xml.stream.events.XMLEvent event)
Complain when we were expecting a end tag, and didn't find it.


getNotCharactersException

protected JournalException getNotCharactersException(javax.xml.namespace.QName tagName,
                                                     javax.xml.stream.events.XMLEvent event)
If we encounter an unexpected event when reading the journal file, create an exception with all of the pertinent information.


getNotNextMemberOrEndOfGroupException

protected JournalException getNotNextMemberOrEndOfGroupException(javax.xml.namespace.QName groupTagName,
                                                                 javax.xml.namespace.QName memberTagName,
                                                                 javax.xml.stream.events.XMLEvent event)
While traversing a group of member tags, we expected either the start of another member tag, or the end of the group.