edu.ou.kmi.buddyspace.core
Class BSConnectionBean

java.lang.Object
  |
  +--edu.ou.kmi.buddyspace.core.BSConnectionBean

public class BSConnectionBean
extends java.lang.Object

BSConnectionBean is the main bean for BuddySpaceBeans. A BSConnectionBean mantains connection to a jabber server. All the other beans are dependent on this and has to be reset (typically using bean.setConnection function) after a new connection is setablished (BSConnectionBean.connect function). The class is based on ConnectionBean and implements ConnectionListener from JabberBeans.


Method Summary
 void addConnectionListener(ConnectionListener listener)
          Adds ConnectionListener to listeners notified when connection state changes.
 boolean connect(java.lang.String hostName)
          Creates new connection to the specified hostName
 boolean connect(java.lang.String hostName, boolean useSSL)
          Creates new connection to the specified hostName
 boolean connect(java.lang.String hostName, int port)
          Creates new connection to the specified hostName
 boolean connect(java.lang.String hostName, int port, boolean useSSL)
          Creates new connection to the specified hostName
 void connectionChanged(ConnectionEvent ce)
          Handles changes of connection state.
 void disconnect()
          Closes current connection
 ConnectionBean getConnection()
          Returns current ConnectionBean.
 ConnectionEvent.EState getConnectionState()
          Returns current connection state
 ConnectionEvent.EState getState()
          Returns current connection state.
protected  void prepareToDestroy()
          Frees all object bindings to allow object destroy
 void receivedPacket(PacketEvent pe)
          PacketListener method
 void removeAllConnectionListeners()
          Removes all listeners notified when connection state changes.
 void removeConnectionListener(ConnectionListener listener)
          Removes ConnectionListener from listeners notified when connection state changes.
 void sendFailed(PacketEvent pe)
          PacketListener method
 void sentPacket(PacketEvent pe)
          PacketListener method
protected  void setConnectionState(ConnectionEvent.EState state)
          Sets that connection state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnectionState

public ConnectionEvent.EState getConnectionState()
Returns current connection state


connect

public boolean connect(java.lang.String hostName,
                       int port,
                       boolean useSSL)
Creates new connection to the specified hostName

Returns:
false if the connection cannot be established

connect

public boolean connect(java.lang.String hostName,
                       int port)
Creates new connection to the specified hostName

Returns:
false if the connection cannot be established

connect

public boolean connect(java.lang.String hostName)
Creates new connection to the specified hostName

Returns:
false if the connection cannot be established

connect

public boolean connect(java.lang.String hostName,
                       boolean useSSL)
Creates new connection to the specified hostName

Returns:
false if the connection cannot be established

disconnect

public void disconnect()
Closes current connection


setConnectionState

protected void setConnectionState(ConnectionEvent.EState state)
Sets that connection state.


prepareToDestroy

protected void prepareToDestroy()
Frees all object bindings to allow object destroy


connectionChanged

public void connectionChanged(ConnectionEvent ce)
Handles changes of connection state. See ConnectionListener in JabberBeans.


addConnectionListener

public void addConnectionListener(ConnectionListener listener)
Adds ConnectionListener to listeners notified when connection state changes.

See Also:
removeConnectionListener(ConnectionListener), removeAllConnectionListeners(), #notifyConnectionListeners

removeConnectionListener

public void removeConnectionListener(ConnectionListener listener)
Removes ConnectionListener from listeners notified when connection state changes.

See Also:
addConnectionListener(ConnectionListener), removeAllConnectionListeners(), #notifyConnectionListeners

removeAllConnectionListeners

public void removeAllConnectionListeners()
Removes all listeners notified when connection state changes. This can be used before to free dependencies and allow dispose of all objects.

See Also:
addConnectionListener(ConnectionListener), removeConnectionListener(ConnectionListener), #notifyConnectionListeners

getState

public ConnectionEvent.EState getState()
Returns current connection state.


getConnection

public ConnectionBean getConnection()
Returns current ConnectionBean. Which is typically used for initialization of other beans.


receivedPacket

public void receivedPacket(PacketEvent pe)
PacketListener method


sendFailed

public void sendFailed(PacketEvent pe)
PacketListener method


sentPacket

public void sentPacket(PacketEvent pe)
PacketListener method