X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FCoreListener.java;h=e2d49466f3fc7c5134a1092e4dd8a0bd4869884e;hb=bc536390e605790a8948825c2ed6abaf591b0b67;hp=cef057a7f86d987042f20543b4ae26294703c346;hpb=7ccb1fcb746198ee1417bb2f92c846132bf6bc96;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/CoreListener.java b/src/net/pterodactylus/jsite/core/CoreListener.java index cef057a..e2d4946 100644 --- a/src/net/pterodactylus/jsite/core/CoreListener.java +++ b/src/net/pterodactylus/jsite/core/CoreListener.java @@ -19,6 +19,8 @@ package net.pterodactylus.jsite.core; +import net.pterodactylus.jsite.project.Project; + /** * Interface definition for user interfaces. * @@ -127,8 +129,27 @@ 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 @@ -144,6 +165,16 @@ public interface CoreListener { 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 @@ -155,17 +186,58 @@ public interface CoreListener { public void nodeDisconnected(Node node, Throwable throwable); // - // request stuff + // project insertion stuff // /** - * Notifies a listener that a request was added to a node. + * Notifies a listener that a project insert started. * - * @param node - * The node the request was added to - * @param request - * The request that was added + * @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 requestAdded(Node node, Request request); + public void projectInsertFinished(Project project, boolean success); }