X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FInsertListener.java;h=5386a91136072bec35314124d2017e3d1eb73dec;hb=a6bda7a82aa1b2cfd0313fb28d3dcca68ca516c5;hp=0966e1047c5096f7de378d4929cf109176969009;hpb=6f1a8216cfba28add0ef365b46a08d16d4eb87fe;p=jSite.git diff --git a/src/de/todesbaum/jsite/application/InsertListener.java b/src/de/todesbaum/jsite/application/InsertListener.java index 0966e10..5386a91 100644 --- a/src/de/todesbaum/jsite/application/InsertListener.java +++ b/src/de/todesbaum/jsite/application/InsertListener.java @@ -1,6 +1,5 @@ /* - * jSite - a tool for uploading websites into Freenet - * Copyright (C) 2006 David Roden + * jSite - InsertListener.java - Copyright © 2006–2011 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 @@ -22,19 +21,92 @@ package de.todesbaum.jsite.application; import java.util.EventListener; /** - * @author David Roden <droden@gmail.com> - * @version $Id: InsertListener.java 397 2006-03-25 16:11:34Z bombe $ + * Interface for objects that want to be notified abount insert events. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public interface InsertListener extends EventListener { + /** + * Enumeration for the different error situations. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ public static enum ErrorType { - KEY_COLLISION, ROUTE_NOT_FOUND, DATA_NOT_FOUND, FCP_ERROR, IO_ERROR + + /** The key does already exist. */ + KEY_COLLISION, + + /** The route to the key was not found. */ + ROUTE_NOT_FOUND, + + /** The data was not found. */ + DATA_NOT_FOUND, + + /** Error in the FCP communication. */ + FCP_ERROR, + + /** General error in the communication. */ + IO_ERROR } + /** + * Notifies a listener that an insert has started. + * + * @param project + * The project that is now being inserted + */ public void projectInsertStarted(Project project); + /** + * Notifies a listener that the upload of a project has finished and the + * inserting will start now. + * + * @param project + * The project that has been uploaded + */ + public void projectUploadFinished(Project project); + + /** + * Notifies a listener that a project insert has generated a URI. + * + * @param project + * The project being inserted + * @param uri + * The generated URI + */ + public void projectURIGenerated(Project project, String uri); + + /** + * Notifies a listener that an insert has made some progress. + * + * @param project + * The project being inserted + * @param succeeded + * The number of succeeded blocks + * @param failed + * The number of failed blocks + * @param fatal + * The number of fatally failed blocks + * @param total + * The total number of blocks + * @param finalized + * true if the total number of blocks has been + * finalized, false otherwise + */ public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized); + /** + * Notifies a listener that a project insert has finished. + * + * @param project + * The project being inserted + * @param success + * true if the insert succeeded, false + * otherwise + * @param cause + * The cause of a failure, if any (may be null) + */ public void projectInsertFinished(Project project, boolean success, Throwable cause); }