2 * jSite2 - FpcListener.java -
3 * Copyright © 2008 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 net.pterodactylus.fcp;
22 import java.util.EventListener;
25 * Interface for objects that want to be notified on certain FCP events.
27 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
29 public interface FcpListener extends EventListener {
32 * Notifies a listener that a “NodeHello” message was received.
34 * @param fcpConnection
35 * The connection that received the message
37 * The “NodeHello” message
39 public void receivedNodeHello(FcpConnection fcpConnection, NodeHello nodeHello);
42 * Notifies a listener that a “CloseConnectionDuplicateClientName” message
45 * @param fcpConnection
46 * The connection that received the message
47 * @param closeConnectionDuplicateClientName
48 * The “CloseConnectionDuplicateClientName” message
50 public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName);
53 * Notifies a listener that a “SSKKeypair” message was received.
55 * @param fcpConnection
56 * The connection that received themessage
58 * The “SSKKeypair” message
60 public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair);
63 * Notifies a listener that a “Peer” message was received.
65 * @param fcpConnection
66 * The connection that received the message
70 public void receivedPeer(FcpConnection fcpConnection, Peer peer);
73 * Notifies a listener that an “EndListPeers” message was received.
75 * @param fcpConnection
76 * The connection that recevied the message
78 * The “EndListPeers” message
80 public void receivedEndListPeers(FcpConnection fcpConnection, EndListPeers endListPeers);
83 * Notifies a listener that a “PeerNote” message was received.
85 * @param fcpConnection
86 * The connection that received the message
88 * The “PeerNote” message
90 public void receivedPeerNote(FcpConnection fcpConnection, PeerNote peerNote);
93 * Notifies a listener that an “EndListPeerNotes” message was received.
95 * @param fcpConnection
96 * The connection that received the message
97 * @param endListPeerNotes
98 * The “EndListPeerNotes” message
100 public void receivedEndListPeerNotes(FcpConnection fcpConnection, EndListPeerNotes endListPeerNotes);
103 * Notifies a listener that a “PeerRemoved” message was received.
105 * @param fcpConnection
106 * The connection that received the message
108 * The “PeerRemoved” message
110 public void receivedPeerRemoved(FcpConnection fcpConnection, PeerRemoved peerRemoved);
113 * Notifies a listener that a “NodeData” message was received.
115 * @param fcpConnection
116 * The connection that received the message
118 * The “NodeData” message
120 public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData);
123 * Notifies a listener that a “TestDDAReply” message was received.
125 * @param fcpConnection
126 * The connection that received the message
127 * @param testDDAReply
128 * The “TestDDAReply” message
130 public void receivedTestDDAReply(FcpConnection fcpConnection, TestDDAReply testDDAReply);
133 * Notifies a listener that a “TestDDAComplete” was received.
135 * @param fcpConnection
136 * The connection that received the message
137 * @param testDDAComplete
138 * The “TestDDAComplete” message
140 public void receivedTestDDAComplete(FcpConnection fcpConnection, TestDDAComplete testDDAComplete);
143 * Notifies a listener that a “PersistentGet” was received.
145 * @param fcpConnection
146 * The connection that received the message
147 * @param persistentGet
148 * The “PersistentGet” message
150 public void receivedPersistentGet(FcpConnection fcpConnection, PersistentGet persistentGet);
153 * Notifies a listener that a “PersistentPut” was received.
155 * @param fcpConnection
156 * The connection that received the message
157 * @param persistentPut
158 * The “PersistentPut” message
160 public void receivedPersistentPut(FcpConnection fcpConnection, PersistentPut persistentPut);
163 * Notifies a listener that a “EndListPersistentRequests” was received.
165 * @param fcpConnection
166 * The connection that received the message
167 * @param endListPersistentRequests
168 * The “EndListPersistentRequests” message
170 public void receivedEndListPersistentRequests(FcpConnection fcpConnection, EndListPersistentRequests endListPersistentRequests);
173 * Notifies a listener that a “URIGenerated” was received.
175 * @param fcpConnection
176 * The connection that received the message
177 * @param uriGenerated
178 * The “URIGenerated” message
180 public void receivedURIGenerated(FcpConnection fcpConnection, URIGenerated uriGenerated);
183 * Notifies a listener that a “DataFound” was received.
185 * @param fcpConnection
186 * The connection that received the message
188 * The “DataFound” message
190 public void receivedDataFound(FcpConnection fcpConnection, DataFound dataFound);
193 * Notifies a listener that an “AllData” was received.
195 * @param fcpConnection
196 * The connection that received the message
198 * The “AllData” message
200 public void receivedAllData(FcpConnection fcpConnection, AllData allData);
203 * Notifies a listener that a “SimpleProgress” was received.
205 * @param fcpConnection
206 * The connection that received the message
207 * @param simpleProgress
208 * The “SimpleProgress” message
210 public void receivedSimpleProgress(FcpConnection fcpConnection, SimpleProgress simpleProgress);
213 * Notifies a listener that a “StartedCompression” was received.
215 * @param fcpConnection
216 * The connection that received the message
217 * @param startedCompression
218 * The “StartedCompression” message
220 public void receivedStartedCompression(FcpConnection fcpConnection, StartedCompression startedCompression);
223 * Notifies a listener that a “FinishedCompression” was received.
225 * @param fcpConnection
226 * The connection that received the message
227 * @param finishedCompression
228 * The “FinishedCompression” message
230 public void receviedFinishedCompression(FcpConnection fcpConnection, FinishedCompression finishedCompression);
233 * Notifies a listener that an “UnknownPeerNoteType” was received.
235 * @param fcpConnection
236 * The connection that received the message
237 * @param unknownPeerNoteType
238 * The “UnknownPeerNoteType” message
240 public void receivedUnknownPeerNoteType(FcpConnection fcpConnection, UnknownPeerNoteType unknownPeerNoteType);
243 * Notifies a listener that a “UnknownNodeIdentifier” message was received.
245 * @param fcpConnection
246 * The connection that received the message
247 * @param unknownNodeIdentifier
248 * The “UnknownNodeIdentifier” message
250 public void receivedUnknownNodeIdentifier(FcpConnection fcpConnection, UnknownNodeIdentifier unknownNodeIdentifier);
253 * Notifies a listener that a “ConfigData” message was received.
255 * @param fcpConnection
256 * The connection that received the message
258 * The “ConfigData” message
260 public void receivedConfigData(FcpConnection fcpConnection, ConfigData configData);
263 * Notifies a listener that a “GetFailed” message was recevied.
265 * @param fcpConnection
266 * The connection that received the message
268 * The “GetFailed” message
270 public void receivedGetFailed(FcpConnection fcpConnection, GetFailed getFailed);
273 * Notifies a listener that a “PutFailed” message was received.
275 * @param fcpConnection
276 * The connection that received the message
278 * The “PutFailed” message
280 public void receivedPutFailed(FcpConnection fcpConnection, PutFailed putFailed);
283 * Notifies a listener that an “IdentifierCollision” message was receied.
285 * @param fcpConnection
286 * The connection that received the message
287 * @param identifierCollision
288 * The “IdentifierCollision” message
290 public void receivedIdentifierCollision(FcpConnection fcpConnection, IdentifierCollision identifierCollision);
293 * Notifies a listener that a “PersistentPutDir” message was received.
295 * @param fcpConnection
296 * The connection that received the message
297 * @param persistentPutDir
298 * The “PersistentPutDir” message
300 public void receivedPersistentPutDir(FcpConnection fcpConnection, PersistentPutDir persistentPutDir);
303 * Notifies a listener that a “PersistentRequestRemoved” message was
306 * @param fcpConnection
307 * The connection that received the message
308 * @param persistentRequestRemoved
309 * The “PersistentRequestRemoved” message
311 public void receivedPersistentRequestRemoved(FcpConnection fcpConnection, PersistentRequestRemoved persistentRequestRemoved);
314 * Notifies a listener that a “SubscribedUSKUpdate” message was received.
316 * @param fcpConnection
317 * The connection that recevied the message
318 * @param subscribedUSKUpdate
319 * The “SubscribedUSKUpdate” message
321 public void receivedSubscribedUSKUpdate(FcpConnection fcpConnection, SubscribedUSKUpdate subscribedUSKUpdate);
324 * Notifies a listener that a “PluginInfo” message was received.
326 * @param fcpConnection
327 * The connection that received the message
329 * The “PluginInfo” message
331 public void receivedPluginInfo(FcpConnection fcpConnection, PluginInfo pluginInfo);
334 * Notifies a listener that an “FCPPluginReply“ message was received.
336 * @param fcpConnection
337 * The connection that received the message
338 * @param fcpPluginReply
339 * The “FCPPluginReply” message
341 public void receivedFCPPluginReply(FcpConnection fcpConnection, FCPPluginReply fcpPluginReply);
344 * Notifies a listener that a “PersistentRequestModified” message was
347 * @param fcpConnection
348 * The connection that received the message
349 * @param persistentRequestModified
350 * The “PersistentRequestModified” message
352 public void receivedPersistentRequestModified(FcpConnection fcpConnection, PersistentRequestModified persistentRequestModified);
355 * Notifies a listener that a “PutSuccessful” message was received.
357 * @param fcpConnection
358 * The connection that received the message
359 * @param putSuccessful
360 * The “PutSuccessful” message
362 public void receivedPutSuccessful(FcpConnection fcpConnection, PutSuccessful putSuccessful);
365 * Notifies a listener that a “PutFetchable” message was received.
367 * @param fcpConnection
368 * The connection that received the message
369 * @param putFetchable
370 * The “PutFetchable” message
372 public void receivedPutFetchable(FcpConnection fcpConnection, PutFetchable putFetchable);
375 * Notifies a listener that a “ProtocolError” was received.
377 * @param fcpConnection
378 * The connection that received the message
379 * @param protocolError
380 * The “ProtocolError” message
382 public void receivedProtocolError(FcpConnection fcpConnection, ProtocolError protocolError);
385 * Notifies a listener that a message has been received. This method is only
386 * called if {@link FcpConnection#handleMessage(FcpMessage)} does not
387 * recognize the message. Should that ever happen, please file a bug report!
389 * @param fcpConnection
390 * The connection that received the message
392 * The message that was received
394 public void receivedMessage(FcpConnection fcpConnection, FcpMessage fcpMessage);
397 * Notifies a listener that a connection was closed. A closed connection can
398 * be reestablished by calling {@link FcpConnection#connect()} on the same
401 * @param fcpConnection
402 * The connection that was closed.
404 * The exception that caused the disconnect, or <code>null</code>
405 * if there was no exception
407 public void connectionClosed(FcpConnection fcpConnection, Throwable throwable);