001package fr.ifremer.adagio.synchro;
002
003/*
004 * #%L
005 * SIH-Adagio :: Core for Allegro
006 * $Id:$
007 * $HeadURL:$
008 * %%
009 * Copyright (C) 2012 - 2014 Ifremer
010 * %%
011 * This program is free software: you can redistribute it and/or modify
012 * it under the terms of the GNU Affero General Public License as published by
013 * the Free Software Foundation, either version 3 of the License, or
014 * (at your option) any later version.
015 * 
016 * This program is distributed in the hope that it will be useful,
017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019 * GNU General Public License for more details.
020 * 
021 * You should have received a copy of the GNU Affero General Public License
022 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
023 * #L%
024 */
025
026import java.util.Arrays;
027
028import org.apache.commons.io.IOUtils;
029import org.apache.commons.logging.Log;
030import org.apache.commons.logging.LogFactory;
031
032import fr.ifremer.adagio.synchro.config.SynchroConfiguration;
033
034public class RunSynchro {
035
036    /* Logger */
037    private static final Log log = LogFactory.getLog(RunSynchro.class);
038
039    public static final int DELETE_DB_EXIT_CODE = 89;
040
041    public static final int UPATE_EXIT_CODE = 88;
042
043    public static final int NORMAL_EXIT_CODE = 0;
044
045    public static void main(String[] args) {
046        if (log.isInfoEnabled()) {
047            log.info("Starting SIH-Adagio :: Synchro with arguments: " + Arrays.toString(args));
048        }
049
050        // By default, display help
051        if (args == null || args.length == 0) {
052            args = new String[] { "-h" };
053        }
054
055        // Create configuration
056        SynchroConfiguration config = new SynchroConfiguration("synchro.config", args);
057        SynchroConfiguration.setInstance(config);
058
059        try {
060            config.getApplicationConfig().doAllAction();
061        } catch (Exception e) {
062            e.printStackTrace();
063        }
064    }
065}