Examples of OServerCommand


Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

      }

      final String commandString = getCommandString(command);

      // TRY TO FIND EXACT MATCH
      OServerCommand cmd = exactCommands.get(commandString);

      if (cmd == null) {
        // TRY WITH WILDCARD COMMANDS
        // TODO: OPTIMIZE SEARCH!
        String partLeft, partRight;
        for (Entry<String, OServerCommand> entry : wildcardCommands.entrySet()) {
          final int wildcardPos = entry.getKey().indexOf('*');
          partLeft = entry.getKey().substring(0, wildcardPos);
          partRight = entry.getKey().substring(wildcardPos + 1);

          if (commandString.startsWith(partLeft) && commandString.endsWith(partRight)) {
            cmd = entry.getValue();
            break;
          }
        }
      }

      if (cmd != null)
        try {
          if (cmd.beforeExecute(request))
            // EXECUTE THE COMMAND
            isChain = cmd.execute(request);

        } catch (Exception e) {
          handleError(e);
        }
      else {
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

   *
   * @param iServerCommandInstance
   */
  @Override
  public void registerCommand(final Object iServerCommandInstance) {
    OServerCommand cmd = (OServerCommand) iServerCommandInstance;

    for (String name : cmd.getNames())
      if (OStringSerializerHelper.contains(name, '*'))
        wildcardCommands.put(name, cmd);
      else
        exactCommands.put(name, cmd);
  }
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

      }

      final String commandString = getCommandString(command);

      // TRY TO FIND EXACT MATCH
      OServerCommand cmd = exactCommands.get(commandString);

      if (cmd == null) {
        // TRY WITH WILDCARD COMMANDS
        String partLeft, partRight;
        for (Entry<String, OServerCommand> entry : wildcardCommands.entrySet()) {
          final int wildcardPos = entry.getKey().indexOf('*');
          partLeft = entry.getKey().substring(0, wildcardPos);
          partRight = entry.getKey().substring(wildcardPos + 1);

          if (commandString.startsWith(partLeft) && commandString.endsWith(partRight)) {
            cmd = entry.getValue();
            break;
          }
        }
      }

      if (cmd != null)
        try {
          if (cmd.beforeExecute(request)) {
            // EXECUTE THE COMMAND
            isChain = cmd.execute(request);
          }

        } catch (Exception e) {
          handleError(e);
        }
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

   *
   * @param iServerCommandInstance
   */
  @Override
  public void registerCommand(final Object iServerCommandInstance) {
    OServerCommand cmd = (OServerCommand) iServerCommandInstance;

    for (String name : cmd.getNames())
      if (OStringSerializerHelper.contains(name, '*'))
        wildcardCommands.put(name, cmd);
      else
        exactCommands.put(name, cmd);
  }
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

      }

      final String commandString = getCommandString(command);

      // TRY TO FIND EXACT MATCH
      OServerCommand cmd = exactCommands.get(commandString);

      if (cmd == null) {
        // TRY WITH WILDCARD COMMANDS
        // TODO: OPTIMIZE SEARCH!
        String partLeft, partRight;
        for (Entry<String, OServerCommand> entry : wildcardCommands.entrySet()) {
          final int wildcardPos = entry.getKey().indexOf('*');
          partLeft = entry.getKey().substring(0, wildcardPos);
          partRight = entry.getKey().substring(wildcardPos + 1);

          if (commandString.startsWith(partLeft) && commandString.endsWith(partRight)) {
            cmd = entry.getValue();
            break;
          }
        }
      }

      if (cmd != null)
        try {
          if (cmd.beforeExecute(request)) {
            // EXECUTE THE COMMAND
            isChain = cmd.execute(request);
          }

        } catch (Exception e) {
          handleError(e);
        }
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

   *
   * @param iServerCommandInstance
   */
  @Override
  public void registerCommand(final Object iServerCommandInstance) {
    OServerCommand cmd = (OServerCommand) iServerCommandInstance;

    for (String name : cmd.getNames())
      if (OStringSerializerHelper.contains(name, '*'))
        wildcardCommands.put(name, cmd);
      else
        exactCommands.put(name, cmd);
  }
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

   @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);
     }
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

     server = iServer;
     parent = iParent;
   }

   public Object getCommand(final String iName) {
     OServerCommand cmd = exactCommands.get(iName);

     if (cmd == null) {
       for (Entry<String, OServerCommand> entry : restCommands.entrySet()) {
         if (matches(entry.getKey(), iName)) {
           return entry.getValue();
View Full Code Here

Examples of com.orientechnologies.orient.server.network.protocol.http.command.OServerCommand

         command = request.url.substring(1);
       }

       final String commandString = getCommandString(command);

       final OServerCommand cmd = (OServerCommand) cmdManager.getCommand(commandString);
       Map<String, String> requestParams = cmdManager.extractUrlTokens(commandString);
       if (requestParams != null) {
         if (request.parameters == null) {
           request.parameters = new HashMap<String, String>();
         }
         for (Map.Entry<String, String> entry : requestParams.entrySet()) {
           request.parameters.put(entry.getKey(), URLDecoder.decode(entry.getValue(), "UTF-8"));
         }
       }

       if (cmd != null)
         try {
           if (cmd.beforeExecute(request, response))
             try {
               // EXECUTE THE COMMAND
               isChain = cmd.execute(request, response);
             } finally {
               cmd.afterExecute(request, response);
             }

         } catch (Exception e) {
           handleError(e);
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.