ix.iquery
Class LookupHandler

java.lang.Object
  extended by ix.iquery.LookupHandler
Direct Known Subclasses:
SimpleIQuery.ExampleLookupHandler

public abstract class LookupHandler
extends java.lang.Object

Performs a lookup for a query agent.

See IQuery for an example.


Field Summary
protected  Activity lookupActivity
          The activity this handler is processing.
protected  IQuery queryAgent
          The agent that created this handler.
 
Constructor Summary
LookupHandler(IQuery queryAgent, Activity lookupActivity)
          Creates a LookupHander to handle the specified activity for the specified agent.
 
Method Summary
protected abstract  void handleLookup()
          Looks up information and sends report back to the agent that sent us the activity.
protected  Report makeReport(Activity about, ReportType type, java.lang.String text)
          Constructs a report about the specified activity.
protected  Report makeReport(ReportType type, java.lang.String text)
          Constructs a report about this handler's lookupActivity.
protected  Constraint makeStateConstraint(LList pattern)
           
protected  Constraint makeStateConstraint(LList pattern, java.lang.Object value)
           
protected  Constraint makeStateConstraint(java.lang.String pattern)
           
protected  Constraint makeStateConstraint(java.lang.String pattern, java.lang.Object value)
           
protected  void sendAbout(Activity about, java.lang.Object contents)
          Sends to the agent that should receive reports about the specified activity.
protected  void sendReply(java.lang.Object contents)
          Sends to the agent that send this handler's lookupActivity.
protected  void sendReport(Activity about, ReportType type, java.lang.String text)
          Sends a report about the specified activity.
protected  void sendReport(ReportType type, java.lang.String text)
          Sends a report about this handler's lookupActivity by calling sendReport(Activity, ReportType, String).
protected  void sendTo(java.lang.Object destination, java.lang.Object contents)
          Sends the contents object to the agent represented by the specified destination.
protected  void transcript(java.lang.String line)
          Adds a line to the agent's transcript window after switching to the AWT event-handling thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queryAgent

protected IQuery queryAgent
The agent that created this handler.


lookupActivity

protected Activity lookupActivity
The activity this handler is processing.

Constructor Detail

LookupHandler

public LookupHandler(IQuery queryAgent,
                     Activity lookupActivity)
Creates a LookupHander to handle the specified activity for the specified agent.

Method Detail

transcript

protected void transcript(java.lang.String line)
Adds a line to the agent's transcript window after switching to the AWT event-handling thread.

See Also:
Util.swingAndWait(Runnable)

sendReport

protected void sendReport(ReportType type,
                          java.lang.String text)
Sends a report about this handler's lookupActivity by calling sendReport(Activity, ReportType, String).


sendReport

protected void sendReport(Activity about,
                          ReportType type,
                          java.lang.String text)
Sends a report about the specified activity.

See Also:
makeReport(Activity, ReportType, String), sendAbout(Activity, Object)

makeReport

protected Report makeReport(ReportType type,
                            java.lang.String text)
Constructs a report about this handler's lookupActivity.


makeReport

protected Report makeReport(Activity about,
                            ReportType type,
                            java.lang.String text)
Constructs a report about the specified activity.


sendReply

protected void sendReply(java.lang.Object contents)
Sends to the agent that send this handler's lookupActivity.

See Also:
sendAbout(Activity, Object)

sendAbout

protected void sendAbout(Activity about,
                         java.lang.Object contents)
Sends to the agent that should receive reports about the specified activity. The object being sent needn't be a Report, but typically will be one. Any fields in the object that refer to the asctivity must have already been filled-in; this method sends the object as-is.

This method calls sendTo(Object, Object).


sendTo

protected void sendTo(java.lang.Object destination,
                      java.lang.Object contents)
Sends the contents object to the agent represented by the specified destination. The object is sent by calling IPC.sendObject(Object, Object) after switching to the AWT event-handling thread.

See Also:
Util.swingAndWait(Runnable)

makeStateConstraint

protected Constraint makeStateConstraint(LList pattern,
                                         java.lang.Object value)

makeStateConstraint

protected Constraint makeStateConstraint(LList pattern)

makeStateConstraint

protected Constraint makeStateConstraint(java.lang.String pattern,
                                         java.lang.Object value)

makeStateConstraint

protected Constraint makeStateConstraint(java.lang.String pattern)

handleLookup

protected abstract void handleLookup()
Looks up information and sends report back to the agent that sent us the activity. Note that this method is called in a separate thread and is a method of a new instance of the relevant LookupHandler subclass. This allows multiple activities to be handled in parallel without interfering with each other.