public static void main()

in services/billing-aws/src/main/java/com/epam/datalab/BillingTool.java [122:175]


    public static void main(String[] args) throws InitializationException {
        if (ServiceUtils.printAppVersion(BillingServiceImpl.class, args)) {
            return;
        }

        String confName = null;
        String json = null;

        for (int i = 0; i < args.length; i++) {
            if (isKey("help", args[i])) {
                i++;
                Help.usage(i < args.length ? Arrays.copyOfRange(args, i, args.length) : null);
                return;
            } else if (isKey("conf", args[i])) {
                i++;
                if (i < args.length) {
                    confName = args[i];
                } else {
                    throw new InitializationException("Missing the name of configuration file");
                }
            } else if (isKey("json", args[i])) {
                i++;
                if (i < args.length) {
                    json = args[i];
                } else {
                    throw new InitializationException("Missing the content of json configuration");
                }
            } else {
                throw new InitializationException("Unknow argument: " + args[i]);
            }
        }

        if (confName == null && json == null) {
            Help.usage();
            throw new InitializationException("Missing arguments");
        }

        if (confName != null && json != null) {
            Help.usage();
            throw new InitializationException("Invalid arguments.");
        }

        setLoggerLevel();
        try {
            if (confName != null) {
                new BillingTool().run(confName);
            } else {
                JsonNode jsonNode = new ObjectMapper().valueToTree(json);
                new BillingTool().run(jsonNode);
            }
        } catch (Exception e) {
            throw new DatalabException("Billing tool failed", e);
        }
    }