wt.ixb.handlers.netmarkets
Class PrepMapFile

java.lang.Object
  extended bywt.ixb.handlers.netmarkets.PrepMapFile

public class PrepMapFile
extends Object


Nested Class Summary
(package private)  class PrepMapFile.DtdEntry
           
 
Field Summary
private  StringBuffer _dtdBuff
           
(package private) static Hashtable _entityMap
           
private  File _file
           
private  String _nl
           
private  StringBuffer _outBuff
           
private static String _rb
           
(package private) static Hashtable _substMap
           
private static String beg
           
private static String end
           
private static String space
          Generates a DTD corresponding to the constraints in the mapfile.
 
Constructor Summary
PrepMapFile()
           
PrepMapFile(String mapFileName)
           
 
Method Summary
private  void addElement(String name)
           
static String doEncoding(String startString)
           
private  String doSuperTag(String str)
           
private  void doTopLevel(Enumeration keys, StringBuffer buff)
           
 void generateLoadFile(File outputDir, File inDir, String inFile)
           
 void generateLoadFile(File outputDir, File inDir, String inFile, boolean saveDupe)
           
 StringBuffer generateLoadFile(String fname)
          Given a csv load file name, generates an XML version of it.
 String getDtd()
           
 StringBuffer getDtdBuff()
           
private  boolean isElementNew(String elem)
           
 void makeDtd()
           
 StringBuffer processCsvBuffer(StringBuffer buff)
           
 StringBuffer processCsvBuffer(StringBuffer buff, String dtd)
           
 StringBuffer processCsvFile(BufferedReader br)
           
 StringBuffer processCsvFile(BufferedReader br, String dtd)
           
private  String processCsvLine(String str)
           
private  void processEntities(String key)
           
 void processFile()
           
private  void processLine(String str)
           
private  String replaceSpaceByUnderScore(String str)
           
private  String substStr(String inStr, String key, String repl)
           
private  void testDecoding(StringBuffer testBuff, String origStr)
           
 String toString()
           
private  void validateState()
           
 void writeTemplateDB(PrintWriter out)
          Writes out mapping between entities and handlers to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_rb

private static final String _rb

_file

private File _file

_outBuff

private StringBuffer _outBuff

_dtdBuff

private StringBuffer _dtdBuff

_nl

private String _nl

beg

private static final String beg
See Also:
Constant Field Values

end

private static final String end
See Also:
Constant Field Values

_entityMap

static Hashtable _entityMap

_substMap

static Hashtable _substMap

space

private static final String space
Generates a DTD corresponding to the constraints in the mapfile. The generated DTD can be modified to incorporate any attribute constraints which should be enforced for import. We are interested in reproducting the behaviour of the existing csv file so we are going to assign a sequence number to each of the attribute sets which corresponds to its index in the csv file.

See Also:
Constant Field Values
Constructor Detail

PrepMapFile

public PrepMapFile()
            throws WTException

PrepMapFile

public PrepMapFile(String mapFileName)
            throws WTException
Method Detail

processFile

public void processFile()
                 throws IOException
Throws:
IOException

makeDtd

public void makeDtd()
             throws IOException
Throws:
IOException

getDtdBuff

public StringBuffer getDtdBuff()
                        throws WTException
Throws:
WTException

isElementNew

private boolean isElementNew(String elem)

writeTemplateDB

public void writeTemplateDB(PrintWriter out)
                     throws IOException
Writes out mapping between entities and handlers to a file. Used for prototyping Template processor.

Throws:
IOException

processEntities

private void processEntities(String key)

addElement

private void addElement(String name)

doTopLevel

private void doTopLevel(Enumeration keys,
                        StringBuffer buff)

getDtd

public String getDtd()

toString

public String toString()

processLine

private void processLine(String str)

replaceSpaceByUnderScore

private String replaceSpaceByUnderScore(String str)

doSuperTag

private String doSuperTag(String str)

generateLoadFile

public StringBuffer generateLoadFile(String fname)
                              throws IOException,
                                     FileNotFoundException,
                                     Exception
Given a csv load file name, generates an XML version of it.

Throws:
IOException
FileNotFoundException
Exception

generateLoadFile

public void generateLoadFile(File outputDir,
                             File inDir,
                             String inFile,
                             boolean saveDupe)
                      throws WTException
Throws:
WTException

generateLoadFile

public void generateLoadFile(File outputDir,
                             File inDir,
                             String inFile)
                      throws IOException,
                             Exception
Throws:
IOException
Exception

processCsvBuffer

public StringBuffer processCsvBuffer(StringBuffer buff)
                              throws WTException
Throws:
WTException

processCsvBuffer

public StringBuffer processCsvBuffer(StringBuffer buff,
                                     String dtd)
                              throws WTException
Throws:
WTException

processCsvFile

public StringBuffer processCsvFile(BufferedReader br,
                                   String dtd)
                            throws WTException
Throws:
WTException

processCsvFile

public StringBuffer processCsvFile(BufferedReader br)
                            throws IOException,
                                   Exception
Throws:
IOException
Exception

processCsvLine

private String processCsvLine(String str)
                       throws WTException
Throws:
WTException

doEncoding

public static String doEncoding(String startString)

testDecoding

private void testDecoding(StringBuffer testBuff,
                          String origStr)

substStr

private String substStr(String inStr,
                        String key,
                        String repl)

validateState

private void validateState()
                    throws IOException
Throws:
IOException