com.objectwave.templateMerge
Class MergeTemplateWriter

java.lang.Object
  |
  +--com.objectwave.templateMerge.MergeTemplateWriter

public class MergeTemplateWriter
extends java.lang.Object

Version:
$Id: MergeTemplateWriter.java,v 2.0 2001/06/11 15:54:25 dave_hoag Exp $
Author:
zcai

Constructor Summary
MergeTemplateWriter()
           
 
Method Summary
static void containsSubTemplates(MergeTemplate result, java.util.Vector templateNames)
          Change by Zhou Cai Change this method to be public static
static void dumpToText(java.util.Enumeration e, java.io.BufferedWriter buff)
          Write ascii code to the buffer containing the MergeTemplate definitions.
static void dumpToXML(java.util.Enumeration e, java.io.BufferedWriter buff)
          Write the templates into the the buffer of an XML file.
static InformationToken getToken(java.lang.String name)
          Used when restoring templates from a text file.
static InformationToken[] getTokenList()
          Gets the TokenList attribute of the MergeTemplateWriter class
static KnownTemplates importFromText(java.io.BufferedReader buff)
          Entery point for reading in templates from a text file.
static KnownTemplates importFromXML(java.io.Reader xmlFile)
          Entery point for reading in templates from a XML file.
protected  java.lang.String readBody(MergeTemplate result, java.io.BufferedReader rdr)
          Used when restoring templates from a text file.
 MergeTemplate readFrom(java.io.BufferedReader rdr)
          It is possible to create a text base version of the MergeTemplates.
protected  void readName(MergeTemplate result, java.lang.String line)
          Used when restoring templates from a text file.
protected  boolean readTemplates(MergeTemplate result, java.io.BufferedReader rdr)
          Used when restoring templates from a text file.
protected  boolean readTokens(MergeTemplate result, java.io.BufferedReader rdr)
          Used when restoring templates from a text file.
protected  void realizeTemplateCache(KnownTemplates known)
          Convert the string names into real MergeTemplate objects.
static void setTokenList(InformationToken[] toks)
          Sets the TokenList attribute of the MergeTemplateWriter class
static void writeOut(MergeTemplate temp, java.io.BufferedWriter buff)
          Entry point for writing templates as a text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeTemplateWriter

public MergeTemplateWriter()
Method Detail

setTokenList

public static void setTokenList(InformationToken[] toks)
Sets the TokenList attribute of the MergeTemplateWriter class

Parameters:
toks - The new TokenList value

getToken

public static InformationToken getToken(java.lang.String name)
Used when restoring templates from a text file. Changed by Zhou Cai Change this method to be public static

Parameters:
name -
Returns:
The Token value

getTokenList

public static InformationToken[] getTokenList()
Gets the TokenList attribute of the MergeTemplateWriter class

Returns:
The TokenList value

containsSubTemplates

public static void containsSubTemplates(MergeTemplate result,
                                        java.util.Vector templateNames)
Change by Zhou Cai Change this method to be public static

Parameters:
result -
templateNames -

dumpToText

public static void dumpToText(java.util.Enumeration e,
                              java.io.BufferedWriter buff)
                       throws java.io.IOException
Write ascii code to the buffer containing the MergeTemplate definitions. Usefull if you don't want to rely upon serialized objects.

Parameters:
e - Enumeration of mergeTemplate objects.
buff -
Throws:
java.io.IOException

dumpToXML

public static void dumpToXML(java.util.Enumeration e,
                             java.io.BufferedWriter buff)
                      throws ConfigurationException
Write the templates into the the buffer of an XML file. Usefull if you don't want to rely upon serialized objects.

Parameters:
e - Enumeration mergeTemplate objects.
buff - BufferedWriter The output buffer of an XML file
Throws:
ConfigurationException - Receive the exception from XMLTemplateWriter

importFromText

public static KnownTemplates importFromText(java.io.BufferedReader buff)
                                     throws java.io.IOException
Entery point for reading in templates from a text file.

Parameters:
buff -
Returns:
Throws:
java.io.IOException

importFromXML

public static KnownTemplates importFromXML(java.io.Reader xmlFile)
                                    throws ConfigurationException
Entery point for reading in templates from a XML file.

Parameters:
xmlFile - FileReader Input Stream of the XML file
Returns:
KnowTemplates
Throws:
ConfigurationException - If there is any error in the procsssing of the XML file

writeOut

public static void writeOut(MergeTemplate temp,
                            java.io.BufferedWriter buff)
                     throws java.io.IOException
Entry point for writing templates as a text file.

Parameters:
temp -
buff -
Throws:
java.io.IOException

readFrom

public MergeTemplate readFrom(java.io.BufferedReader rdr)
                       throws java.io.IOException
It is possible to create a text base version of the MergeTemplates. This method would allow you to read that text and convert it into a MergeTemplate.

Parameters:
rdr -
Returns:
Throws:
java.io.IOException

readBody

protected java.lang.String readBody(MergeTemplate result,
                                    java.io.BufferedReader rdr)
                             throws java.io.IOException
Used when restoring templates from a text file.

Parameters:
result -
rdr -
Returns:
Throws:
java.io.IOException

readName

protected void readName(MergeTemplate result,
                        java.lang.String line)
Used when restoring templates from a text file.

Parameters:
result -
line -

readTemplates

protected boolean readTemplates(MergeTemplate result,
                                java.io.BufferedReader rdr)
                         throws java.io.IOException
Used when restoring templates from a text file.

Parameters:
result -
rdr -
Returns:
Throws:
java.io.IOException

readTokens

protected boolean readTokens(MergeTemplate result,
                             java.io.BufferedReader rdr)
                      throws java.io.IOException
Used when restoring templates from a text file.

Parameters:
result -
rdr -
Returns:
Throws:
java.io.IOException

realizeTemplateCache

protected void realizeTemplateCache(KnownTemplates known)
Convert the string names into real MergeTemplate objects.

Parameters:
known -