org.jcoderz.commons.connector
Class ConnectionBase

java.lang.Object
  extended by org.jcoderz.commons.connector.ConnectionBase
All Implemented Interfaces:
ConnectionHandle

public abstract class ConnectionBase
extends Object
implements ConnectionHandle

This abstract class provides a set of common methods that used by all derived connection's implementations.


Constructor Summary
protected ConnectionBase(ConnectionNotificationListener cnl)
          Constructor.
 
Method Summary
protected  void assertNotCleanedUp()
          Throws the ResourceException if this connection has already been cleaned up.
protected  void assertNotClosed()
          Throws the ResourceException if this connection has already been closed.
protected  void assertValid()
          Throws the ResourceException if this connection has already been closed or cleaned up.
 void changeAssociation(ConnectionNotificationListener newCnl)
          The underlying managed connection calls this method to force this handle change the managed connection's association.
 void cleanUp()
          Sets this connection to the state cleaned up.
protected  void setClosed()
          Sets this connection to the state closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionBase

protected ConnectionBase(ConnectionNotificationListener cnl)
Constructor.

Parameters:
cnl - The ConnectionNotificationListener to be used.
Method Detail

assertNotClosed

protected void assertNotClosed()
                        throws IllegalStateException
Throws the ResourceException if this connection has already been closed.

Throws:
IllegalStateException - if this connection has already been closed.

assertNotCleanedUp

protected void assertNotCleanedUp()
                           throws IllegalStateException
Throws the ResourceException if this connection has already been cleaned up.

Throws:
IllegalStateException - if this connection has already been cleaned up.

assertValid

protected void assertValid()
                    throws ResourceException
Throws the ResourceException if this connection has already been closed or cleaned up.

Throws:
ResourceException - if this connection has already been closed or cleaned up.

setClosed

protected void setClosed()
                  throws ResourceException
Sets this connection to the state closed. All futher calls on the public methods of this connection will throw a ResourceException.

Throws:
ResourceException - thrown if this connection has already been closed.

cleanUp

public void cleanUp()
Sets this connection to the state cleaned up. All futher calls on the public methods of this connection will throw a ResourceException.

Specified by:
cleanUp in interface ConnectionHandle

changeAssociation

public void changeAssociation(ConnectionNotificationListener newCnl)
The underlying managed connection calls this method to force this handle change the managed connection's association. In other words, this handle should migrate to another managed connection.

Specified by:
changeAssociation in interface ConnectionHandle
Parameters:
newCnl - The new listener to be used for this handle.


Copyright 2007 The jCoderZ Project.