mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Mage.Stats WS module for getting server stats in json format
This commit is contained in:
parent
78c0d76088
commit
71614becc2
43 changed files with 1587 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
package com.xmage.ws.model;
|
||||
|
||||
/**
|
||||
* Domain status error codes.
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class DomainErrors {
|
||||
|
||||
public enum Errors {
|
||||
STATUS_OK(100, "OK"),
|
||||
STATUS_SERVER_ERROR(101, "Server Internal Error"),
|
||||
STATUS_AUTH_FAILED(102, "Auth failed"),
|
||||
STATUS_ACCESS_DENIED(108, "Access denied"),
|
||||
STATUS_NOT_ENOUGH_PARAMETERS(301, "Not enough parameters"),
|
||||
STATUS_WRONG_PARAM_FORMAT(302, "Wrong param format"),
|
||||
STATUS_NOT_IMPLEMENTED(800, "Not implemented"),
|
||||
STATUS_NOT_FOUND(1000, "Resource Not Found");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
Errors(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setCustomMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.xmage.ws.model;
|
||||
|
||||
|
||||
/**
|
||||
* Some services may return simple response that is not related to domain or contain minor information.
|
||||
* Example: return OK or FALSE only for checking server state.
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class SimpleResponse {
|
||||
|
||||
private int code;
|
||||
|
||||
private String message;
|
||||
|
||||
public SimpleResponse(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public SimpleResponse(DomainErrors.Errors error) {
|
||||
this(error.getCode(), error.getMessage());
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue