Examples of ExecutableCommand


Examples of de.esoco.j2me.ui.ExecutableCommand

        {
          changeNodeEncryption((MicroSafeNode) rNode);
        }
      };

    aChangePasswordCommand = new ExecutableCommand(getString("ChgPasswd"),
                             Command.ITEM, 100)
      {
        public void execute(Object rArg)
          throws UserNotificationException
        {
View Full Code Here

Examples of de.esoco.j2me.ui.ExecutableCommand

   *
   * @return An new Command array
   */
  protected Command[] getStandardCommands()
  {
    Command aQuitCmd = new ExecutableCommand(getString("Quit") + "...",
                         Command.EXIT,
                         999)
    {
      public void execute(Object rArg)
      {
        queryQuitApp();
      }
    };

    Command aAboutCmd = new ExecutableCommand(getString("About") + "...",
                          Command.HELP,
                          99)
    {
      public void execute(Object rArg)
      {
View Full Code Here

Examples of de.esoco.j2me.ui.ExecutableCommand

    Form aForm = new Form("Test");

    aForm.append("Testinfo");
    aForm.setCommandListener(this);

    aForm.addCommand(new ExecutableCommand("Quit", Command.EXIT, 99)
      {
        public void execute(Object rArg)
        {
          queryQuitApp();
        }
      });
    aForm.addCommand(new ExecutableCommand("Test Progress View",
                         Command.SCREEN, 1)
      {
        public void execute(Object rArg)
        {
          testProgressView();
View Full Code Here

Examples of org.elasticsearch.shell.command.ExecutableCommand

        CommandRegistry registry = injector.getInstance(CommandRegistry.class);

        List<String> missingCommands = new ArrayList<String>();
        for (Command command : registry.commands) {
            ExecutableCommand annotation = command.getClass().getAnnotation(ExecutableCommand.class);
            boolean found = false;
            for (String alias : annotation.aliases()) {
                //pretty basic but works for now, a regex might be better here
                if (help.contains(alias)) {
                    found = true;
                    break;
                }
View Full Code Here

Examples of org.jostraca.util.ExecutableCommand

          + Standard.SPACE
          + compilerOpts
          ;
      }

      ExecutableCommand cmd = new ExecutableCommand( compiler, compilerOpts, sourceFiles );
      String fullcmd = cmd.getFullCmd();

      cmd.setUserMessageHandler( iUserMessageHandler );
      cmd.setActivityDescription( UserText.get( UserText.TXT_compiling ) );

      boolean successful = cmd.execute
        ( new ExecutableCommand.AlternativeExecutableCommands
          (
           // try jikes if javac not found and vice versa
           new ExecutableCommand( JavaUtil.COMPILER_javac.equals( compiler ) ? JavaUtil.COMPILER_jikes : JavaUtil.COMPILER_javac,
                                  compilerOpts, sourceFiles )

           // try to use JAVA_HOME
           ,new ExecutableCommand( "JAVA_HOME/"+JavaUtil.COMPILER_javac, compilerOpts, sourceFiles ) {
               public boolean execute( ExecutableCommand pParent ) {
                 ExecutableCommand jhc = new ExecutableCommand( "cmd", "/c echo %JAVA_HOME%" );
                 if( jhc.execute( new ExecutableCommand.AlternativeExecutableCommands
                   ( new ExecutableCommand( "sh", "-c \"echo $JAVA_HOME\"" ) ) ) ) {
                   String javaHome = jhc.getOutResult().trim();
                   if( !Standard.EMPTY.equals( javaHome ) ) {
                     iCmdPrefix = javaHome + File.separator + "bin" + File.separator + JavaUtil.COMPILER_javac;
                     return execute();
                   }
                   else {
View Full Code Here

Examples of org.jostraca.util.ExecutableCommand

    if( compile ) {
      String sourceFiles  = sourceFilesB.toString();
      String compiler     = tmps.get( Property.main_ExternalCompiler );
      String compilerOpts = tmps.get( Property.main_ExternalCompilerOptions );

      ExecutableCommand cmd = new ExecutableCommand( compiler, compilerOpts, sourceFiles );
      String fullcmd = cmd.getFullCmd();

      cmd.setUserMessageHandler( iUserMessageHandler );
      cmd.setActivityDescription( UserText.get( UserText.TXT_compiling ) );

      successful = cmd.execute();

      if( !successful ) {
        if( cmd.hasErrResult() ) {
          throw ProcessException.CODE_compile_errors( cmd.getExecutedCmd() + Standard.NEWLINE
                                                       + cmd.getOutResult() + Standard.NEWLINE
                                                       + cmd.getErrResult() + Standard.NEWLINE
                                                       );
        }
        else if( cmd.wasNotFound() ) {
          throw ProcessException.CODE_compiler_not_found( compiler );
        }
        else {
          throw ProcessException.CODE_compile_failed( cmd.getExecutedCmd() + Standard.NEWLINE
                                                       + cmd.getOutResult() + Standard.NEWLINE
                                                       + cmd.getErrResult() + Standard.NEWLINE
                                                       );
        }
      }
    }
  }
View Full Code Here

Examples of org.jostraca.util.ExecutableCommand

  // REVIEW: need to use RecordingUserMessageHandler to verify test

  public void testExecute() throws Exception {

    String args = "/c echo %JAVA_HOME%";
    ExecutableCommand ec = new ExecutableCommand( "badcmd", args );
    final RecordingUserMessageHandler rumh = new RecordingUserMessageHandler();

    ec.setUserMessageHandler( rumh );
    ec.setActivityDescription("Activity:");
    boolean outcome = ec.execute( new ExecutableCommand.AlternativeExecutableCommands
      (
       new ExecutableCommand( "badcmd2", args ),
       new ExecutableCommand( "", args ) {
           public boolean execute( ExecutableCommand pParent ) {
             iCmdPrefix = "badcmd3";
             return super.execute();
           }
         },
       new ExecutableCommand() {
           public boolean execute( ExecutableCommand pParent ) {
             ExecutableCommand sec = new ExecutableCommand( "subcmd1", "r", "s", this );
             sec.setUserMessageHandler( rumh );
             return sec.execute( new ExecutableCommand.AlternativeExecutableCommands
               (
                new ExecutableCommand( "subcmd2", sec.getCmdRoot(), sec.getCmdSuffix() ),
                new ExecutableCommand( "subcmd3", sec.getCmdRoot(), sec.getCmdSuffix() ),
                new ExecutableCommand( "cmd",     pParent.getCmdRoot() )
                ) );
           }
         }

       ) );
View Full Code Here

Examples of org.jostraca.util.ExecutableCommand

          + Standard.SPACE
          + compilerOpts
          ;
      }

      ExecutableCommand cmd = new ExecutableCommand( compiler, compilerOpts, sourceFiles );
      String fullcmd = cmd.getFullCmd();

      cmd.setUserMessageHandler( mUserMessageHandler );
      cmd.setActivityDescription( UserText.get( UserText.TXT_compiling ) );

      boolean successful = cmd.execute();
      /*
        ( new ExecutableCommand.AlternativeExecutableCommands
          (
           // try jikes if javac not found and vice versa
           new ExecutableCommand( JavaUtil.COMPILER_javac.equals( compiler ) ? JavaUtil.COMPILER_jikes : JavaUtil.COMPILER_javac,
                                  compilerOpts, sourceFiles )

           // try to use JAVA_HOME
           ,new ExecutableCommand( "JAVA_HOME/"+JavaUtil.COMPILER_javac, compilerOpts, sourceFiles ) {
               public boolean execute( ExecutableCommand pParent ) {
                 ExecutableCommand jhc = new ExecutableCommand( "cmd", "/c echo %JAVA_HOME%" );
                 if( jhc.execute( new ExecutableCommand.AlternativeExecutableCommands
                   ( new ExecutableCommand( "sh", "-c \"echo $JAVA_HOME\"" ) ) ) ) {
                   String javaHome = jhc.getOutResult().trim();
                   if( !Standard.EMPTY.equals( javaHome ) ) {
                     iCmdPrefix = javaHome + File.separator + "bin" + File.separator + JavaUtil.COMPILER_javac;
                     return execute();
                   }
                   else {
                     return false;
                   }
                 }
                 else {
                   return false;
                 }
               }
             }
           ) );
       */
      if( !successful ) {
        boolean containsErrorMsgs = -1 < cmd.getOutResult().indexOf("error");
        System.out.println("cem:"+containsErrorMsgs);
        if( cmd.hasErrResult() || containsErrorMsgs ) {
          throw ProcessException.CODE_compile_errors( cmd.getExecutedCmd() + Standard.NEWLINE
                                                       + cmd.getOutResult() + Standard.NEWLINE
                                                       + cmd.getErrResult() + Standard.NEWLINE
                                                       );
        }
        else if( cmd.wasNotFound() ) {
          throw ProcessException.CODE_compiler_not_found( compiler );
        }
        else {
          throw ProcessException.CODE_compile_failed( cmd.getExecutedCmd() + Standard.NEWLINE
                                                       + cmd.getOutResult() + Standard.NEWLINE
                                                       + cmd.getErrResult() + Standard.NEWLINE
                                                       );
        }
      }
    }
  }
View Full Code Here

Examples of org.jostraca.util.ExecutableCommand

    if( compile ) {
      String sourceFiles  = sourceFilesB.toString();
      String compiler     = tmps.get( Property.main_ExternalCompiler );
      String compilerOpts = tmps.get( Property.main_ExternalCompilerOptions );

      ExecutableCommand cmd = new ExecutableCommand( compiler, compilerOpts, sourceFiles );
      String fullcmd = cmd.getFullCmd();

      cmd.setUserMessageHandler( mUserMessageHandler );
      cmd.setActivityDescription( UserText.get( UserText.TXT_compiling ) );

      successful = cmd.execute();

      if( !successful ) {
        if( cmd.hasErrResult() ) {
          throw ProcessException.CODE_compile_errors( cmd.getExecutedCmd() + Standard.NEWLINE
                                                       + cmd.getOutResult() + Standard.NEWLINE
                                                       + cmd.getErrResult() + Standard.NEWLINE
                                                       );
        }
        else if( cmd.wasNotFound() ) {
          throw ProcessException.CODE_compiler_not_found( compiler );
        }
        else {
          throw ProcessException.CODE_compile_failed( cmd.getExecutedCmd() + Standard.NEWLINE
                                                       + cmd.getOutResult() + Standard.NEWLINE
                                                       + cmd.getErrResult() + Standard.NEWLINE
                                                       );
        }
      }
    }
  }
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.