Search in sources :

Example 1 with ArgumentException

use of se.softhouse.jargo.ArgumentException in project exist by eXist-db.

the class ExportMain method main.

@SuppressWarnings("unchecked")
public static void main(final String[] args) {
    try {
        CompatibleJavaVersionCheck.checkForCompatibleJavaVersion();
        final ParsedArguments arguments = CommandLineParser.withArguments(noCheckArg, checkDocsArg, directAccessArg, exportArg, noExportArg, incrementalArg, zipArg, noZipArg).andArguments(configArg, outputDirArg).andArguments(helpArg, verboseArg).parse(args);
        process(arguments);
    } catch (final StartException e) {
        if (e.getMessage() != null && !e.getMessage().isEmpty()) {
            System.err.println(e.getMessage());
        }
        System.exit(e.getErrorCode());
    } catch (final ArgumentException e) {
        System.out.println(e.getMessageAndUsage());
        System.exit(SystemExitCodes.INVALID_ARGUMENT_EXIT_CODE);
    }
}
Also used : StartException(org.exist.start.StartException) ArgumentException(se.softhouse.jargo.ArgumentException) ParsedArguments(se.softhouse.jargo.ParsedArguments)

Example 2 with ArgumentException

use of se.softhouse.jargo.ArgumentException in project exist by eXist-db.

the class JMXClient method main.

@SuppressWarnings("unchecked")
public static void main(final String[] args) {
    try {
        CompatibleJavaVersionCheck.checkForCompatibleJavaVersion();
        final ParsedArguments arguments = CommandLineParser.withArguments(addressArg, portArg, instanceArg, waitArg).andArguments(cacheDisplayArg, locksDisplayArg).andArguments(dbInfoArg, memoryInfoArg, sanityCheckInfoArg, jobsInfoArg).andArguments(helpArg).parse(args);
        process(arguments);
    } catch (final StartException e) {
        if (e.getMessage() != null && !e.getMessage().isEmpty()) {
            System.err.println(e.getMessage());
        }
        System.exit(e.getErrorCode());
    } catch (final ArgumentException e) {
        System.out.println(e.getMessageAndUsage());
        System.exit(SystemExitCodes.INVALID_ARGUMENT_EXIT_CODE);
    }
}
Also used : StartException(org.exist.start.StartException) ArgumentException(se.softhouse.jargo.ArgumentException) ParsedArguments(se.softhouse.jargo.ParsedArguments)

Example 3 with ArgumentException

use of se.softhouse.jargo.ArgumentException in project exist by eXist-db.

the class ServerShutdown method main.

@SuppressWarnings("unchecked")
public static void main(final String[] args) {
    try {
        CompatibleJavaVersionCheck.checkForCompatibleJavaVersion();
        final ParsedArguments arguments = CommandLineParser.withArguments(userArg, passwordArg, uriArg).andArguments(helpArg).parse(args);
        process(arguments);
    } catch (final StartException e) {
        if (e.getMessage() != null && !e.getMessage().isEmpty()) {
            System.err.println(e.getMessage());
        }
        System.exit(e.getErrorCode());
    } catch (final ArgumentException e) {
        System.out.println(e.getMessageAndUsage());
        System.exit(SystemExitCodes.INVALID_ARGUMENT_EXIT_CODE);
    }
}
Also used : StartException(org.exist.start.StartException) ArgumentException(se.softhouse.jargo.ArgumentException) ParsedArguments(se.softhouse.jargo.ParsedArguments)

Example 4 with ArgumentException

use of se.softhouse.jargo.ArgumentException in project exist by eXist-db.

the class BlobStoreDumpTool method main.

public static void main(final String[] args) throws IOException {
    try {
        CompatibleJavaVersionCheck.checkForCompatibleJavaVersion();
        final ParsedArguments arguments = CommandLineParser.withArguments(digestArg, persistentFileArg).andArguments(helpArg).parse(args);
        final DigestType digestType = arguments.get(digestArg);
        final Path persistentFile = arguments.get(persistentFileArg);
        final PrintStream printStream = System.out;
        dump(digestType, persistentFile, printStream);
    } catch (final StartException e) {
        if (e.getMessage() != null && !e.getMessage().isEmpty()) {
            System.err.println(e.getMessage());
        }
        System.exit(e.getErrorCode());
    } catch (final ArgumentException e) {
        System.out.println(e.getMessageAndUsage());
        System.exit(SystemExitCodes.INVALID_ARGUMENT_EXIT_CODE);
    }
}
Also used : Path(java.nio.file.Path) PrintStream(java.io.PrintStream) DigestType(org.exist.util.crypto.digest.DigestType) StartException(org.exist.start.StartException) ArgumentException(se.softhouse.jargo.ArgumentException) ParsedArguments(se.softhouse.jargo.ParsedArguments)

Aggregations

StartException (org.exist.start.StartException)4 ArgumentException (se.softhouse.jargo.ArgumentException)4 ParsedArguments (se.softhouse.jargo.ParsedArguments)4 PrintStream (java.io.PrintStream)1 Path (java.nio.file.Path)1 DigestType (org.exist.util.crypto.digest.DigestType)1