Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.ou.kmi.buddyspace.core
Class BSConnectionBean  view BSConnectionBean download BSConnectionBean.java

java.lang.Object
  extended byedu.ou.kmi.buddyspace.core.BSConnectionBean
All Implemented Interfaces:
org.jabber.jabberbeans.ConnectionListener, org.jabber.jabberbeans.PacketListener

public class BSConnectionBean
extends java.lang.Object
implements org.jabber.jabberbeans.ConnectionListener, org.jabber.jabberbeans.PacketListener

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.


Field Summary
private  org.jabber.jabberbeans.ConnectionBean connection
           
private  java.util.Vector connectionListeners
           
private  ConnectionEvent.EState connState
           
private  java.lang.String name
           
 
Constructor Summary
(package private) BSConnectionBean()
          Constructor
 
Method Summary
 void addConnectionListener(org.jabber.jabberbeans.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, int port)
          Creates new connection to the specified hostName
 void connectionChanged(ConnectionEvent ce)
          Handles changes of connection state.
 void disconnect()
          Closes current connection
 org.jabber.jabberbeans.ConnectionBean getConnection()
          Returns current ConnectionBean.
 ConnectionEvent.EState getState()
          Returns current connection state.
private  void notifyConnectionListeners(ConnectionEvent ce)
          Notifies connection listeners about connection state change.
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(org.jabber.jabberbeans.ConnectionListener listener)
          Removes ConnectionListener from listeners notified when connection state changes.
 void sendFailed(PacketEvent pe)
          PacketListener method
 void sentPacket(PacketEvent pe)
          PacketListener method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jabber.jabberbeans.ConnectionListener
connected, connectFailed, connecting, disconnected
 
Methods inherited from interface org.jabber.jabberbeans.PacketListener
receivedPacket, sentPacket
 

Field Detail

connection

private org.jabber.jabberbeans.ConnectionBean connection

connState

private ConnectionEvent.EState connState

name

private final java.lang.String name
See Also:
Constant Field Values

connectionListeners

private java.util.Vector connectionListeners
Constructor Detail

BSConnectionBean

BSConnectionBean()
Constructor

Method Detail

connect

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


connect

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


disconnect

public void disconnect()
Closes current connection


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(org.jabber.jabberbeans.ConnectionListener listener)
Adds ConnectionListener to listeners notified when connection state changes.


removeConnectionListener

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


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.


notifyConnectionListeners

private void notifyConnectionListeners(ConnectionEvent ce)
Notifies connection listeners about connection state change.


getState

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


getConnection

public org.jabber.jabberbeans.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