|
|||||||||||
| 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
Wrapper class for all input that enters the PTK. Application-specific
input source classes extend this abstract class. The abstract method that
input developers must implement is newInput. This method
is responsible for getting the actual input data (i.e., from a sensor,
Web page, etc.). The other methods in this class help wrap the input data
in PTK objects, set up communication with the PTK server, and dispatch
events to the server. Typically in a class that extends this class, you
would include a main function that did the following:
mds data field)
will start to receive and handle events this input class provides. You are
responsible for setting the Metadata mds field of this class.
This is necessary so that outputs can subscribe to receive the input the
subclasses of this class generates. They are also necessary because they are
used by this class to register to the PTK server.
| Field Summary | |
protected History |
history
Used only if there are Abstractors installed to aid in abstraction. |
Metadata |
mds
The MetadataItems of the events this input source creates. |
java.lang.String |
my_id
A unique ID String for this input. |
java.lang.String |
my_ip
This is the IP address for the machine on which this input will run. |
protected long |
time_between_events
|
| Fields inherited from class edu.berkeley.guir.ptk.PTK |
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG |
| Constructor Summary | |
InputSource(Metadata mds,
java.lang.String my_id)
This constructor is used when the input and application are not distributed. |
|
InputSource(Metadata mds,
java.lang.String my_id,
Abstractor abs)
Use one of the constructors that take an Abstractor or array of Abstractors to do abstraction on the input side. |
|
InputSource(Metadata mds,
java.lang.String my_id,
Abstractor[] abs)
|
|
InputSource(Metadata mds,
java.lang.String my_id,
java.lang.String my_ip)
Use this constructor whenever you instantiate an Input subclass object. |
|
InputSource(Metadata mds,
java.lang.String my_id,
java.lang.String my_ip,
Abstractor abs)
Use one of the constructors that take an Abstractor or array of Abstractors to do abstraction on the input side. |
|
InputSource(Metadata mds,
java.lang.String my_id,
java.lang.String my_ip,
Abstractor[] abs)
|
|
| Method Summary | |
void |
addMetadata(Metadata md)
Adds the given metadata to this input's metadata, without replacing any of the existing metadata. |
void |
addMetadataItem(MetadataItem mi)
|
protected void |
addMyMetadataToEvent(Events e)
Adds this InputSource's metadata (set in constructor) to this event. |
boolean |
dispatchEvent(Event e)
Dispatches given event to the PTK server, which will make sure any output applications that want the data will get it. |
protected void |
finalize()
Unregisters this input upon Java garbage collection. |
boolean |
getAbstractThenSendInputEvent()
Provides an alternate way of getting input from the input source to the PTK server, that involves abstracting the event first. |
Metadata |
getMetadata()
|
MetadataItem[] |
getMetadataItemsAsArray()
|
boolean |
getThenSendInputEvent()
Provides the main way of getting input from the input source to the PTK server. |
abstract Events |
newInput()
Gets input from the data source and fills a Template with it. |
protected void |
register(Metadata mds)
Register this input source with the PTK Server. |
void |
run()
|
void |
setMetadata(Metadata md)
Replaces this input's metadata with the given metadata. |
void |
setTimeBetweenEvents(long milliseconds)
|
void |
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 java.lang.String my_ip
public java.lang.String my_id
public Metadata mds
protected History history
protected long time_between_events
| Constructor Detail |
public InputSource(Metadata mds,
java.lang.String my_id,
java.lang.String my_ip)
mds - The MetadataItems of the events created by
this input source. Used to register to the
PTK server and to identify events this class
generates.my_id - A unique id for this input source. Must be
unique for all input sources registered to a
single PTK Server instance. (Anind: true?)my_ip - The ip address where this input class is
running.
public InputSource(Metadata mds,
java.lang.String my_id,
java.lang.String my_ip,
Abstractor abs)
public InputSource(Metadata mds,
java.lang.String my_id,
java.lang.String my_ip,
Abstractor[] abs)
public InputSource(Metadata mds,
java.lang.String my_id)
mds - my_id -
public InputSource(Metadata mds,
java.lang.String my_id,
Abstractor abs)
public InputSource(Metadata mds,
java.lang.String my_id,
Abstractor[] abs)
| Method Detail |
public void run()
run in interface java.lang.Runnablepublic void startInput()
public boolean getThenSendInputEvent()
public boolean getAbstractThenSendInputEvent()
public abstract Events newInput()
public boolean dispatchEvent(Event e)
e - the event to send to the server
protected void register(Metadata mds)
mds - The Metadata of the events created by this
input source. Used to register to the PTK server
and to identify events this class generates.
protected void finalize()
throws java.lang.Throwable
java.lang.ThrowableObject.finalize()public void setTimeBetweenEvents(long milliseconds)
public void setMetadata(Metadata md)
public void addMetadata(Metadata md)
public void addMetadataItem(MetadataItem mi)
public MetadataItem[] getMetadataItemsAsArray()
public Metadata getMetadata()
protected void addMyMetadataToEvent(Events e)
e -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||