uk.org.ogsadai.client.toolkit.activity.xmldb
Class XMLResourceSetBlockMaker

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.xmldb.XMLResourceSetBlockMaker
All Implemented Interfaces:
BlockMaker

public class XMLResourceSetBlockMaker
extends java.lang.Object
implements BlockMaker

This BlockMaker processes an org.xmldb.api.base.ResourceSet, returning an XML representation as a sequence of java.lang.String blocks.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static java.lang.String FOOTER
          Footer for the XML representation.
private static java.lang.String HEADER
          Header for the XML representation.
private  boolean mFirstCall
          Used to ensure that the header is written on the first call to next.
private  boolean mMoreBlocks
          Tracks whether there are any more blocks to be retrieved.
private  org.xmldb.api.base.ResourceIterator mResourceIterator
          Resource iterator
 
Constructor Summary
XMLResourceSetBlockMaker(org.xmldb.api.base.ResourceSet resourceSet)
          Constructor.
 
Method Summary
 boolean hasNext()
          Returns true if this BlockMaker has more blocks to return, otherwise false.
 java.lang.Object next()
          Returns the next block.
private  java.lang.String resourceToXML(org.xmldb.api.base.Resource resource)
          Converts a Resource into an XML String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

HEADER

private static final java.lang.String HEADER
Header for the XML representation.

See Also:
Constant Field Values

FOOTER

private static final java.lang.String FOOTER
Footer for the XML representation.

See Also:
Constant Field Values

mResourceIterator

private org.xmldb.api.base.ResourceIterator mResourceIterator
Resource iterator


mMoreBlocks

private boolean mMoreBlocks
Tracks whether there are any more blocks to be retrieved.


mFirstCall

private boolean mFirstCall
Used to ensure that the header is written on the first call to next.

Constructor Detail

XMLResourceSetBlockMaker

public XMLResourceSetBlockMaker(org.xmldb.api.base.ResourceSet resourceSet)
                         throws BlockMakerException
Constructor.

Parameters:
resourceSet - A ResourceSet to be converted to XML and provided as blocks.
Throws:
java.lang.IllegalArgumentException - If resourceSet is null.
BlockMakerException - If for some reason there is a problem setting up the block maker using resourceSet.
Method Detail

hasNext

public boolean hasNext()
                throws BlockMakerException
Description copied from interface: BlockMaker
Returns true if this BlockMaker has more blocks to return, otherwise false.

Specified by:
hasNext in interface BlockMaker
Returns:
true or false.
Throws:
BlockMakerException - if a problem occurs when accessing the blocks.

next

public java.lang.Object next()
                      throws BlockMakerException
Description copied from interface: BlockMaker
Returns the next block.

Specified by:
next in interface BlockMaker
Returns:
an Object.
Throws:
BlockMakerException - if a problem occurs when accessing the block.

resourceToXML

private java.lang.String resourceToXML(org.xmldb.api.base.Resource resource)
                                throws org.xmldb.api.base.XMLDBException
Converts a Resource into an XML String representation.

Parameters:
resource - Resource to convert.
Returns:
XML representation.
Throws:
org.xmldb.api.base.XMLDBException - If there is a problem accessing the content of the Resource.