use of org.syncany.operations.daemon.messages.api.ManagementRequestHandler in project syncany by syncany.
the class WatchServer method onManagementRequestReceived.
@Subscribe
public void onManagementRequestReceived(ManagementRequest managementRequest) {
logger.log(Level.INFO, "Received " + managementRequest);
try {
ManagementRequestHandler handler = ManagementRequestHandler.createManagementRequestHandler(managementRequest);
Response response = handler.handleRequest(managementRequest);
if (response != null) {
eventBus.post(response);
}
} catch (ClassNotFoundException e) {
// Not logging 'e'!
logger.log(Level.FINE, "No handler found for management request class " + managementRequest.getClass() + ". Ignoring.");
} catch (Exception e) {
logger.log(Level.FINE, "Failed to process request", e);
eventBus.post(new BadRequestResponse(managementRequest.getId(), "Invalid request."));
}
}
Aggregations