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

Quick Search    Search Deep

cvebrowser.dictionary.data.net
Class MitreDataRepository  view MitreDataRepository download MitreDataRepository.java

java.lang.Object
  extended bycvebrowser.dictionary.data.net.MitreDataRepository

public final class MitreDataRepository
extends java.lang.Object

MitreDataRepository - Manages access to the CVE Mitre data file.

Since:
0.1
Version:
0.2 - 07/06/2003

Field Summary
private  byte[] _buffer
           
private static java.util.ResourceBundle _bundle
           
private  java.util.Properties _config
           
private  java.lang.String _fileName
           
private  int _numberOfRetries
           
private  int _retryWait
           
private  java.net.URL _url
           
static int EXPECTED_PARAMETERS
          Expected number of arguments
static int FILE_BUFFER_SIZE
          Size of the local file buffer
static int NET_BUFFER_SIZE
          Size of the network buffer size
static int NUMBER_OF_RETRY
          Number of retry atempts after a failed connection
static int RETRY_WAIT
          Amount of time to wait between retry, in miliseconds
 
Constructor Summary
MitreDataRepository(java.net.URL url_, java.lang.String fileName_)
          Parametric constructor.
 
Method Summary
 java.lang.Object clone()
          Make this class uncloneable.
 int download()
          Download the file to the desired location.
private  java.net.URLConnection getConnection()
          Returns a new URLConnection object
 java.io.InputStream getInputStream()
          Get an InputStream, regardless if the data file is compressed or not.
 int getNumberOfRetries()
          Get the current number of retries
 int getRetriesTimeout()
          Return the current retry time
 int getType()
          Returns the type of the polled data file, using content heuristics.
 java.lang.String getVersion()
          Returns the version of the CVE / CAN datafile.
 boolean isCompressed()
          Tells if the CVE file is compressed or not
static void main(java.lang.String[] argv_)
          Command line entry point Currently recognized parameters.
private  void readObject(java.io.ObjectInputStream in_)
          Make this class undeserializeable.
 void setNumberOfRetries(int number_)
          Set the default amount of retries after a failure
 void setRetriesWait(int time_)
          Set the number of retries when getting a conection
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

NET_BUFFER_SIZE

public static final int NET_BUFFER_SIZE
Size of the network buffer size

See Also:
Constant Field Values

FILE_BUFFER_SIZE

public static final int FILE_BUFFER_SIZE
Size of the local file buffer

See Also:
Constant Field Values

NUMBER_OF_RETRY

public static final int NUMBER_OF_RETRY
Number of retry atempts after a failed connection

See Also:
Constant Field Values

RETRY_WAIT

public static final int RETRY_WAIT
Amount of time to wait between retry, in miliseconds

See Also:
Constant Field Values

EXPECTED_PARAMETERS

public static final int EXPECTED_PARAMETERS
Expected number of arguments

See Also:
Constant Field Values

_url

private java.net.URL _url

_fileName

private java.lang.String _fileName

_buffer

private byte[] _buffer

_config

private java.util.Properties _config

_bundle

private static java.util.ResourceBundle _bundle

_numberOfRetries

private int _numberOfRetries

_retryWait

private int _retryWait
Constructor Detail

MitreDataRepository

public MitreDataRepository(java.net.URL url_,
                           java.lang.String fileName_)
Parametric constructor.

Since:
0.1
Method Detail

setNumberOfRetries

public void setNumberOfRetries(int number_)
                        throws java.lang.IllegalArgumentException
Set the default amount of retries after a failure

Since:
0.1

getNumberOfRetries

public int getNumberOfRetries()
Get the current number of retries

Since:
0.1

setRetriesWait

public void setRetriesWait(int time_)
                    throws java.lang.IllegalArgumentException
Set the number of retries when getting a conection

Since:
0.1

getRetriesTimeout

public int getRetriesTimeout()
Return the current retry time

Since:
0.1

getConnection

private java.net.URLConnection getConnection()
                                      throws java.io.IOException,
                                             java.lang.InterruptedException
Returns a new URLConnection object

Since:
0.1

getType

public int getType()
            throws java.io.IOException,
                   java.lang.InterruptedException,
                   cvebrowser.dictionary.data.parser.DataParserException,
                   cvebrowser.util.parser.ParserException
Returns the type of the polled data file, using content heuristics.

Since:
0.1

isCompressed

public boolean isCompressed()
                     throws java.io.IOException,
                            java.lang.InterruptedException
Tells if the CVE file is compressed or not

Since:
0.1

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException,
                                          java.lang.InterruptedException
Get an InputStream, regardless if the data file is compressed or not.

Since:
0.1

getVersion

public java.lang.String getVersion()
                            throws java.io.IOException,
                                   java.lang.InterruptedException,
                                   java.lang.NumberFormatException,
                                   cvebrowser.dictionary.data.parser.DataParserException,
                                   cvebrowser.util.parser.ParserException
Returns the version of the CVE / CAN datafile. An internal check is made to check wich type of data file is being polled.

Since:
0.1

download

public int download()
             throws java.io.IOException,
                    java.lang.InterruptedException
Download the file to the desired location. If the file is not compressed then is compressed on the fly using GZIP.

Since:
0.1

main

public static void main(java.lang.String[] argv_)
                 throws NetException
Command line entry point Currently recognized parameters.
  • -s : Where to download the file.
  • -d : Where to save the file
Optional parameters:
  • -l : Languaje to use
  • -k : Country to use
  • -h : Show the localized mini help.


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.