+ logger.log(Level.FINE, "Could not send error to plugin.", pnfe1);
+ }
+ }
+
+ //
+ // PRIVATE METHODS
+ //
+
+ /**
+ * Sends the given response to the given plugin.
+ *
+ * @param pluginReplySender
+ * The reply sender
+ * @param identifier
+ * The identifier (may be {@code null})
+ * @param response
+ * The response to send
+ * @throws PluginNotFoundException
+ * if the plugin can not be found
+ */
+ private static void sendReply(PluginReplySender pluginReplySender, String identifier, Response response) throws PluginNotFoundException {
+ SimpleFieldSet replyParameters = response.getReplyParameters();
+ if (identifier != null) {
+ replyParameters.putOverwrite("Identifier", identifier);
+ }
+ pluginReplySender.send(replyParameters);
+ }
+
+ @Subscribe
+ public void fcpInterfaceActivated(FcpInterfaceActivatedEvent fcpInterfaceActivatedEvent) {
+ setActive(true);
+ }
+
+ @Subscribe
+ public void fcpInterfaceDeactivated(FcpInterfaceDeactivatedEvent fcpInterfaceDeactivatedEvent) {
+ setActive(false);
+ }
+
+ @Subscribe
+ public void fullAccessRequiredChanged(FullAccessRequiredChanged fullAccessRequiredChanged) {
+ setFullAccessRequired(fullAccessRequiredChanged.getFullAccessRequired());
+ }
+
+ @Singleton
+ public static class CommandSupplier {
+
+ public Map<String, AbstractSoneCommand> supplyCommands(Core core) {
+ Map<String, AbstractSoneCommand> commands = new HashMap<>();
+ commands.put("Version", new VersionCommand(core));
+ commands.put("GetLocalSones", new GetLocalSonesCommand(core));
+ commands.put("GetSones", new GetSonesCommand(core));
+ commands.put("GetSone", new GetSoneCommand(core));
+ commands.put("GetPost", new GetPostCommand(core));
+ commands.put("GetPosts", new GetPostsCommand(core));
+ commands.put("GetPostFeed", new GetPostFeedCommand(core));
+ commands.put("LockSone", new LockSoneCommand(core));
+ commands.put("UnlockSone", new UnlockSoneCommand(core));
+ commands.put("LikePost", new LikePostCommand(core));
+ commands.put("LikeReply", new LikeReplyCommand(core));
+ commands.put("CreatePost", new CreatePostCommand(core));
+ commands.put("CreateReply", new CreateReplyCommand(core));
+ commands.put("DeletePost", new DeletePostCommand(core));
+ commands.put("DeleteReply", new DeleteReplyCommand(core));
+ return commands;