use of org.syncany.operations.daemon.EventUserInteractionListener in project syncany by syncany.
the class ConnectManagementRequestHandler method handleRequest.
@Override
public Response handleRequest(final ManagementRequest request) {
final ConnectManagementRequest concreteRequest = (ConnectManagementRequest) request;
logger.log(Level.SEVERE, "Executing ConnectOperation for folder " + concreteRequest.getOptions().getLocalDir() + " ...");
Thread connectThread = new Thread(new Runnable() {
@Override
public void run() {
try {
ConnectOperation initOperation = new ConnectOperation(concreteRequest.getOptions(), new EventUserInteractionListener());
ConnectOperationResult operationResult = initOperation.execute();
switch(operationResult.getResultCode()) {
case OK:
eventBus.post(new ConnectManagementResponse(ConnectManagementResponse.OK, operationResult, request.getId()));
break;
case NOK_TEST_FAILED:
eventBus.post(new ConnectManagementResponse(ConnectManagementResponse.NOK_FAILED_TEST, operationResult, request.getId()));
break;
default:
eventBus.post(new ConnectManagementResponse(ConnectManagementResponse.NOK_FAILED_UNKNOWN, operationResult, request.getId()));
break;
}
} catch (Exception e) {
logger.log(Level.WARNING, "Error adding watch to daemon config.", e);
eventBus.post(new ConnectManagementResponse(ConnectManagementResponse.NOK_OPERATION_FAILED, new ConnectOperationResult(), request.getId()));
}
}
}, "ConRq/" + concreteRequest.getOptions().getLocalDir().getName());
connectThread.start();
return null;
}
use of org.syncany.operations.daemon.EventUserInteractionListener in project syncany by syncany.
the class InitManagementRequestHandler method handleRequest.
@Override
public Response handleRequest(final ManagementRequest request) {
final InitManagementRequest concreteRequest = (InitManagementRequest) request;
logger.log(Level.SEVERE, "Executing InitOperation for folder " + concreteRequest.getOptions().getLocalDir() + " ...");
Thread initThread = new Thread(new Runnable() {
@Override
public void run() {
try {
InitOperation initOperation = new InitOperation(concreteRequest.getOptions(), new EventUserInteractionListener());
InitOperationResult operationResult = initOperation.execute();
switch(operationResult.getResultCode()) {
case OK:
eventBus.post(new InitManagementResponse(InitManagementResponse.OK, operationResult, request.getId()));
break;
case NOK_TEST_FAILED:
eventBus.post(new InitManagementResponse(InitManagementResponse.NOK_FAILED_TEST, operationResult, request.getId()));
break;
default:
eventBus.post(new InitManagementResponse(InitManagementResponse.NOK_FAILED_UNKNOWN, operationResult, request.getId()));
break;
}
} catch (Exception e) {
logger.log(Level.WARNING, "Error adding watch to daemon config.", e);
eventBus.post(new InitManagementResponse(InitManagementResponse.NOK_OPERATION_FAILED, new InitOperationResult(), request.getId()));
}
}
}, "IntRq/" + concreteRequest.getOptions().getLocalDir().getName());
initThread.start();
return null;
}
Aggregations