org.fcrepo.server.journal.xmlhelpers
Class AbstractXmlReader

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

public abstract class AbstractXmlReader
extends Object
implements JournalConstants

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

Author:
Jim Blake

Field Summary
 
Fields inherited from interface org.fcrepo.server.journal.JournalConstants
ARGUMENT_NAME_ALT_IDS, ARGUMENT_NAME_CHECKSUM, ARGUMENT_NAME_CHECKSUM_TYPE, ARGUMENT_NAME_CONTEXT, ARGUMENT_NAME_CONTROL_GROUP, ARGUMENT_NAME_DATATYPE, 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_IS_LITERAL, ARGUMENT_NAME_LABEL, ARGUMENT_NAME_LAST_MODIFIED_DATE, ARGUMENT_NAME_LOCATION, ARGUMENT_NAME_LOG_MESSAGE, ARGUMENT_NAME_MIME_TYPE, ARGUMENT_NAME_NAMESPACE, ARGUMENT_NAME_NEW_PID, ARGUMENT_NAME_NUM_PIDS, ARGUMENT_NAME_OBJECT, ARGUMENT_NAME_OWNERID, ARGUMENT_NAME_PID, ARGUMENT_NAME_RELATIONSHIP, 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_ADD_RELATIONSHIP, METHOD_GET_NEXT_PID, METHOD_INGEST, 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_PURGE_RELATIONSHIP, 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(XMLEventReader reader)
          Advance past any white space.
protected  JournalException getNotCharactersException(QName tagName, 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(QName tagName, XMLEvent event)
          Complain when we were expecting a end tag, and didn't find it.
protected  JournalException getNotNextMemberOrEndOfGroupException(QName groupTagName, QName memberTagName, 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(QName tagName, XMLEvent event)
          Complain when we were expecting a start tag, and didn't find it.
protected  String getOptionalAttributeValue(StartElement start, QName attributeName)
          Get the value of a given attribute from this start tag, or null if the attribute is not there.
protected  String getRequiredAttributeValue(StartElement start, QName attributeName)
          Get the value of a given attribute from this start tag, or complain if it's not there.
protected  boolean isEndTagEvent(XMLEvent event, QName tagName)
          Test an event to see whether it is an end tag with the expected name.
protected  boolean isStartTagEvent(XMLEvent event, QName tagName)
          Test an event to see whether it is an start tag with the expected name.
protected  String readCharactersUntilEndTag(XMLEventReader reader, QName tagName)
          Loop through a series of character events, accumulating the data into a String.
protected  XMLEvent readStartTag(XMLEventReader reader, 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(XMLEventReader reader)
                              throws XMLStreamException
Advance past any white space. Leave the reader positioned before the next tag (or non-white-space event).

Throws:
XMLStreamException

readStartTag

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

Throws:
XMLStreamException
JournalException

isStartTagEvent

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


isEndTagEvent

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


getRequiredAttributeValue

protected String getRequiredAttributeValue(StartElement start,
                                           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 String getOptionalAttributeValue(StartElement start,
                                           QName attributeName)
Get the value of a given attribute from this start tag, or null if the attribute is not there.


readCharactersUntilEndTag

protected String readCharactersUntilEndTag(XMLEventReader reader,
                                           QName tagName)
                                    throws 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:
XMLStreamException
JournalException

getNotStartTagException

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


getNotEndTagException

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


getNotCharactersException

protected JournalException getNotCharactersException(QName tagName,
                                                     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(QName groupTagName,
                                                                 QName memberTagName,
                                                                 XMLEvent event)
While traversing a group of member tags, we expected either the start of another member tag, or the end of the group.



Copyright © 2011 DuraSpace. All Rights Reserved.