* Interface for listeners that want to be notified about node events.
*
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
*/
public interface NodeListener extends EventListener {
/**
+ * Notifies a listener that a node was added.
+ *
+ * @param node
+ * The node that was added
+ */
+ public void nodeAdded(Node node);
+
+ /**
+ * Notifies a listener that a node was removed.
+ *
+ * @param node
+ * The node that was removed
+ */
+ public void nodeRemoved(Node node);
+
+ /**
* Notifies a listener that a connection to the given node was established.
*
* @param node
public void nodeConnected(Node node);
/**
- * Notifies a listener that a connection to the given node was severed. The
- * listener is responsible for
+ * Notifies a listener that a connection to a node has failed.
+ *
+ * @param node
+ * The node that could not be connected
+ * @param cause
+ * The cause of the failure
+ */
+ public void nodeConnectionFailed(Node node, Throwable cause);
+
+ /**
+ * Notifies a listener that a connection to the given node was severed. If
+ * the listener needs the high-level client associated with the node for
+ * anything else (like deregistering as listener from it) it should retrieve
+ * the high-level client using {@link NodeManager#getHighLevelClient(Node)}
+ * before this method returns!
*
* @param node
* The node that is now disconnected