X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Ffcp%2FCommand.java;h=f3f32cfde6f6d5e4aef0c6e3d932ed11699b7ec3;hp=e3b55a9d226b4176f7188654efefe3fa43ba302e;hb=HEAD;hpb=50ce65f69e49ed10abeedaeb6615ffb37a0c0772 diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java index e3b55a9..f3f32cf 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java @@ -1,5 +1,5 @@ /* - * Sone - Command.java - Copyright © 2011–2012 David Roden + * Sone - Command.java - Copyright © 2011–2020 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 @@ -19,13 +19,10 @@ package net.pterodactylus.sone.freenet.fcp; import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder; import freenet.support.SimpleFieldSet; -import freenet.support.api.Bucket; /** * Implementation of an FCP interface for other clients or plugins to * communicate with Sone. - * - * @author David ‘Bombe’ Roden */ public interface Command { @@ -35,20 +32,14 @@ public interface Command { * * @param parameters * The parameters of the comand - * @param data - * The data of the command (may be {@code null}) - * @param accessType - * The access type * @return A reply to send back to the plugin * @throws FcpException * if an error processing the parameters occurs */ - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException; + public Response execute(SimpleFieldSet parameters) throws FcpException; /** * The access type of the request. - * - * @author David ‘Bombe’ Roden */ public static enum AccessType { @@ -65,8 +56,6 @@ public interface Command { /** * Interface for command replies. - * - * @author David ‘Bombe’ Roden */ public static class Response { @@ -76,12 +65,6 @@ public interface Command { /** The reply parameters. */ private final SimpleFieldSet replyParameters; - /** The reply data, may be {@code null}. */ - private final byte[] data; - - /** The data bucket, may be {@code null}. */ - private final Bucket bucket; - /** * Creates a new reply with the given parameters. * @@ -91,54 +74,8 @@ public interface Command { * The reply parameters */ public Response(String messageName, SimpleFieldSet replyParameters) { - this(messageName, replyParameters, null, null); - } - - /** - * Creates a new reply with the given parameters. - * - * @param messageName - * The message name - * @param replyParameters - * The reply parameters - * @param data - * The data of the reply (may be {@code null}) - */ - public Response(String messageName, SimpleFieldSet replyParameters, byte[] data) { - this(messageName, replyParameters, data, null); - } - - /** - * Creates a new reply with the given parameters. - * - * @param messageName - * The message name - * @param replyParameters - * The reply parameters - * @param bucket - * The bucket of the reply (may be {@code null}) - */ - public Response(String messageName, SimpleFieldSet replyParameters, Bucket bucket) { - this(messageName, replyParameters, null, bucket); - } - - /** - * Creates a new reply with the given parameters. - * - * @param messageName - * The message name - * @param replyParameters - * The reply parameters - * @param data - * The data of the reply (may be {@code null}) - * @param bucket - * The bucket of the reply (may be {@code null}) - */ - private Response(String messageName, SimpleFieldSet replyParameters, byte[] data, Bucket bucket) { this.messageName = messageName; this.replyParameters = replyParameters; - this.data = data; - this.bucket = bucket; } /** @@ -150,52 +87,11 @@ public interface Command { return new SimpleFieldSetBuilder(replyParameters).put("Message", messageName).get(); } - /** - * Returns whether the reply has reply data. - * - * @see #getData() - * @return {@code true} if this reply has data, {@code false} otherwise - */ - public boolean hasData() { - return data != null; - } - - /** - * Returns the data of the reply. - * - * @return The data of the reply - */ - public byte[] getData() { - return data; - } - - /** - * Returns whether the reply has a data bucket. - * - * @see #getBucket() - * @return {@code true} if the reply has a data bucket, {@code false} - * otherwise - */ - public boolean hasBucket() { - return bucket != null; - } - - /** - * Returns the data bucket of the reply. - * - * @return The data bucket of the reply - */ - public Bucket getBucket() { - return bucket; - } - } /** * Response implementation that can return an error message and an optional * error code. - * - * @author David ‘Bombe’ Roden */ public class ErrorResponse extends Response {