X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fplugin%2Fevent%2FReceivedReplyEvent.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fplugin%2Fevent%2FReceivedReplyEvent.java;h=89a8df3c0e20f486513c8ca92d677758bbd4be99;hb=64d4f133925b0b8aac6f4dd225500d326f20ac41;hp=0000000000000000000000000000000000000000;hpb=8c1a4ad1d3f11ba0a11a077c47df48425360e0ac;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/freenet/plugin/event/ReceivedReplyEvent.java b/src/main/java/net/pterodactylus/sone/freenet/plugin/event/ReceivedReplyEvent.java new file mode 100644 index 0000000..89a8df3 --- /dev/null +++ b/src/main/java/net/pterodactylus/sone/freenet/plugin/event/ReceivedReplyEvent.java @@ -0,0 +1,117 @@ +/* + * Sone - ReceivedReplyEvent.java - Copyright © 2013 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sone.freenet.plugin.event; + +import net.pterodactylus.sone.freenet.plugin.PluginConnector; +import freenet.support.SimpleFieldSet; +import freenet.support.api.Bucket; + +/** + * Event that signals that a plugin reply was received. + * + * @author David ‘Bombe’ Roden + */ +public class ReceivedReplyEvent { + + /** The connector that received the reply. */ + private final PluginConnector pluginConnector; + + /** The name of the plugin that sent the reply. */ + private final String pluginName; + + /** The identifier of the initial request. */ + private final String identifier; + + /** The fields containing the reply. */ + private final SimpleFieldSet fieldSet; + + /** The optional reply data. */ + private final Bucket data; + + /** + * Creates a new “reply received” event. + * + * @param pluginConnector + * The connector that received the event + * @param pluginName + * The name of the plugin that sent the reply + * @param identifier + * The identifier of the initial request + * @param fieldSet + * The fields containing the reply + * @param data + * The optional data of the reply + */ + public ReceivedReplyEvent(PluginConnector pluginConnector, String pluginName, String identifier, SimpleFieldSet fieldSet, Bucket data) { + this.pluginConnector = pluginConnector; + this.pluginName = pluginName; + this.identifier = identifier; + this.fieldSet = fieldSet; + this.data = data; + } + + // + // ACCESSORS + // + + /** + * Returns the plugin connector that received the reply. + * + * @return The plugin connector that received the reply + */ + public PluginConnector pluginConnector() { + return pluginConnector; + } + + /** + * Returns the name of the plugin that sent the reply. + * + * @return The name of the plugin that sent the reply + */ + public String pluginName() { + return pluginName; + } + + /** + * Returns the identifier of the initial request. + * + * @return The identifier of the initial request + */ + public String identifier() { + return identifier; + } + + /** + * Returns the fields containing the reply. + * + * @return The fields containing the reply + */ + public SimpleFieldSet fieldSet() { + return fieldSet; + } + + /** + * Returns the optional data of the reply. + * + * @return The optional data of the reply (may be {@code null}) + */ + public Bucket data() { + return data; + } + +}