stockDataRetrieval
Class WebConnectionEngine

java.lang.Object
  extended bystockDataRetrieval.WebConnectionEngine

public class WebConnectionEngine
extends java.lang.Object

Class implements the functionality for connecting to a web page by URL address and downlading the web page text to the local machine (without downloading any pictures or other graphics).

This web page is suitable for passing to the parsing function to extract interesting information.


Constructor Summary
WebConnectionEngine()
           
 
Method Summary
static java.lang.String grabWebPage(java.lang.String targetURL)
          Retrieves the web page source code of a page that contains ticker and company name info.
private static java.net.URL initializeRobot(java.lang.String targetURL)
          Initializes the robot that will go and download the target webpage.
private static java.lang.String ripWebPage(java.lang.String targetURL, java.net.URL urlRobot)
          Responsible for performing a buffered download of the webpage and returning the web page text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebConnectionEngine

public WebConnectionEngine()
Method Detail

grabWebPage

public static java.lang.String grabWebPage(java.lang.String targetURL)
Retrieves the web page source code of a page that contains ticker and company name info.

The return string is null if the web page could not be harvested

Parameters:
targetURL - the target web page to return
Returns:
the source code from the page to be harvested for information

initializeRobot

private static java.net.URL initializeRobot(java.lang.String targetURL)
Initializes the robot that will go and download the target webpage.

If the initialization fails, the robot returned is null.

Parameters:
targetURL - target URL which to access
Returns:
robot used to access the target page

ripWebPage

private static java.lang.String ripWebPage(java.lang.String targetURL,
                                           java.net.URL urlRobot)
Responsible for performing a buffered download of the webpage and returning the web page text.

If the ripping fails, the return value is null.

Parameters:
targetURL - the source URL - used in error messges (if any)
urlRobot - the robot which grabs the page
Returns:
source of the webpage in simple text format