001package com.ganteater.ae.desktop;
002
003import java.io.IOException;
004
005import org.apache.commons.lang.ArrayUtils;
006import org.apache.commons.lang.StringUtils;
007
008import com.ganteater.ae.ConfigConstants;
009import com.ganteater.ae.RecipeRunner;
010import com.ganteater.ae.TaskCancelingException;
011import com.ganteater.ae.desktop.ui.AEFrame;
012import com.ganteater.ae.util.AEUtils;
013
014/**
015 * Viktor_Tovstyi Date: Sep 7, 2006 Time: 10:24:58 AM
016 */
017public class Anteater {
018
019        public static void main(final String... args) throws IOException {
020
021                System.out.println("Starting Anteater Desktop Application - Version: " + AEUtils.getPrjProperty("application.version"));
022                
023                if (args.length > 0 && "/console".equalsIgnoreCase(args[0])) {
024                        String[] argStr = (String[]) ArrayUtils.subarray(args, 1, args.length);
025                        RecipeRunner.main(argStr);
026
027                } else {
028                        AEFrame theMainFrame = new AEFrame();
029                        try {
030                                System.setProperty(ConfigConstants.RECIPES_PARAM_NAME, StringUtils.join(args, ","));
031                                theMainFrame.start();
032                                for (String taskFileName : args) {
033                                        theMainFrame.runTask(taskFileName);
034                                }
035                        } catch (TaskCancelingException e) {
036                                System.exit(0);
037                        } 
038                }
039        }
040
041}