com.echomine.net
Class Connection

java.lang.Object
  extended by com.echomine.net.Connection
Direct Known Subclasses:
TimeableConnection

public abstract class Connection
extends java.lang.Object

Base class for all network connection related services. Specifies necessary methods to be implemented by subclasses plus add the foundation for dispatching connection events.


Field Summary
protected  javax.swing.event.EventListenerList listenerList
           
 
Constructor Summary
Connection()
           
 
Method Summary
 void addConnectionListener(ConnectionListener l)
          adds a subscriber to listen for connection events
protected  void fireConnectionClosed(ConnectionEvent event)
           
protected  void fireConnectionEstablished(ConnectionEvent event)
           
protected  void fireConnectionStarting(ConnectionEvent event, ConnectionEvent vetoEvent)
          convenience method to fire off connection starting events.
protected  void fireConnectionStartingWithoutVeto(ConnectionEvent event)
          this method is specially designed to fire off the event without capturing the veto exception.
 void removeConnectionListener(ConnectionListener l)
          remove from listening to connection events
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

Connection

public Connection()
Method Detail

addConnectionListener

public void addConnectionListener(ConnectionListener l)
adds a subscriber to listen for connection events


removeConnectionListener

public void removeConnectionListener(ConnectionListener l)
remove from listening to connection events


fireConnectionStarting

protected void fireConnectionStarting(ConnectionEvent event,
                                      ConnectionEvent vetoEvent)
                               throws ConnectionVetoException
convenience method to fire off connection starting events. If a connection is vetoed, it will automatically broadcast connection closed events to the listeners that already processed the starting event. It will also throw the exception when a connectio is vetoed.

Throws:
ConnectionVetoException

fireConnectionStartingWithoutVeto

protected void fireConnectionStartingWithoutVeto(ConnectionEvent event)
                                          throws ConnectionVetoException
this method is specially designed to fire off the event without capturing the veto exception. The reason for using this is when the subclasses wraps the connection listening event caused by another connection event. This passing of the connection events should be captured at only one level, the base level where connection event was first fired. The difference between this method and the fireConnectionStarting() method is that the latter will automatically call connection closed events while this method does not.

Throws:
ConnectionVetoException

fireConnectionEstablished

protected void fireConnectionEstablished(ConnectionEvent event)

fireConnectionClosed

protected void fireConnectionClosed(ConnectionEvent event)


Copyright © 2001-2005 Echomine. All Rights Reserved.