Class AbstractXMLPrintVisitor
- java.lang.Object
-
- edu.isi.pegasus.planner.catalog.site.classes.AbstractXMLPrintVisitor
-
- All Implemented Interfaces:
SiteDataVisitor
- Direct Known Subclasses:
XML3PrintVisitor,XML4PrintVisitor
public abstract class AbstractXMLPrintVisitor extends java.lang.Object implements SiteDataVisitor
The base class to be used by the various visitor implementors for displaying the Site Catalog in different XML formats- Version:
- $Revision$
- Author:
- Karan Vahi
-
-
Field Summary
Fields Modifier and Type Field Description protected intmCurrentIndentIndexThe number of tabs to use for current indentprotected java.lang.StringmNewLineThe new line character to be usedprotected java.io.WritermWriterThe internal writer
-
Constructor Summary
Constructors Constructor Description AbstractXMLPrintVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseElement(java.lang.String element)Generates a closing tag for an elementvoiddecrementIndentIndex()Decrements the indent indexvoiddepart(SiteData data)java.lang.StringgetCurrentIndent()Returns the current indent to be used while writing outjava.lang.StringgetNextIndent()Returns the indent to be used for the nested element.voidincrementIndentIndex()Increments the indent indexvoidinitialize(java.io.Writer writer)Initialize the visitor implementationvoidvisit(SiteData data)voidwriteAttribute(java.io.Writer writer, java.lang.String key, java.lang.String value)Writes an attribute to the stream.voidwriteAttribute(java.lang.String key, java.lang.String value)Writes an attribute to the stream.
-
-
-
Method Detail
-
initialize
public void initialize(java.io.Writer writer)
Initialize the visitor implementation- Specified by:
initializein interfaceSiteDataVisitor- Parameters:
writer- the writer
-
writeAttribute
public void writeAttribute(java.lang.String key, java.lang.String value) throws java.io.IOExceptionWrites an attribute to the stream. Wraps the value in quotes as required by XML.- Parameters:
key- the attribute keyvalue- the attribute value- Throws:
java.io.IOException
-
writeAttribute
public void writeAttribute(java.io.Writer writer, java.lang.String key, java.lang.String value) throws java.io.IOExceptionWrites an attribute to the stream. Wraps the value in quotes as required by XML.- Parameters:
writer- the stream to write tokey- the attribute keyvalue- the attribute value- Throws:
java.io.IOException
-
getCurrentIndent
public java.lang.String getCurrentIndent()
Returns the current indent to be used while writing out- Returns:
- the current indent
-
getNextIndent
public java.lang.String getNextIndent()
Returns the indent to be used for the nested element.- Returns:
- the new indent
-
incrementIndentIndex
public void incrementIndentIndex()
Increments the indent index
-
decrementIndentIndex
public void decrementIndentIndex()
Decrements the indent index
-
closeElement
public void closeElement(java.lang.String element) throws java.io.IOExceptionGenerates a closing tag for an element- Parameters:
element- the element tag name- Throws:
java.io.IOException
-
visit
public void visit(SiteData data) throws java.io.IOException
- Specified by:
visitin interfaceSiteDataVisitor- Throws:
java.io.IOException
-
depart
public void depart(SiteData data) throws java.io.IOException
- Specified by:
departin interfaceSiteDataVisitor- Throws:
java.io.IOException
-
-