whitespace fixups
[jSite2.git] / src / net / pterodactylus / jsite / core / CoreListener.java
index 04b063e..4da2ec8 100644 (file)
@@ -21,9 +21,8 @@ package net.pterodactylus.jsite.core;
 
 /**
  * Interface definition for user interfaces.
- * 
+ *
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
  */
 public interface CoreListener {
 
@@ -33,7 +32,7 @@ public interface CoreListener {
 
        /**
         * Notifies a listener that loading the projects finished successfully.
-        * 
+        *
         * @param directory
         *            The directory the nodes were loaded from
         */
@@ -41,7 +40,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 +51,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 +59,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 +67,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 +107,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 +117,7 @@ public interface CoreListener {
 
        /**
         * Notifies a listener that the nodes were successfully saved.
-        * 
+        *
         * @param directory
         *            The directory the nodes were saved to
         */
@@ -100,7 +125,7 @@ public interface CoreListener {
 
        /**
         * Notifies a listener that saving the nodes has failed.
-        * 
+        *
         * @param directory
         *            The directory the nodes were saved to
         * @param throwable
@@ -128,7 +153,7 @@ public interface CoreListener {
 
        /**
         * Notifies a listener that a node was added to the core.
-        * 
+        *
         * @param node
         *            The node that was added.
         */
@@ -138,7 +163,7 @@ public interface CoreListener {
         * 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
         */
@@ -148,7 +173,7 @@ public interface CoreListener {
         * Notifies all listeners that the core started connecting to the given
         * 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
         */
@@ -156,7 +181,7 @@ public interface CoreListener {
 
        /**
         * Notifies all listeners that the core connected to the given node.
-        * 
+        *
         * @param node
         *            The node that is connected
         */
@@ -164,7 +189,7 @@ public interface CoreListener {
 
        /**
         * Notifies a listener that a connection to a node has failed.
-        * 
+        *
         * @param node
         *            The node that could not be connected
         * @param cause
@@ -174,7 +199,7 @@ public interface CoreListener {
 
        /**
         * Notifies all listeners that the core disconnected from the given node.
-        * 
+        *
         * @param node
         *            The node that was diconnected
         * @param throwable
@@ -184,38 +209,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.
-        * 
-        * @param node
-        *            The node the request was added to
-        * @param request
-        *            The request that was added
+        * Notifies a listener that a project insert started.
+        *
+        * @param project
+        *            The project that is now inserting
         */
-       public void requestAdded(Node node, Request request);
+       public void projectInsertStarted(Project project);
 
        /**
-        * Notifies a listener that a request made some progress.
-        * 
-        * @param request
-        *            The request that made the progress
+        * Notifies a listener that a project insert made progress.
+        *
+        * @param project
+        *            The project that made progress
         * @param totalBlocks
-        *            The total number of blocks
+        *            The number of total blocks
         * @param requiredBlocks
         *            The number of required blocks
         * @param successfulBlocks
-        *            The number of successful blocks
+        *            The number of successfully inserted blocks
         * @param failedBlocks
-        *            The number of failed blocks
+        *            The number of blocks that could not be inserted
         * @param fatallyFailedBlocks
-        *            The number of fatally failed blocks
+        *            The number of blocks that can not be inserted even with
+        *            retries
         * @param finalizedTotal
-        *            <code>true</code> if the number of total blocks is
-        *            finalized, <code>false</code> if it is not
+        *            <code>true</code> if the number of total blocks is already
+        *            finalized, <code>false</code> 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
+        *            <code>true</code> if the project was inserted successfully,
+        *            <code>false</code> otherwise
         */
-       public void requestProgressed(Request request, int totalBlocks, int requiredBlocks, int successfulBlocks, int failedBlocks, int fatallyFailedBlocks, boolean finalizedTotal);
+       public void projectInsertFinished(Project project, boolean success);
 
 }