net.i2p.sam.client
Class SAMEventHandler

java.lang.Object
  extended by net.i2p.sam.client.SAMClientEventListenerImpl
      extended by net.i2p.sam.client.SAMEventHandler
All Implemented Interfaces:
SAMReader.SAMClientEventListener

public class SAMEventHandler
extends SAMClientEventListenerImpl

Simple helper implementation of a the SAMClientEventListener


Field Summary
 
Fields inherited from interface net.i2p.sam.client.SAMReader.SAMClientEventListener
NAMING_REPLY_INVALID_KEY, NAMING_REPLY_KEY_NOT_FOUND, NAMING_REPLY_OK, SESSION_STATUS_DUPLICATE_DEST, SESSION_STATUS_I2P_ERROR, SESSION_STATUS_INVALID_KEY, SESSION_STATUS_OK, STREAM_CLOSED_CANT_REACH_PEER, STREAM_CLOSED_I2P_ERROR, STREAM_CLOSED_OK, STREAM_CLOSED_PEER_NOT_FOUND, STREAM_CLOSED_TIMEOUT, STREAM_STATUS_CANT_REACH_PEER, STREAM_STATUS_I2P_ERROR, STREAM_STATUS_INVALID_KEY, STREAM_STATUS_OK, STREAM_STATUS_TIMEOUT
 
Constructor Summary
SAMEventHandler(I2PAppContext ctx)
           
 
Method Summary
 void helloReplyReceived(boolean ok)
           
 void namingReplyReceived(java.lang.String name, java.lang.String result, java.lang.String value, java.lang.String msg)
           
 void sessionStatusReceived(java.lang.String result, java.lang.String destination, java.lang.String msg)
           
 void unknownMessageReceived(java.lang.String major, java.lang.String minor, java.util.Properties params)
           
 boolean waitForHelloReply()
          Wait for the connection to be established, returning true if everything went ok
 java.lang.String waitForNamingReply(java.lang.String name)
          Return the destination found matching the name, or null if the key was not able to be retrieved.
 boolean waitForSessionCreateReply()
          Wait for the session to be created, returning true if everything went ok
 
Methods inherited from class net.i2p.sam.client.SAMClientEventListenerImpl
destReplyReceived, streamClosedReceived, streamConnectedReceived, streamDataReceived, streamStatusReceived
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAMEventHandler

public SAMEventHandler(I2PAppContext ctx)
Method Detail

helloReplyReceived

public void helloReplyReceived(boolean ok)
Specified by:
helloReplyReceived in interface SAMReader.SAMClientEventListener
Overrides:
helloReplyReceived in class SAMClientEventListenerImpl

sessionStatusReceived

public void sessionStatusReceived(java.lang.String result,
                                  java.lang.String destination,
                                  java.lang.String msg)
Specified by:
sessionStatusReceived in interface SAMReader.SAMClientEventListener
Overrides:
sessionStatusReceived in class SAMClientEventListenerImpl

namingReplyReceived

public void namingReplyReceived(java.lang.String name,
                                java.lang.String result,
                                java.lang.String value,
                                java.lang.String msg)
Specified by:
namingReplyReceived in interface SAMReader.SAMClientEventListener
Overrides:
namingReplyReceived in class SAMClientEventListenerImpl

unknownMessageReceived

public void unknownMessageReceived(java.lang.String major,
                                   java.lang.String minor,
                                   java.util.Properties params)
Specified by:
unknownMessageReceived in interface SAMReader.SAMClientEventListener
Overrides:
unknownMessageReceived in class SAMClientEventListenerImpl

waitForHelloReply

public boolean waitForHelloReply()
Wait for the connection to be established, returning true if everything went ok

Returns:
true if everything ok

waitForSessionCreateReply

public boolean waitForSessionCreateReply()
Wait for the session to be created, returning true if everything went ok

Returns:
true if everything ok

waitForNamingReply

public java.lang.String waitForNamingReply(java.lang.String name)
Return the destination found matching the name, or null if the key was not able to be retrieved.

Parameters:
name - name to be looked for, or "ME"
Returns:
destination found matching the name, or null