@Override
protected IStatus performJob() {
try {
ComputeTargetCommand computeTarget = new ComputeTargetCommand(this.userId, jsonData);
IStatus result = computeTarget.doIt();
Target target = computeTarget.getTarget();
if (jsonData.has("Username") && jsonData.has("Password")) {
result = new LoginCommand(target.getCloud(), jsonData.getString("Username"), jsonData.getString("Password")).doIt();
if (!result.isOK())
return result;
}
CFActivator.getDefault().getTargetRegistry().markDefault(this.userId, target);
return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, target.toJSON());
} catch (Exception e) {
String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
logger.error(msg, e);
return status;