use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class ONetworkProtocolBinary method configGet.
protected void configGet(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Get config");
checkServerAccess("server.config.get", connection);
final String key = channel.readString();
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(key);
String cfgValue = cfg != null ? cfg.isHidden() ? "<hidden>" : cfg.getValueAsString() : "";
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeString(cfgValue);
} finally {
endResponse(connection);
}
}
use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class ONetworkProtocolBinary method configList.
protected void configList(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "List config");
checkServerAccess("server.config.get", connection);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeShort((short) OGlobalConfiguration.values().length);
for (OGlobalConfiguration cfg : OGlobalConfiguration.values()) {
String key;
try {
key = cfg.getKey();
} catch (Exception e) {
key = "?";
}
String value;
if (cfg.isHidden())
value = "<hidden>";
else
try {
value = cfg.getValueAsString() != null ? cfg.getValueAsString() : "";
} catch (Exception e) {
value = "";
}
channel.writeString(key);
channel.writeString(value);
}
} finally {
endResponse(connection);
}
}
use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class ONetworkProtocolBinary method configSet.
protected void configSet(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Set config");
checkServerAccess("server.config.set", connection);
final String key = channel.readString();
final String value = channel.readString();
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(key);
if (cfg != null) {
cfg.setValue(value);
if (!cfg.isChangeableAtRuntime())
throw new OConfigurationException("Property '" + key + "' cannot be changed at runtime. Change the setting at startup");
} else
throw new OConfigurationException("Property '" + key + "' was not found in global configuration");
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
Aggregations