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:CTmousetrack.java

public static void main(String[] args) {

    String outLoc = new String("." + File.separator + "CTdata"); // Location of the base output data folder; only used when writing out CT data to a local folder
    String srcName = "CTmousetrack"; // name of the output CT source
    long blockPts = 10; // points per block flush
    long sampInterval = 10; // time between sampling updates, msec
    double trimTime = 0.0; // amount of data to keep (trim time), sec
    boolean debug = false; // turn on debug?

    // Specify the CT output connection
    CTWriteMode writeMode = CTWriteMode.LOCAL; // The selected mode for writing out CT data
    String serverHost = ""; // Server (FTP or HTTP/S) host:port
    String serverUser = ""; // Server (FTP or HTTPS) username
    String serverPassword = ""; // Server (FTP or HTTPS) password

    // For UDP output mode
    DatagramSocket udpServerSocket = null;
    InetAddress udpServerAddress = null;
    String udpHost = "";
    int udpPort = -1;

    // Concatenate all of the CTWriteMode types
    String possibleWriteModes = "";
    for (CTWriteMode wm : CTWriteMode.values()) {
        possibleWriteModes = possibleWriteModes + ", " + wm.name();
    }/*from   w w w.  j a  v a  2 s.  c o m*/
    // Remove ", " from start of string
    possibleWriteModes = possibleWriteModes.substring(2);

    //
    // Argument processing using Apache Commons CLI
    //
    // 1. Setup command line options
    Options options = new Options();
    options.addOption("h", "help", false, "Print this message.");
    options.addOption(Option.builder("o").argName("base output dir").hasArg().desc(
            "Base output directory when writing data to local folder (i.e., this is the location of CTdata folder); default = \""
                    + outLoc + "\".")
            .build());
    options.addOption(Option.builder("s").argName("source name").hasArg()
            .desc("Name of source to write data to; default = \"" + srcName + "\".").build());
    options.addOption(Option.builder("b").argName("points per block").hasArg()
            .desc("Number of points per block; UDP output mode will use 1 point/block; default = "
                    + Long.toString(blockPts) + ".")
            .build());
    options.addOption(Option.builder("dt").argName("samp interval msec").hasArg()
            .desc("Sampling period in msec; default = " + Long.toString(sampInterval) + ".").build());
    options.addOption(Option.builder("t").argName("trim time sec").hasArg().desc(
            "Trim (ring-buffer loop) time (sec); this is only used when writing data to local folder; specify 0 for indefinite; default = "
                    + Double.toString(trimTime) + ".")
            .build());
    options.addOption(
            Option.builder("w").argName("write mode").hasArg()
                    .desc("Type of write connection; one of " + possibleWriteModes
                            + "; all but UDP mode write out to CT; default = " + writeMode.name() + ".")
                    .build());
    options.addOption(Option.builder("host").argName("host[:port]").hasArg()
            .desc("Host:port when writing via FTP, HTTP, HTTPS, UDP.").build());
    options.addOption(Option.builder("u").argName("username,password").hasArg()
            .desc("Comma-delimited username and password when writing to CT via FTP or HTTPS.").build());
    options.addOption("x", "debug", false, "Enable CloudTurbine debug output.");

    // 2. Parse command line options
    CommandLineParser parser = new DefaultParser();
    CommandLine line = null;
    try {
        line = parser.parse(options, args);
    } catch (ParseException exp) { // oops, something went wrong
        System.err.println("Command line argument parsing failed: " + exp.getMessage());
        return;
    }

    // 3. Retrieve the command line values
    if (line.hasOption("help")) { // Display help message and quit
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp("CTmousetrack", "", options,
                "NOTE: UDP output is a special non-CT output mode where single x,y points are sent via UDP to the specified host:port.");
        return;
    }

    outLoc = line.getOptionValue("o", outLoc);
    if (!outLoc.endsWith("\\") && !outLoc.endsWith("/")) {
        outLoc = outLoc + File.separator;
    }
    // Make sure the base output folder location ends in "CTdata"
    if (!outLoc.endsWith("CTdata\\") && !outLoc.endsWith("CTdata/")) {
        outLoc = outLoc + "CTdata" + File.separator;
    }

    srcName = line.getOptionValue("s", srcName);

    blockPts = Long.parseLong(line.getOptionValue("b", Long.toString(blockPts)));

    sampInterval = Long.parseLong(line.getOptionValue("dt", Long.toString(sampInterval)));

    trimTime = Double.parseDouble(line.getOptionValue("t", Double.toString(trimTime)));

    // Type of output connection
    String writeModeStr = line.getOptionValue("w", writeMode.name());
    boolean bMatch = false;
    for (CTWriteMode wm : CTWriteMode.values()) {
        if (wm.name().toLowerCase().equals(writeModeStr.toLowerCase())) {
            writeMode = wm;
            bMatch = true;
        }
    }
    if (!bMatch) {
        System.err.println("Unrecognized write mode, \"" + writeModeStr + "\"; write mode must be one of "
                + possibleWriteModes);
        System.exit(0);
    }
    if (writeMode != CTWriteMode.LOCAL) {
        // User must have specified the host
        // If FTP or HTTPS, they may also specify username/password
        serverHost = line.getOptionValue("host", serverHost);
        if (serverHost.isEmpty()) {
            System.err.println(
                    "When using write mode \"" + writeModeStr + "\", you must specify the server host.");
            System.exit(0);
        }
        if (writeMode == CTWriteMode.UDP) {
            // Force blockPts to be 1
            blockPts = 1;
            // User must have specified both host and port
            int colonIdx = serverHost.indexOf(':');
            if ((colonIdx == -1) || (colonIdx >= serverHost.length() - 1)) {
                System.err.println(
                        "For UDP output mode, both the host and port (<host>:<port>)) must be specified.");
                System.exit(0);
            }
            udpHost = serverHost.substring(0, colonIdx);
            String udpPortStr = serverHost.substring(colonIdx + 1);
            try {
                udpPort = Integer.parseInt(udpPortStr);
            } catch (NumberFormatException nfe) {
                System.err.println("The UDP port must be a positive integer.");
                System.exit(0);
            }
        }
        if ((writeMode == CTWriteMode.FTP) || (writeMode == CTWriteMode.HTTPS)) {
            String userpassStr = line.getOptionValue("u", "");
            if (!userpassStr.isEmpty()) {
                // This string should be comma-delimited username and password
                String[] userpassCSV = userpassStr.split(",");
                if (userpassCSV.length != 2) {
                    System.err.println("When specifying a username and password for write mode \""
                            + writeModeStr + "\", separate the username and password by a comma.");
                    System.exit(0);
                }
                serverUser = userpassCSV[0];
                serverPassword = userpassCSV[1];
            }
        }
    }

    debug = line.hasOption("debug");

    System.err.println("CTmousetrack parameters:");
    System.err.println("\toutput mode = " + writeMode.name());
    if (writeMode == CTWriteMode.UDP) {
        System.err.println("\twrite to " + udpHost + ":" + udpPort);
    } else {
        System.err.println("\tsource = " + srcName);
        System.err.println("\ttrim time = " + trimTime + " sec");
    }
    System.err.println("\tpoints per block = " + blockPts);
    System.err.println("\tsample interval = " + sampInterval + " msec");

    try {
        //
        // Setup CTwriter or UDP output
        //
        CTwriter ctw = null;
        CTinfo.setDebug(debug);
        if (writeMode == CTWriteMode.LOCAL) {
            ctw = new CTwriter(outLoc + srcName, trimTime);
            System.err.println("\tdata will be written to local folder \"" + outLoc + "\"");
        } else if (writeMode == CTWriteMode.FTP) {
            CTftp ctftp = new CTftp(srcName);
            try {
                ctftp.login(serverHost, serverUser, serverPassword);
            } catch (Exception e) {
                throw new IOException(
                        new String("Error logging into FTP server \"" + serverHost + "\":\n" + e.getMessage()));
            }
            ctw = ctftp; // upcast to CTWriter
            System.err.println("\tdata will be written to FTP server at " + serverHost);
        } else if (writeMode == CTWriteMode.HTTP) {
            // Don't send username/pw in HTTP mode since they will be unencrypted
            CThttp cthttp = new CThttp(srcName, "http://" + serverHost);
            ctw = cthttp; // upcast to CTWriter
            System.err.println("\tdata will be written to HTTP server at " + serverHost);
        } else if (writeMode == CTWriteMode.HTTPS) {
            CThttp cthttp = new CThttp(srcName, "https://" + serverHost);
            // Username/pw are optional for HTTPS mode; only use them if username is not empty
            if (!serverUser.isEmpty()) {
                try {
                    cthttp.login(serverUser, serverPassword);
                } catch (Exception e) {
                    throw new IOException(new String(
                            "Error logging into HTTP server \"" + serverHost + "\":\n" + e.getMessage()));
                }
            }
            ctw = cthttp; // upcast to CTWriter
            System.err.println("\tdata will be written to HTTPS server at " + serverHost);
        } else if (writeMode == CTWriteMode.UDP) {
            try {
                udpServerSocket = new DatagramSocket();
            } catch (SocketException se) {
                System.err.println("Error creating socket for UDP:\n" + se);
                System.exit(0);
            }
            try {
                udpServerAddress = InetAddress.getByName(udpHost);
            } catch (UnknownHostException uhe) {
                System.err.println("Error getting UDP server host address:\n" + uhe);
                System.exit(0);
            }
        }
        if (writeMode != CTWriteMode.UDP) {
            ctw.setBlockMode(blockPts > 1, blockPts > 1);
            ctw.autoFlush(0); // no autoflush
            ctw.autoSegment(1000);
        }

        // screen dims
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = screenSize.getWidth();
        double height = screenSize.getHeight();

        // use Map for consolidated putData
        Map<String, Object> cmap = new LinkedHashMap<String, Object>();

        // loop and write some output
        for (int i = 0; i < 1000000; i++) { // go until killed
            long currentTime = System.currentTimeMillis();
            Point mousePos = MouseInfo.getPointerInfo().getLocation();
            float x_pt = (float) (mousePos.getX() / width); // normalize
            float y_pt = (float) ((height - mousePos.getY()) / height); // flip Y (so bottom=0)
            if (writeMode != CTWriteMode.UDP) {
                // CT output mode
                ctw.setTime(currentTime);
                cmap.clear();
                cmap.put("x", x_pt);
                cmap.put("y", y_pt);
                ctw.putData(cmap);
                if (((i + 1) % blockPts) == 0) {
                    ctw.flush();
                    System.err.print(".");
                }
            } else {
                // UDP output mode
                // We force blockPts to be 1 for UDP output mode, i.e. we "flush" the data every time
                // Write the following data (21 bytes total):
                //     header = "MOUSE", 5 bytes
                //     current time, long, 8 bytes
                //     2 floats (x,y) 4 bytes each, 8 bytes
                int len = 21;
                ByteBuffer bb = ByteBuffer.allocate(len);
                String headerStr = "MOUSE";
                bb.put(headerStr.getBytes("UTF-8"));
                bb.putLong(currentTime);
                bb.putFloat(x_pt);
                bb.putFloat(y_pt);
                // Might be able to use the following, but not sure:
                //     byte[] sendData = bb.array();
                byte[] sendData = new byte[len];
                bb.position(0);
                bb.get(sendData, 0, len);
                DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, udpServerAddress,
                        udpPort);
                try {
                    udpServerSocket.send(sendPacket);
                } catch (IOException e) {
                    System.err.println("Test server caught exception trying to send data to UDP client:\n" + e);
                }
                System.err.print(".");
            }
            try {
                Thread.sleep(sampInterval);
            } catch (Exception e) {
            }
            ;
        }
        if (writeMode != CTWriteMode.UDP) {
            ctw.flush(); // wrap up
        }
    } catch (Exception e) {
        System.err.println("CTmousetrack exception: " + e);
        e.printStackTrace();
    }
}

From source file:contractEditor.contractHOST4.java

public static void main(String[] args) {

    JSONObject obj = new JSONObject();
    obj.put("name", "HOST4");
    obj.put("context", "VM-deployment");

    //obj.put("Context", new Integer);

    HashMap serviceDescription = new HashMap();
    serviceDescription.put("location", "France");
    serviceDescription.put("certificate", "true");
    serviceDescription.put("volume", "100_GB");
    serviceDescription.put("price", "3_euro");

    obj.put("serviceDescription", serviceDescription);

    HashMap gauranteeTerm = new HashMap();
    gauranteeTerm.put("availability", "more_98_percentage");
    obj.put("gauranteeTerm", gauranteeTerm);

    //Constraint1

    ArrayList creationConstraint1 = new ArrayList();
    ArrayList totalConstraint = new ArrayList();
    totalConstraint.add(creationConstraint1);

    obj.put("creationConstraint", totalConstraint);

    try {//from w ww  .j a  va  2  s. co  m

        FileWriter file = new FileWriter("confSP" + File.separator + "Host4.json");
        file.write(obj.toJSONString());
        file.flush();
        file.close();

    } catch (IOException e) {
        e.printStackTrace();
    }

    System.out.print(obj);

    /*
            
    JSONParser parser = new JSONParser();
            
    try {
            
    Object obj2 = parser.parse(new FileReader("confSP\\confHost1.json"));
            
    JSONObject jsonObject = (JSONObject) obj2;
            
        HashMap serviceDescription2=(HashMap) jsonObject.get("serviceDescription");
                 
        method.printHashMap(serviceDescription2);
                
                
        HashMap gauranteeTerm2=(HashMap) jsonObject.get("gauranteeTerm");
                 
        method.printHashMap(gauranteeTerm2);
                
                
                
        ArrayList creationConstraint=(ArrayList) jsonObject.get("creationConstraint");
                
        method.printArrayList(creationConstraint);
            
            
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    } catch (ParseException e) {
    e.printStackTrace();
    }
            
            
            
            
            
    */

}

From source file:com.marklogic.client.example.tutorial.Example_02_CreateXML.java

public static void main(String[] args) throws IOException {

    System.out.println("example: " + Example_02_CreateXML.class.getName());

    // create the client
    DatabaseClient client = DatabaseClientFactory.newClient(Config.host, Config.port, Config.user,
            Config.password, Config.authType);

    // acquire the content
    InputStream docStream = Example_02_CreateXML.class.getClassLoader()
            .getResourceAsStream("data" + File.separator + "flipper.xml");

    // create a manager for XML documents
    XMLDocumentManager docMgr = client.newXMLDocumentManager();

    // create a handle on the content
    InputStreamHandle handle = new InputStreamHandle(docStream);

    // url encode

    /*ServerEvaluationCall theCall = client.newServerEval();
    String query = "xquery version '1.0-ml';" + " xdmp:url-encode('/dms/document/.xml');";
    theCall.xquery(query);/*from  ww w .  ja  v a2 s.c o  m*/
            
    String response = theCall.evalAs(String.class);*/

    // url encode end

    // write the document content
    docMgr.write("/example/pankaj.xml", handle);

    /*if(docMgr.exists("/example/flipper3.xml") == null) {
       //System.out.println("URI does not exists hecne loading it to the database!");
       logger.info("/example/flipper.xml");
       docMgr.write("/example/flipper3.xml", handle);
    }
    else */

    //System.out.println("The document URI already exists!");
    //System.out.println("Wrote /example/flipper.xml content");

    // release the client

    // decode
    // read the document content
    // create a handle to receive the document content
    /*   System.out.println();
    DOMHandle readhandle = new DOMHandle();
    docMgr.read(response, readhandle);
            
    // access the document content
    Document document = readhandle.get();
            
            
            
    //System.out.println("document fetched is: " + document.toString());
            
    String rootName = document.getDocumentElement().getTagName();
            
    System.out.println("Read /example/flipper.xml content with the <"+rootName+"/> root element");
               
       //decode end */
    client.release();
}

From source file:main.ReportGenerator.java

/**
 * Entry point for the program.//w  ww  . j  a va2  s .  c o  m
 * Takes the variables as JSON on the standard input.
 * @param args Arguments from the command line.
 */
public static void main(String[] args) {
    CommandLine cmd = createOptions(args);

    GeneratorError result = GeneratorError.NO_ERROR;
    try {
        //Build the output name, by default ./output
        String directory = cmd.getOptionValue("output", "./");
        if (!directory.endsWith(File.separator))
            directory += File.separator;
        String filename = cmd.getOptionValue("name", "output");
        String output = directory + filename;

        //Get the JSON from file if given, or get it from the standard input.
        String jsonText = null;
        if (!cmd.hasOption("input")) {
            // Initializes the input with the standard input
            jsonText = IOUtils.toString(System.in, "UTF-8");
        } else // read the file
        {
            FileInputStream inputStream = new FileInputStream(cmd.getOptionValue("input"));
            try {
                jsonText = IOUtils.toString(inputStream);
            } finally {
                inputStream.close();
            }
        }

        //Build the report object
        Report report = new Report(jsonText, cmd.getOptionValue("template"), output);

        //Generate the document
        if (cmd.hasOption("all")) {
            new AllGenerator(report).generate();
        } else {
            if (cmd.hasOption("html"))
                new HTMLGenerator(report).generate();
            if (cmd.hasOption("pdf"))
                new PDFGenerator(report).generate();
            if (cmd.hasOption("doc"))
                new DocGenerator(report).generate();
        }

    } catch (IOException e) {
        System.err.println("Error: " + e.getMessage());
        System.exit(GeneratorError.IO_ERROR.getCode());
    } catch (GeneratorException e) {
        System.err.println("Error: " + e.getMessage());
        System.exit(e.getError().getCode());
    }
    System.exit(result.getCode());
}

From source file:uk.ac.kcl.iop.brc.core.pipeline.dncpipeline.Main.java

/**
 * Entry point of Cognition-DNC//from www  .java2  s  .  co m
 */
public static void main(String[] args) {
    printGNULicense();

    if (requiresHelp(args)) {
        CommandHelper.printHelp();
        System.exit(0);
    }

    String path = "file:" + getCurrentFolder() + File.separator + "config" + File.separator
            + "applicationContext.xml";
    logger.info("Loading context from " + path);

    context = new ClassPathXmlApplicationContext(path);

    Options options = getOptions();
    CommandLineParser parser = new GnuParser();

    Runtime.getRuntime().addShutdownHook(getShutDownBehaviour());
    try {
        CommandLine cmd = parser.parse(options, args);
        processCommands(cmd);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.seleniumtests.util.helper.AppTestDocumentation.java

public static void main(String[] args) throws IOException {
    File srcDir = Paths.get(args[0].replace(File.separator, "/"), "src", "test", "java").toFile();

    javadoc = new StringBuilder(
            "Cette page rfrence l'ensemble des tests et des opration disponible pour l'application\n");
    javadoc.append("\n{toc}\n\n");
    javadoc.append("${project.summary}\n");
    javadoc.append("h1. Tests\n");
    try {/*from   w  ww . j  a va 2s. c om*/
        Path testsFolders = Files.walk(Paths.get(srcDir.getAbsolutePath())).filter(Files::isDirectory)
                .filter(p -> p.getFileName().toString().equals("tests")).collect(Collectors.toList()).get(0);

        exploreTests(testsFolders.toFile());
    } catch (IndexOutOfBoundsException e) {
        throw new ConfigurationException("no 'tests' sub-package found");
    }

    javadoc.append("----");
    javadoc.append("h1. Pages\n");
    try {
        Path pagesFolders = Files.walk(Paths.get(srcDir.getAbsolutePath())).filter(Files::isDirectory)
                .filter(p -> p.getFileName().toString().equals("webpage")).collect(Collectors.toList()).get(0);

        explorePages(pagesFolders.toFile());
    } catch (IndexOutOfBoundsException e) {
        throw new ConfigurationException("no 'webpage' sub-package found");
    }

    javadoc.append("${project.scmManager}\n");
    FileUtils.write(Paths.get(args[0], "src/site/confluence/template.confluence").toFile(), javadoc,
            Charset.forName("UTF-8"));
}

From source file:de.uzk.hki.da.sb.SIPBuilder.java

public static void main(String[] args) {

    logger.setLevel(Level.ERROR);

    try {//from  www  . ja va2s.c o  m
        if (SystemUtils.IS_OS_WINDOWS)
            System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "CP850"));
        else
            System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        return;
    }

    String mainFolderPath = SIPBuilder.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    String confFolderPath, dataFolderPath;
    try {
        mainFolderPath = URLDecoder.decode(mainFolderPath, "UTF-8");
        confFolderPath = new File(mainFolderPath).getParent() + File.separator + "conf";
        dataFolderPath = new File(mainFolderPath).getParent() + File.separator + "data";
    } catch (UnsupportedEncodingException e) {
        confFolderPath = "conf";
        dataFolderPath = "data";
    }

    if (args.length == 0)
        startGUIMode(confFolderPath, dataFolderPath);
    else
        startCLIMode(confFolderPath, dataFolderPath, args);
}

From source file:com.ibm.iotf.connector.Connector.java

public static void main(String[] args) {
    userDir = System.getProperty("user.dir");
    resourceDir = null;/*from ww w . j av  a  2 s.  c o  m*/
    isBluemix = false;

    IoTFSubscriber subscriber = null;
    MHubPublisher publisher = null;

    isBluemix = new File(userDir + File.separator + ".java-buildpack").exists();

    try {
        if (isBluemix) {
            logger.log(Level.INFO, "Running in Bluemix mode.");

            resourceDir = userDir + File.separator + "Connector-MessageHub-1.0" + File.separator + "bin"
                    + File.separator + "resources";

            if (System.getProperty(JAAS_CONFIG_PROPERTY) == null) {
                System.setProperty(JAAS_CONFIG_PROPERTY, resourceDir + File.separator + "jaas.conf");
            }

            // Attempt to retrieve the environment configuration for the IoTF and Message Hub services
            IoTFEnvironment iotEnv = parseIoTFEnv();

            if (iotEnv == null) {
                logger.log(Level.FATAL, "Unable to retrieve the IoTF environment configuration.");
                System.exit(1);
            }

            MessageHubEnvironment messageHubEnv = parseProducerProps();

            if (messageHubEnv == null) {
                logger.log(Level.FATAL, "Unable to retrieve the Message Hub environment configuration.");
                System.exit(1);
            }

            // update the JAAS configuration with auth details from the environment
            // configuration we have just parsed
            updateJaasConfiguration(messageHubEnv.getCredentials());

            // create a single subscriber/producer
            subscriber = new IoTFSubscriber(iotEnv);
            publisher = new MHubPublisher(messageHubEnv);
            // configure the subscriber to hand off events to the publisher
            subscriber.setPublisher(publisher);

        } else {
            logger.log(Level.INFO, "Running in standalone mode - not currently supported.");
            System.exit(1);
        }

    } catch (Throwable t) {
        logger.log(Level.FATAL,
                "An error occurred while configuring and starting the environment: " + t.getMessage(), t);
        System.exit(1);
    }

    logger.log(Level.INFO, "Starting the subscriber run loop.");
    // The subscriber run method + the thread(s) used by the IoT client libraries will keep
    // the application alive.
    subscriber.run();
}

From source file:evaluation.evaluation2OrBACGeneration.java

public static void main(String[] args) throws IOException, ParseException, COrbacException {

    for (int i = 0; i < 5; i++) {

        String info = null;/*from w  w  w .j  a v a2  s .  c  o  m*/

        LinkedList<Long> policyGenerationTime = new LinkedList<Long>();
        LinkedList<Long> allocationTime = new LinkedList<Long>();

        for (int totalClientNumber = 10; totalClientNumber < 61; totalClientNumber = totalClientNumber + 10) {

            for (int totalHOSTNumber = 10; totalHOSTNumber < 61; totalHOSTNumber = totalHOSTNumber + 10)

            {

                int count = 0;

                util.test.VMAndHostGeneration(totalClientNumber, totalHOSTNumber);
                long returnValue[] = util.test.timeMeasure(totalClientNumber, totalHOSTNumber);

                info = info + "-----------------------------------\n";
                info = info + "VM: " + totalClientNumber + "\n";
                info = info + "HOST: " + totalHOSTNumber + "\n";
                info = info + "Policy generation time: " + returnValue[0] + "\n";
                info = info + "allocation  time: " + returnValue[1] + "\n";

                if ((totalClientNumber == 10) && (totalHOSTNumber == 10)) {
                    policyGenerationTime.add(returnValue[0]);
                    allocationTime.add(returnValue[1]);
                }

                else {
                    policyGenerationTime.set(count, policyGenerationTime.get(count) + returnValue[0]);
                    allocationTime.set(count, allocationTime.get(count) + returnValue[1]);
                }
                count++;

            }

            method.fromStringToFile(info, "evaluation" + File.separator + "test2and3.txt");

        }

    }

}

From source file:de.uni_rostock.goodod.checker.CheckerApp.java

public static void main(String[] args) throws OWLOntologyCreationException {
    config = Configuration.getConfiguration(args);
    String bioTopVariantA = "biotoplite_group_A_TEST.owl";
    String bioTopVariantB = "biotoplite_group_B_TEST.owl";
    String repoRoot = config.getString("repositoryRoot");
    File commonBioTopF = new File(repoRoot + File.separator + config.getString("bioTopLiteSource"));

    String groupAFile = repoRoot + File.separator + "Results" + File.separator + "GruppeA" + File.separator
            + bioTopVariantA;//from   ww w  . j a v  a  2 s .  c om
    String groupBFile = repoRoot + File.separator + "Results" + File.separator + "GruppeB" + File.separator
            + bioTopVariantB;
    String testFile = config.getString("testDescription");
    IRI bioTopIRI = IRI.create("http://purl.org/biotop/biotoplite.owl");
    SimpleIRIMapper bioTopLiteMapper = new SimpleIRIMapper(bioTopIRI, IRI.create(commonBioTopF));
    SimpleIRIMapper variantMapperA = new SimpleIRIMapper(
            IRI.create("http://purl.org/biotop/biotoplite_group_A_TEST.owl"), IRI.create(new File(groupAFile)));
    SimpleIRIMapper variantMapperB = new SimpleIRIMapper(
            IRI.create("http://purl.org/biotop/biotoplite_group_B_TEST.owl"), IRI.create(new File(groupBFile)));
    //logger.info("Loading ontology " + testFile + ".");
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    manager.addIRIMapper(variantMapperA);
    manager.addIRIMapper(variantMapperB);
    manager.addIRIMapper(bioTopLiteMapper);
    FileDocumentSource source = new FileDocumentSource(new File(testFile));
    OWLOntology ontology = null;
    try {
        ontology = manager.loadOntologyFromOntologyDocument(source);
    } catch (Throwable e) {
        logger.fatal("Loading failed", e);
        System.exit(1);
    }

    org.semanticweb.HermiT.Configuration reasonerConfig = new org.semanticweb.HermiT.Configuration();
    reasonerConfig.throwInconsistentOntologyException = false;
    //ReasonerProgressMonitor monitor = new ConsoleProgressMonitor();
    reasonerConfig.existentialStrategyType = ExistentialStrategyType.INDIVIDUAL_REUSE;
    //reasonerConfig.reasonerProgressMonitor = monitor;
    reasonerConfig.tableauMonitorType = TableauMonitorType.NONE;
    //reasonerConfig.individualTaskTimeout = 10000;
    Reasoner reasoner = new Reasoner(reasonerConfig, ontology);
    reasoner.classifyClasses();
    Set<OWLClass> before = reasoner.getUnsatisfiableClasses()
            .getEntitiesMinus(manager.getOWLDataFactory().getOWLNothing());
    //logger.info("Found " + before.size() + " inconsistent classes before import change.");
    logger.debug(before);

    reasoner.dispose();
    reasoner = null;
    manager.removeOntology(ontology);
    ontology = null;

    Map<IRI, IRI> importMap = new HashMap<IRI, IRI>();

    OWLOntologyLoaderConfiguration interimConfig = new OWLOntologyLoaderConfiguration();
    for (String str : config.getStringArray("ignoredImports")) {
        IRI ignoredIRI = IRI.create(str);
        importMap.put(ignoredIRI, bioTopIRI);

        interimConfig = interimConfig.addIgnoredImport(ignoredIRI);
    }

    interimConfig = interimConfig.setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT);
    try {
        ontology = manager.loadOntologyFromOntologyDocument(source, interimConfig);
    } catch (Throwable e) {
        logger.fatal("Loading failed", e);
        System.exit(1);
    }
    BasicImportingNormalizerFactory n = new BasicImportingNormalizerFactory(importMap, interimConfig);

    n.normalize(ontology);

    reasoner = new Reasoner(reasonerConfig, ontology);
    reasoner.classifyClasses();
    Set<OWLClass> after = reasoner.getUnsatisfiableClasses()
            .getEntitiesMinus(manager.getOWLDataFactory().getOWLNothing());

    //logger.info("Found " + after.size() + " inconsistent classes after import change.");
    logger.debug(after);

    /*
     * We need some tidying afterwards. The after set can contain
     * inconsistent classes that are inconsistent only because in the new
     * import, they are subclasses of a class that was already inconsistent before.
     * Hence we remove them from the after set.  
     */
    for (OWLClass c : before) {
        Set<OWLClass> subclasses = SubClassCollector.collect(c, manager.getImportsClosure(ontology));
        for (OWLClass subC : subclasses) {
            if ((true == after.contains(subC)) && (false == before.contains(subC))) {
                after.remove(subC);
            }
        }
    }
    int difference = before.size() - after.size();

    if (0 == difference) {
        logger.info(testFile + ": OK");
    } else {
        logger.warn(testFile + ": Import change is not neutral to inconsistencies (" + before.size() + '/'
                + after.size() + ")");
    }
}