import net.pterodactylus.sone.freenet.fcp.Command;
import net.pterodactylus.sone.freenet.fcp.FcpException;
import net.pterodactylus.sone.freenet.fcp.Command.AccessType;
-import net.pterodactylus.sone.freenet.fcp.Command.Reply;
+import net.pterodactylus.sone.freenet.fcp.Command.Response;
import freenet.pluginmanager.FredPluginFCP;
import freenet.pluginmanager.PluginNotFoundException;
import freenet.pluginmanager.PluginReplySender;
return;
}
try {
- Reply reply = command.execute(parameters, data, AccessType.values()[accessType]);
+ Response reply = command.execute(parameters, data, AccessType.values()[accessType]);
SimpleFieldSet replyParameters = reply.getReplyParameters();
replyParameters.putOverwrite("Identifier", identifier);
if (reply.hasData()) {
* {@inheritDoc}
*/
@Override
- public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
- return new Reply(encodeSones(getCore().getLocalSones()));
+ public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+ return new Response(encodeSones(getCore().getLocalSones()));
}
}
* {@inheritDoc}
*/
@Override
- public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+ public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
Sone sone = getSone(parameters, "Sone");
int startPost = getInt(parameters, "StartPost", 0);
int maxPosts = getInt(parameters, "MaxPosts", -1);
Collections.sort(sortedPosts, Post.TIME_COMPARATOR);
if (sortedPosts.size() < startPost) {
- return new Reply(encodePosts(Collections.<Post> emptyList()));
+ return new Response(encodePosts(Collections.<Post> emptyList()));
}
- return new Reply(encodePosts(sortedPosts.subList(startPost, (maxPosts == -1) ? sortedPosts.size() : Math.min(startPost + maxPosts, sortedPosts.size()))));
+ return new Response(encodePosts(sortedPosts.subList(startPost, (maxPosts == -1) ? sortedPosts.size() : Math.min(startPost + maxPosts, sortedPosts.size()))));
}
}
* {@inheritDoc}
*/
@Override
- public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) {
- return new Reply(new SimpleFieldSetBuilder().put("Version", SonePlugin.VERSION.toString()).put("ProtocolVersion", 1).get());
+ public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) {
+ return new Response(new SimpleFieldSetBuilder().put("Version", SonePlugin.VERSION.toString()).put("ProtocolVersion", 1).get());
}
}
* @throws FcpException
* if an error processing the parameters occurs
*/
- public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException;
+ public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException;
/**
* The access type of the request.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- public static class Reply {
+ public static class Response {
/** The reply parameters. */
private final SimpleFieldSet replyParameters;
* @param replyParameters
* The reply parameters
*/
- public Reply(SimpleFieldSet replyParameters) {
+ public Response(SimpleFieldSet replyParameters) {
this(replyParameters, null, null);
}
* @param data
* The data of the reply (may be {@code null})
*/
- public Reply(SimpleFieldSet replyParameters, byte[] data) {
+ public Response(SimpleFieldSet replyParameters, byte[] data) {
this(replyParameters, data, null);
}
* @param bucket
* The bucket of the reply (may be {@code null})
*/
- public Reply(SimpleFieldSet replyParameters, Bucket bucket) {
+ public Response(SimpleFieldSet replyParameters, Bucket bucket) {
this(replyParameters, null, bucket);
}
* @param bucket
* The bucket of the reply (may be {@code null})
*/
- private Reply(SimpleFieldSet replyParameters, byte[] data, Bucket bucket) {
+ private Response(SimpleFieldSet replyParameters, byte[] data, Bucket bucket) {
this.replyParameters = replyParameters;
this.data = data;
this.bucket = bucket;