Example usage for java.io File separator

List of usage examples for java.io File separator

Introduction

In this page you can find the example usage for java.io File separator.

Prototype

String separator

To view the source code for java.io File separator.

Click Source Link

Document

The system-dependent default name-separator character, represented as a string for convenience.

Usage

From source file:ktdiedrich.imagek.SegmentationCMD.java

/**
 * @author ktdiedrich@gmail.com//from   ww  w . j a va 2  s . c o  m
 * @param ags:  [file path] [Median filter size] [imageId]
 * Command line segmentation
 * @throws org.apache.commons.cli.ParseException 
 */
public static void main(String[] args) throws org.apache.commons.cli.ParseException {
    int imageIds[] = null;
    int medianFilterSize = 0;
    float seed = Extractor3D.SEED_HIST_THRES;
    String paths[] = null;

    Options options = new Options();
    options.addOption("p", true, "path name to file including filename");
    options.addOption("m", true, "median filter size, m*2+1");
    options.addOption("i", true, "image ID");
    options.addOption("f", true, "Image ID from");
    options.addOption("t", true, "Image ID to, (inclusive)");
    options.addOption("s", true, "Seed threshold default " + seed);
    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);

    if (cmd.hasOption("s")) {
        seed = Float.parseFloat(cmd.getOptionValue("s"));
    }
    if (cmd.hasOption("i")) {
        imageIds = new int[1];
        imageIds[0] = Integer.parseInt(cmd.getOptionValue("i"));
        paths = new String[1];
        paths[0] = getImageIdPath(imageIds[0]);
        // TODO get path to image ID from database and properties file. 
    }
    if (cmd.hasOption("f") && cmd.hasOption("t")) {
        int from = Integer.parseInt(cmd.getOptionValue("f"));
        int to = Integer.parseInt(cmd.getOptionValue("t"));
        int range = to - from + 1;
        paths = new String[range];
        imageIds = new int[range];
        for (int i = 0, imId = from; i < range; i++, imId++) {
            imageIds[i] = imId;
            paths[i] = getImageIdPath(imId);
        }
    }
    if (paths == null && cmd.hasOption("p")) {
        paths = new String[1];
        paths[0] = cmd.getOptionValue("p");
    }
    if (cmd.hasOption("m")) {
        medianFilterSize = Integer.parseInt(cmd.getOptionValue("m"));
    }

    // System.out.println("ImageID: "+imageId+" Path: "+paths+" Median filter: "+medianFilterSize);
    if (paths != null) {
        int i = 0;
        for (String path : paths) {
            String p[] = parseDirectoryFileName(path);
            String dirPath = p[0];
            ImagePlus segImage = segment(path, medianFilterSize, imageIds[i], seed);
            String title = segImage.getShortTitle();
            if (title.contains(File.separator))
                ;
            {
                title = parseDirectoryFileName(title)[1];
            }
            String outputPath = null;
            if (!dirPath.endsWith(File.separator))
                dirPath = dirPath + File.separator;
            outputPath = dirPath + title + ".zip";

            FileSaver fs = new FileSaver(segImage);
            fs.saveAsZip(outputPath);
            System.out.println("Saved: " + outputPath);
            ImagePlus mipYim = MIP.createShortMIP(segImage, MIP.Y_AXIS);
            fs = new FileSaver(mipYim);
            title = mipYim.getShortTitle();
            if (title.contains(File.separator))
                ;
            {
                title = parseDirectoryFileName(title)[1];
            }
            outputPath = dirPath + title + ".png";
            fs.saveAsPng(outputPath);
            System.out.println("Saved: " + outputPath + "\n");
            i++;
        }
    }
}

From source file:eu.edisonproject.classification.main.BatchMain.java

public static void main(String[] args) throws Exception {
    try {//www .  ja v a 2 s . c  o  m
        //            args = new String[1];
        //            args[0] = "..";
        //            TestDataFlow.execute(args);
        //            System.exit(0);
        //            TestTFIDF.execute(args);

        Options options = new Options();

        Option operation = new Option("op", "operation", true, "type of operation to perform. "
                + "To convert txt to avro 'a'.\n" + "For running clasification on avro documents 'c'");
        operation.setRequired(true);
        options.addOption(operation);

        Option input = new Option("i", "input", true, "input path");
        input.setRequired(false);
        options.addOption(input);

        Option output = new Option("o", "output", true, "output file");
        output.setRequired(false);
        options.addOption(output);

        Option competencesVector = new Option("c", "competences-vector", true, "competences vectors");
        competencesVector.setRequired(false);
        options.addOption(competencesVector);

        Option v1 = new Option("v1", "vector1", true, "");
        v1.setRequired(false);
        options.addOption(v1);

        Option v2 = new Option("v2", "vector2", true, "");
        v2.setRequired(false);
        options.addOption(v2);

        Option popertiesFile = new Option("p", "properties", true, "path for a properties file");
        popertiesFile.setRequired(false);
        options.addOption(popertiesFile);

        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(options, args);
        String propPath = cmd.getOptionValue("properties");
        MyProperties prop;
        if (propPath == null) {
            prop = ConfigHelper
                    .getProperties(".." + File.separator + "etc" + File.separator + "configure.properties");
        } else {
            prop = ConfigHelper.getProperties(propPath);
        }

        switch (cmd.getOptionValue("operation")) {
        case "a":
            text2Avro(cmd.getOptionValue("input"), cmd.getOptionValue("output"), prop);
            break;
        case "c":
            calculateTFIDF(cmd.getOptionValue("input"), cmd.getOptionValue("output"),
                    cmd.getOptionValue("competences-vector"), prop);
            break;
        case "p":
            //                    -op p -v2 $HOME/Downloads/msc.csv -v1 $HOME/Downloads/job.csv -p $HOME/workspace/E-CO-2/etc/classification.properties
            profile(cmd.getOptionValue("v1"), cmd.getOptionValue("v2"), cmd.getOptionValue("output"));
            break;
        }

    } catch (IllegalArgumentException | ParseException | IOException ex) {
        Logger.getLogger(BatchMain.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.adobe.aem.demomachine.gui.AemDemo.java

public static void main(String[] args) {

    String demoMachineRootFolder = null;

    // Command line options for this tool
    Options options = new Options();
    options.addOption("f", true, "Path to Demo Machine root folder");
    CommandLineParser parser = new BasicParser();
    try {//from  www .  ja  va  2  s  . c  o  m
        CommandLine cmd = parser.parse(options, args);
        if (cmd.hasOption("f")) {
            demoMachineRootFolder = cmd.getOptionValue("f");
        }

    } catch (ParseException ex) {

        logger.error(ex.getMessage());

    }

    // Let's grab the version number for the core Maven file
    String mavenFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder
            : System.getProperty("user.dir")) + File.separator + "java" + File.separator + "core"
            + File.separator + "pom.xml";
    File mavenFile = new File(mavenFilePath);
    if (mavenFile.exists() && !mavenFile.isDirectory()) {

        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document document;
            document = builder.parse(mavenFile);
            NodeList list = document.getElementsByTagName("version");
            if (list != null && list.getLength() > 0) {
                aemDemoMachineVersion = list.item(0).getFirstChild().getNodeValue();
            }

        } catch (Exception e) {
            logger.error("Can't parse Maven pom.xml file");
        }

    }

    // Let's check if we have a valid build.xml file to work with...
    String buildFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder
            : System.getProperty("user.dir")) + File.separator + "build.xml";
    logger.debug("Trying to load build file from " + buildFilePath);
    buildFile = new File(buildFilePath);
    if (buildFile.exists() && !buildFile.isDirectory()) {

        // Launching the main window
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {

                    UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.BOLD, 14));
                    AemDemo window = new AemDemo();
                    window.frameMain.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

    } else {

        logger.error("No valid build.xml file to work with");
        System.exit(-1);

    }
}

From source file:DruidResponseTime.java

public static void main(String[] args) throws Exception {
    try (CloseableHttpClient client = HttpClients.createDefault()) {
        HttpPost post = new HttpPost("http://localhost:8082/druid/v2/?pretty");
        post.addHeader("content-type", "application/json");
        CloseableHttpResponse res;//ww w .j  a  v a  2  s  .co m

        if (STORE_RESULT) {
            File dir = new File(RESULT_DIR);
            if (!dir.exists()) {
                dir.mkdirs();
            }
        }

        int length;

        // Make sure all segments online
        System.out.println("Test if number of records is " + RECORD_NUMBER);
        post.setEntity(new StringEntity("{" + "\"queryType\":\"timeseries\","
                + "\"dataSource\":\"tpch_lineitem\"," + "\"intervals\":[\"1992-01-01/1999-01-01\"],"
                + "\"granularity\":\"all\"," + "\"aggregations\":[{\"type\":\"count\",\"name\":\"count\"}]}"));
        while (true) {
            System.out.print('*');
            res = client.execute(post);
            boolean valid;
            try (BufferedInputStream in = new BufferedInputStream(res.getEntity().getContent())) {
                length = in.read(BYTE_BUFFER);
                valid = new String(BYTE_BUFFER, 0, length, "UTF-8").contains("\"count\" : 6001215");
            }
            res.close();
            if (valid) {
                break;
            } else {
                Thread.sleep(5000);
            }
        }
        System.out.println("Number of Records Test Passed");

        for (int i = 0; i < QUERIES.length; i++) {
            System.out.println(
                    "--------------------------------------------------------------------------------");
            System.out.println("Start running query: " + QUERIES[i]);
            try (BufferedReader reader = new BufferedReader(
                    new FileReader(QUERY_FILE_DIR + File.separator + i + ".json"))) {
                length = reader.read(CHAR_BUFFER);
                post.setEntity(new StringEntity(new String(CHAR_BUFFER, 0, length)));
            }

            // Warm-up Rounds
            System.out.println("Run " + WARMUP_ROUND + " times to warm up cache...");
            for (int j = 0; j < WARMUP_ROUND; j++) {
                res = client.execute(post);
                res.close();
                System.out.print('*');
            }
            System.out.println();

            // Test Rounds
            int[] time = new int[TEST_ROUND];
            int totalTime = 0;
            System.out.println("Run " + TEST_ROUND + " times to get average time...");
            for (int j = 0; j < TEST_ROUND; j++) {
                long startTime = System.currentTimeMillis();
                res = client.execute(post);
                long endTime = System.currentTimeMillis();
                if (STORE_RESULT && j == 0) {
                    try (BufferedInputStream in = new BufferedInputStream(res.getEntity().getContent());
                            BufferedWriter writer = new BufferedWriter(
                                    new FileWriter(RESULT_DIR + File.separator + i + ".json", false))) {
                        while ((length = in.read(BYTE_BUFFER)) > 0) {
                            writer.write(new String(BYTE_BUFFER, 0, length, "UTF-8"));
                        }
                    }
                }
                res.close();
                time[j] = (int) (endTime - startTime);
                totalTime += time[j];
                System.out.print(time[j] + "ms ");
            }
            System.out.println();

            // Process Results
            double avgTime = (double) totalTime / TEST_ROUND;
            double stdDev = 0;
            for (int temp : time) {
                stdDev += (temp - avgTime) * (temp - avgTime) / TEST_ROUND;
            }
            stdDev = Math.sqrt(stdDev);
            System.out.println("The average response time for the query is: " + avgTime + "ms");
            System.out.println("The standard deviation is: " + stdDev);
        }
    }
}

From source file:languages.TabFile.java

public static void main(String[] args) {
    if (args[0].equals("optimize")) {
        Scanner sc = new Scanner(System.in);
        String targetPath;/*ww w  .j  a  v a2 s . c o  m*/
        String originPath;

        System.out.println("Please enter the path of the original *.tab-files:");

        originPath = sc.nextLine();

        System.out.println(
                "Please enter the path where you wish to save the optimized *.tab-files (Directories will be created, existing files with same filenames will be overwritten):");

        targetPath = sc.nextLine();

        sc.close();

        File folder = new File(originPath);
        File[] listOfFiles = folder.listFiles();

        assert listOfFiles != null;
        for (File file : listOfFiles) {
            if (!file.getName().equals("LICENSE")) {
                TabFile origin;
                try {
                    String originFileName = file.getAbsolutePath();
                    System.out.print("Reading file '" + originFileName + "'...");
                    origin = new TabFile(originFileName);
                    System.out.println("Done!");
                    System.out.print("Optimizing file...");
                    TabFile res = TabFile.optimizeDictionaries(origin, 2, true);
                    System.out.println("Done!");

                    String targetFileName = targetPath + File.separator + file.getName();

                    System.out.println("Saving new file as '" + targetFileName + "'...");
                    res.save(targetFileName);
                    System.out.println("Done!");
                } catch (IOException e) {
                    FOKLogger.log(TabFile.class.getName(), Level.SEVERE, "An error occurred", e);
                }
            }
        }
    } else if (args[0].equals("merge")) {
        System.err.println(
                "Merging dictionaries is not supported anymore. Please checkout commit 1a6fa16 to merge dictionaries.");
    }
}

From source file:FDLRequestor.java

public static void main(String[] args) throws Exception {
    String hostId = "";
    String partnerId = "";
    String userId = "";

    CommandLineParser parser = new BasicParser();
    Options options = new Options();
    options.addOption("h", "host", true, "EBICS Host ID");
    options.addOption("p", "partner", true, "Registred Partner ID for you user");
    options.addOption("u", "user", true, "User ID to initiate");

    // Parse the program arguments
    CommandLine commandLine = parser.parse(options, args);

    if (!commandLine.hasOption('h')) {
        System.out.println("Host-ID is mandatory");
        System.exit(0);/*from  ww w  .  ja  v a2s . c o m*/
    } else {
        hostId = commandLine.getOptionValue('h');
        System.out.println("host: " + hostId);
    }

    if (!commandLine.hasOption('p')) {
        System.out.println("Partner-ID is mandatory");
        System.exit(0);
    } else {
        partnerId = commandLine.getOptionValue('p');
        System.out.println("partnerId: " + partnerId);
    }

    if (!commandLine.hasOption('u')) {
        System.out.println("User-ID is mandatory");
        System.exit(0);
    } else {
        userId = commandLine.getOptionValue('u');
        System.out.println("userId: " + userId);
    }

    FDLRequestor fdlRequestor;
    PasswordCallback pwdHandler;
    Product product;
    String filePath;

    fdlRequestor = new FDLRequestor();
    product = new Product("kopiLeft Dev 1.0", Locale.FRANCE, null);
    pwdHandler = new UserPasswordHandler(userId, "2012");

    // Load alredy created user
    fdlRequestor.loadUser(hostId, partnerId, userId, pwdHandler);

    filePath = System.getProperty("user.home") + File.separator + "download.txt";

    // Send FDL Requets
    fdlRequestor.fetchFile(filePath, userId, product, OrderType.FDL, true, null, null);
}

From source file:androidimporter.AndroidImporter.java

public static void main(String[] args) throws ParseException {
    //"/usr/local/apache-ant/bin/ant"
    String antPath = System.getProperty("ANT_PATH", System.getenv("ANT_PATH"));
    if (antPath == null || !new File(antPath).exists()) {
        throw new RuntimeException("Cannot find ant at " + antPath
                + ".  Please specify location to ant via the ANT_PATH environment variable or java system property.");
    }//from w  w w .j  a  va  2  s .c  o m

    Options opts = new Options()
            .addOption("i", "android-resource-dir", true, "Android project res directory path")
            .addOption("o", "cn1-project-dir", true, "Path to the CN1 output project directory.")
            .addOption("r", "cn1-resource-file", false,
                    "Path to CN1 output .res file.  Defaults to theme.res in project dir")
            .addOption("p", "package", true, "Java package to place GUI forms in.")
            .addOption("h", "help", false, "Usage instructions");

    CommandLineParser parser = new DefaultParser();

    CommandLine line = parser.parse(opts, args);

    if (line.hasOption("help")) {
        showHelp(opts);
        System.exit(0);
    }
    args = line.getArgs();

    if (args.length < 1) {
        System.out.println("No command provided.");
        showHelp(opts);
        System.exit(0);
    }

    switch (args[0]) {
    case "import-project": {

        if (!line.hasOption("android-resource-dir") || !line.hasOption("cn1-project-dir")
                || !line.hasOption("package")) {
            System.out.println("Please provide android-resource-dir, package, and cn1-project-dir options");
            showHelp(opts);
            System.exit(1);
        }
        File resDir = findResDir(new File(line.getOptionValue("android-resource-dir")));
        if (resDir == null || !resDir.isDirectory()) {
            System.out.println("Failed to find android resource directory from provided value");
            showHelp(opts);
            System.exit(1);
        }

        File projDir = new File(line.getOptionValue("cn1-project-dir"));
        File resFile = new File(projDir, "src" + File.separator + "theme.res");
        if (line.hasOption("cn1-resource-file")) {
            resFile = new File(line.getOptionValue("cn1-resource-file"));
        }

        JavaSEPort.setShowEDTViolationStacks(false);
        JavaSEPort.setShowEDTWarnings(false);
        JFrame frm = new JFrame("Placeholder");
        frm.setVisible(false);
        Display.init(frm.getContentPane());
        JavaSEPort.setBaseResourceDir(resFile.getParentFile());
        try {
            System.out.println("About to import project at " + resDir.getAbsolutePath());
            System.out.println("Codename One Output Project: " + projDir.getAbsolutePath());
            System.out.println("Resource file: " + resFile.getAbsolutePath());
            System.out.println("Java Package: " + line.getOptionValue("package"));
            AndroidProjectImporter.importProject(resDir, projDir, resFile, line.getOptionValue("package"));
            Runtime.getRuntime().exec(new String[] { antPath, "init" }, new String[] {},
                    resFile.getParentFile().getParentFile());
            //runAnt(new File(resFile.getParentFile().getParentFile(), "build.xml"), "init");
            System.exit(0);
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            System.exit(0);
        }
        break;
    }

    default:
        System.out.println("Unknown command " + args[0]);
        showHelp(opts);
        break;

    }

}

From source file:FULRequestor.java

public static void main(String[] args) throws Exception {
    String hostId = "";
    String partnerId = "";
    String userId = "";

    CommandLineParser parser = new BasicParser();
    Options options = new Options();
    options.addOption("h", "host", true, "EBICS Host ID");
    options.addOption("p", "partner", true, "Registred Partner ID for you user");
    options.addOption("u", "user", true, "User ID to initiate");

    // Parse the program arguments
    CommandLine commandLine = parser.parse(options, args);

    if (!commandLine.hasOption('h')) {
        System.out.println("Host-ID is mandatory");
        System.exit(0);//from  ww w  . j  a  v  a  2  s.  com
    } else {
        hostId = commandLine.getOptionValue('h');
        System.out.println("host: " + hostId);
    }

    if (!commandLine.hasOption('p')) {
        System.out.println("Partner-ID is mandatory");
        System.exit(0);
    } else {
        partnerId = commandLine.getOptionValue('p');
        System.out.println("partnerId: " + partnerId);
    }

    if (!commandLine.hasOption('u')) {
        System.out.println("User-ID is mandatory");
        System.exit(0);
    } else {
        userId = commandLine.getOptionValue('u');
        System.out.println("userId: " + userId);
    }

    FULRequestor hbbRequestor;
    PasswordCallback pwdHandler;
    Product product;
    String filePath;

    hbbRequestor = new FULRequestor();
    product = new Product("kopiLeft Dev 1.0", Locale.FRANCE, null);
    pwdHandler = new UserPasswordHandler(userId, "2012");

    // Load alredy created user
    hbbRequestor.loadUser(hostId, partnerId, userId, pwdHandler);

    filePath = System.getProperty("user.home") + File.separator + "test.txt";
    // Send FUL Requets
    hbbRequestor.sendFile(filePath, userId, product);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwingHttpCLI.CFAsteriskSwingHttpCLI.java

public static void main(String args[]) {
    final String S_ProcName = "CFAsteriskSwingHttpCLI.main() ";
    initConsoleLog();//from   w w  w  . ja va2  s  . c o  m
    boolean fastExit = false;

    String homeDirName = System.getProperty("HOME");
    if (homeDirName == null) {
        homeDirName = System.getProperty("user.home");
        if (homeDirName == null) {
            log.message(S_ProcName + "ERROR: Home directory not set");
            return;
        }
    }
    File homeDir = new File(homeDirName);
    if (!homeDir.exists()) {
        log.message(S_ProcName + "ERROR: Home directory \"" + homeDirName + "\" does not exist");
        return;
    }
    if (!homeDir.isDirectory()) {
        log.message(S_ProcName + "ERROR: Home directory \"" + homeDirName + "\" is not a directory");
        return;
    }

    CFAsteriskClientConfigurationFile cFAsteriskClientConfig = new CFAsteriskClientConfigurationFile();
    String cFAsteriskClientConfigFileName = homeDir.getPath() + File.separator + ".cfasteriskclientrc";
    cFAsteriskClientConfig.setFileName(cFAsteriskClientConfigFileName);
    File cFAsteriskClientConfigFile = new File(cFAsteriskClientConfigFileName);
    if (!cFAsteriskClientConfigFile.exists()) {
        String cFAsteriskKeyStoreFileName = homeDir.getPath() + File.separator + ".msscfjceks";
        cFAsteriskClientConfig.setKeyStore(cFAsteriskKeyStoreFileName);
        InetAddress localHost;
        try {
            localHost = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            localHost = null;
        }
        if (localHost == null) {
            log.message(S_ProcName + "ERROR: LocalHost is null");
            return;
        }
        String hostName = localHost.getHostName();
        if ((hostName == null) || (hostName.length() <= 0)) {
            log.message("ERROR: LocalHost.HostName is null or empty");
            return;
        }
        String userName = System.getProperty("user.name");
        if ((userName == null) || (userName.length() <= 0)) {
            log.message("ERROR: user.name is null or empty");
            return;
        }
        String deviceName = hostName.replaceAll("[^\\w]", "_").toLowerCase() + "-"
                + userName.replaceAll("[^\\w]", "_").toLowerCase();
        cFAsteriskClientConfig.setDeviceName(deviceName);
        cFAsteriskClientConfig.save();
        log.message(S_ProcName + "INFO: Created CFAsterisk client configuration file "
                + cFAsteriskClientConfigFileName);
        fastExit = true;
    }
    if (!cFAsteriskClientConfigFile.isFile()) {
        log.message(S_ProcName + "ERROR: Proposed client configuration file " + cFAsteriskClientConfigFileName
                + " is not a file.");
        fastExit = true;
    }
    if (!cFAsteriskClientConfigFile.canRead()) {
        log.message(S_ProcName + "ERROR: Permission denied attempting to read client configuration file "
                + cFAsteriskClientConfigFileName);
        fastExit = true;
    }
    cFAsteriskClientConfig.load();

    if (fastExit) {
        return;
    }

    // Configure logging
    Properties sysProps = System.getProperties();
    sysProps.setProperty("log4j.rootCategory", "WARN");
    sysProps.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger");

    Logger httpLogger = Logger.getLogger("org.apache.http");
    httpLogger.setLevel(Level.WARN);

    // The Invoker and it's implementation
    CFAsteriskXMsgClientHttpSchema invoker = new CFAsteriskXMsgClientHttpSchema();

    // And now for the client side cache implementation that invokes it
    ICFAsteriskSchemaObj clientSchemaObj = new CFAsteriskSchemaObj() {
        public void logout() {
            CFAsteriskXMsgClientHttpSchema invoker = (CFAsteriskXMsgClientHttpSchema) getBackingStore();
            try {
                invoker.logout(getAuthorization());
            } catch (RuntimeException e) {
            }
            setAuthorization(null);
        }
    };
    clientSchemaObj.setBackingStore(invoker);
    // And stitch the response handler to reference our client instance
    invoker.setResponseHandlerSchemaObj(clientSchemaObj);
    // And now we can stitch together the CLI to the SAX loader code
    CFAsteriskSwingHttpCLI cli = new CFAsteriskSwingHttpCLI();
    cli.setXMsgClientHttpSchema(invoker);
    cli.setSchema(clientSchemaObj);
    ICFAsteriskSwingSchema swing = cli.getSwingSchema();
    swing.setClientConfigurationFile(cFAsteriskClientConfig);
    swing.setSchema(clientSchemaObj);
    swing.setClusterName("system");
    swing.setTenantName("system");
    swing.setSecUserName("system");
    JFrame jframe = cli.getDesktop();
    jframe.setVisible(true);
    jframe.toFront();
}

From source file:mecard.BImportCustomerLoader.java

/**
 * Runs the entire process of loading customer bimport files as a timed 
 * process such as cron or Windows scheduler.
 * @param args /*from w  ww . j  a va  2  s . com*/
 */
public static void main(String args[]) {
    // First get the valid options
    Options options = new Options();
    // add t option c to config directory true=arg required.
    options.addOption("c", true,
            "Configuration file directory path, include all sys dependant dir seperators like '/'.");
    // add v option v for server version.
    options.addOption("v", false, "Metro server version information.");
    options.addOption("d", false, "Outputs debug information about the customer load.");
    options.addOption("U", false,
            "Execute upload of customer accounts, otherwise just cleans up the directory.");
    options.addOption("p", true,
            "Path to PID file. If present back off and wait for reschedule customer load.");
    options.addOption("a", false, "Maximum age of PID file before warning (in minutes).");
    try {
        // parse the command line.
        CommandLineParser parser = new BasicParser();
        CommandLine cmd;
        cmd = parser.parse(options, args);
        if (cmd.hasOption("v")) {
            System.out.println("Metro (MeCard) server version " + PropertyReader.VERSION);
            return; // don't run if user just wants version.
        }
        if (cmd.hasOption("U")) {
            uploadCustomers = true;
        }
        if (cmd.hasOption("p")) // location of the pidFile, default is current directory (relative to jar location).
        {
            pidDir = cmd.getOptionValue("p");
            if (pidDir.endsWith(File.separator) == false) {
                pidDir += File.separator;
            }
        }
        if (cmd.hasOption("d")) // debug.
        {
            debug = true;
        }
        if (cmd.hasOption("a")) {
            try {
                maxPIDAge = Integer.parseInt(cmd.getOptionValue("a"));
            } catch (NumberFormatException e) {
                System.out.println("*Warning: the value used on the '-a' flag, '" + cmd.getOptionValue("a")
                        + "' cannot be " + "converted to an integer and is therefore an illegal value for "
                        + "maximum PID file age. Maximum PID age set to: " + maxPIDAge + " minutes.");
            }
        }
        // get c option value
        String configDirectory = cmd.getOptionValue("c");
        PropertyReader.setConfigDirectory(configDirectory);
        BImportCustomerLoader loader = new BImportCustomerLoader();
        loader.run();
    } catch (ParseException ex) {
        String msg = new Date()
                + "Unable to parse command line option. Please check your service configuration.";
        if (debug) {
            System.out.println("DEBUG: request for invalid command line option.");
        }
        Logger.getLogger(MetroService.class.getName()).log(Level.SEVERE, msg, ex);
        System.exit(899); // 799 for mecard
    } catch (NumberFormatException ex) {
        String msg = new Date() + "Request for invalid -a command line option.";
        if (debug) {
            System.out.println("DEBUG: request for invalid -a command line option.");
            System.out.println("DEBUG: value set to " + maxPIDAge);
        }
        Logger.getLogger(MetroService.class.getName()).log(Level.WARNING, msg, ex);
    }
    System.exit(0);
}