@SuppressWarnings("static-access")
	public static void main(String[] args) {
		// options contains the different options that can be added as
		// arguments to the program.
		Options options = new Options();
		options.addOption(OptionBuilder.hasArg().isRequired().withArgName("foursquare-venue-id-file-path").withDescription("Path to the file containing the ids of the Foursquare venues.").create("venidfile"));
		options.addOption(OptionBuilder.hasArg().isRequired().withArgName("foursquare-client-id").withDescription("Foursquare ID of the client.").create("clid"));
		options.addOption(OptionBuilder.hasArg().isRequired().withArgName("foursquare-secret-id").withDescription("Foursquare secret of the client.").create("clsecret"));
		options.addOption(OptionBuilder.hasArg().isRequired().withArgName("output-directory-path").withDescription("Path to the output directory.").create("output"));
		options.addOption("verbose", false, "Print information about the execution (optional).");
		
		try {
            CommandLineParser parser = new GnuParser();
            // Parsing of the program arguments.
        	CommandLine commandLine = parser.parse(options, args);
            
            String venueIdFilePath = commandLine.getOptionValue("venidfile");
            String clientId = commandLine.getOptionValue("clid");
            String clientSecret = commandLine.getOptionValue("clsecret");
            String outputDirectoryPath = commandLine.getOptionValue("output");
		
            boolean verbose = commandLine.hasOption("verbose");
            
            // Beginning of the execution.
            long beginTime = System.currentTimeMillis();
            
            Collection<String> foursquareVenueIds = getFoursquareVenueIds(venueIdFilePath);
            
            for (String foursquareVenueId : foursquareVenueIds) {
            	File foursquareVenueFile = new File(outputDirectoryPath + File.separator + foursquareVenueId);
            	if (!foursquareVenueFile.exists()) {
            		String jsonString = getFoursquareVenueById(foursquareVenueId, clientId, clientSecret);
            		FileUtils.write(foursquareVenueFile, jsonString);
            	}
            }
            
            // End of the execution.
            long endTime = System.currentTimeMillis();

            // Total execution time.
            float totalTime = endTime - beginTime;
            DecimalFormat decimalFormat = new DecimalFormat("0.000");
            if (verbose) {
            	System.out.println("Execution time: " + decimalFormat.format(totalTime/1000) + " second(s)");
            }
		} catch(ParseException exception) {
			System.out.print("Parsing error: ");
			System.out.println(exception.getMessage());

			// Displaying the usage.
			HelpFormatter formatter = new HelpFormatter();
			formatter.printHelp("java -jar foursquare-venue-fetcher.jar", options);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}