java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIStarter.java
changeset 5 5019e3e93a4e
parent 4 f3b4caf1d05d
child 11 f517bafcf812
     1.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIStarter.java	Sun Nov 16 21:59:13 2014 +0100
     1.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIStarter.java	Sun Nov 16 23:47:28 2014 +0100
     1.3 @@ -17,18 +17,35 @@
     1.4   */
     1.5  package cz.frantovo.copyImageResizer.cli;
     1.6  
     1.7 +import cz.frantovo.copyImageResizer.RecursiveException;
     1.8 +import cz.frantovo.copyImageResizer.RecursiveImageResizer;
     1.9 +import cz.frantovo.copyImageResizer.RecursiveOptions;
    1.10 +import cz.frantovo.copyImageResizer.ResizeException;
    1.11 +import java.util.logging.Level;
    1.12 +import java.util.logging.Logger;
    1.13 +
    1.14  /**
    1.15   *
    1.16   * @author Ing. František Kučera (frantovo.cz)
    1.17   */
    1.18  public class CLIStarter {
    1.19  
    1.20 -	/**
    1.21 -	 * @param args the command line arguments
    1.22 -	 */
    1.23 +	private static final Logger log = Logger.getLogger(CLIStarter.class.getName());
    1.24 +
    1.25  	public static void main(String[] args) {
    1.26 -		// TODO code application logic here
    1.27 -		System.out.println("TODO");
    1.28 +
    1.29 +		try {
    1.30 +			CLIParser parser = new CLIParser();
    1.31 +			RecursiveOptions options = parser.parseOptions(args);
    1.32 +			RecursiveImageResizer resizer = new RecursiveImageResizer();
    1.33 +			resizer.resize(options);
    1.34 +		} catch (CLIParserException e) {
    1.35 +			log.log(Level.SEVERE, "Unable to parse CLI options", e);
    1.36 +		} catch (RecursiveException e) {
    1.37 +			log.log(Level.SEVERE, "Error while processing filesystem hierarchy", e);
    1.38 +		} catch (ResizeException e) {
    1.39 +			log.log(Level.SEVERE, "Error while resizing image", e);
    1.40 +		}
    1.41  	}
    1.42 -	
    1.43 +
    1.44  }