nu.zoom.ldap.eon.connection
Class AbstractConnectionFactory

java.lang.Object
  extended by nu.zoom.ldap.eon.connection.AbstractConnectionFactory
All Implemented Interfaces:
ConnectionFactory
Direct Known Subclasses:
PasswordConnectionFactory

public abstract class AbstractConnectionFactory
extends Object
implements ConnectionFactory

Abstract utility class for implementing Connection factories. This class handles registration and informing listeners of factory events. Subclasses are responsible for persisting the changes to connections.

Version:
$Revision: 1.4 $
Author:
$Author: johan $

Constructor Summary
AbstractConnectionFactory()
           
 
Method Summary
 void addConnection(Connection connection)
          Add a new connection to the list of connections.
 void addConnectionFactoryListener(ConnectionFactoryListener listener)
          Add a listener for changes in the connection collection.
 void connectionChanged(Connection connection)
          A connection has had its data changed.
protected abstract  void delegateAddConnection(Connection connection)
          Subclasses should add the connection to the list of connections.
protected abstract  void delegateConnectionChanged(Connection connection)
          Subclasses should rememeber the new connection data.
protected abstract  void delegateRemoveConnection(Connection connection)
          Subclasses should remove the connection from the connection list.
protected  void fireConnectionAdded(Connection connection)
          Informs listeners that a connection has been added.
protected  void fireConnectionChanged(Connection connection)
          Informs listeners that a connection has changed.
protected  void fireConnectionRemoved(ConnectionGUID connectionID)
          Informs listeners that a connection has been removed.
abstract  String getDescription()
          Get a description of the type of connections this factory handles.
abstract  ConnectionEditor getEditor()
          Subclasses should provide an editor for the type of connection it handles.
abstract  ImageIcon getIcon()
          The factory can provide an icon to represent the connection type it handles.
abstract  String getName()
          The connection factory should provide a short name for the type of connections the factory handles.
 void removeConnection(Connection connection)
          Removes the connection (by delegating to a subclass implementation) and informs the listeners that the connection has been removed.
 void removeConnectionFactoryListener(ConnectionFactoryListener listener)
          Remove a previously registered listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nu.zoom.ldap.eon.connection.ConnectionFactory
listConnections
 

Constructor Detail

AbstractConnectionFactory

public AbstractConnectionFactory()
Method Detail

addConnectionFactoryListener

public void addConnectionFactoryListener(ConnectionFactoryListener listener)
Description copied from interface: ConnectionFactory
Add a listener for changes in the connection collection. Implementation classes should notify listeners when connections changes.

Specified by:
addConnectionFactoryListener in interface ConnectionFactory
Parameters:
listener - The listener.

removeConnectionFactoryListener

public void removeConnectionFactoryListener(ConnectionFactoryListener listener)
Description copied from interface: ConnectionFactory
Remove a previously registered listener.

Specified by:
removeConnectionFactoryListener in interface ConnectionFactory
Parameters:
listener - The listener to remove.

removeConnection

public void removeConnection(Connection connection)
                      throws BackendException
Removes the connection (by delegating to a subclass implementation) and informs the listeners that the connection has been removed.

Specified by:
removeConnection in interface ConnectionFactory
Parameters:
connection - The connection to delete.
Throws:
BackendException
See Also:
delegateRemoveConnection(Connection)

addConnection

public void addConnection(Connection connection)
                   throws BackendException
Add a new connection to the list of connections. Informs listerners of the change then delegates (to the subclass) the operation of adding the connection.

Parameters:
connection - The new connection to add.
Throws:
BackendException
See Also:
delegateAddConnection(Connection)

connectionChanged

public void connectionChanged(Connection connection)
                       throws BackendException
A connection has had its data changed. Informs listeners of the change and delegates the change operation to the subclass.

Parameters:
connection - The connection that changed.
Throws:
BackendException

delegateAddConnection

protected abstract void delegateAddConnection(Connection connection)
                                       throws BackendException
Subclasses should add the connection to the list of connections. This (parent) class will inform listeners that it has been added.

Parameters:
connection -
Throws:
BackendException

delegateRemoveConnection

protected abstract void delegateRemoveConnection(Connection connection)
                                          throws BackendException
Subclasses should remove the connection from the connection list. This (parent) class will inform listeners that the connection has been removed.

Parameters:
connection - The connection to remove. Never null.
Throws:
BackendException
See Also:
fireConnectionRemoved(ConnectionGUID)

delegateConnectionChanged

protected abstract void delegateConnectionChanged(Connection connection)
                                           throws BackendException
Subclasses should rememeber the new connection data.

Parameters:
connection - The connection that changed.
Throws:
BackendException

getDescription

public abstract String getDescription()
Description copied from interface: ConnectionFactory
Get a description of the type of connections this factory handles. THe description should be suitable for use as a tooltip.

Specified by:
getDescription in interface ConnectionFactory
Returns:
A descrioption of the connections this factory provides.

getName

public abstract String getName()
Description copied from interface: ConnectionFactory
The connection factory should provide a short name for the type of connections the factory handles. This should be suitable for use as an item on a menu.

Specified by:
getName in interface ConnectionFactory
Returns:
The name for the connection factory.

getIcon

public abstract ImageIcon getIcon()
Description copied from interface: ConnectionFactory
The factory can provide an icon to represent the connection type it handles.

Specified by:
getIcon in interface ConnectionFactory
Returns:
The icon to use. Null if hte factory does not have an icon.

getEditor

public abstract ConnectionEditor getEditor()
Subclasses should provide an editor for the type of connection it handles. If a connection is added or changed the editor should call the fireXXX methods on this class to inform connection factory listeners that the list of connections has changed.

Specified by:
getEditor in interface ConnectionFactory
Returns:
An editor.
See Also:
fireConnectionAdded(Connection), fireConnectionChanged(Connection)

fireConnectionAdded

protected void fireConnectionAdded(Connection connection)
Informs listeners that a connection has been added.

Parameters:
connection - The new connection.

fireConnectionChanged

protected void fireConnectionChanged(Connection connection)
Informs listeners that a connection has changed.

Parameters:
connection - The connection that changed.

fireConnectionRemoved

protected void fireConnectionRemoved(ConnectionGUID connectionID)
Informs listeners that a connection has been removed.

Parameters:
connectionID - The ID of the connection that was removed.


Copyright © 2011. All Rights Reserved.