📄 commandhandler.java
字号:
temp.append(", Max Idle: ");
temp.append(target.getBasicConfig().getObjectPoolConfig().getByteBufferObjectPoolConfig().getMaxIdle());
temp.append(", Max Active: ");
temp.append(target.getBasicConfig().getObjectPoolConfig().getByteBufferObjectPoolConfig().getMaxActive());
} else {
temp.append("Byte Buffer Pool - Closed");
}
} else {
temp.append("Byte Buffer Pool - Not Used");
}
handler.sendClientMsg(temp.toString());
temp.setLength(0);
if(target.getClientDataPool()!=null) {
if(PoolHelper.isPoolOpen(target.getClientDataPool())==true) {
temp.append("Client Data Pool - ");
temp.append("Num Active: ");
temp.append(target.getClientDataPool().getNumActive());
temp.append(", Num Idle: ");
temp.append(target.getClientDataPool().getNumIdle());
temp.append(", Max Idle: ");
temp.append(target.getBasicConfig().getObjectPoolConfig().getClientDataObjectPoolConfig().getMaxIdle());
temp.append(", Max Active: ");
temp.append(target.getBasicConfig().getObjectPoolConfig().getClientDataObjectPoolConfig().getMaxActive());
} else {
temp.append("Client Data Pool - Closed");
}
} else {
temp.append("Client Data Pool - Not Used");
}
handler.sendClientMsg(temp.toString());
temp.setLength(0);
handler.sendClientMsg(".");
return;
} else if(cmd.equals("set")) {
if(param.length < 3)/*target,key,value*/ {
handler.sendClientMsg("-ERR "+"insufficient param");
return;
}
if(param[2].equals("null"))
param[2]=null;
try {
if(param[1].equals("maxClient")) {
long no = Long.parseLong(param[2]);
target.setMaxConnection(no);
} else if(param[1].equals("maxClientMsg")) {
target.setMaxConnectionMsg(param[2]);
} else if(param[1].equals("port")) {
long no = Long.parseLong(param[2]);
target.setPort((int)no);
} else if(param[1].equals("port")) {
long no = Long.parseLong(param[2]);
target.setPort((int)no);
} else if(param[1].equals("maxAuthTry")) {
int no = Integer.parseInt(param[2]);
target.setMaxAuthTry(no);
} else if(param[1].equals("maxAuthTryMsg")) {
target.setMaxAuthTryMsg(param[2]);
} else if(param[1].equals("clientEventHandler")) { /*v1.4.6*/
target.setClientEventHandler(param[2]);
} else if(param[1].equals("clientCommandHandler")) {
target.setClientCommandHandler(param[2]);
} else if(param[1].equals("clientWriteHandler")) { /*v1.4.6*/
target.setClientWriteHandler(param[2]);
} else if(param[1].equals("clientObjectHandler")) {
target.setClientObjectHandler(param[2]); /*v1.3*/
} else if(param[1].equals("clientAuthenticationHandler")) {
target.setClientAuthenticationHandler(param[2]);
} else if(param[1].equals("clientData")) {
target.setClientData(param[2]);
} else if(param[1].equals("clientExtendedEventHandler")) { /*v1.4.6*/
target.setClientExtendedEventHandler(param[2]);
} else if(param[1].equals("timeout")) {
long no = Long.parseLong(param[2]);
target.setTimeout((int)no);
} else if(param[1].equals("timeoutMsg")) {
target.setTimeoutMsg(param[2]); /* v1.3 */
} else if(param[1].equals("plugin")) /* v1.2*/{
if(param[0].equals("self")) {
try {
adminServer.setCommandPlugin(param[2]);
} catch(Exception e) {
handler.sendClientMsg("-ERR not set : "+e);
return;
}
} else {
handler.sendClientMsg("-ERR Bad target : "+param[0]+" self is only allowed.");
return;
}
} else if(param[1].equals("consoleLoggingFormatter")) {
target.setConsoleLoggingFormatter(param[2]); /* v1.3 */
} else if(param[1].equals("consoleLoggingLevel")) { /* v1.3 */
if(param[2].endsWith("SEVERE"))
target.setConsoleLoggingLevel(Level.SEVERE);
else if(param[2].endsWith("WARNING"))
target.setConsoleLoggingLevel(Level.WARNING);
else if(param[2].endsWith("INFO"))
target.setConsoleLoggingLevel(Level.INFO);
else if(param[2].endsWith("CONFIG"))
target.setConsoleLoggingLevel(Level.CONFIG);
else if(param[2].endsWith("FINE"))
target.setConsoleLoggingLevel(Level.FINE);
else if(param[2].endsWith("FINER"))
target.setConsoleLoggingLevel(Level.FINER);
else if(param[2].endsWith("FINEST"))
target.setConsoleLoggingLevel(Level.FINEST);
else if(param[2].endsWith("ALL"))
target.setConsoleLoggingLevel(Level.ALL);
else if(param[2].endsWith("OFF"))
target.setConsoleLoggingLevel(Level.OFF);
else {
handler.sendClientMsg("-ERR Bad Level "+param[2]);
return;
}
} else if(param[1].equals("loggingLevel")) { /* v1.3.1 */
if(param[2].endsWith("SEVERE"))
target.setLoggingLevel(Level.SEVERE);
else if(param[2].endsWith("WARNING"))
target.setLoggingLevel(Level.WARNING);
else if(param[2].endsWith("INFO"))
target.setLoggingLevel(Level.INFO);
else if(param[2].endsWith("CONFIG"))
target.setLoggingLevel(Level.CONFIG);
else if(param[2].endsWith("FINE"))
target.setLoggingLevel(Level.FINE);
else if(param[2].endsWith("FINER"))
target.setLoggingLevel(Level.FINER);
else if(param[2].endsWith("FINEST"))
target.setLoggingLevel(Level.FINEST);
else if(param[2].endsWith("ALL"))
target.setLoggingLevel(Level.ALL);
else if(param[2].endsWith("OFF"))
target.setLoggingLevel(Level.OFF);
else {
handler.sendClientMsg("-ERR Bad Level "+param[2]);
return;
}
} else if(param[1].equals("communicationLogging")) {
if(param[2].equals("true"))/* v1.3.2 */
target.setCommunicationLogging(true);
else
target.setCommunicationLogging(false);
} else if(param[1].equals("objectPoolConfig-maxActive")) {
int no = Integer.parseInt(param[2]);
target.getConfig().getObjectPoolConfig().setMaxActive(no);
} else if(param[1].equals("objectPoolConfig-maxIdle")) {
int no = Integer.parseInt(param[2]);
target.getConfig().getObjectPoolConfig().setMaxIdle(no);
} else if(param[1].equals("objectPoolConfig-initSize")) {
int no = Integer.parseInt(param[2]);
target.getConfig().getObjectPoolConfig().setInitSize(no);
} else {
handler.sendClientMsg("-ERR Bad Set Key : "+param[1]);
return;
}
handler.sendClientMsg("+OK Set");
} catch(Exception e) {
handler.sendClientMsg("-ERR "+e);
}
return;
} else if(cmd.equals("get")) {
if(param.length < 2)/*target,key*/ {
handler.sendClientMsg("-ERR "+"insufficient param");
return;
}
try {
if(param[1].equals("maxClient")) {
long no = target.getMaxConnection();
handler.sendClientMsg("+OK "+no);
} else if(param[1].equals("maxClientMsg")) {
String msg = target.getMaxConnectionMsg();
msg = MyString.replaceAll(msg, "\n", "\\n");
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("port")) {
long no = target.getPort();
handler.sendClientMsg("+OK "+no);
} else if(param[1].equals("maxAuthTry")) {
int no = target.getMaxAuthTry();
handler.sendClientMsg("+OK "+no);
} else if(param[1].equals("maxAuthTryMsg")) {
String msg=target.getMaxAuthTryMsg();
msg = MyString.replaceAll(msg, "\n", "\\n");
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientEventHandler")) { /*v1.4.6*/
String msg=target.getClientEventHandler();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientCommandHandler")) {
String msg=target.getClientCommandHandler();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientWriteHandler")) { /*v1.4.6*/
String msg=target.getClientWriteHandler();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientObjectHandler")) {
String msg=target.getClientObjectHandler();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientAuthenticationHandler")) {
String msg=target.getClientAuthenticationHandler();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientData")) {
String msg=target.getClientData();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("clientExtendedEventHandler")) { /*v1.4.6*/
String msg=target.getClientExtendedEventHandler();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("timeout")) {
String msg=""+target.getTimeout();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("timeoutMsg")) {
String msg=""+target.getTimeoutMsg();
msg = MyString.replaceAll(msg, "\n", "\\n");
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("plugin")) /* v1.2*/{
if(param[0].equals("self")) {
String msg = adminServer.getCommandPlugin();
handler.sendClientMsg("+OK "+msg);
} else {
handler.sendClientMsg("-ERR Bad target : "+param[0]+" self is only allowed.");
}
} else if(param[1].equals("consoleLoggingFormatter")) {
String msg=""+target.getConsoleLoggingFormatter(); /* v1.3 */
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("consoleLoggingLevel")) { /* v1.3 */
String msg=""+target.getConsoleLoggingLevel();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("serviceState")) {
int state=target.getServiceState(); /*v1.3*/
if(state==org.quickserver.net.Service.INIT)
handler.sendClientMsg("+OK INIT");
else if(state==org.quickserver.net.Service.RUNNING)
handler.sendClientMsg("+OK RUNNING");
else if(state==org.quickserver.net.Service.STOPPED)
handler.sendClientMsg("+OK STOPPED");
else if(state==org.quickserver.net.Service.SUSPENDED)
handler.sendClientMsg("+OK SUSPENDED");
else
handler.sendClientMsg("+OK UNKNOWN");
} else if(param[1].equals("communicationLogging")) {
String msg=""+target.getCommunicationLogging();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("objectPoolConfig-maxActive")) {
String msg=""+target.getConfig().getObjectPoolConfig().getMaxActive();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("objectPoolConfig-maxIdle")) {
String msg=""+target.getConfig().getObjectPoolConfig().getMaxIdle();
handler.sendClientMsg("+OK "+msg);
} else if(param[1].equals("objectPoolConfig-initSize")) {
String msg=""+target.getConfig().getObjectPoolConfig().getInitSize();
handler.sendClientMsg("+OK "+msg);
} else {
handler.sendClientMsg("-ERR Bad Get Key : "+param[1]);
}
} catch(Exception e) {
handler.sendClientMsg("-ERR "+e);
}
return;
} else {
handler.sendClientMsg("-ERR Bad Command : "+cmd);
}
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -