xml2fol
Class Global

java.lang.Object
  extended by xml2fol.Global

public class Global
extends java.lang.Object

A utility class that contains common constant and methods that can be called from the other classes.


Field Summary
static java.lang.String CMDLINE_AGRGUMENT_DELIM
          Deliminator for command line aruguments
static java.lang.String CMDLINE_KEYVALUE_DELIM
          Deliminator for key,values paris in command line aruguments
static java.lang.String DEFAULT_XPATH_VALUE
          default xpath value
static java.lang.String ERROR_FILENAME
          global error file filename
static java.lang.String FOL_DELIM
          Delimator for FOL documents
static java.lang.String FOL_SUFFIX
          Suffix for file,offset,length documents
static java.lang.String HTML_SUFFIX
          Suffix for HTML documents
static java.lang.String JPG_SUFFIX
          Suffix for JPG images
static java.lang.String QRL_SUFFIX
          Suffix for GPXRai Log documents
static java.lang.String TXT_SUFFIX
          Suffix for text documents
static java.lang.String XML_SUFFIX
          Suffix for XML documents
static int XML_SUFFIX_LENGTH
          Number of characters in XML suffix
 
Constructor Summary
Global()
           
 
Method Summary
static int BinarySearch(java.util.Vector v, java.lang.Object objp, java.util.Comparator c)
          A standard binary search program that returns the index of a given object in a vector
static java.lang.Long GetHashKey(java.lang.String filename, java.lang.String xpath)
          a utility method that produces a unique key for a given filename and xpath Used to ensure that keys are kept consistant throughout the program Key is returned as a number derived via MD5 hash algorithm
static java.lang.String GetJustFileName(java.lang.String filename)
          a utility method that for a given will just the name of the file when given a given a complete filepath e.g.
static java.lang.String GetKey(java.lang.String filename, java.lang.String xpath)
          a utility method that produces a unique key for a given filename and xpath Used to ensure that keys are kept consistant throughout the program
static java.util.Hashtable ProcessCommandsLinrArguments(java.lang.String[] args)
          Populates a hashtable with a set of command line arguments and values (in lower case) arguments should be in -key=value format otherwise entire argument will be returned as the key with a empty string as its value
static void ReportProgress(int current, int length, int num_of_increments)
          Reports progress the amount of progress that has been made is signifcant
static void ReportProgress(long current, long length, long num_of_increments)
          Reports progress the amount of progress that has been made is signifcant
static void SetErrorFilename(java.lang.String filename)
          Sets the filename of the global error file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_SUFFIX

public static java.lang.String XML_SUFFIX
Suffix for XML documents


TXT_SUFFIX

public static java.lang.String TXT_SUFFIX
Suffix for text documents


FOL_SUFFIX

public static java.lang.String FOL_SUFFIX
Suffix for file,offset,length documents


JPG_SUFFIX

public static java.lang.String JPG_SUFFIX
Suffix for JPG images


HTML_SUFFIX

public static java.lang.String HTML_SUFFIX
Suffix for HTML documents


QRL_SUFFIX

public static java.lang.String QRL_SUFFIX
Suffix for GPXRai Log documents


FOL_DELIM

public static java.lang.String FOL_DELIM
Delimator for FOL documents


CMDLINE_AGRGUMENT_DELIM

public static java.lang.String CMDLINE_AGRGUMENT_DELIM
Deliminator for command line aruguments


CMDLINE_KEYVALUE_DELIM

public static java.lang.String CMDLINE_KEYVALUE_DELIM
Deliminator for key,values paris in command line aruguments


XML_SUFFIX_LENGTH

public static int XML_SUFFIX_LENGTH
Number of characters in XML suffix


DEFAULT_XPATH_VALUE

public static java.lang.String DEFAULT_XPATH_VALUE
default xpath value


ERROR_FILENAME

public static java.lang.String ERROR_FILENAME
global error file filename

Constructor Detail

Global

public Global()
Method Detail

GetJustFileName

public static java.lang.String GetJustFileName(java.lang.String filename)
a utility method that for a given will just the name of the file when given a given a complete filepath e.g. given "c:\foo\bar.xml" return "bar"

Parameters:
filename - - the complete filename
Returns:
- the name of the file without leading directory or suffix

GetKey

public static java.lang.String GetKey(java.lang.String filename,
                                      java.lang.String xpath)
a utility method that produces a unique key for a given filename and xpath Used to ensure that keys are kept consistant throughout the program

Parameters:
filename - - the element's filename
xpath - - the element's xpath
Returns:
- "filename:xpath"

GetHashKey

public static java.lang.Long GetHashKey(java.lang.String filename,
                                        java.lang.String xpath)
a utility method that produces a unique key for a given filename and xpath Used to ensure that keys are kept consistant throughout the program Key is returned as a number derived via MD5 hash algorithm

Parameters:
filename - - the element's filename
xpath - - the element's xpath
Returns:
- MD5 representation of "filename:xpath" string

BinarySearch

public static int BinarySearch(java.util.Vector v,
                               java.lang.Object objp,
                               java.util.Comparator c)
A standard binary search program that returns the index of a given object in a vector

Parameters:
v - - A vector of objects
objp - - The object whose index we are searching for
c - - The comparator used to compare objects in the vector
Returns:
- The index position of the object in the vector

ReportProgress

public static void ReportProgress(int current,
                                  int length,
                                  int num_of_increments)
Reports progress the amount of progress that has been made is signifcant

Parameters:
current - - The current iteration
length - - The total number of iterations
num_of_increments - - Number of incremenets that are to be reported

ReportProgress

public static void ReportProgress(long current,
                                  long length,
                                  long num_of_increments)
Reports progress the amount of progress that has been made is signifcant

Parameters:
current - - The current iteration
length - - The total number of iterations
num_of_increments - - Number of incremenets that are to be reported

ProcessCommandsLinrArguments

public static java.util.Hashtable ProcessCommandsLinrArguments(java.lang.String[] args)
Populates a hashtable with a set of command line arguments and values (in lower case) arguments should be in -key=value format otherwise entire argument will be returned as the key with a empty string as its value

Parameters:
args - - The command line arguments
Returns:
- A hashtable of key,value pairs

SetErrorFilename

public static void SetErrorFilename(java.lang.String filename)
Sets the filename of the global error file

Parameters:
filename - - The filename of the global error file