Example usage for java.util Scanner Scanner

List of usage examples for java.util Scanner Scanner

Introduction

In this page you can find the example usage for java.util Scanner Scanner.

Prototype

public Scanner(ReadableByteChannel source) 

Source Link

Document

Constructs a new Scanner that produces values scanned from the specified channel.

Usage

From source file:org.musa.tcpclients.Main.java

/**
 * Load the Spring Integration Application Context
 *
 * @param args - command line arguments//  w  w  w . j a v  a  2 s  .co m
 */
public static void main(final String... args) {

    final Scanner scanner = new Scanner(System.in);

    //context.getB
    GenericXmlApplicationContext context = Main.setupContext();
    WarpGateway gateway = (WarpGateway) context.getBean("gw");

    System.out.println("running.\n\n");

    System.out.println("Please enter numbers to spawn spacemarines :");
    System.out.println("1: Gabriel Loken");
    System.out.println("2: Nathaniel Garro");
    System.out.println("3: Ezekyl Abaddon");
    System.out.println("4: Sanguinius");
    System.out.println("5: Lucius");

    System.out.println("\t- Entering q will quit the application");
    System.out.print("\n");

    while (true) {

        final String input = scanner.nextLine();

        if ("q".equals(input.trim())) {
            break;
        } else {

            SpaceMarine gabriel = new SpaceMarine("Gabriel Loken", "Luna Wolves", 500, SMRank.CaptainBrother,
                    SMLoyalty.Loyalist, 100);
            SpaceMarine garro = new SpaceMarine("Nathaniel Garro", "Deathguard", 500, SMRank.CaptainBrother,
                    SMLoyalty.Loyalist, 100);
            SpaceMarine ezekyl = new SpaceMarine("Ezekyl Abaddon", "Black Legion", 500, SMRank.CaptainBrother,
                    SMLoyalty.Traitor, 100);
            SpaceMarine sanguinius = new SpaceMarine("Sanguinius", "Blood angels", 999, SMRank.Primarch,
                    SMLoyalty.Loyalist, 600);
            SpaceMarine lucius = new SpaceMarine("Lucius", "Emperor's children", 500, SMRank.SwordMaster,
                    SMLoyalty.Traitor, 700);

            SpaceMarine[] spaceMarines = { gabriel, garro, ezekyl, sanguinius, lucius };
            int max_id = spaceMarines.length;

            int num = 0; //input
            try {
                num = Integer.parseInt(input);
            } catch (NumberFormatException e) {
                System.out.println("unable to parse value");
            }
            if (num >= max_id) {
                System.out.println("no such spacemarine, using Loken");
                num = 0;
            }

            System.out.println("teleporting " + spaceMarines[num].getName() + "....");

            Message<SpaceMarine> m = MessageBuilder.withPayload(spaceMarines[num]).build();

            //context.
            String reply = (String) gateway.send(m);
            System.out.println(reply);

        }
    }

    System.out.println("Exiting application...bye.");
    System.exit(0);

}

From source file:TwitterClustering.java

public static void main(String[] args) throws FileNotFoundException, IOException {
    // TODO code application logic here

    File outFile = new File(args[3]);
    Scanner s = new Scanner(new File(args[1])).useDelimiter(",");
    JSONParser parser = new JSONParser();
    Set<Cluster> clusterSet = new HashSet<Cluster>();
    HashMap<String, Tweet> tweets = new HashMap();
    FileWriter fw = new FileWriter(outFile.getAbsoluteFile());
    BufferedWriter bw = new BufferedWriter(fw);

    // init/*from  w ww. j  ava 2s  .  c o m*/
    try {

        Object obj = parser.parse(new FileReader(args[2]));

        JSONArray jsonArray = (JSONArray) obj;

        for (int i = 0; i < jsonArray.size(); i++) {

            Tweet twt = new Tweet();
            JSONObject jObj = (JSONObject) jsonArray.get(i);
            String text = jObj.get("text").toString();

            long sum = 0;
            for (int y = 0; y < text.toCharArray().length; y++) {

                sum += (int) text.toCharArray()[y];
            }

            String[] token = text.split(" ");
            String tID = jObj.get("id").toString();

            Set<String> mySet = new HashSet<String>(Arrays.asList(token));
            twt.setAttributeValue(sum);
            twt.setText(mySet);
            twt.setTweetID(tID);
            tweets.put(tID, twt);

        }

        // preparing initial clusters
        int i = 0;
        while (s.hasNext()) {
            String id = s.next();// id
            Tweet t = tweets.get(id.trim());
            clusterSet.add(new Cluster(i + 1, t, new LinkedList()));
            i++;
        }

        Iterator it = tweets.entrySet().iterator();

        for (int l = 0; l < 2; l++) { // limit to 25 iterations

            while (it.hasNext()) {
                Map.Entry me = (Map.Entry) it.next();

                // calculate distance to each centroid
                Tweet p = (Tweet) me.getValue();
                HashMap<Cluster, Float> distMap = new HashMap();

                for (Cluster clust : clusterSet) {

                    distMap.put(clust, jaccardDistance(p.getText(), clust.getCentroid().getText()));
                }

                HashMap<Cluster, Float> sorted = (HashMap<Cluster, Float>) sortByValue(distMap);

                sorted.keySet().iterator().next().getMembers().add(p);

            }

            // calculate new centroid and update Clusterset
            for (Cluster clust : clusterSet) {

                TreeMap<String, Long> tDistMap = new TreeMap();

                Tweet newCentroid = null;
                Long avgSumDist = new Long(0);
                for (int j = 0; j < clust.getMembers().size(); j++) {

                    avgSumDist += clust.getMembers().get(j).getAttributeValue();
                    tDistMap.put(clust.getMembers().get(j).getTweetID(),
                            clust.getMembers().get(j).getAttributeValue());
                }
                if (clust.getMembers().size() != 0) {
                    avgSumDist /= (clust.getMembers().size());
                }

                ArrayList<Long> listValues = new ArrayList<Long>(tDistMap.values());

                if (tDistMap.containsValue(findClosestNumber(listValues, avgSumDist))) {
                    // found closest
                    newCentroid = tweets
                            .get(getKeyByValue(tDistMap, findClosestNumber(listValues, avgSumDist)));
                    clust.setCentroid(newCentroid);
                }

            }

        }
        // create an iterator
        Iterator iterator = clusterSet.iterator();

        // check values
        while (iterator.hasNext()) {

            Cluster c = (Cluster) iterator.next();
            bw.write(c.getId() + "\t");
            System.out.print(c.getId() + "\t");

            for (Tweet t : c.getMembers()) {
                bw.write(t.getTweetID() + ", ");
                System.out.print(t.getTweetID() + ",");

            }
            bw.write("\n");
            System.out.println("");
        }

        System.out.println("");

        System.out.println("SSE " + sumSquaredErrror(clusterSet));

    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        bw.close();
        fw.close();
    }
}

From source file:ohtu.Poytasaha.java

/**
 * @param args the command line arguments
 *//*from ww w .  j a v  a2 s.  co m*/
public static void main(String[] args) {
    //        // TODO code application logic here
    //        ApplicationContext ctx = new FileSystemXmlApplicationContext("src/main/resources/spring-context.xml");
    //        Poytasaha poytasaha = (Poytasaha) ctx.getBean("poytasaha");
    //        poytasaha.run();

    //        Scanner lukija = new Scanner(System.in);
    ConsoleIO io = new ConsoleIO(new Scanner(System.in));
    FileReferenceDao dao = new FileReferenceDao();
    UI ui = new UI(io, dao);

    ui.run();

}

From source file:OpenDataExtractor.java

public static void main(String[] args) {

    System.out.println("\nSeleziona in che campo fare la ricerca: ");
    System.out.println("Elenco completo delle gare in formato (1)"); // cc16106a-1a65-4c34-af13-cc045d181452
    System.out.println("Composizione delle commissioni giudicatrici (2)"); // c90f1ffb-c315-4f59-b0e3-b0f2f8709127
    System.out.println("Registro delle imprese escluse dalle gare (3)"); // 2ea798cc-1f52-4fc8-a28e-f92a6f409cb8
    System.out.println("Registro delle imprese invitate alle gare (4)"); // a124b6af-ae31-428a-8ac5-bb341feb3c46
    System.out.println("Registro delle imprese che hanno partecipato alle gare (5)");// e58396cf-1145-4cb1-84a4-34311238a0c6
    System.out.println("Anagrafica completa dei contratti per l'acquisizione di beni e servizi (6)"); // aa6a8664-5ef5-43eb-a563-910e25161798
    System.out.println("Fornitori (7)"); // 253c8ac9-8335-4425-84c5-4a90be863c00
    System.out.println("Autorizzazioni subappalti per i lavori  (8)"); // 4f9ba542-5768-4b39-a92a-450c45eabd5d
    System.out.println("Aggiudicazioni delle gare per i lavori (9)"); // 34e298ad-3a99-4feb-9614-b9c4071b9d8e
    System.out.println("Dati cruscotto lavori per area (10)"); // 1ee3ea1b-58e3-48bf-8eeb-36ac313eeaf8
    System.out.println("Dati cruscotto lavori per lotto (11)"); // cbededce-269f-48d2-8c25-2359bf246f42
    int count = 0;
    int scelta;//  w  w w.  ja  v  a  2s.  c o m
    String id_ref = "";
    Scanner scanner;

    try {

        do {
            scanner = new Scanner(System.in);
            scelta = scanner.nextInt();
            switch (scelta) {

            case 1:
                id_ref = "cc16106a-1a65-4c34-af13-cc045d181452&q=";
                break;
            case 2:
                id_ref = "c90f1ffb-c315-4f59-b0e3-b0f2f8709127&q=";
                break;
            case 3:
                id_ref = "2ea798cc-1f52-4fc8-a28e-f92a6f409cb8&q=";
                break;
            case 4:
                id_ref = "a124b6af-ae31-428a-8ac5-bb341feb3c46&q=";
                break;
            case 5:
                id_ref = "e58396cf-1145-4cb1-84a4-34311238a0c6&q=";
                break;
            case 6:
                id_ref = "aa6a8664-5ef5-43eb-a563-910e25161798&q=";
                break;
            case 7:
                id_ref = "253c8ac9-8335-4425-84c5-4a90be863c00&q=";
                break;
            case 8:
                id_ref = "4f9ba542-5768-4b39-a92a-450c45eabd5d&q=";
                break;
            case 9:
                id_ref = "34e298ad-3a99-4feb-9614-b9c4071b9d8e&q=";
                break;
            case 10:
                id_ref = "1ee3ea1b-58e3-48bf-8eeb-36ac313eeaf8&q=";
                break;
            case 11:
                id_ref = "cbededce-269f-48d2-8c25-2359bf246f42&q=";
                break;
            default:
                System.out.println("Numero non selezionabile");
                System.out.println("Reinserisci");
                break;

            }
        } while (scelta <= 0 || scelta > 11);

        scanner = new Scanner(System.in);

        System.out.println("Inserisci un parametro di ricerca: ");
        String record = scanner.nextLine();
        String limit = "&limit=10000";
        System.out.println("id di riferimento: " + id_ref);
        System.out.println("___________________________");
        String requestString = "http://dati.openexpo2015.it/catalog/api/action/datastore_search?resource_id="
                + id_ref + record + limit;
        HttpClient client = HttpClientBuilder.create().build();
        HttpGet request = new HttpGet(requestString);
        HttpResponse response = client.execute(request);

        BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
        String result = "";
        String resline = "";
        while ((resline = rd.readLine()) != null) {
            result += resline;
        }
        if (result != null) {
            JSONObject jsonObject = new JSONObject(result);
            JSONObject resultJson = (JSONObject) jsonObject.get("result");
            JSONArray resultJsonFields = (JSONArray) resultJson.get("fields");
            ArrayList<TypeFields> type = new ArrayList<TypeFields>();
            TypeFields type1;
            JSONObject temp;

            while (count < resultJsonFields.length()) {

                temp = (JSONObject) resultJsonFields.get(count);
                type1 = new TypeFields(temp.getString("id"), temp.getString("type"));
                type.add(type1);
                count++;
            }

            JSONArray arr = (JSONArray) resultJson.get("records");
            count = 0;

            while (count < arr.length()) {
                System.out.println("Entry numero: " + count);
                temp = (JSONObject) arr.get(count);
                for (TypeFields temp2 : type) {
                    System.out.println(temp2.nameType + ": " + temp.get(temp2.nameType));
                }
                count++;
                System.out.println("--------------------------");

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

}

From source file:examples.SubnetUtilsExample.java

public static void main(String[] args) {
    String subnet = "192.168.0.1/29";
    SubnetUtils utils = new SubnetUtils(subnet);
    SubnetInfo info = utils.getInfo();/*w  ww  .ja  v a2 s.co  m*/

    System.out.printf("Subnet Information for %s:\n", subnet);
    System.out.println("--------------------------------------");
    System.out.printf("IP Address:\t\t\t%s\t[%s]\n", info.getAddress(),
            Integer.toBinaryString(info.asInteger(info.getAddress())));
    System.out.printf("Netmask:\t\t\t%s\t[%s]\n", info.getNetmask(),
            Integer.toBinaryString(info.asInteger(info.getNetmask())));
    System.out.printf("CIDR Representation:\t\t%s\n\n", info.getCidrSignature());

    System.out.printf("Supplied IP Address:\t\t%s\n\n", info.getAddress());

    System.out.printf("Network Address:\t\t%s\t[%s]\n", info.getNetworkAddress(),
            Integer.toBinaryString(info.asInteger(info.getNetworkAddress())));
    System.out.printf("Broadcast Address:\t\t%s\t[%s]\n", info.getBroadcastAddress(),
            Integer.toBinaryString(info.asInteger(info.getBroadcastAddress())));
    System.out.printf("First Usable Address:\t\t%s\t[%s]\n", info.getLowAddress(),
            Integer.toBinaryString(info.asInteger(info.getLowAddress())));
    System.out.printf("Last Usable Address:\t\t%s\t[%s]\n", info.getHighAddress(),
            Integer.toBinaryString(info.asInteger(info.getHighAddress())));

    System.out.printf("Total usable addresses: \t%d\n", info.getAddressCount());
    System.out.printf("Address List: %s\n\n", Arrays.toString(info.getAllAddresses()));

    final String prompt = "Enter an IP address (e.g. 192.168.0.10):";
    System.out.println(prompt);
    Scanner scanner = new Scanner(System.in);
    while (scanner.hasNextLine()) {
        String address = scanner.nextLine();
        System.out.println("The IP address [" + address + "] is " + (info.isInRange(address) ? "" : "not ")
                + "within the subnet [" + subnet + "]");
        System.out.println(prompt);
    }

}

From source file:examples.cidr.SubnetUtilsExample.java

public static void main(String[] args) {
    String subnet = "192.168.0.3/31";
    SubnetUtils utils = new SubnetUtils(subnet);
    SubnetInfo info = utils.getInfo();//  w w  w . j a  v a 2 s.c o m

    System.out.printf("Subnet Information for %s:\n", subnet);
    System.out.println("--------------------------------------");
    System.out.printf("IP Address:\t\t\t%s\t[%s]\n", info.getAddress(),
            Integer.toBinaryString(info.asInteger(info.getAddress())));
    System.out.printf("Netmask:\t\t\t%s\t[%s]\n", info.getNetmask(),
            Integer.toBinaryString(info.asInteger(info.getNetmask())));
    System.out.printf("CIDR Representation:\t\t%s\n\n", info.getCidrSignature());

    System.out.printf("Supplied IP Address:\t\t%s\n\n", info.getAddress());

    System.out.printf("Network Address:\t\t%s\t[%s]\n", info.getNetworkAddress(),
            Integer.toBinaryString(info.asInteger(info.getNetworkAddress())));
    System.out.printf("Broadcast Address:\t\t%s\t[%s]\n", info.getBroadcastAddress(),
            Integer.toBinaryString(info.asInteger(info.getBroadcastAddress())));
    System.out.printf("Low Address:\t\t\t%s\t[%s]\n", info.getLowAddress(),
            Integer.toBinaryString(info.asInteger(info.getLowAddress())));
    System.out.printf("High Address:\t\t\t%s\t[%s]\n", info.getHighAddress(),
            Integer.toBinaryString(info.asInteger(info.getHighAddress())));

    System.out.printf("Total usable addresses: \t%d\n", Integer.valueOf(info.getAddressCount()));
    System.out.printf("Address List: %s\n\n", Arrays.toString(info.getAllAddresses()));

    final String prompt = "Enter an IP address (e.g. 192.168.0.10):";
    System.out.println(prompt);
    Scanner scanner = new Scanner(System.in);
    while (scanner.hasNextLine()) {
        String address = scanner.nextLine();
        System.out.println("The IP address [" + address + "] is " + (info.isInRange(address) ? "" : "not ")
                + "within the subnet [" + subnet + "]");
        System.out.println(prompt);
    }

}

From source file:example.wildcard.Client.java

public static void main(String[] args) {
    String url = BROKER_URL;
    if (args.length > 0) {
        url = args[0].trim();//from w ww  .j  av a  2s. c om
    }
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
    Connection connection = null;

    try {
        Topic senderTopic = new ActiveMQTopic(System.getProperty("topicName"));

        connection = connectionFactory.createConnection("admin", "password");

        Session senderSession = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
        MessageProducer sender = senderSession.createProducer(senderTopic);

        Session receiverSession = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);

        String policyType = System.getProperty("wildcard", ".*");
        String receiverTopicName = senderTopic.getTopicName() + policyType;
        Topic receiverTopic = receiverSession.createTopic(receiverTopicName);

        MessageConsumer receiver = receiverSession.createConsumer(receiverTopic);
        receiver.setMessageListener(new MessageListener() {
            public void onMessage(Message message) {
                try {
                    if (message instanceof TextMessage) {
                        String text = ((TextMessage) message).getText();
                        System.out.println("We received a new message: " + text);
                    }
                } catch (JMSException e) {
                    System.out.println("Could not read the receiver's topic because of a JMSException");
                }
            }
        });

        connection.start();
        System.out.println("Listening on '" + receiverTopicName + "'");
        System.out.println("Enter a message to send: ");

        Scanner inputReader = new Scanner(System.in);

        while (true) {
            String line = inputReader.nextLine();
            if (line == null) {
                System.out.println("Done!");
                break;
            } else if (line.length() > 0) {
                try {
                    TextMessage message = senderSession.createTextMessage();
                    message.setText(line);
                    System.out.println("Sending a message: " + message.getText());
                    sender.send(message);
                } catch (JMSException e) {
                    System.out.println("Exception during publishing a message: ");
                }
            }
        }

        receiver.close();
        receiverSession.close();
        sender.close();
        senderSession.close();

    } catch (Exception e) {
        System.out.println("Caught exception!");
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (JMSException e) {
                System.out.println("When trying to close connection: ");
            }
        }
    }

}

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  va2s  .  co  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:URLConnectionTest.java

public static void main(String[] args) {
    try {// ww w.j  ava  2s  .  c o m
        String urlName;
        if (args.length > 0)
            urlName = args[0];
        else
            urlName = "http://java.sun.com";

        URL url = new URL(urlName);
        URLConnection connection = url.openConnection();

        // set username, password if specified on command line

        if (args.length > 2) {
            String username = args[1];
            String password = args[2];
            String input = username + ":" + password;
            String encoding = base64Encode(input);
            connection.setRequestProperty("Authorization", "Basic " + encoding);
        }

        connection.connect();

        // print header fields

        Map<String, List<String>> headers = connection.getHeaderFields();
        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
            String key = entry.getKey();
            for (String value : entry.getValue())
                System.out.println(key + ": " + value);
        }

        // print convenience functions

        System.out.println("----------");
        System.out.println("getContentType: " + connection.getContentType());
        System.out.println("getContentLength: " + connection.getContentLength());
        System.out.println("getContentEncoding: " + connection.getContentEncoding());
        System.out.println("getDate: " + connection.getDate());
        System.out.println("getExpiration: " + connection.getExpiration());
        System.out.println("getLastModifed: " + connection.getLastModified());
        System.out.println("----------");

        Scanner in = new Scanner(connection.getInputStream());

        // print first ten lines of contents

        for (int n = 1; in.hasNextLine() && n <= 10; n++)
            System.out.println(in.nextLine());
        if (in.hasNextLine())
            System.out.println(". . .");
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:edu.usf.cutr.obascs.OBASCSMain.java

public static void main(String[] args) {

    String logLevel = null;//from   w w w  .j a  va  2  s  . c  o  m
    String outputFilePath = null;
    String inputFilePath = null;
    String spreadSheetId = null;
    Logger logger = Logger.getInstance();

    Options options = CommandLineUtil.createCommandLineOptions();
    CommandLineParser parser = new BasicParser();
    CommandLine cmd;
    try {
        cmd = parser.parse(options, args);
        logLevel = CommandLineUtil.getLogLevel(cmd);
        logger.setup(logLevel);
        outputFilePath = CommandLineUtil.getOutputPath(cmd);
        spreadSheetId = CommandLineUtil.getSpreadSheetId(cmd);

        inputFilePath = CommandLineUtil.getInputPath(cmd);
    } catch (ParseException e1) {
        logger.logError(e1);
    } catch (FileNotFoundException e) {
        logger.logError(e);
    }

    Map<String, String> agencyMap = null;
    try {
        agencyMap = FileUtil.readAgencyInformantions(inputFilePath);
    } catch (IOException e1) {
        logger.logError(e1);
    }

    logger.log("Consolidation started...");
    logger.log("Trying as public url");

    ListFeed listFeed = null;
    Boolean authRequired = false;
    try {
        listFeed = SpreadSheetReader.readPublicSpreadSheet(spreadSheetId);
    } catch (IOException e) {
        logger.logError(e);
    } catch (ServiceException e) {
        logger.log("Authentication Required");
        authRequired = true;
    }

    if (listFeed == null && authRequired == true) {
        Scanner scanner = new Scanner(System.in);
        String userName, password;
        logger.log("UserName:");
        userName = scanner.nextLine();
        logger.log("Password:");
        password = scanner.nextLine();
        scanner.close();

        try {
            listFeed = SpreadSheetReader.readPrivateSpreadSheet(userName, password, spreadSheetId);
        } catch (IOException e) {
            logger.logError(e);
        } catch (ServiceException e) {
            logger.logError(e);
        }
    }

    if (listFeed != null) {
        //Creating consolidated stops
        String consolidatedString = FileConsolidator.consolidateFile(listFeed, agencyMap);
        try {
            FileUtil.writeToFile(consolidatedString, outputFilePath);
        } catch (FileNotFoundException e) {
            logger.logError(e);
        }

        //Creating sample stop consolidation script config file
        try {
            String path = ClassLoader.getSystemClassLoader()
                    .getResource(GeneralConstants.CONSOLIDATION_SCRIPT_CONFIG_FILE).getPath();
            String configXml = FileUtil.readFile(URLUtil.trimSpace(path));
            configXml = ConfigFileGenerator.generateStopConsolidationScriptConfigFile(configXml, agencyMap);
            path = URLUtil.trimPath(outputFilePath) + "/" + GeneralConstants.CONSOLIDATION_SCRIPT_CONFIG_FILE;
            FileUtil.writeToFile(configXml, path);
        } catch (IOException e) {
            logger.logError(e);
        }

        //Creating sample real-time config file
        try {
            String path = ClassLoader.getSystemClassLoader()
                    .getResource(GeneralConstants.SAMPLE_REALTIME_CONFIG_FILE).getPath();
            String configXml = FileUtil.readFile(URLUtil.trimSpace(path));
            configXml = ConfigFileGenerator.generateSampleRealTimeConfigFile(configXml, agencyMap);
            path = URLUtil.trimPath(outputFilePath) + "/" + GeneralConstants.SAMPLE_REALTIME_CONFIG_FILE;
            FileUtil.writeToFile(configXml, path);
        } catch (IOException e) {
            logger.logError(e);
        }
    } else {
        logger.logError("Cannot write files");
    }

    logger.log("Consolidation finished...");

}