use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method configSet.
@ConsoleCommand(description = "Change the value of a configuration value")
public void configSet(@ConsoleParameter(name = "config-name", description = "Name of the configuration") final String iConfigName, @ConsoleParameter(name = "config-value", description = "Value to set") final String iConfigValue) throws IOException {
final OGlobalConfiguration config = OGlobalConfiguration.findByKey(iConfigName);
if (config == null)
throw new IllegalArgumentException("Configuration variable '" + iConfigName + "' not found");
if (serverAdmin != null) {
serverAdmin.setGlobalConfiguration(config, iConfigValue);
message("\nRemote configuration value changed correctly");
} else {
config.setValue(iConfigValue);
message("\nLocal configuration value changed correctly");
}
out.println();
}
use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class OServerCommandPostServer method changeConfiguration.
private void changeConfiguration(final OHttpResponse iResponse, final String settingName, final String settingValue) throws IOException {
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(settingName);
if (cfg != null) {
final Object oldValue = cfg.getValue();
cfg.setValue(settingValue);
iResponse.send(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN, "Server global configuration '" + settingName + "' update successfully. Old value was '" + oldValue + "', new value is '" + settingValue + "'", null);
} else
iResponse.send(OHttpUtils.STATUS_BADREQ_CODE, OHttpUtils.STATUS_BADREQ_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN, "Server global configuration '" + settingName + "' is invalid", null);
}
use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class OStorageLocalTest method contextConfigurationOnCreation.
public void contextConfigurationOnCreation() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:testCtxCfgOnCreate");
Map<OGlobalConfiguration, Object> settings = new HashMap<OGlobalConfiguration, Object>();
settings.put(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD, "gzip");
db.create(settings);
db.close();
ODatabaseDocumentTx db2 = new ODatabaseDocumentTx("memory:testCtxCfgOnCreate").open("admin", "admin");
Assert.assertEquals(db2.getConfiguration().getValueAsString(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD), "gzip");
}
use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class OOrientDBLoader method configure.
@Override
public void configure(final OETLProcessor iProcessor, final ODocument conf, final OCommandContext iContext) {
super.configure(iProcessor, conf, iContext);
if (conf.containsField("dbURL"))
dbURL = (String) resolve(conf.field("dbURL"));
if (conf.containsField("dbUser"))
dbUser = (String) resolve(conf.field("dbUser"));
if (conf.containsField("dbPassword"))
dbPassword = (String) resolve(conf.field("dbPassword"));
if (conf.containsField("serverUser"))
serverUser = (String) resolve(conf.field("serverUser"));
if (conf.containsField("serverPassword"))
serverPassword = (String) resolve(conf.field("serverPassword"));
if (conf.containsField("dbType"))
dbType = DB_TYPE.valueOf(conf.field("dbType").toString().toUpperCase());
if (conf.containsField("tx"))
tx = conf.<Boolean>field("tx");
if (conf.containsField("wal"))
wal = conf.<Boolean>field("wal");
if (conf.containsField("txUseLog"))
txUseLog = conf.<Boolean>field("txUseLog");
if (conf.containsField("batchCommit"))
batchCommitSize = conf.<Integer>field("batchCommit");
if (conf.containsField("dbAutoCreate"))
dbAutoCreate = conf.<Boolean>field("dbAutoCreate");
if (conf.containsField("dbAutoDropIfExists"))
dbAutoDropIfExists = conf.<Boolean>field("dbAutoDropIfExists");
if (conf.containsField("dbAutoCreateProperties"))
dbAutoCreateProperties = conf.<Boolean>field("dbAutoCreateProperties");
if (conf.containsField("useLightweightEdges"))
useLightweightEdges = conf.<Boolean>field("useLightweightEdges");
if (conf.containsField("standardElementConstraints"))
standardElementConstraints = conf.<Boolean>field("standardElementConstraints");
if (conf.containsField("skipDuplicates"))
skipDuplicates = conf.field("skipDuplicates");
clusterName = conf.field("cluster");
className = conf.field("class");
indexes = conf.field("indexes");
classes = conf.field("classes");
if (conf.containsField("settings")) {
final ODocument settings = conf.field("settings");
settings.setAllowChainedAccess(false);
for (String s : settings.fieldNames()) {
final OGlobalConfiguration v = OGlobalConfiguration.findByKey(s);
if (v != null)
v.setValue(settings.field(s));
}
}
// use wal or not
OGlobalConfiguration.USE_WAL.setValue(wal);
if (dbURL.startsWith("remote")) {
manageRemoteDatabase();
} else {
switch(dbType) {
case DOCUMENT:
configureDocumentDB();
break;
case GRAPH:
configureGraphDB();
break;
}
}
}
use of com.orientechnologies.orient.core.config.OGlobalConfiguration in project orientdb by orientechnologies.
the class OSystemDatabase method init.
private void init() {
final ODatabaseRecordThreadLocal tl = ODatabaseRecordThreadLocal.INSTANCE;
final ODatabaseDocumentInternal oldDbInThread = tl != null ? tl.getIfDefined() : null;
try {
ODatabaseDocumentTx sysDB = new ODatabaseDocumentTx("plocal:" + getSystemDatabasePath());
if (!sysDB.exists()) {
OLogManager.instance().info(this, "Creating the system database '%s' for current server", SYSTEM_DB_NAME);
Map<OGlobalConfiguration, Object> settings = new ConcurrentHashMap<OGlobalConfiguration, Object>();
settings.put(OGlobalConfiguration.CREATE_DEFAULT_USERS, false);
settings.put(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS, 1);
sysDB.create(settings);
sysDB.close();
}
} finally {
if (oldDbInThread != null) {
ODatabaseRecordThreadLocal.INSTANCE.set(oldDbInThread);
} else {
ODatabaseRecordThreadLocal.INSTANCE.remove();
}
}
}
Aggregations