use of com.orientechnologies.orient.core.exception.OConfigurationException in project orientdb by orientechnologies.
the class OServerPluginManager method registerStaticDirectory.
protected void registerStaticDirectory(final OServerPluginInfo iPluginData) {
Object pluginWWW = iPluginData.getParameter("www");
if (pluginWWW == null)
pluginWWW = iPluginData.getName();
final OServerNetworkListener httpListener = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if (httpListener == null)
throw new OConfigurationException("HTTP listener not registered while installing Static Content command");
final OServerCommandGetStaticContent command = (OServerCommandGetStaticContent) httpListener.getCommand(OServerCommandGetStaticContent.class);
if (command != null) {
final URL wwwURL = iPluginData.getClassLoader().findResource("www/");
final OCallable<Object, String> callback;
if (wwwURL != null)
callback = createStaticLinkCallback(iPluginData, wwwURL);
else
// LET TO THE COMMAND TO CONTROL IT
callback = new OCallable<Object, String>() {
@Override
public Object call(final String iArgument) {
return iPluginData.getInstance().getContent(iArgument);
}
};
command.registerVirtualFolder(pluginWWW.toString(), callback);
}
}
use of com.orientechnologies.orient.core.exception.OConfigurationException in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method dropServerUser.
@SuppressWarnings("unchecked")
@ConsoleCommand(description = "Drop a server user. For more information look at http://orientdb.com/docs/last/Security.html#orientdb-server-security", onlineHelp = "Console-Command-Drop-Server-User")
public void dropServerUser(@ConsoleParameter(name = "user-name", description = "User name") String iServerUserName) {
if (iServerUserName == null || iServerUserName.length() == 0)
throw new IllegalArgumentException("User name null or empty");
final File serverCfgFile = new File("../config/orientdb-server-config.xml");
if (!serverCfgFile.exists())
throw new OConfigurationException("Cannot access to file " + serverCfgFile);
try {
final OServerConfigurationManager serverCfg = new OServerConfigurationManager(serverCfgFile);
if (!serverCfg.existsUser(iServerUserName)) {
error("\nServer user '%s' not found in configuration", iServerUserName);
return;
}
serverCfg.dropUser(iServerUserName);
serverCfg.saveConfiguration();
message("\nServer user '%s' dropped correctly", iServerUserName);
} catch (Exception e) {
error("\nError on loading %s file: %s", serverCfgFile, e.toString());
}
}
use of com.orientechnologies.orient.core.exception.OConfigurationException in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method listServerUsers.
@SuppressWarnings("unchecked")
@ConsoleCommand(description = "Display all the server user names. For more information look at http://orientdb.com/docs/last/Security.html#orientdb-server-security", onlineHelp = "Console-Command-List-Server-User")
public void listServerUsers() {
final File serverCfgFile = new File("../config/orientdb-server-config.xml");
if (!serverCfgFile.exists())
throw new OConfigurationException("Cannot access to file " + serverCfgFile);
try {
final OServerConfigurationManager serverCfg = new OServerConfigurationManager(serverCfgFile);
message("\nSERVER USERS\n");
final Set<OServerUserConfiguration> users = serverCfg.getUsers();
if (users.isEmpty())
message("\nNo users found");
else
for (OServerUserConfiguration u : users) {
message("\n- '%s', permissions: %s", u.name, u.resources);
}
} catch (Exception e) {
error("\nError on loading %s file: %s", serverCfgFile, e.toString());
}
}
use of com.orientechnologies.orient.core.exception.OConfigurationException in project orientdb by orientechnologies.
the class ODistributedAbstractPlugin method config.
@SuppressWarnings("unchecked")
@Override
public void config(OServer oServer, OServerParameterConfiguration[] iParams) {
serverInstance = oServer;
oServer.setVariable("ODistributedAbstractPlugin", this);
for (OServerParameterConfiguration param : iParams) {
if (param.name.equalsIgnoreCase("enabled")) {
if (!Boolean.parseBoolean(OSystemVariableResolver.resolveSystemVariables(param.value))) {
// DISABLE IT
enabled = false;
return;
}
} else if (param.name.equalsIgnoreCase("nodeName")) {
nodeName = param.value;
if (nodeName.contains("."))
throw new OConfigurationException("Illegal node name '" + nodeName + "'. '.' is not allowed in node name");
} else if (param.name.startsWith(PAR_DEF_DISTRIB_DB_CONFIG)) {
setDefaultDatabaseConfigFile(param.value);
}
}
if (serverInstance.getUser("replicator") == null)
// DROP THE REPLICATOR USER. THIS USER WAS NEEDED BEFORE 2.2, BUT IT'S NOT REQUIRED ANYMORE
OLogManager.instance().config(this, "Found 'replicator' user. Starting from OrientDB v2.2 this internal user is no needed anymore. Removing it...");
try {
serverInstance.dropUser("replicator");
} catch (IOException e) {
throw OException.wrapException(new OConfigurationException("Error on deleting 'replicator' user"), e);
}
}
use of com.orientechnologies.orient.core.exception.OConfigurationException in project orientdb by orientechnologies.
the class OServerSSLSocketFactory method config.
@Override
public void config(String name, final OServerParameterConfiguration[] iParameters) {
super.config(name, iParameters);
for (OServerParameterConfiguration param : iParameters) {
if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_CLIENT_AUTH)) {
clientAuth = Boolean.parseBoolean(param.value);
} else if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_KEYSTORE)) {
keyStorePath = param.value;
} else if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_KEYSTORE_PASSWORD)) {
keyStorePassword = param.value;
} else if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_KEYSTORE_TYPE)) {
keyStoreType = param.value;
} else if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_TRUSTSTORE)) {
trustStorePath = param.value;
} else if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_TRUSTSTORE_PASSWORD)) {
trustStorePassword = param.value;
} else if (param.name.equalsIgnoreCase(PARAM_NETWORK_SSL_TRUSTSTORE_TYPE)) {
trustStoreType = param.value;
}
}
if (keyStorePath == null) {
throw new OConfigurationException("Missing parameter " + PARAM_NETWORK_SSL_KEYSTORE);
} else if (keyStorePassword == null) {
throw new OConfigurationException("Missing parameter " + PARAM_NETWORK_SSL_KEYSTORE_PASSWORD);
}
keyStoreFile = new File(keyStorePath);
if (!keyStoreFile.isAbsolute()) {
keyStoreFile = new File(OSystemVariableResolver.resolveSystemVariables("${ORIENTDB_HOME}"), keyStorePath);
}
if (trustStorePath != null) {
trustStoreFile = new File(trustStorePath);
if (!trustStoreFile.isAbsolute()) {
trustStoreFile = new File(OSystemVariableResolver.resolveSystemVariables("${ORIENTDB_HOME}"), trustStorePath);
}
}
}
Aggregations