Search in sources :

Example 1 with OServerCommandConfiguration

use of com.orientechnologies.orient.server.config.OServerCommandConfiguration in project orientdb by orientechnologies.

the class OServerNetworkListener method createCommand.

@SuppressWarnings("unchecked")
public static OServerCommand createCommand(final OServer server, final OServerCommandConfiguration iCommand) {
    try {
        final Constructor<OServerCommand> c = (Constructor<OServerCommand>) Class.forName(iCommand.implementation).getConstructor(OServerCommandConfiguration.class);
        final OServerCommand cmd = c.newInstance(new Object[] { iCommand });
        cmd.configure(server);
        return cmd;
    } catch (Exception e) {
        throw new IllegalArgumentException("Cannot create custom command invoking the constructor: " + iCommand.implementation + "(" + iCommand + ")", e);
    }
}
Also used : OServerCommand(com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand) Constructor(java.lang.reflect.Constructor) OServerCommandConfiguration(com.orientechnologies.orient.server.config.OServerCommandConfiguration) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException) ONetworkProtocolException(com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException)

Example 2 with OServerCommandConfiguration

use of com.orientechnologies.orient.server.config.OServerCommandConfiguration in project orientdb by orientechnologies.

the class ONetworkProtocolHttpAbstract method registerStatelessCommands.

protected void registerStatelessCommands(final OServerNetworkListener iListener) {
    cmdManager = new OHttpNetworkCommandManager(server, null);
    cmdManager.registerCommand(new OServerCommandGetConnect());
    cmdManager.registerCommand(new OServerCommandGetDisconnect());
    cmdManager.registerCommand(new OServerCommandGetClass());
    cmdManager.registerCommand(new OServerCommandGetCluster());
    cmdManager.registerCommand(new OServerCommandGetDatabase());
    cmdManager.registerCommand(new OServerCommandGetDictionary());
    cmdManager.registerCommand(new OServerCommandGetDocument());
    cmdManager.registerCommand(new OServerCommandGetDocumentByClass());
    cmdManager.registerCommand(new OServerCommandGetQuery());
    cmdManager.registerCommand(new OServerCommandGetServer());
    cmdManager.registerCommand(new OServerCommandGetConnections());
    cmdManager.registerCommand(new OServerCommandGetStorageAllocation());
    cmdManager.registerCommand(new OServerCommandGetFileDownload());
    cmdManager.registerCommand(new OServerCommandGetIndex());
    cmdManager.registerCommand(new OServerCommandGetListDatabases());
    cmdManager.registerCommand(new OServerCommandIsEnterprise());
    cmdManager.registerCommand(new OServerCommandGetExportDatabase());
    cmdManager.registerCommand(new OServerCommandPatchDocument());
    cmdManager.registerCommand(new OServerCommandPostBatch());
    cmdManager.registerCommand(new OServerCommandPostClass());
    cmdManager.registerCommand(new OServerCommandPostCommand());
    cmdManager.registerCommand(new OServerCommandPostDatabase());
    cmdManager.registerCommand(new OServerCommandPostInstallDatabase());
    cmdManager.registerCommand(new OServerCommandPostDocument());
    cmdManager.registerCommand(new OServerCommandPostImportRecords());
    cmdManager.registerCommand(new OServerCommandPostProperty());
    cmdManager.registerCommand(new OServerCommandPostConnection());
    cmdManager.registerCommand(new OServerCommandPostServer());
    cmdManager.registerCommand(new OServerCommandPostStudio());
    cmdManager.registerCommand(new OServerCommandPutDocument());
    cmdManager.registerCommand(new OServerCommandPutIndex());
    cmdManager.registerCommand(new OServerCommandDeleteClass());
    cmdManager.registerCommand(new OServerCommandDeleteDatabase());
    cmdManager.registerCommand(new OServerCommandDeleteDocument());
    cmdManager.registerCommand(new OServerCommandDeleteProperty());
    cmdManager.registerCommand(new OServerCommandDeleteIndex());
    cmdManager.registerCommand(new OServerCommandOptions());
    cmdManager.registerCommand(new OServerCommandFunction());
    cmdManager.registerCommand(new OServerCommandPostKillDbConnection());
    cmdManager.registerCommand(new OServerCommandGetSupportedLanguages());
    cmdManager.registerCommand(new OServerCommandPostAuthToken());
    cmdManager.registerCommand(new OServerCommandGetSSO());
    cmdManager.registerCommand(new OServerCommandGetPing());
    for (OServerCommandConfiguration c : iListener.getStatefulCommands()) try {
        cmdManager.registerCommand(OServerNetworkListener.createCommand(server, c));
    } catch (Exception e) {
        OLogManager.instance().error(this, "Error on creating stateful command '%s'", e, c.implementation);
    }
    for (OServerCommand c : iListener.getStatelessCommands()) cmdManager.registerCommand(c);
}
Also used : OServerCommandPutDocument(com.orientechnologies.orient.server.network.protocol.http.command.put.OServerCommandPutDocument) OServerCommandPostConnection(com.orientechnologies.orient.server.network.protocol.http.command.put.OServerCommandPostConnection) OServerCommandPutIndex(com.orientechnologies.orient.server.network.protocol.http.command.put.OServerCommandPutIndex) OServerCommandConfiguration(com.orientechnologies.orient.server.config.OServerCommandConfiguration) OServerCommandOptions(com.orientechnologies.orient.server.network.protocol.http.command.options.OServerCommandOptions) OServerCommandFunction(com.orientechnologies.orient.server.network.protocol.http.command.all.OServerCommandFunction) OServerCommand(com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand) OServerCommandPatchDocument(com.orientechnologies.orient.server.network.protocol.http.command.patch.OServerCommandPatchDocument) OLockException(com.orientechnologies.common.concur.lock.OLockException) OCommandSQLParsingException(com.orientechnologies.orient.core.sql.OCommandSQLParsingException) SocketException(java.net.SocketException) ONetworkProtocolException(com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException) SocketTimeoutException(java.net.SocketTimeoutException) IOException(java.io.IOException)

Aggregations

ONetworkProtocolException (com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException)2 OServerCommandConfiguration (com.orientechnologies.orient.server.config.OServerCommandConfiguration)2 OServerCommand (com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand)2 IOException (java.io.IOException)2 OLockException (com.orientechnologies.common.concur.lock.OLockException)1 OException (com.orientechnologies.common.exception.OException)1 OCommandSQLParsingException (com.orientechnologies.orient.core.sql.OCommandSQLParsingException)1 OServerCommandFunction (com.orientechnologies.orient.server.network.protocol.http.command.all.OServerCommandFunction)1 OServerCommandOptions (com.orientechnologies.orient.server.network.protocol.http.command.options.OServerCommandOptions)1 OServerCommandPatchDocument (com.orientechnologies.orient.server.network.protocol.http.command.patch.OServerCommandPatchDocument)1 OServerCommandPostConnection (com.orientechnologies.orient.server.network.protocol.http.command.put.OServerCommandPostConnection)1 OServerCommandPutDocument (com.orientechnologies.orient.server.network.protocol.http.command.put.OServerCommandPutDocument)1 OServerCommandPutIndex (com.orientechnologies.orient.server.network.protocol.http.command.put.OServerCommandPutIndex)1 Constructor (java.lang.reflect.Constructor)1 SocketException (java.net.SocketException)1 SocketTimeoutException (java.net.SocketTimeoutException)1