Codota Logo
Response.setSuccess
Code IndexAdd Codota to your IDE (free)

How to use
setSuccess
method
in
com.jobxhub.common.job.Response

Best Java code snippets using com.jobxhub.common.job.Response.setSuccess (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: jobxhub/JobX

public Response setExitCode(int exitCode) {
  this.exitCode = exitCode;
  setSuccess(Constants.ExitCode.SUCCESS_EXIT.getValue() == exitCode);
  return this;
}
origin: jobxhub/JobX

@Override
public Response listPath(Request request) {
  Response response = Response.response(request).setExitCode(ExitCode.SUCCESS_EXIT.getValue());
  String path = request.getParams().getString(Constants.PARAM_LISTPATH_PATH_KEY);
  if (CommonUtils.isEmpty(path)) return response.setSuccess(false).end();
  File file = new File(path);
  if (!file.exists()) {
    return response.setSuccess(false).end();
  }
  Map<String, String> result = new HashMap<String, String>(0);
  List<Map<String, String>> data = new ArrayList<Map<String, String>>(0);
  for (File itemFile : file.listFiles()) {
    if (itemFile.isHidden()) continue;
    Map<String, String> itemMap = new HashMap<String, String>(0);
    itemMap.put(Constants.PARAM_LISTPATH_NAME_KEY, itemFile.getName());
    itemMap.put(Constants.PARAM_LISTPATH_PATH_KEY, itemFile.getAbsolutePath());
    itemMap.put(Constants.PARAM_LISTPATH_ISDIRECTORY_KEY, itemFile.isDirectory() ? "0" : "1");
    data.add(itemMap);
  }
  result.put(Constants.PARAM_LISTPATH_PATH_KEY, JSON.toJSONString(data));
  response.setSuccess(true).setResult(result).end();
  return response;
}
origin: jobxhub/JobX

public void caught(Throwable throwable) {
  lock.lock();
  try {
    if (!(throwable instanceof IOException) && !(throwable instanceof SecurityException)) {
      throwable = new IOException(throwable);
    }
    this.response = Response.response(request);
    this.response.setThrowable(throwable);
    this.response.setStartTime(this.startTime);
    this.response.setSuccess(false);
    this.response.setExitCode(Constants.ExitCode.ERROR_EXEC.getValue());
    invokeCallback();
  } finally {
    lock.unlock();
  }
}
origin: jobxhub/JobX

@Override
public Response macId(Request request) {
  String guid = getMacId();
  Response response = Response.response(request).end();
  if (notEmpty(guid)) {
    return response.setMessage(guid).setSuccess(true).setExitCode(ExitCode.SUCCESS_EXIT.getValue());
  }
  return response.setSuccess(false).setExitCode(ExitCode.ERROR_EXIT.getValue());
}
origin: jobxhub/JobX

/**
 * ping的时候将失联的信息返回server...
 * @param request
 * @return
 */
@Override
public Response ping(Request request) {
  Map<String, String> result = new HashMap<String, String>(0);
  //agent Platform...
  if (CommonUtils.isWindows()) {
    result.put(Constants.PARAM_OS_KEY, Constants.Platform.Windows.toString());
  } else {
    result.put(Constants.PARAM_OS_KEY, Constants.Platform.Unix.toString());
  }
  if (!lostResponse.isEmpty()) {
    result.putAll(lostResponse);
    lostResponse.clear();
  }
  return Response.response(request)
      .setResult(result)
      .setSuccess(true)
      .setExitCode(ExitCode.SUCCESS_EXIT.getValue())
      .end();
}
origin: jobxhub/JobX

@Override
public Response path(Request request) {
  //返回密码文件的路径...
  return Response.response(request).setSuccess(true)
      .setExitCode(ExitCode.SUCCESS_EXIT.getValue())
      .setMessage(Constants.JOBX_HOME)
      .end();
}
origin: jobxhub/JobX

Response response = Response.response(request).setExitCode(Constants.ExitCode.SUCCESS_EXIT.getValue()).setSuccess(true);
    ResponseFile responseFile = new ResponseFile(start, requestFile.getFileMD5());
    responseFile.setEnd(true);
    response.setExitCode(Constants.ExitCode.NOTFOUND.getValue()).setSuccess(false).setUploadFile(responseFile).end();
    handlerContext.writeAndFlush(response).addListener(new ChannelFutureListener() {
      @Override
origin: jobxhub/JobX

@Override
public Response password(Request request) {
  String newPassword = request.getParams().getString(Constants.PARAM_NEWPASSWORD_KEY);
  Response response = Response.response(request);
  if (isEmpty(newPassword)) {
    return response.setSuccess(false).setExitCode(ExitCode.SUCCESS_EXIT.getValue()).setMessage("密码不能为空").end();
  }
  //把老的注册删除
  unRegister(request.getHost(),request.getPort());
  SystemPropertyUtils.setProperty(Constants.PARAM_JOBX_PASSWORD_KEY, newPassword);
  IOUtils.writeText(Constants.JOBX_PASSWORD_FILE, newPassword, Constants.CHARSET_UTF8);
  //最新密码信息注册进来
  register(request.getHost(),request.getPort());
  return response.setSuccess(true).setExitCode(ExitCode.SUCCESS_EXIT.getValue()).end();
}
origin: jobxhub/JobX

@Override
public Response monitor(Request request) {
  Constants.ConnType connType = Constants.ConnType.getByName(request.getParams().getString("connType"));
  Response response = Response.response(request);
  switch (connType) {
    case PROXY:
      try {
        Monitor monitor = monitorService.monitor();
        Map<String, String> map = monitor.toMap();
        response.setResult(map)
            .setSuccess(true)
            .setExitCode(ExitCode.SUCCESS_EXIT.getValue())
            .end();
        return response;
      } catch (SigarException e) {
        e.printStackTrace();
      }
    default:
      return null;
  }
}
origin: jobxhub/JobX

@Override
public Response proxy(Request request) {
  if (this.client == null) {
    this.client = ExtensionLoader.load(Client.class);
  }
  String proxyHost = request.getParams().getString(Constants.PARAM_PROXYHOST_KEY);
  String proxyPort = request.getParams().getString(Constants.PARAM_PROXYPORT_KEY);
  String proxyAction = request.getParams().getString(Constants.PARAM_PROXYACTION_KEY);
  String proxyPassword = request.getParams().getString(Constants.PARAM_PROXYPASSWORD_KEY);
  //其他参数....
  String proxyParams = request.getParams().getString(Constants.PARAM_PROXYPARAMS_KEY);
  HashMap<String, Object> params = new HashMap<String, Object>(0);
  if (CommonUtils.notEmpty(proxyParams)) {
    params = (HashMap<String, Object>) JSON.parse(proxyParams);
  }
  Request proxyReq = Request.request(proxyHost, toInt(proxyPort), Action.findByName(proxyAction), proxyPassword, request.getTimeOut(), null).setParams(params);
  Response response;
  try {
    response = this.client.sentSync(proxyReq);
  } catch (Exception e) {
    e.printStackTrace();
    response = Response.response(request);
    response.setExitCode(ExitCode.ERROR_EXIT.getValue())
        .setMessage("[JobX]:proxy error:" + e.getLocalizedMessage())
        .setSuccess(false)
        .end();
  }
  return response;
}
origin: jobxhub/JobX

result.put(Action.PING.name(),"0");
return Response.response(request)
    .setSuccess(false)
    .setResult(result)
    .setExitCode(ExitCode.ERROR_PASSWORD.getValue())
com.jobxhub.common.jobResponsesetSuccess

Popular methods of Response

  • end
  • response
  • setExitCode
  • <init>
  • getAction
  • getId
  • getThrowable
  • getUploadFile
  • setAction
  • setId
  • setMessage
  • setResult
  • setMessage,
  • setResult,
  • setStartTime,
  • setThrowable,
  • setUploadFile,
  • start

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Reference (javax.naming)
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now