protected final void normalizeOptionName(final String primaryOptionName, final String... alternateOptionName) { requireNonNull(primaryOptionName, "No option name provided"); final List<String> optionNames = new ArrayList<>(); optionNames.add(primaryOptionName); if (alternateOptionName != null) { optionNames.addAll(Arrays.asList(alternateOptionName)); } Collections.reverse(optionNames); String value = null; boolean foundValue = false; for (final String optionName: optionNames) { if (config.hasValue(optionName)) { value = config.get(optionName); foundValue = true; } config.remove(optionName); } if (foundValue) { config.put(primaryOptionName, value); } }
protected final void normalizeOptionName(final String primaryOptionName, final String... alternateOptionName) { requireNonNull(primaryOptionName, "No option name provided"); final List<String> optionNames = new ArrayList<>(); optionNames.add(primaryOptionName); if (alternateOptionName != null) { optionNames.addAll(Arrays.asList(alternateOptionName)); } Collections.reverse(optionNames); String value = null; boolean foundValue = false; for (final String optionName: optionNames) { if (config.hasValue(optionName)) { value = config.get(optionName); foundValue = true; } config.remove(optionName); } if (foundValue) { config.put(primaryOptionName, value); } }
@Override public void loadConfig() throws SchemaCrawlerException { super.loadConfig(); if (config.hasValue(HOST)) { config.put(HOST, config.getStringValue(HOST, "")); } if (config.hasValue(PORT)) { config.put(PORT, String.valueOf(config.getIntegerValue(PORT, 0))); } if (config.hasValue(DATABASE)) { config.put(DATABASE, config.getStringValue(DATABASE, "")); } if (config.hasValue(URLX)) { config.put(URLX, config.getStringValue(URLX, "")); } }
@Override public void loadConfig() throws SchemaCrawlerException { super.loadConfig(); if (config.hasValue(HOST)) { config.put(HOST, config.getStringValue(HOST, "")); } if (config.hasValue(PORT)) { config.put(PORT, String.valueOf(config.getIntegerValue(PORT, 0))); } if (config.hasValue(DATABASE)) { config.put(DATABASE, config.getStringValue(DATABASE, "")); } if (config.hasValue(URLX)) { config.put(URLX, config.getStringValue(URLX, "")); } }
private String getPassword() { final String password; if (config.hasValue(PASSWORD)) { password = config.getStringValue(PASSWORD, null); } else { password = promptForPassword(); } config.remove(PASSWORD); return password; }
private String getPassword() { final String password; if (config.hasValue(PASSWORD)) { password = config.getStringValue(PASSWORD, null); } else { password = promptForPassword(); } config.remove(PASSWORD); return password; }
@Override public void loadConfig() throws SchemaCrawlerException { super.loadConfig(); if (config.hasValue(URL)) { config.put(URL, config.getStringValue(URL, null)); } final String connectionUrl = config.getStringValue(URL, null); if (isBlank(connectionUrl)) { throw new SchemaCrawlerCommandLineException("Please provde a database connection URL"); } }
@Override public void loadConfig() throws SchemaCrawlerException { super.loadConfig(); if (config.hasValue(URL)) { config.put(URL, config.getStringValue(URL, null)); } final String connectionUrl = config.getStringValue(URL, null); if (isBlank(connectionUrl)) { throw new SchemaCrawlerCommandLineException("Please provde a database connection URL"); } }
if (config.hasValue("noinfo")) consumeOption("noinfo"); if (config.hasValue("noremarks")) consumeOption("noremarks"); if (config.hasValue("weakassociations")) consumeOption("weakassociations"); if (config.hasValue("sorttables")) consumeOption("sorttables"); if (config.hasValue("sortcolumns")) consumeOption("sortcolumns"); if (config.hasValue("sortinout")) consumeOption("sortinout"); if (config.hasValue("portablenames"))
if (config.hasValue("noinfo")) consumeOption("noinfo"); if (config.hasValue("noremarks")) consumeOption("noremarks"); if (config.hasValue("weakassociations")) consumeOption("weakassociations"); if (config.hasValue("sorttables")) consumeOption("sorttables"); if (config.hasValue("sortcolumns")) consumeOption("sortcolumns"); if (config.hasValue("sortinout")) consumeOption("sortinout"); if (config.hasValue("portablenames"))
if (dbServerType.isUnknownDatabaseSystem() || config.hasValue("url"))
@Override public DatabaseConnector getOptions() throws SchemaCrawlerException { final DatabaseConnectorRegistry registry = new DatabaseConnectorRegistry(); final String databaseSystemIdentifier = config.getStringValue(SERVER, null); if (config.hasValue(SERVER) && !registry.hasDatabaseSystemIdentifier(databaseSystemIdentifier)) { throw new SchemaCrawlerCommandLineException(String .format("Unsupported server <%s> %n" + "Please provide a database connection URL on the command-line, %n" + "and re-run SchemaCrawler without the -server argument", databaseSystemIdentifier)); } final DatabaseConnector dbConnector; if (databaseSystemIdentifier != null) { dbConnector = registry.lookupDatabaseConnector(databaseSystemIdentifier); consumeOption(SERVER); } else { final String connectionUrl = config.getStringValue(URL, null); dbConnector = registry.lookupDatabaseConnectorFromUrl(connectionUrl); // NOTE: Do not consume URL option, since it is needed later } return dbConnector; }
@Override public DatabaseConnector getOptions() throws SchemaCrawlerException { final DatabaseConnectorRegistry registry = new DatabaseConnectorRegistry(); final String databaseSystemIdentifier = config.getStringValue(SERVER, null); if (config.hasValue(SERVER) && !registry.hasDatabaseSystemIdentifier(databaseSystemIdentifier)) { throw new SchemaCrawlerCommandLineException(String .format("Unsupported server <%s> %n" + "Please provide a database connection URL on the command-line, %n" + "and re-run SchemaCrawler without the -server argument", databaseSystemIdentifier)); } final DatabaseConnector dbConnector; if (databaseSystemIdentifier != null) { dbConnector = registry.lookupDatabaseConnector(databaseSystemIdentifier); consumeOption(SERVER); } else { final String connectionUrl = config.getStringValue(URL, null); dbConnector = registry.lookupDatabaseConnectorFromUrl(connectionUrl); // NOTE: Do not consume URL option, since it is needed later } return dbConnector; }
/** * Parse connection options, for both ways of connecting. * * @param dbServerType * Database server type */ private UserCredentials parseConnectionOptions() throws SchemaCrawlerException { final BaseDatabaseConnectionOptionsParser dbConnectionOptionsParser; if (databaseConnector.isUnknownDatabaseSystem() || config.hasValue("url")) { dbConnectionOptionsParser = new CommandLineConnectionOptionsParser(config); } else { dbConnectionOptionsParser = new BundledDriverConnectionOptionsParser(config); } dbConnectionOptionsParser.loadConfig(); config.putAll(dbConnectionOptionsParser.getOptions()); final UserCredentials userCredentials = dbConnectionOptionsParser .getUserCredentials(); return userCredentials; }
/** * Parse connection options, for both ways of connecting. * * @param dbServerType * Database server type */ private UserCredentials parseConnectionOptions() throws SchemaCrawlerException { final BaseDatabaseConnectionOptionsParser dbConnectionOptionsParser; if (databaseConnector.isUnknownDatabaseSystem() || config.hasValue("url")) { dbConnectionOptionsParser = new CommandLineConnectionOptionsParser(config); } else { dbConnectionOptionsParser = new BundledDriverConnectionOptionsParser(config); } dbConnectionOptionsParser.loadConfig(); config.putAll(dbConnectionOptionsParser.getOptions()); final UserCredentials userCredentials = dbConnectionOptionsParser .getUserCredentials(); return userCredentials; }
if (config.hasValue("title")) if (config.hasValue("infolevel")) if (config.hasValue("schemas")) if (config.hasValue("tabletypes")) if (config.hasValue("tables")) if (config.hasValue("excludecolumns")) if (config.hasValue("routinetypes")) if (config.hasValue("routines")) if (config.hasValue("excludeinout")) if (config.hasValue("synonyms")) if (config.hasValue("sequences")) if (config.hasValue("invert-match")) if (config.hasValue("only-matching")) if (config.hasValue("grepcolumns")) if (config.hasValue("grepinout"))
if (config.hasValue("title")) if (config.hasValue("infolevel")) if (config.hasValue("schemas")) if (config.hasValue("tabletypes")) if (config.hasValue("tables")) if (config.hasValue("excludecolumns")) if (config.hasValue("routinetypes")) if (config.hasValue("routines")) if (config.hasValue("excludeinout")) if (config.hasValue("synonyms")) if (config.hasValue("sequences")) if (config.hasValue("invert-match")) if (config.hasValue("only-matching")) if (config.hasValue("grepcolumns")) if (config.hasValue("grepinout"))
|| config.hasValue("url"))