Class ConnectionEvent

  • All Implemented Interfaces:
    Serializable

    public class ConnectionEvent
    extends EventObject
    An event that is generated when a connection is established or dropped.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    ConnectionListener, Serialized Form
    • Constructor Detail

      • ConnectionEvent

        public ConnectionEvent​(Object source,
                               int type,
                               DbUtils utils)
        constructs the event
        Parameters:
        source - the source that generated this event
        type - whether CONNECT or DISCONNECT happened
        utils - the DatabaseUtils isntance responsible for the connection
      • ConnectionEvent

        public ConnectionEvent​(Object source,
                               int type,
                               DbUtils utils,
                               Exception ex)
        constructs the event
        Parameters:
        source - the source that generated this event
        type - whether CONNECT or DISCONNECT happened
        utils - the DatabaseUtils isntance responsible for the connection
        ex - a possible exception, if not successful
    • Method Detail

      • getType

        public int getType()
        returns the type of this event, CONNECT or DISCONNECT
        Returns:
        the type of this event
        See Also:
        CONNECT, DISCONNECT
      • failed

        public boolean failed()
        whether an exception happened and is stored
        Returns:
        whether an exception happened
      • isConnected

        public boolean isConnected()
        returns whether the connection is still open.
        Returns:
        whether the connection is still open
      • getException

        public Exception getException()
        returns the stored exception, if any (can be NULL)
      • getDbUtils

        public DbUtils getDbUtils()
        returns the DbUtils instance that is responsible for the connect/disconnect.
        Returns:
        the responsible DbUtils instance
      • toString

        public String toString()
        returns the event in a string representation
        Overrides:
        toString in class EventObject
        Returns:
        the event in a string representation