data.commandInfo = "Get config";
checkServerAccess("server.config.get");
final String key = channel.readString();
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(key);
String cfgValue = cfg != null ? cfg.getValueAsString() : "";
channel.acquireExclusiveLock();
try {
sendOk(lastClientTxId);
channel.writeString(cfgValue);
} finally {
channel.releaseExclusiveLock();
}
break;
}
case OChannelBinaryProtocol.REQUEST_CONFIG_SET: {
data.commandInfo = "Get config";
checkServerAccess("server.config.set");
final String key = channel.readString();
final String value = channel.readString();
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(key);
if (cfg != null)
cfg.setValue(value);
channel.acquireExclusiveLock();
try {
sendOk(lastClientTxId);
} finally {
channel.releaseExclusiveLock();
}
break;
}
case OChannelBinaryProtocol.REQUEST_CONFIG_LIST: {
data.commandInfo = "List config";
checkServerAccess("server.config.get");
channel.acquireExclusiveLock();
try {
sendOk(lastClientTxId);
channel.writeShort((short) OGlobalConfiguration.values().length);
for (OGlobalConfiguration cfg : OGlobalConfiguration.values()) {
channel.writeString(cfg.getKey());
channel.writeString(cfg.getValueAsString() != null ? cfg.getValueAsString() : "");
}
} finally {
channel.releaseExclusiveLock();
}