org.jabber.jabberbeans
Class ConnectionEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--org.jabber.jabberbeans.ConnectionEvent
All Implemented Interfaces:
java.io.Serializable

public class ConnectionEvent
extends java.util.EventObject

A ConnectionEvent is an event occuring on a connection (from the ConnectionBean) describing a change in the connection state, being offline, online, connecting, or an error condition (connectFailed). The main purpose for a ConnectionEvent currently is to mark the 'source' of the event, so that the same event handler code can handle multiple connections.

See Also:
Serialized Form

Nested Class Summary
static class ConnectionEvent.EReason
           
static class ConnectionEvent.EState
          EState is an enumerator class; it provides an immutable reference on the current state of the connection to a jabber server.
 
Field Summary
static ConnectionEvent.EReason REASON_CLIENT_INITIATED
           
static ConnectionEvent.EReason REASON_IO_ERROR
           
static ConnectionEvent.EReason REASON_SERVER_INITIATED
           
static ConnectionEvent.EReason REASON_UNKNOWN
           
static ConnectionEvent.EState STATE_CONNECTED
           
static ConnectionEvent.EState STATE_CONNECTING
           
static ConnectionEvent.EState STATE_DISCONNECTED
           
static ConnectionEvent.EState STATE_UNKNOWN
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ConnectionEvent(java.lang.Object source, ConnectionEvent.EState state, ConnectionEvent.EState oldState, ConnectionEvent.EReason reason)
          Creates a new ConnectionEvent instance.
 
Method Summary
 ConnectionEvent.EState getOldState()
          getOldState returns the state which we were in before this event
 ConnectionEvent.EReason getReason()
          getReason returns the reason the state changed, indicating why the source sent this event (connection lost, client requested disconnect, server requested disconnect)
 ConnectionEvent.EState getState()
          getState returns the state change which prompted this event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_UNKNOWN

public static final ConnectionEvent.EState STATE_UNKNOWN

STATE_DISCONNECTED

public static final ConnectionEvent.EState STATE_DISCONNECTED

STATE_CONNECTING

public static final ConnectionEvent.EState STATE_CONNECTING

STATE_CONNECTED

public static final ConnectionEvent.EState STATE_CONNECTED

REASON_UNKNOWN

public static final ConnectionEvent.EReason REASON_UNKNOWN

REASON_CLIENT_INITIATED

public static final ConnectionEvent.EReason REASON_CLIENT_INITIATED

REASON_SERVER_INITIATED

public static final ConnectionEvent.EReason REASON_SERVER_INITIATED

REASON_IO_ERROR

public static final ConnectionEvent.EReason REASON_IO_ERROR
Constructor Detail

ConnectionEvent

public ConnectionEvent(java.lang.Object source,
                       ConnectionEvent.EState state,
                       ConnectionEvent.EState oldState,
                       ConnectionEvent.EReason reason)
Creates a new ConnectionEvent instance. This should only really be called by ConnectionBean.

Parameters:
source - an Object value
state - an Estate value
oldState - an EState value
reason - an Estate value
Method Detail

getState

public ConnectionEvent.EState getState()
getState returns the state change which prompted this event.

Returns:
an EState value

getOldState

public ConnectionEvent.EState getOldState()
getOldState returns the state which we were in before this event

Returns:
an EState value

getReason

public ConnectionEvent.EReason getReason()
getReason returns the reason the state changed, indicating why the source sent this event (connection lost, client requested disconnect, server requested disconnect)

Returns:
an EReason value