* {@link FredPluginFCP#ACCESS_FCP_RESTRICTED}
*/
public void handle(PluginReplySender pluginReplySender, SimpleFieldSet parameters, Bucket data, int accessType) {
if (!active) {
try {
sendReply(pluginReplySender, null, new ErrorResponse(400, "FCP Interface deactivated"));
} catch (PluginNotFoundException pnfe1) {
logger.log(Level.FINE, "Could not set error to plugin.", pnfe1);
}
return;
}
AbstractSoneCommand command = commands.get(parameters.get("Message"));
if ((accessType == FredPluginFCP.ACCESS_FCP_RESTRICTED) && (((fullAccessRequired == FullAccessRequired.WRITING) && command.requiresWriteAccess()) || (fullAccessRequired == FullAccessRequired.ALWAYS))) {
try {
sendReply(pluginReplySender, null, new ErrorResponse(401, "Not authorized"));
} catch (PluginNotFoundException pnfe1) {
logger.log(Level.FINE, "Could not set error to plugin.", pnfe1);
}
return;
}
try {
if (command == null) {
sendReply(pluginReplySender, null, new ErrorResponse("Unrecognized Message: " + parameters.get("Message")));
return;
}
String identifier = parameters.get("Identifier");
if ((identifier == null) || (identifier.length() == 0)) {
sendReply(pluginReplySender, null, new ErrorResponse("Missing Identifier."));
return;
}
try {
Response response = command.execute(parameters, data, AccessType.values()[accessType]);
sendReply(pluginReplySender, identifier, response);
} catch (Exception e1) {
logger.log(Level.WARNING, "Could not process FCP command ā%sā.", command);
sendReply(pluginReplySender, identifier, new ErrorResponse("Error executing command: " + e1.getMessage()));
}
} catch (PluginNotFoundException pnfe1) {
logger.log(Level.WARNING, "Could not find destination plugin: " + pluginReplySender);
}
}