Search in sources :

Example 11 with OGlobalConfiguration

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);
    }
}
Also used : OGlobalConfiguration(com.orientechnologies.orient.core.config.OGlobalConfiguration)

Example 12 with OGlobalConfiguration

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);
    }
}
Also used : OGlobalConfiguration(com.orientechnologies.orient.core.config.OGlobalConfiguration) OLockException(com.orientechnologies.common.concur.lock.OLockException) OException(com.orientechnologies.common.exception.OException) SocketException(java.net.SocketException) OInterruptedException(com.orientechnologies.common.concur.lock.OInterruptedException) OIOException(com.orientechnologies.common.io.OIOException) OOfflineClusterException(com.orientechnologies.orient.core.storage.impl.local.paginated.OOfflineClusterException) IOException(java.io.IOException)

Example 13 with OGlobalConfiguration

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);
    }
}
Also used : OGlobalConfiguration(com.orientechnologies.orient.core.config.OGlobalConfiguration)

Aggregations

OGlobalConfiguration (com.orientechnologies.orient.core.config.OGlobalConfiguration)13 ConsoleCommand (com.orientechnologies.common.console.annotation.ConsoleCommand)3 IOException (java.io.IOException)3 OException (com.orientechnologies.common.exception.OException)2 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)2 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)2 OOfflineClusterException (com.orientechnologies.orient.core.storage.impl.local.paginated.OOfflineClusterException)2 ONeedRetryException (com.orientechnologies.common.concur.ONeedRetryException)1 OInterruptedException (com.orientechnologies.common.concur.lock.OInterruptedException)1 OLockException (com.orientechnologies.common.concur.lock.OLockException)1 OIOException (com.orientechnologies.common.io.OIOException)1 OCommandCacheHook (com.orientechnologies.orient.core.cache.OCommandCacheHook)1 OContextConfiguration (com.orientechnologies.orient.core.config.OContextConfiguration)1 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)1 ODatabaseRecordThreadLocal (com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal)1 OMetadataDefault (com.orientechnologies.orient.core.metadata.OMetadataDefault)1 File (java.io.File)1 SocketException (java.net.SocketException)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1