X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FCoreListener.java;h=3dbc55eb005ad8a8d76833d9d07622c2602c098c;hb=e1e349bae97feb779fc692eb03c2fea0e0e612c9;hp=b4a25746ea058c5e5f004e54bc5ac3335dca647c;hpb=2bd90a148fe17a4f091d148586d67eb69f4122f6;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/CoreListener.java b/src/net/pterodactylus/jsite/core/CoreListener.java index b4a2574..3dbc55e 100644 --- a/src/net/pterodactylus/jsite/core/CoreListener.java +++ b/src/net/pterodactylus/jsite/core/CoreListener.java @@ -19,11 +19,12 @@ package net.pterodactylus.jsite.core; +import net.pterodactylus.jsite.core.project.Project; + /** * Interface definition for user interfaces. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ */ public interface CoreListener { @@ -33,7 +34,7 @@ public interface CoreListener { /** * Notifies a listener that loading the projects finished successfully. - * + * * @param directory * The directory the nodes were loaded from */ @@ -41,7 +42,7 @@ public interface CoreListener { /** * Notifies all listeners that loading the projects has failed. - * + * * @param directory * The directory the projects were tried to load from * @param throwable @@ -52,7 +53,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 */ @@ -60,7 +61,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 @@ -68,13 +69,39 @@ public interface CoreListener { */ public void savingProjectsFailed(String directory, Throwable throwable); + /** + * Notifies a listener that the given project was added. + * + * @param project + * The project that was added. + */ + public void projectAdded(Project project); + + /** + * Notifies a listener that a project was cloned. + * + * @param clonedProject + * The clones project + * @param projectClone + * The clone of the project + */ + public void projectCloned(Project clonedProject, Project projectClone); + + /** + * Notifies a listener that the given project was removed. + * + * @param project + * The project that was removed. + */ + public void projectRemoved(Project project); + // // node configuration // /** * Notifies a listener that the nodes were successfully loaded. - * + * * @param directory * The directory the nodes were loaded from */ @@ -82,7 +109,7 @@ public interface CoreListener { /** * Notifies a listener that loading the nodes has failed. - * + * * @param directory * The directory the nodes were loaded from * @param throwable @@ -92,7 +119,7 @@ public interface CoreListener { /** * Notifies a listener that the nodes were successfully saved. - * + * * @param directory * The directory the nodes were saved to */ @@ -100,7 +127,7 @@ public interface CoreListener { /** * Notifies a listener that saving the nodes has failed. - * + * * @param directory * The directory the nodes were saved to * @param throwable @@ -127,9 +154,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 */ @@ -137,15 +183,25 @@ 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 @@ -154,4 +210,59 @@ public interface CoreListener { */ public void nodeDisconnected(Node node, Throwable throwable); + // + // project insertion stuff + // + + /** + * Notifies a listener that a project insert started. + * + * @param project + * The project that is now inserting + */ + public void projectInsertStarted(Project project); + + /** + * Notifies a listener that a project insert made progress. + * + * @param project + * The project that made progress + * @param totalBlocks + * The number of total blocks + * @param requiredBlocks + * The number of required blocks + * @param successfulBlocks + * The number of successfully inserted blocks + * @param failedBlocks + * The number of blocks that could not be inserted + * @param fatallyFailedBlocks + * The number of blocks that can not be inserted even with + * retries + * @param finalizedTotal + * true if the number of total blocks is already + * finalized, false otherwise + */ + public void projectInsertProgressed(Project project, int totalBlocks, int requiredBlocks, int successfulBlocks, int failedBlocks, int fatallyFailedBlocks, boolean finalizedTotal); + + /** + * Notifies a listener that a project insert has generated a URI. + * + * @param project + * The project that generated a URI + * @param uri + * The URI that was generated + */ + public void projectInsertGeneratedURI(Project project, String uri); + + /** + * Notifies a listener that a project insert has finished. + * + * @param project + * The project that has finished + * @param success + * true if the project was inserted successfully, + * false otherwise + */ + public void projectInsertFinished(Project project, boolean success); + }