Package org.crsh.lang.spi

Examples of org.crsh.lang.spi.CommandResolution


      int index = resourceName.indexOf('.');
      String name = resourceName.substring(0, index);
      String ext = resourceName.substring(index + 1);
      if (activeCompilers.containsKey(ext)) {
        try {
          CommandResolution resolution = resolveCommand2(name);
          commands.put(name, resolution.getDescription());
        }
        catch (CommandException e) {
          //
        }
      }
View Full Code Here


    return commands.entrySet();
  }

  @Override
  public Command<?> resolveCommand(String name) throws CommandException, NullPointerException {
    CommandResolution resolution = resolveCommand2(name);
    return resolution != null ? resolution.getCommand() : null;
  }
View Full Code Here

  private CommandResolution resolveCommand2(String name) throws CommandException, NullPointerException {
    for (Compiler manager : activeCompilers.values()) {
      for (String ext : manager.getExtensions()) {
        Iterable<Resource> resources = context.loadResources(name + "." + ext, ResourceKind.COMMAND);
        for (Resource resource : resources) {
          CommandResolution resolution = resolveCommand(manager, name, resource);
          if (resolution != null) {
            return resolution;
          }
        }
      }
View Full Code Here

    if (ref != null) {
      if (script.getTimestamp() != ref.getTimestamp()) {
        ref = null;
      }
    }
    CommandResolution command;
    if (ref == null) {
      command = manager.compileCommand(name, script.getContent());
      if (command != null) {
        commandCache.put(name, new TimestampedObject<CommandResolution>(script.getTimestamp(), command));
      }
View Full Code Here

          }
          catch (IntrospectionException e) {
            throw new CommandException(ErrorKind.INTERNAL, "Invalid cli annotations", e);
          }
          final String description = command.describe(name, Format.DESCRIBE);
          return new CommandResolution() {
            @Override
            public String getDescription() {
              return description;
            }
            @Override
View Full Code Here

  }

  @Override
  public CommandResolution compileCommand(final String name, final byte[] source) throws CommandException, NullPointerException {

    return new CommandResolution() {
      @Override
      public String getDescription() {
        return "";
      }
      @Override
View Full Code Here

      }
    }
    final String description = resolveDescription;

    //
    return new CommandResolution() {
      Command<?> command;
      @Override
      public String getDescription() {
        return description;
      }
View Full Code Here

      description = shellCommand.describe(commandClass.getSimpleName(), Format.DESCRIBE);
    }
    catch (IntrospectionException e) {
      throw new CommandException(ErrorKind.SYNTAX, "Invalid cli annotation in command " + commandClass.getSimpleName(), e);
    }
    return new CommandResolution() {
      @Override
      public String getDescription() {
        return description;
      }
      @Override
View Full Code Here

TOP

Related Classes of org.crsh.lang.spi.CommandResolution

Copyright © 2018 www.massapicom. 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.