001package com.quorum.tessera.config.migration;
002
003import com.quorum.tessera.cli.CliResult;
004import com.quorum.tessera.cli.CliType;
005import com.quorum.tessera.cli.parsers.ConfigConverter;
006import com.quorum.tessera.config.Config;
007import picocli.CommandLine;
008
009public class Main {
010
011    public static void main(String... args) {
012        System.setProperty("javax.xml.bind.JAXBContextFactory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
013        System.setProperty("javax.xml.bind.context.factory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
014        System.setProperty(CliType.CLI_TYPE_KEY, CliType.CONFIG_MIGRATION.name());
015        try {
016            final CommandLine commandLine = new CommandLine(new LegacyCliAdapter());
017            commandLine
018                    .registerConverter(Config.class, new ConfigConverter())
019                    .setSeparator(" ")
020                    .setCaseInsensitiveEnumValuesAllowed(true);
021
022            commandLine.execute(args);
023            final CliResult cliResult = commandLine.getExecutionResult();
024
025            System.exit(cliResult.getStatus());
026        } catch (final Exception ex) {
027            System.err.println(ex.toString());
028            System.exit(1);
029        }
030    }
031}