|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.berkeley.guir.ptk.PTK
edu.berkeley.guir.ptk.input.InputSource
edu.berkeley.guir.ptk.input.StockInput
Uses the StockParser class to get stock quotes from quotes.nasdaq.com and * dispatches all the quotes in one event to the PTK Server. Extends the class * InputSource and implements newInput() (an inherited, abstract method). This * method is responsible for calling the utility class, StockParser, to get the * actual input data from the NASDAQ Web page. *
* This class sets the inherited Metadata mds field in the main
* function where the Stocks instance is created. It is necessary to set the metadata
* because this is what identifies the events this input creates to outputs and to
* the PTK server. Outputs that want stock input would subscribe to same metadata
* that is added to the event in the newInput method, here. Metadata is added
* using a Metadata object, which includes the ID of the metadata (which type
* of metadata it is) and the value of the metadata (the value that separates it
* from other events. Multiple events can have Metadatas with the same
* ID, but if it is important to tell them apart, their values should be different.
* For this stock input, the only Metadata in the event is the
* EVENT_TYPE_ID (the metadata ID), which is set to StockConstants.STOCK
* (the metadata value). All event should have a EVENT_TYPE_ID.
*
* To start the input, run this class as a Java application. The main class * creates a new Stocks input and calls getThenSendInputData() to get new input * and dispatch it to the PTK server. This method is called in a loop, with a * waiting period between each call where the process sleeps. The sleeping time is * specified by the constant PTKConstants.TIME_BETWEEN_EVENTS.
| Field Summary | |
static java.lang.String |
MY_ID
The unique ID String for this input, found in StockConstants, which is an application specific class. |
| Fields inherited from class edu.berkeley.guir.ptk.input.InputSource |
history, mds, my_id, my_ip, time_between_events |
| Fields inherited from class edu.berkeley.guir.ptk.PTK |
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG |
| Constructor Summary | |
StockInput()
Constructor for non-distributed applications. |
|
StockInput(java.lang.String my_ip)
Constructor for distributed applications. |
|
| Method Summary | |
static void |
main(java.lang.String[] argsv)
This main method allows the input to run, continually getting new input and * dispatching the data in events to the PTK server. |
Events |
newInput()
Gets stock quote input from the data source, quotes.nasdaq.com, and fills an * Events with the stock quote strings. |
| Methods inherited from class edu.berkeley.guir.ptk.input.InputSource |
addMetadata, addMetadataItem, addMyMetadataToEvent, dispatchEvent, finalize, getAbstractThenSendInputEvent, getMetadata, getMetadataItemsAsArray, getThenSendInputEvent, register, run, setMetadata, setTimeBetweenEvents, startInput |
| Methods inherited from class edu.berkeley.guir.ptk.PTK |
getMAX, getMED, getMIN, getNO, printDebug, printDebug, printError |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String MY_ID
| Constructor Detail |
public StockInput()
public StockInput(java.lang.String my_ip)
| Method Detail |
public Events newInput()
newInput in class InputSourcepublic static void main(java.lang.String[] argsv)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||