Package com.atolsystems.atolutilities

Examples of com.atolsystems.atolutilities.ArgSpec


                argList.toArray(args);
                Integer curArgIndex = null;
                Arg curArg = null;
                curArgIndex = 0;

                ArgSpec argSpecs[] = {
                    new ArgSpec(ARG_HELP, ARG_HELP_ID),
                    new ArgSpec(ARG_ADD_COM_PORT, ARG_ADD_COM_PORT_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    new ArgSpec(ARG_ADD_COUPLER, ARG_ADD_COUPLER_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    };
                Set<ArgSpec> specs=ACommandLineUtilities.addArgFileArgSpecs(argSpecs);
                argSpecs=new ArgSpec[specs.size()];
                specs.toArray(argSpecs);
                args = ACommandLineUtilities.processArgFile(new File("").getAbsoluteFile(), args);
View Full Code Here


        File out[]=new File[argDirectories.size()];
        return argDirectories.toArray(out);
    }

    public ArgSpec[] getArgSpecsAsArray() {
        ArgSpec out[]=new ArgSpec[argSpecs.size()];
        return argSpecs.toArray(out);
    }
View Full Code Here

     */


    static public LinkedHashSet<ArgSpec> getArgFileArgSpecs() {
        LinkedHashSet<ArgSpec> out = new LinkedHashSet<ArgSpec>();
        out.add(new ArgSpec(ARG_ARGFILE, ARG_ARGFILE_ID, ArgSpec.UNLIMITED_OCCURENCE));
        out.add(new ArgSpec(ARG_PUSH_ARG_DIRECTORY, ARG_PUSH_ARG_DIRECTORY_ID, ArgSpec.UNLIMITED_OCCURENCE));
        out.add(new ArgSpec(ARG_SET_ARG_DIRECTORY, ARG_SET_ARG_DIRECTORY_ID, ArgSpec.UNLIMITED_OCCURENCE));
        out.add(new ArgSpec(ARG_POP_ARG_DIRECTORY, ARG_POP_ARG_DIRECTORY_ID, ArgSpec.UNLIMITED_OCCURENCE));
        out.add(new ArgSpec(ARG_SKIP, ARG_SKIP_ID, ArgSpec.UNLIMITED_OCCURENCE));
        return out;
    }
View Full Code Here

                Integer curArgIndex = null;
                Arg curArg = null;
                curArgIndex = 0;
                ArrayList<String> virtualTerminalList=new ArrayList<String>();

                ArgSpec argSpecs[] = {
                    new ArgSpec(ARG_HELP, ARG_HELP_ID),
                    new ArgSpec(ARG_ADD_VIRTUAL_TERMINAL, ARG_ADD_VIRTUAL_TERMINAL_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    new ArgSpec(ARG_SET_DELAY, ARG_SET_DELAY_ID),
                    };
                Set<ArgSpec> specs=ACommandLineUtilities.addArgFileArgSpecs(argSpecs);
                argSpecs=new ArgSpec[specs.size()];
                specs.toArray(argSpecs);
                ACommandLineUtilities.checkArgs(args, argSpecs);
View Full Code Here

                Integer curArgIndex = null;
                Arg curArg = null;
                curArgIndex = 0;
                ArrayList<String> virtualTerminalList=new ArrayList<String>();

                ArgSpec argSpecs[] = {
                    new ArgSpec(ARG_HELP, ARG_HELP_ID),
                    new ArgSpec(ARG_ADD_VIRTUAL_TERMINAL, ARG_ADD_VIRTUAL_TERMINAL_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    new ArgSpec(ARG_SET_DELAY, ARG_SET_DELAY_ID),
                    };
                Set<ArgSpec> specs=ACommandLineUtilities.addArgFileArgSpecs(argSpecs);
                argSpecs=new ArgSpec[specs.size()];
                specs.toArray(argSpecs);
                ACommandLineUtilities.checkArgs(args, argSpecs);
View Full Code Here

                argList.toArray(args);
                Integer curArgIndex = null;
                Arg curArg = null;
                curArgIndex = 0;

                ArgSpec argSpecs[] = {
                    new ArgSpec(ARG_HELP, ARG_HELP_ID),
                    new ArgSpec(ARG_ADD_COM_PORT, ARG_ADD_COM_PORT_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    new ArgSpec(ARG_ADD_COUPLER, ARG_ADD_COUPLER_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    };
               
                Set<ArgSpec> specs=ACommandLineUtilities.addArgFileArgSpecs(argSpecs);
                argSpecs=new ArgSpec[specs.size()];
                specs.toArray(argSpecs);
View Full Code Here

                Integer curArgIndex = null;
                Arg curArg = null;
                curArgIndex = 0;
                ArrayList<Integer> virtualTerminalList=new ArrayList<Integer>();

                ArgSpec argSpecs[] = {
                    new ArgSpec(ARG_HELP, ARG_HELP_ID),
                    new ArgSpec(ARG_ADD_REMOTE_TERMINAL, ARG_ADD_REMOTE_TERMINAL_ID, ArgSpec.UNLIMITED_OCCURENCE),
                    };
                Set<ArgSpec> specs=ACommandLineUtilities.addArgFileArgSpecs(argSpecs);
                argSpecs=new ArgSpec[specs.size()];
                specs.toArray(argSpecs);
                ACommandLineUtilities.checkArgs(args, argSpecs);
View Full Code Here

        }
        return home + pathSeparator + "TerminalsConf" + pathSeparator;
    }

    static public ArgSpec[] getStdArgSpecs() {
        ArgSpec out[] = {
            new ArgSpec(ARG_HELP, ARG_HELP_ID),
            new ArgSpec(ARG_SET_CONF_FOLDER, ARG_SET_CONF_FOLDER_ID, 0),
            new ArgSpec(ARG_ADD_JAR_FILE, ARG_ADD_JAR_FILE_ID, 0),
            new ArgSpec(ARG_ADD_TERMINAL_MANAGER, ARG_ADD_TERMINAL_MANAGER_ID, ArgSpec.UNLIMITED_OCCURENCE),
            new ArgSpec(ARG_TASK, ARG_TASK_ID, ArgSpec.UNLIMITED_OCCURENCE),
            new ArgSpec(ARG_STAR_SCRIPT_FILE, ARG_STAR_SCRIPT_FILE_ID, ArgSpec.UNLIMITED_OCCURENCE),
            new ArgSpec(ARG_SET_NRUN, ARG_SET_NRUN_ID, ArgSpec.UNLIMITED_OCCURENCE),
            new ArgSpec(ARG_SET_PRINT_STREAM_LOG, ARG_SET_PRINT_STREAM_LOG_ID, ArgSpec.UNLIMITED_OCCURENCE),
            new ArgSpec(ARG_SET_STAR_SCRIPT_LOG, ARG_SET_STAR_SCRIPT_LOG_ID, ArgSpec.UNLIMITED_OCCURENCE)
        };
        return out;
    }
View Full Code Here

        };
        return out;
    }

    static public ArgSpec[] addStdArgSpecs(ArgSpec[] argSpecs) {
        ArgSpec stdArgSpecs[] = getStdArgSpecs();
        ArgSpec out[] = new ArgSpec[stdArgSpecs.length + argSpecs.length];
        int n = 0;
        for (int i = 0; i < stdArgSpecs.length; i++) {
            out[n++] = stdArgSpecs[i];
        }
        for (int i = 0; i < argSpecs.length; i++) {
View Full Code Here

        return out;
    }

    public static StdParams processStdArgs(String[] args, ArgSpec argSpecs[], Class classInMainPackage, String appName) throws FileNotFoundException, IOException {
        StdParams p = new StdParams();
        ArgSpec internalArgSpecs[] = addStdArgSpecs(argSpecs);
        Set specs = ACommandLineUtilities.addArgFileArgSpecs(internalArgSpecs);
        //internalArgSpecs = ACommandLineUtilities.addArgFileArgSpecs(internalArgSpecs);
        /*ArgSpec argFileArgSpecs[] = ACommandLineUtilities.getArgFileArgSpecs();
        ArgSpec internalArgSpecs[] = new ArgSpec[argSpecs.length + 8 + argFileArgSpecs.length];
        int offset = 0;
        internalArgSpecs[offset++] = new ArgSpec(ARG_HELP, ARG_HELP_ID);
        internalArgSpecs[offset++] = new ArgSpec(ARG_SET_CONF_FOLDER, ARG_SET_CONF_FOLDER_ID, 0);
        internalArgSpecs[offset++] = new ArgSpec(ARG_ADD_JAR_FILE, ARG_ADD_JAR_FILE_ID, 0);
        internalArgSpecs[offset++] = new ArgSpec(ARG_ADD_TERMINAL_MANAGER, ARG_ADD_TERMINAL_MANAGER_ID, ArgSpec.UNLIMITED_OCCURENCE);
        internalArgSpecs[offset++] = new ArgSpec(ARG_TASK, ARG_TASK_ID, ArgSpec.UNLIMITED_OCCURENCE);
        internalArgSpecs[offset++] = new ArgSpec(ARG_STAR_SCRIPT_FILE, ARG_STAR_SCRIPT_FILE_ID, ArgSpec.UNLIMITED_OCCURENCE);
        internalArgSpecs[offset++] = new ArgSpec(ARG_SET_NRUN, ARG_SET_NRUN_ID, ArgSpec.UNLIMITED_OCCURENCE);
        internalArgSpecs[offset++] = new ArgSpec(ARG_SET_PRINT_STREAM_LOG, ARG_SET_PRINT_STREAM_LOG_ID, ArgSpec.UNLIMITED_OCCURENCE);
        for (int i = 0; i < argFileArgSpecs.length; i++) {
        internalArgSpecs[offset++] = argFileArgSpecs[i];
        }
        for (int i = 0; i < argSpecs.length; i++) {
        internalArgSpecs[offset++] = argSpecs[i];
        }*/
        //p.argSpecs = ACommandLineUtilities.addArgFileArgSpecs(internalArgSpecs);
        p.argSpecs = new ArgSpec[specs.size()];
        specs.toArray(p.argSpecs);
        p.args = ACommandLineUtilities.processArgFile(new File("").getAbsoluteFile(), args);
        //ACommandLineUtilities clContext=new ACommandLineUtilities(new File("").getAbsoluteFile(),args,internalArgSpecs,null);
        //clContext.processArgs();
        argSpecs = p.argSpecs;
        args = p.args;
        //ACommandLineUtilities.checkArgs(p.args, p.argSpecs);
        List<Class> registeredTerminalManagers = new LinkedList<Class>();

        boolean nimpHomeNotDefined = false;
        String confFolderName = ACommandLineUtilities.getArgValue(p.args, ARG_SET_CONF_FOLDER, null);
        if (null != confFolderName) {
            //force the path to be absolute
            File f = new File(confFolderName);
            if (false == f.exists()) {
                throw new RuntimeException("Folder specified by \"" + ARG_SET_CONF_FOLDER + "\" argument does not exist:\n" + f.getAbsolutePath());
            }
            confFolderName = f.getAbsolutePath() + System.getProperty("file.separator");
        } else {
            try {
                confFolderName = getDefaultConfFolder();
            } catch (RuntimeException e) {
                Logger.getLogger(classInMainPackage.getName()).log(Level.SEVERE, null, e);
                confFolderName = (new File("")).getAbsolutePath() + System.getProperty("file.separator");
                nimpHomeNotDefined = true;
            }
        }

        try {
            List<String> names = ACommandLineUtilities.getArgValues(p.args, p.argSpecs, ARG_ADD_JAR_FILE, null);
            Set<String> uniqueNames = new HashSet<String>();
            uniqueNames.addAll(names);

            if (uniqueNames.size() >= 1) {
                for (String jarName : uniqueNames) {
                    File jarFile = new File(jarName);
                    if (null == pluginJarClassLoader) {
                        pluginJarClassLoader = new JarClassLoader(jarFile.toURI().toURL());
                    } else {
                        pluginJarClassLoader.addJarURL(jarFile.toURI().toURL());
                    }
                }
            } else {
                File appJarFile = new File(AFileUtilities.getPackagePath(classInMainPackage, "packageLocator"));
                pluginJarClassLoader = new JarClassLoader(appJarFile.toURI().toURL());
            }

            names = ACommandLineUtilities.getArgValues(p.args, p.argSpecs, ARG_ADD_TERMINAL_MANAGER, null);
            if (0 == names.size()) {
                //look for app default conf
                File argFile = new File(confFolderName + appName + DEFAULT_CONF_EXTENSION);
                if (false == argFile.exists()) {
                    //look for framework default conf
                    argFile = new File(confFolderName + DEFAULT_CONF_FILENAME);
                }

                ArgSpec confArgSpecs[] = {
                    new ArgSpec(ARG_HELP, ARG_HELP_ID),
                    new ArgSpec(ARG_ADD_TERMINAL_MANAGER, ARG_ADD_TERMINAL_MANAGER_ID, ArgSpec.UNLIMITED_OCCURENCE)
                };
                try {
                    if (argFile.exists()) {
                        List<String> confArgsList = ACommandLineUtilities.processArgFile(argFile);
                        String confArgs[] = new String[confArgsList.size()];
View Full Code Here

TOP

Related Classes of com.atolsystems.atolutilities.ArgSpec

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.