Class copyURL

java.lang.Object
  extended by copyURL

public class copyURL
extends java.lang.Object

A general helper class that reads data form the net...


Field Summary
private static java.lang.String amazon1
           
private static java.lang.String amazon2
           
private static java.lang.String amazon3
           
private static java.lang.String amazonAssId
          Amazons associate key (Your Access Key ID) used to retrieve book data.
private static java.lang.String isbndb1
           
private static java.lang.String isbndb2
           
private static java.lang.String isbndbKey
          isbndb's key used to retrieve their book metadata.
 
Constructor Summary
copyURL()
           
 
Method Summary
static boolean findS(java.lang.String xmlFile, java.lang.String regex)
          Attempts to find (not match) the String regex in the file that was downloaded from amazon/isbndb.
static java.lang.String[] getCatagories(java.lang.String xmlFile)
          Gets the categories of the book from the books xml file downloaded from amazon.
static java.lang.String getFile(java.lang.String amazonXMLPath, java.lang.String fileType, java.lang.String isbn, java.lang.String xmlName, java.lang.String responseGrp, java.lang.String isbndbResults, boolean isbndb)
          This takes an ISBN number and attempts to get from amazon or isbndb its corresponding xml file.
static int getNumberOfFiles(java.io.File dir, java.io.File[] fileList, int listPosition)
          Given directory dir, this calculates the total number of files in it including files in its sub-directories but doesn't count the directories themselves.
static java.lang.String getTitle(java.lang.String xmlFile)
          Gets the title of the book from the books xml file downloaded from amazon.
static void printAllFiles(java.io.File[] fileList, java.lang.String resultPath)
          Prints and saves a text file with all the file names in fileList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amazonAssId

private static final java.lang.String amazonAssId
Amazons associate key (Your Access Key ID) used to retrieve book data. Get it at (http://aws.amazon.com/)

See Also:
Constant Field Values

amazon1

private static final java.lang.String amazon1
See Also:
Constant Field Values

amazon2

private static final java.lang.String amazon2
See Also:
Constant Field Values

amazon3

private static final java.lang.String amazon3
See Also:
Constant Field Values

isbndbKey

private static final java.lang.String isbndbKey
isbndb's key used to retrieve their book metadata. Get it at (https://isbndb.com/account/dev/keys/)

See Also:
Constant Field Values

isbndb1

private static final java.lang.String isbndb1
See Also:
Constant Field Values

isbndb2

private static final java.lang.String isbndb2
See Also:
Constant Field Values
Constructor Detail

copyURL

public copyURL()
Method Detail

getFile

public static java.lang.String getFile(java.lang.String amazonXMLPath,
                                       java.lang.String fileType,
                                       java.lang.String isbn,
                                       java.lang.String xmlName,
                                       java.lang.String responseGrp,
                                       java.lang.String isbndbResults,
                                       boolean isbndb)
This takes an ISBN number and attempts to get from amazon or isbndb its corresponding xml file.

Parameters:
amazonXMLPath - The full path of the directory where the downloaded temp files are stored.
fileType - The file type in which to save the downloaded metadata, usually just "txt".
isbn - The ISBN number without "-", just the number.
xmlName - The name of the file to which the downloaded data will be saved to. "TempFile" works.
responseGrp - Amazons response group, usually "Small".
isbndbResults - isbndb's results/response group, usually "details".
isbndb - Whether to get the data from amazon or from isbndb. If true it only get it from isbndb, if false only from amazon.
Returns:
The full path and filename of the file that was downloaded/gotten/saved by this method.

getCatagories

public static java.lang.String[] getCatagories(java.lang.String xmlFile)
Gets the categories of the book from the books xml file downloaded from amazon. May not be working yet.

Parameters:
xmlFile - The full path and filename of the xml file that was downloaded/gotten/saved from amazon/isbndb.
Returns:
A list of categories under which this book can be classified.

getTitle

public static java.lang.String getTitle(java.lang.String xmlFile)
Gets the title of the book from the books xml file downloaded from amazon.

Parameters:
xmlFile - The full path and filename of the xml file that was downloaded/gotten/saved from amazon/isbndb.
Returns:
The title of the book or null if didn't find one.

findS

public static boolean findS(java.lang.String xmlFile,
                            java.lang.String regex)
Attempts to find (not match) the String regex in the file that was downloaded from amazon/isbndb.

Parameters:
xmlFile - The full path and filename of the xml file that was downloaded/gotten/saved from amazon/isbndb.
findIt - the String regex to be found in the file.
Returns:
true if it was found, else false.

getNumberOfFiles

public static int getNumberOfFiles(java.io.File dir,
                                   java.io.File[] fileList,
                                   int listPosition)
Given directory dir, this calculates the total number of files in it including files in its sub-directories but doesn't count the directories themselves. It also places each file into the fileList array. So that you end up with all the sub-files in the directory present in the fileList[].

Parameters:
dir - The directory where the files are present.
fileList - a File[] with size at least as big as the probable total number of files in the directory. But it should not contain anything yet.
listPosition - Where in fileList to add the next file. It's used to keep track because this is recursive. When calling this method it should be 0, unless you want to start later in the array.
Returns:
The total number of files in the directory and its sub-directories excluding the directories themselves.

printAllFiles

public static void printAllFiles(java.io.File[] fileList,
                                 java.lang.String resultPath)
Prints and saves a text file with all the file names in fileList. They are supposed to print with recursive indentation for each sub-directory. Works only on windows because it splits the file name by "\".

Parameters:
fileList - The fileList containing all the files.
resultPath - The full path and filename for the text file to which the file list will be saved to.