Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cvebrowser.dictionary.data.parser
Class CSVToXMLParser  view CSVToXMLParser download CSVToXMLParser.java

java.lang.Object
  extended bycvebrowser.dictionary.data.parser.CSVToXMLParser
All Implemented Interfaces:
DataParser

public final class CSVToXMLParser
extends java.lang.Object
implements DataParser

CSVToXMLParser - A CVE CSV data file parser that produces a CVEbrowser compressed XML data file.

Version:
0.2 - 07/31/2003

Field Summary
private static java.util.ResourceBundle _bundle
           
private  java.util.Properties _properties
           
static java.lang.String CAN_LINE_PATTERN
          The order of the main tokens go like this: "CANDIDATE","DESCRIPTION","PHASE","REFERENCES","VOTES","COMMENTS"
static java.lang.String CVE_LINE_PATTERN
          The order of the main tokens go like this: "Name","Description","References"
static int DEFAULT_OUTPUT_BUFFER_SIZE
          Default output buffer size for the XML files.
static int EXPECTED_PARAMETERS
          Number of required expected parameters for the command line
static java.lang.String REFERENCES_LINE_PATTERN
          References pattern (better than a simple StringTokenizer).
static java.lang.String[] XML_TAG_LIST
          Contains a list of XML tags used on the cvebrowser XML document.
 
Constructor Summary
CSVToXMLParser(java.util.Properties prop_)
          Parametric constructor.
 
Method Summary
 java.lang.Object clone()
          Make this class uncloneable.
static void main(java.lang.String[] argv_)
          Command line entry point.
 boolean parse(java.lang.String mitreDataFile_, java.lang.String outputfile_)
          Takes a Mitre data file and creates an XML output format used to load the CVE / CAN data into the local database.
private  void readObject(java.io.ObjectInputStream in_)
          Make this class undeserializeable.
private  void writeObject(java.io.ObjectOutputStream out_)
          Make this class unserializable.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_bundle

private static java.util.ResourceBundle _bundle

_properties

private java.util.Properties _properties

CVE_LINE_PATTERN

public static final java.lang.String CVE_LINE_PATTERN
The order of the main tokens go like this: "Name","Description","References"

See Also:
Constant Field Values

CAN_LINE_PATTERN

public static final java.lang.String CAN_LINE_PATTERN
The order of the main tokens go like this: "CANDIDATE","DESCRIPTION","PHASE","REFERENCES","VOTES","COMMENTS"

See Also:
Constant Field Values

REFERENCES_LINE_PATTERN

public static final java.lang.String REFERENCES_LINE_PATTERN
References pattern (better than a simple StringTokenizer). "SGI:19981006-01-I,CERT:CA-98.12.mountd,CIAC:J-006,BID:121,XF:linux-mountd-bo" There are also special cases like this 'CISCO:http://www.cisco.com/warp/public/770/land-pub.shtml'

See Also:
Constant Field Values

XML_TAG_LIST

public static final java.lang.String[] XML_TAG_LIST
Contains a list of XML tags used on the cvebrowser XML document. This list was taken from the CVEBROWSER DTD.


DEFAULT_OUTPUT_BUFFER_SIZE

public static final int DEFAULT_OUTPUT_BUFFER_SIZE
Default output buffer size for the XML files.

See Also:
Constant Field Values

EXPECTED_PARAMETERS

public static final int EXPECTED_PARAMETERS
Number of required expected parameters for the command line

See Also:
Constant Field Values
Constructor Detail

CSVToXMLParser

public CSVToXMLParser(java.util.Properties prop_)
               throws java.lang.IllegalArgumentException
Parametric constructor. Required keys:
  • cvebrowser.dictionary.data.parser.CSVToXMLParser.dtd - Location of the output DTD

Method Detail

parse

public boolean parse(java.lang.String mitreDataFile_,
                     java.lang.String outputfile_)
              throws DataParserException,
                     java.io.IOException
Takes a Mitre data file and creates an XML output format used to load the CVE / CAN data into the local database. The file is compressed to save space.

Specified by:
parse in interface DataParser
Since:
0.1

main

public static void main(java.lang.String[] argv_)
                 throws DataParserException
Command line entry point. Accepted parameters:
  • -s : Mitre CVS source file
  • -d : Destination full path for the ouput XML data file
  • -x : Location of the DTD required for the XML validation
Optional parameters:
  • -l : Languaje to use
  • -k : Country to use
  • -h : Show the localized mini help.

Since:
0.1

clone

public final java.lang.Object clone()
                             throws java.lang.CloneNotSupportedException
Make this class uncloneable. Anyone who wants to use this class must use the constructor.


writeObject

private final void writeObject(java.io.ObjectOutputStream out_)
                        throws java.io.IOException
Make this class unserializable. Any attempt to serialize will throw an exception.


readObject

private final void readObject(java.io.ObjectInputStream in_)
                       throws java.io.IOException
Make this class undeserializeable. Throw an exception if this method is ever called.