2 * Sone - CoreListener.java - Copyright © 2010–2012 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.core;
20 import java.util.EventListener;
22 import net.pterodactylus.sone.data.Image;
23 import net.pterodactylus.sone.data.Post;
24 import net.pterodactylus.sone.data.PostReply;
25 import net.pterodactylus.sone.data.Sone;
26 import net.pterodactylus.util.version.Version;
29 * Listener interface for objects that want to be notified on certain
30 * {@link Core} events, such es discovery of new data.
32 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
34 public interface CoreListener extends EventListener {
37 * Notifies a listener that a new post has been found.
42 public void newPostFound(Post post);
45 * Notifies a listener that a new reply has been found.
50 public void newReplyFound(PostReply reply);
53 * Notifies a listener that the given Sone is now marked as known.
58 public void markSoneKnown(Sone sone);
61 * Notifies a listener that the given post is now marked as known.
66 public void markPostKnown(Post post);
69 * Notifies a listener that the given reply is now marked as known.
74 public void markReplyKnown(PostReply reply);
77 * Notifies a listener that the given Sone was removed.
82 public void soneRemoved(Sone sone);
85 * Notifies a listener that the given post was removed.
90 public void postRemoved(Post post);
93 * Notifies a listener that the given reply was removed.
98 public void replyRemoved(PostReply reply);
101 * Notifies a listener when a Sone was locked.
104 * The Sone that was locked
106 public void soneLocked(Sone sone);
109 * Notifies a listener that a Sone was unlocked.
112 * The Sone that was unlocked
114 public void soneUnlocked(Sone sone);
117 * Notifies a listener that the insert of the given Sone has started.
119 * @see SoneInsertListener#insertStarted(Sone)
121 * The Sone that is being inserted
123 public void soneInserting(Sone sone);
126 * Notifies a listener that the insert of the given Sone has finished
129 * @see SoneInsertListener#insertFinished(Sone, long)
131 * The Sone that has been inserted
132 * @param insertDuration
133 * The insert duration (in milliseconds)
135 public void soneInserted(Sone sone, long insertDuration);
138 * Notifies a listener that the insert of the given Sone was aborted.
140 * @see SoneInsertListener#insertAborted(Sone, Throwable)
142 * The Sone that was inserted
144 * The cause for the abortion (may be {@code null})
146 public void soneInsertAborted(Sone sone, Throwable cause);
149 * Notifies a listener that a new version has been found.
152 * The version that was found
154 * The release time of the new version
155 * @param latestEdition
156 * The latest edition of the Sone homepage
158 public void updateFound(Version version, long releaseTime, long latestEdition);
161 * Notifies a listener that an image has started being inserted.
164 * The image that is now inserted
166 public void imageInsertStarted(Image image);
169 * Notifies a listener that an image insert was aborted by the user.
172 * The image that is not inserted anymore
174 public void imageInsertAborted(Image image);
177 * Notifies a listener that an image was successfully inserted.
180 * The image that was inserted
182 public void imageInsertFinished(Image image);
185 * Notifies a listener that an image failed to be inserted.
188 * The image that could not be inserted
190 * The reason for the failed insert
192 public void imageInsertFailed(Image image, Throwable cause);