com.dionloy.joogleagent
Class JAJoogleAgent

com.dionloy.joogleagent.JAJoogleAgent

public class JAJoogleAgent

JAJoogleAgent is a Jabber agent that can query Google for data and return those responses over the Jabber network.

Note that this is not multi-threaded and is not meant for heavy usage. This was done as a personal exercise in learning about JabberBeans, XML parsing in Java and the Jabber protocol.

Version: $Version$


Constructor Summary
JAJoogleAgent()
           
 
Method Summary
 boolean configure(java.util.Properties props)
          Configures the object from the given Properties.
 void connected(com.dionloy.joogleagent.ConnectionEvent ce)
           
 void connectFailed(com.dionloy.joogleagent.ConnectionEvent ce)
           
 void connecting(com.dionloy.joogleagent.ConnectionEvent ce)
           
 void connectionChanged(com.dionloy.joogleagent.ConnectionEvent ce)
           
 void disconnected(com.dionloy.joogleagent.ConnectionEvent ce)
           
static void main(java.lang.String[] argv)
          Main program.
static void printUsage()
          Prints out all the command line options.
 void receivedPacket(com.dionloy.joogleagent.PacketEvent pe)
          Called when a packet has been received.
 void run()
          Runs the agent by connecting to the Jabber server.
 void sendFailed(com.dionloy.joogleagent.PacketEvent pe)
          Called when a send has failed.
protected  void sendHeader(org.jabber.jabberbeans.util.JID user)
          Sends the header.
protected  void sendNoResultsMessage(org.jabber.jabberbeans.util.JID user)
          Sends a message to the user saying that there were no results returned for his query.
protected  void sendResult(com.dionloy.joogle.JGResult result, org.jabber.jabberbeans.util.JID user)
          Sends the result to the user.
protected  void sendResults(com.dionloy.joogle.JGDocument document, org.jabber.jabberbeans.util.JID fromUser)
          Sends the results from the Joogle query back to the user.
 void sentPacket(com.dionloy.joogleagent.PacketEvent pe)
          Called when we have sent a packet.
 

Constructor Detail

JAJoogleAgent

public JAJoogleAgent()
Method Detail

printUsage

public static void printUsage()
Prints out all the command line options.

main

public static void main(java.lang.String[] argv)
Main program.

configure

public boolean configure(java.util.Properties props)
Configures the object from the given Properties.

run

public void run()
         throws java.net.UnknownHostException,
                java.io.IOException,
                java.lang.InstantiationException
Runs the agent by connecting to the Jabber server.

receivedPacket

public void receivedPacket(com.dionloy.joogleagent.PacketEvent pe)
Called when a packet has been received.

sentPacket

public void sentPacket(com.dionloy.joogleagent.PacketEvent pe)
Called when we have sent a packet.

sendFailed

public void sendFailed(com.dionloy.joogleagent.PacketEvent pe)
Called when a send has failed.

connected

public void connected(com.dionloy.joogleagent.ConnectionEvent ce)

disconnected

public void disconnected(com.dionloy.joogleagent.ConnectionEvent ce)

connecting

public void connecting(com.dionloy.joogleagent.ConnectionEvent ce)

connectFailed

public void connectFailed(com.dionloy.joogleagent.ConnectionEvent ce)

connectionChanged

public void connectionChanged(com.dionloy.joogleagent.ConnectionEvent ce)

sendResults

protected void sendResults(com.dionloy.joogle.JGDocument document,
                           org.jabber.jabberbeans.util.JID fromUser)
Sends the results from the Joogle query back to the user.

sendHeader

protected void sendHeader(org.jabber.jabberbeans.util.JID user)
Sends the header.

sendResult

protected void sendResult(com.dionloy.joogle.JGResult result,
                          org.jabber.jabberbeans.util.JID user)
Sends the result to the user.

sendNoResultsMessage

protected void sendNoResultsMessage(org.jabber.jabberbeans.util.JID user)
Sends a message to the user saying that there were no results returned for his query.