Package com.atolsystems.atolutilities

Examples of com.atolsystems.atolutilities.CommandLine


                }
            }

            start = System.nanoTime();
            if(!useOldCommandLineStyle){
                CommandLine cl = new CommandLine(args);
                System.out.println("command line after arg file expansion:");
                System.out.println(cl);
                cl.removeProcessed();
                System.out.println("Command line after clean up:");
                System.out.println(cl);

                cl.addArgDefs(t.getArgDefs());

                boolean argsRemain;
                try{
                    do {
                        argsRemain = cl.processArg(true);
                    } while (argsRemain);
                    //Configuration check after first pass through command line
                    if (false == cl.isAllArgsRecognized()) {
                        throw new InvalidCommandLineException("Not all arguments were recognized:\n" + cl.toString());
                    }
                } catch (InvalidCommandLineException ex){
                    throw new InvalidCommandLineException("Argument "+cl.getCurArgIndex()+" is not valid\n"+
                            "Command line dump:\n"+cl.toString(),ex);
                }catch (Throwable ex){
                    throw new RuntimeException("Error happened during evaluation of argument "+cl.getCurArgIndex()+
                            "\nCommand line dump:\n"+cl.toString(),ex);
                }

                cl.setCurArgIndex(-1);

                int execOut = t.execute(terminal);

                do{
                    argsRemain=cl.processArg(false);
                }while(argsRemain);
                if(cl.isAllArgsProcessed()){
                    terminal.logLine(ScardLogHandler.LOG_INFO,"INFO: All command line arguments processed.");
                }else{
                    throw new InvalidCommandLineException("Not all command line arguments have been processed.\n"+cl.toString());
                }
            }else{
                oldStyleCommandLine.processArgs();
                int execOut = t.execute(terminal);
            }
View Full Code Here


        terminalArgHandlers = new ArrayList<TerminalArgHandler>(selectedTerminals.size());
        terminalThreads = new ArrayList<Thread>(selectedTerminals.size());

        for (GenericTerminal terminal : selectedTerminals) {
            //TODO: mark terminal as reserved terminal.
            CommandLine clForThisTerminal=new CommandLine(cl);
            clForThisTerminal.removeAllNonStdArgDefs();
            clForThisTerminal.addArgDefs(argDefs);
            List<SmartCardTask> tasksForThisTerminal = new ArrayList<SmartCardTask>(tasks.size());
            TerminalArgHandler terminalArgHandler = new TerminalArgHandler(terminal, new ArrayList<String[]>(), tasksForThisTerminal, clForThisTerminal);
            terminalArgHandlers.add(terminalArgHandler);
            for (SmartCardTask task : tasks) {
                SmartCardTask taskForThisTerminal=task.clone();
                clForThisTerminal.addArgDefs(taskForThisTerminal.getArgDefs());
                tasksForThisTerminal.add(taskForThisTerminal);
            }

            Thread terminalThread = new Thread(terminalArgHandler);
            terminalThread.setName("Thread for " + terminal.getName());
View Full Code Here

                //look for framework default conf
                argFile = new File(confFolderName + DEFAULT_CONF_FILENAME);
            }

            if (argFile.exists()) {
                CommandLine confCl=new CommandLine(argFile);
                confCl.addArgDefs(getArgDefs());
                boolean argsRemain;
                try{
                    do {
                        argsRemain = confCl.processArg(true);
                    } while (argsRemain);
                    //Configuration check after first pass through command line
                    if (false == confCl.isAllArgsRecognized()) {
                        throw new InvalidCommandLineException("Not all arguments were recognized:\n" + confCl.toString());
                    }
                } catch (InvalidCommandLineException ex){
                    throw new InvalidCommandLineException("Configuration file argument "+confCl.getCurArgIndex()+" is not valid\n"+
                            "Configuration file dump:\n"+confCl.toString()+"\n"+ex.getMessage(),ex);
                }catch (Throwable ex){
                    throw new RuntimeException("Configuration file: Error happened during evaluation of argument "+confCl.getCurArgIndex()+
                            "\nConfiguration file dump:\n"+confCl.toString(),ex);
                }
            }
            if (terminalManagers.isEmpty()) {
                //complain
                if (argFile.exists()) {
View Full Code Here

        terminalArgHandlers = new ArrayList<TerminalArgHandler>(selectedTerminals.size());
        terminalThreads = new ArrayList<Thread>(selectedTerminals.size());
       
        for (GenericTerminal terminal : selectedTerminals) {
            //TODO: mark terminal as reserved terminal.
            CommandLine clForThisTerminal=new CommandLine(cl);
            clForThisTerminal.removeAllNonStdArgDefs();
            clForThisTerminal.addArgDefs(getArgDefs());
            TerminalArgHandler terminalArgHandler = new TerminalArgHandler(terminal, clTerminalArgHandler, clForThisTerminal);
            terminalArgHandlers.add(terminalArgHandler);
           
            Thread terminalThread = new Thread(terminalArgHandler);
            terminalThread.setName("Thread for " + terminal.getName());
View Full Code Here

}

    boolean processArgs(String args[]) {
        boolean stoppedByUser=false;
        try {
            CommandLine cl = new CommandLine(args);
            System.out.println("command line after arg file expansion:");
            System.out.println(cl);
            cl.removeProcessed();
            System.out.println("Command line after clean up:");
            System.out.println(cl);

            cl.addArgDefs(getArgDefs());
            /*HelpArgHandler helpArgHandler=new HelpArgHandler();
            cl.addArgDef(helpArgHandler.argDef);*/

            this.initSetConfFolder();
           
            //check configuration args
            TerminalArgHandler dummyTerminalArgHandler = new TerminalArgHandler(cl.getPlugInLoader(), cl);
            boolean argsRemain;
            try{
                do {
                    argsRemain = cl.processArg(true);
                } while (argsRemain);
                //Configuration check after first pass through command line
                if (false == cl.isAllArgsRecognized()) {
                    throw new InvalidCommandLineException("Not all arguments were recognized:\n" + cl.toString());
                }
            } catch (InvalidCommandLineException ex){
                throw new InvalidCommandLineException("Argument "+cl.getCurArgIndex()+" is not valid\n"+
                        "Command line dump:\n"+cl.toString()+"\n"+ex.getMessage(),ex);
            }catch (Throwable ex){
                throw new RuntimeException("Error happened during evaluation of argument "+cl.getCurArgIndex()+
                        "\nCommand line dump:\n"+cl.toString(),ex);
            }
            this.checkSetConfFolder();
           
            dummyTerminalArgHandler.removeFromCommandLine();
            cl.setCurArgIndex(-1);

            //start real operations
            terminalsConstruction();
           
            terminalSelection();
View Full Code Here

TOP

Related Classes of com.atolsystems.atolutilities.CommandLine

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.