--- /dev/null
+/*
+ * jSite-next - NodeListenerSupport.java -
+ * Copyright © 2008 David Roden
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.pterodactylus.jsite.core;
+
+import net.pterodactylus.util.event.ListenerSupport;
+
+/**
+ * Listener support for {@link NodeListener} events.
+ *
+ * @author David Roden <droden@gmail.com>
+ */
+public class NodeListenerSupport extends ListenerSupport<NodeListener> {
+
+ /**
+ * Notifies all listeners that a node was added.
+ *
+ * @see NodeListener#nodeAdded(Node)
+ * @param node
+ * The node that was added
+ */
+ public void fireNodeAdded(Node node) {
+ for (NodeListener nodeListener : getListeners()) {
+ nodeListener.nodeAdded(node);
+ }
+ }
+
+ /**
+ * Notifies all listeners that a node was removed.
+ *
+ * @see NodeListener#nodeRemoved(Node)
+ * @param node
+ * The node that was removed
+ */
+ public void fireNodeRemoved(Node node) {
+ for (NodeListener nodeListener : getListeners()) {
+ nodeListener.nodeRemoved(node);
+ }
+ }
+
+ /**
+ * Notifies all listeners that a node was connected.
+ *
+ * @see NodeListener#nodeConnected(Node)
+ * @param node
+ * The node that was connected
+ */
+ public void fireNodeConnected(Node node) {
+ for (NodeListener nodeListener : getListeners()) {
+ nodeListener.nodeConnected(node);
+ }
+ }
+
+ /**
+ * Notifies all listeners that the connection to a node failed.
+ *
+ * @see NodeListener#nodeConnectionFailed(Node, Throwable)
+ * @param node
+ * The node that could not be connected
+ * @param cause
+ * The cause of the connection failure
+ */
+ public void fireNodeConnectionFailed(Node node, Throwable cause) {
+ for (NodeListener nodeListener : getListeners()) {
+ nodeListener.nodeConnectionFailed(node, cause);
+ }
+ }
+
+ /**
+ * Notifies all listeners that a node was disconnected.
+ *
+ * @see NodeListener#nodeDisconnected(Node, Throwable)
+ * @param node
+ * The node that was disconnected
+ * @param cause
+ * The cause of the disconnect, or <code>null</code> if there was
+ * no exception
+ */
+ public void fireNodeDisconnected(Node node, Throwable cause) {
+ for (NodeListener nodeListener : getListeners()) {
+ nodeListener.nodeDisconnected(node, cause);
+ }
+ }
+
+}