use of org.syncany.operations.plugin.PluginOperation in project syncany by syncany.
the class PluginManagementRequestHandler method handleRequest.
@Override
public Response handleRequest(final ManagementRequest request) {
final PluginManagementRequest concreteRequest = (PluginManagementRequest) request;
logger.log(Level.SEVERE, "Executing PluginOperation for action " + concreteRequest.getOptions().getAction() + " ...");
Thread pluginThread = new Thread(new Runnable() {
@Override
public void run() {
try {
PluginOperation pluginOperation = new PluginOperation(null, concreteRequest.getOptions());
PluginOperationResult operationResult = pluginOperation.execute();
switch(operationResult.getResultCode()) {
case OK:
eventBus.post(new PluginManagementResponse(PluginManagementResponse.OK, operationResult, request.getId()));
break;
case NOK:
eventBus.post(new PluginManagementResponse(PluginManagementResponse.NOK_FAILED_UNKNOWN, operationResult, request.getId()));
break;
}
} catch (Exception e) {
logger.log(Level.WARNING, "Error executing plugin management request.", e);
eventBus.post(new PluginManagementResponse(PluginManagementResponse.NOK_OPERATION_FAILED, new PluginOperationResult(), request.getId()));
}
}
}, "PlugRq/" + concreteRequest.getOptions().getAction());
pluginThread.start();
return null;
}
use of org.syncany.operations.plugin.PluginOperation in project syncany by syncany.
the class PluginCommand method execute.
@Override
public int execute(String[] operationArgs) throws Exception {
PluginOperationOptions operationOptions = parseOptions(operationArgs);
PluginOperationResult operationResult = new PluginOperation(config, operationOptions).execute();
printResults(operationResult);
return 0;
}
Aggregations