X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FCoreListener.java;h=d5d8cdcf868de6be5cc02a37e18783c2b444161d;hb=52f29c032eb637965d5342d3bd45843774d926b5;hp=7ded200c1b4e48402f1dceb138061aecc6eedb3b;hpb=c7561c631f4bbb94ee0ac9047e953ce56f1df8bb;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/CoreListener.java b/src/net/pterodactylus/jsite/core/CoreListener.java index 7ded200..d5d8cdc 100644 --- a/src/net/pterodactylus/jsite/core/CoreListener.java +++ b/src/net/pterodactylus/jsite/core/CoreListener.java @@ -21,19 +21,27 @@ package net.pterodactylus.jsite.core; /** * Interface definition for user interfaces. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> * @version $Id$ */ public interface CoreListener { // - // configuration stuff + // project configuration // /** + * Notifies a listener that loading the projects finished successfully. + * + * @param directory + * The directory the nodes were loaded from + */ + public void loadingProjectsDone(String directory); + + /** * Notifies all listeners that loading the projects has failed. - * + * * @param directory * The directory the projects were tried to load from * @param throwable @@ -44,7 +52,7 @@ public interface CoreListener { /** * Notifies a listener that the projects were successfully saved to the * given directory. - * + * * @param directory * The directory the projects were saved to */ @@ -52,7 +60,7 @@ public interface CoreListener { /** * Notifies a listener that saving the projects has failed. - * + * * @param directory * The directory the projects were to be saved to * @param throwable @@ -61,6 +69,46 @@ public interface CoreListener { public void savingProjectsFailed(String directory, Throwable throwable); // + // node configuration + // + + /** + * Notifies a listener that the nodes were successfully loaded. + * + * @param directory + * The directory the nodes were loaded from + */ + public void loadingNodesDone(String directory); + + /** + * Notifies a listener that loading the nodes has failed. + * + * @param directory + * The directory the nodes were loaded from + * @param throwable + * The exception that occured while loading the nodes + */ + public void loadingNodesFailed(String directory, Throwable throwable); + + /** + * Notifies a listener that the nodes were successfully saved. + * + * @param directory + * The directory the nodes were saved to + */ + public void savingNodesDone(String directory); + + /** + * Notifies a listener that saving the nodes has failed. + * + * @param directory + * The directory the nodes were saved to + * @param throwable + * The exception that occured while saving the nodes + */ + public void savingNodesFailed(String directory, Throwable throwable); + + // // basic core functionality // @@ -79,9 +127,28 @@ public interface CoreListener { // /** + * Notifies a listener that a node was added to the core. + * + * @param node + * The node that was added. + */ + public void nodeAdded(Node node); + + /** + * Notifies a listener that a node was removed from the core. Before a node + * is removed, it will be disconnected (and + * {@link #nodeDisconnected(Node, Throwable)} will be called). + * + * @param node + * The node that was removed + */ + public void nodeRemoved(Node node); + + /** * Notifies all listeners that the core started connecting to the given - * node. - * + * node. Before a node is connected, it will be added (and + * {@link #nodeAdded(Node)} will be called). + * * @param node * The node that is being connected */ @@ -89,18 +156,59 @@ public interface CoreListener { /** * Notifies all listeners that the core connected to the given node. - * + * * @param node * The node that is connected */ public void nodeConnected(Node node); /** + * 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 all listeners that the core disconnected from the given node. - * + * * @param node * The node that was diconnected + * @param throwable + * The exception that caused the disconnect, or null + * if there was no exception + */ + public void nodeDisconnected(Node node, Throwable throwable); + + // + // request stuff + // + + /** + * Notifies a listener that a request was added to a node. + * + * @param request + * The request that was added + */ + public void requestAdded(Request request); + + /** + * Notifies a listener that a request made some progress. + * + * @param request + * The request that made the progress + */ + public void requestProgressed(Request request); + + /** + * Notifies a listener that a request was removed. + * + * @param request + * The request that was removed */ - public void nodeDisconnected(Node node); + public void requestRemoved(Request request); }