edu.berkeley.guir.ptk.input
Class ContextInput

java.lang.Object
  extended byedu.berkeley.guir.ptk.PTK
      extended byedu.berkeley.guir.ptk.input.InputSource
          extended byedu.berkeley.guir.ptk.input.ContextInput
All Implemented Interfaces:
context.arch.handler.Handler, java.lang.Runnable

public class ContextInput
extends InputSource
implements context.arch.handler.Handler

Gets a context event from a (running) context widget and dispatches it. The metadata of the events this class creates is ContextConstants.CONTEXT. The data IDs are dependent on the particular context widget that it is hooked up to.

Author:
jmankoff

Field Summary
static java.lang.String CLASSNAME
          Classname of this application
protected  java.lang.Object context
           
static boolean DEBUG
          Set it to true to have more debug information
static int DEFAULT_PORT
          Default port to start the BaseObject on is 5555
static java.lang.String MY_ID
           
 
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
ContextInput()
          Constructors for non-distributed applications.
ContextInput(Abstractor abs)
          Constructor for non-distributed applications that abstracts on the inputs side.
ContextInput(java.lang.String my_ip)
          Constructors for non-distributed applications.
 
Method Summary
 context.arch.comm.DataObject handle(java.lang.String subId, context.arch.comm.DataObject data)
           
 void handleIndependentReply(context.arch.comm.clients.IndependentCommunication ic)
           
static void main(java.lang.String[] argv)
          Starts this Input with the IP address PTKConstants.DEFAULT_INPUT_IP Can instead take one command line parameter: (1) IP address where this Input is running.
 Events newInput()
          Gets input from the data source, fills an Event with it, and returns the Event.
 
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

MY_ID

public static final java.lang.String MY_ID
See Also:
Constant Field Values

context

protected java.lang.Object context

DEFAULT_PORT

public static final int DEFAULT_PORT
Default port to start the BaseObject on is 5555

See Also:
Constant Field Values

DEBUG

public static boolean DEBUG
Set it to true to have more debug information


CLASSNAME

public static final java.lang.String CLASSNAME
Classname of this application

See Also:
Constant Field Values
Constructor Detail

ContextInput

public ContextInput()
Constructors for non-distributed applications. An input that uses this constructor cannot be part of an application on another machine.


ContextInput

public ContextInput(java.lang.String my_ip)
Constructors for non-distributed applications. An input that uses this constructor cannot be part of an application on another machine.


ContextInput

public ContextInput(Abstractor abs)
Constructor for non-distributed applications that abstracts on the inputs side.

Method Detail

newInput

public Events newInput()
Gets input from the data source, fills an Event with it, and returns the Event.

Specified by:
newInput in class InputSource

handleIndependentReply

public void handleIndependentReply(context.arch.comm.clients.IndependentCommunication ic)
Specified by:
handleIndependentReply in interface context.arch.handler.Handler

handle

public context.arch.comm.DataObject handle(java.lang.String subId,
                                           context.arch.comm.DataObject data)
                                    throws context.arch.InvalidMethodException,
                                           context.arch.MethodException
Specified by:
handle in interface context.arch.handler.Handler
Throws:
context.arch.InvalidMethodException
context.arch.MethodException

main

public static void main(java.lang.String[] argv)
Starts this Input with the IP address PTKConstants.DEFAULT_INPUT_IP Can instead take one command line parameter: (1) IP address where this Input is running.

Parameters:
argv - IP address where this Input is running, as a String.