franta-hg@2
|
1 |
/**
|
franta-hg@2
|
2 |
* copy-image-resizer
|
franta-hg@2
|
3 |
* Copyright © 2014 František Kučera (frantovo.cz)
|
franta-hg@2
|
4 |
*
|
franta-hg@2
|
5 |
* This program is free software: you can redistribute it and/or modify
|
franta-hg@2
|
6 |
* it under the terms of the GNU General Public License as published by
|
franta-hg@2
|
7 |
* the Free Software Foundation, either version 3 of the License, or
|
franta-hg@2
|
8 |
* (at your option) any later version.
|
franta-hg@2
|
9 |
*
|
franta-hg@2
|
10 |
* This program is distributed in the hope that it will be useful,
|
franta-hg@2
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
franta-hg@2
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
franta-hg@2
|
13 |
* GNU General Public License for more details.
|
franta-hg@2
|
14 |
*
|
franta-hg@2
|
15 |
* You should have received a copy of the GNU General Public License
|
franta-hg@2
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
franta-hg@2
|
17 |
*/
|
franta-hg@4
|
18 |
package cz.frantovo.copyImageResizer.cli;
|
franta-hg@2
|
19 |
|
franta-hg@5
|
20 |
import cz.frantovo.copyImageResizer.RecursiveException;
|
franta-hg@5
|
21 |
import cz.frantovo.copyImageResizer.RecursiveImageResizer;
|
franta-hg@5
|
22 |
import cz.frantovo.copyImageResizer.RecursiveOptions;
|
franta-hg@5
|
23 |
import cz.frantovo.copyImageResizer.ResizeException;
|
franta-hg@5
|
24 |
import java.util.logging.Level;
|
franta-hg@5
|
25 |
import java.util.logging.Logger;
|
franta-hg@5
|
26 |
|
franta-hg@2
|
27 |
/**
|
franta-hg@2
|
28 |
*
|
franta-hg@2
|
29 |
* @author Ing. František Kučera (frantovo.cz)
|
franta-hg@2
|
30 |
*/
|
franta-hg@3
|
31 |
public class CLIStarter {
|
franta-hg@2
|
32 |
|
franta-hg@5
|
33 |
private static final Logger log = Logger.getLogger(CLIStarter.class.getName());
|
franta-hg@5
|
34 |
|
franta-hg@2
|
35 |
public static void main(String[] args) {
|
franta-hg@5
|
36 |
|
franta-hg@5
|
37 |
try {
|
franta-hg@5
|
38 |
CLIParser parser = new CLIParser();
|
franta-hg@5
|
39 |
RecursiveOptions options = parser.parseOptions(args);
|
franta-hg@5
|
40 |
RecursiveImageResizer resizer = new RecursiveImageResizer();
|
franta-hg@5
|
41 |
resizer.resize(options);
|
franta-hg@5
|
42 |
} catch (CLIParserException e) {
|
franta-hg@5
|
43 |
log.log(Level.SEVERE, "Unable to parse CLI options", e);
|
franta-hg@5
|
44 |
} catch (RecursiveException e) {
|
franta-hg@5
|
45 |
log.log(Level.SEVERE, "Error while processing filesystem hierarchy", e);
|
franta-hg@5
|
46 |
} catch (ResizeException e) {
|
franta-hg@5
|
47 |
log.log(Level.SEVERE, "Error while resizing image", e);
|
franta-hg@5
|
48 |
}
|
franta-hg@2
|
49 |
}
|
franta-hg@5
|
50 |
|
franta-hg@2
|
51 |
}
|