Package uk.co.nimp.scard

Examples of uk.co.nimp.scard.SmartCardTask


            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


        String paramsStr = arg.value.substring(ARG_TASK.length());
        String params[] = paramsStr.split(",");
        String className = params[0];
        try {
            Class theClass = plugInLoader.getPlugInClass(className);
            SmartCardTask task = (SmartCardTask) theClass.newInstance();
            if (params.length > 2) {
                throw new InvalidCommandLineException("Two parameters are accepted at most. "
                        + "Following parameters were found:\n" + params.toString());
            }
            if (2 == params.length) {
                int nArgs;
                if (params[1].equals("...")) {
                    task.setnArgs(SmartCardTask.ALL_ARGS);
                    cl.addArgDefs(task.getArgDefs());
                } else {
                    try {
                        nArgs = Integer.decode(params[1]);
                    } catch (NumberFormatException ex) {
                        throw new InvalidCommandLineException("Could not convert second parameter to an integer.", ex);
                    }
                    if (nArgs < 0) {
                        throw new InvalidCommandLineException("Only positive values is valid as second parameter.");
                    }
                    if (nArgs > 0) {
                        task.setnArgs(nArgs);
                        cl.addEphemeralArgDefs(task.getArgDefs(), nArgs);
                    }
                }
            } else {
                task.setnArgs(0);
                cl.addArgDefs(task.getArgDefs());
            }
            tasks.add(task);
            if(false==taskClassNames.contains(className)){
                taskClassNames.add(className);
                System.out.println("Task added:");
                System.out.println(task.getAboutMsg());
            }
        } catch (InstantiationException ex) {
            throw new InvalidCommandLineException(ex);
        } catch (IllegalAccessException ex) {
            throw new InvalidCommandLineException(ex);
View Full Code Here

        String paramsStr = arg.value.substring(ARG_TASK.length());
        String params[] = paramsStr.split(",");
        String className = params[0];
        int status=SmartCardTask.ERROR;
        try {
            SmartCardTask task = tasks.get(taskCounter++);
            if (false == task.getClass().getName().equals(className)) {
                throw new RuntimeException("Internal error: argument \"" + ARG_TASK + "\": actual class is different from the specified one:\n"
                        + "specified: " + className + "\n"
                        + "actual:    " + task.getClass().getName());
            }
            int nArgs = task.getnArgs();
            if (SmartCardTask.ALL_ARGS != nArgs) {
                if (nArgs > 0) {
                    cl.addEphemeralArgDefs(task.getArgDefs(), nArgs);
                }
            } else {
                cl.addArgDefs(task.getArgDefs());
            }
            task.setnRun(nRun);
            Main.checkTaskPreferences(terminal, task);
            status = task.execute(terminal);
            if (SmartCardTask.ERROR == status) {
                throw new RuntimeException("Task \"" + className + "\" terminated with error.");
            }
        } catch (StopRequestFromUserException e) {
            throw e;
View Full Code Here

    }

    public TerminalArgHandler(GenericTerminal terminal, TerminalArgHandler template, CommandLine cl) {
        List<SmartCardTask> tasksForThisTerminal = new ArrayList<SmartCardTask>(template.getTasks().size());
        for (SmartCardTask task : template.getTasks()) {
            SmartCardTask taskForThisTerminal=task.clone();
            cl.addArgDefs(taskForThisTerminal.getArgDefs());
            tasksForThisTerminal.add(taskForThisTerminal);
        }
        if(null==terminal)
            throw new NullPointerException("Terminal is null.");
        if(null==cl)
View Full Code Here

TOP

Related Classes of uk.co.nimp.scard.SmartCardTask

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.