2 * jSite - a tool for uploading websites into Freenet
3 * Copyright (C) 2006 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package de.todesbaum.jsite.application;
22 import java.util.EventListener;
25 * Interface for objects that want to be notified abount insert events.
27 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
29 public interface InsertListener extends EventListener {
32 * Enumeration for the different error situations.
34 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
36 public static enum ErrorType {
38 /** The key does already exist. */
41 /** The route to the key was not found. */
44 /** The data was not found. */
47 /** Error in the FCP communication. */
50 /** General error in the communication. */
55 * Notifies a listener that an insert has started.
58 * The project that is now being inserted
60 public void projectInsertStarted(Project project);
63 * Notifies a listener that a project insert has generated a URI.
66 * The project being inserted
70 public void projectURIGenerated(Project project, String uri);
73 * Notifies a listener that an insert has made some progress.
76 * The project being inserted
78 * The number of succeeded blocks
80 * The number of failed blocks
82 * The number of fatally failed blocks
84 * The total number of blocks
86 * <code>true</code> if the total number of blocks has been
87 * finalized, <code>false</code> otherwise
89 public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized);
92 * Notifies a listener that a project insert has finished.
95 * The project being inserted
97 * <code>true</code> if the insert succeeded,
98 * <code>false</code> otherwise
100 * The cause of a failure, if any (may be <code>null</code>)
102 public void projectInsertFinished(Project project, boolean success, Throwable cause);