public void setPort(final int port) { if (port > 0) { connectionProperties.put(PORT, String.valueOf(port)); } else { LOGGER.log(Level.WARNING, new StringFormat("Cannot connect to port, %d", port)); } }
@Override public String toString() { return get(); }
private void logOverride(final String inclusionRuleName, final InclusionRule schemaInclusionRule) { LOGGER .log(Level.INFO, new StringFormat("Overriding %s inclusion rule from command-line to %s", inclusionRuleName, schemaInclusionRule)); }
@Override public String toString() { return get(); }
private void logOverride(final String inclusionRuleName, final InclusionRule schemaInclusionRule) { LOGGER .log(Level.INFO, new StringFormat("Overriding %s inclusion rule from command-line to %s", inclusionRuleName, schemaInclusionRule)); }
@Override public Reader openNewInputReader(final Charset charset) throws IOException { requireNonNull(charset, "No input charset provided"); if (!exists(inputFile)) { return new StringReader(""); } final Reader reader = newBufferedReader(inputFile, charset); LOGGER.log(Level.INFO, new StringFormat("Opened input reader to file <%s>", inputFile)); return new InputReader(getDescription(), reader, true); }
public void putLiteral(final String literal, final Color color) { try { if (isBlank(literal)) { throw new IllegalArgumentException("No literal key provided"); } final Pattern pattern = Pattern.compile(literal, Pattern.LITERAL); colorMap.put(pattern, color); } catch (final Exception e) { LOGGER .log(Level.CONFIG, new StringFormat("Could not add literal color mapping for %s = %s", literal, color), e); } }
public void putLiteral(final String literal, final Color color) { try { if (isBlank(literal)) { throw new IllegalArgumentException("No literal key provided"); } final Pattern pattern = Pattern.compile(literal, Pattern.LITERAL); colorMap.put(pattern, color); } catch (final Exception e) { LOGGER .log(Level.CONFIG, new StringFormat("Could not add literal color mapping for %s = %s", literal, color), e); } }
public static InfoLevel valueOfFromString(final String infoLevelValue) { try { return InfoLevel.valueOf(infoLevelValue); } catch (final IllegalArgumentException | NullPointerException e) { LOGGER.log(Level.INFO, new StringFormat("Unknown infolevel <%s>", infoLevelValue)); return unknown; } }
/** * Loads a properties file. * * @param inputResource * Properties resource. * @return Properties */ public static Properties loadProperties(final InputResource inputResource) { requireNonNull(inputResource, "No input resource provided"); LOGGER.log(Level.INFO, new StringFormat("Loading properties from <%s>", inputResource)); try (final Reader reader = inputResource.openNewInputReader(UTF_8);) { final Properties properties = new Properties(); properties.load(reader); return properties; } catch (final IOException e) { LOGGER.log(Level.WARNING, new StringFormat("Cannot load properties from <%s>", inputResource), e); return new Properties(); } }
public static InfoLevel valueOfFromString(final String infoLevelValue) { try { return InfoLevel.valueOf(infoLevelValue); } catch (final IllegalArgumentException | NullPointerException e) { LOGGER.log(Level.INFO, new StringFormat("Unknown infolevel <%s>", infoLevelValue)); return unknown; } }
RetrieverConnection(final Connection connection, final SchemaRetrievalOptions schemaRetrievalOptions) throws SQLException { this.connection = checkConnection(connection); metaData = connection.getMetaData(); this.schemaRetrievalOptions = requireNonNull(schemaRetrievalOptions, "No database specific overrides provided"); LOGGER.log(Level.CONFIG, new StringFormat("%s", schemaRetrievalOptions)); tableTypes = new TableTypes(connection); LOGGER.log(Level.CONFIG, new StringFormat("Supported table types are <%s>", tableTypes)); javaSqlTypes = new JavaSqlTypes(); }
private void logConnection(final Connection connection) { if (connection == null || !LOGGER.isLoggable(Level.INFO)) { return; } try { final DatabaseMetaData dbMetaData = connection.getMetaData(); LOGGER .log(Level.INFO, new StringFormat("Connected to %n%s %s %nusing JDBC driver %n%s %s", dbMetaData.getDatabaseProductName(), dbMetaData.getDatabaseProductVersion(), dbMetaData.getDriverName(), dbMetaData.getDriverVersion())); } catch (final SQLException e) { LOGGER.log(Level.WARNING, "Could not log connection information", e); } }
RetrieverConnection(final Connection connection, final SchemaRetrievalOptions schemaRetrievalOptions) throws SQLException { this.connection = checkConnection(connection); metaData = connection.getMetaData(); this.schemaRetrievalOptions = requireNonNull(schemaRetrievalOptions, "No database specific overrides provided"); LOGGER.log(Level.CONFIG, new StringFormat("%s", schemaRetrievalOptions)); tableTypes = new TableTypes(connection); LOGGER.log(Level.CONFIG, new StringFormat("Supported table types are <%s>", tableTypes)); javaSqlTypes = new JavaSqlTypes(); }
/** * Gets the value of a property as an integer. * * @param propertyName * Property name * @return Integer value */ public int getIntegerValue(final String propertyName, final int defaultValue) { try { return Integer .parseInt(getStringValue(propertyName, String.valueOf(defaultValue))); } catch (final NumberFormatException e) { LOGGER .log(Level.FINEST, new StringFormat("Could not parse integer value for property <%s>", propertyName), e); return defaultValue; } }
/** * Gets the value of a property as an long. * * @param propertyName * Property name * @return Long value */ public long getLongValue(final String propertyName, final long defaultValue) { try { return Long .parseLong(getStringValue(propertyName, String.valueOf(defaultValue))); } catch (final NumberFormatException e) { LOGGER .log(Level.FINEST, new StringFormat("Could not parse long value for property <%s>", propertyName), e); return defaultValue; } }
/** * Gets the value of a property as an integer. * * @param propertyName * Property name * @return Integer value */ public int getIntegerValue(final String propertyName, final int defaultValue) { try { return Integer .parseInt(getStringValue(propertyName, String.valueOf(defaultValue))); } catch (final NumberFormatException e) { LOGGER .log(Level.FINEST, new StringFormat("Could not parse integer value for property <%s>", propertyName), e); return defaultValue; } }
/** * Gets the value of a property as an long. * * @param propertyName * Property name * @return Long value */ public long getLongValue(final String propertyName, final long defaultValue) { try { return Long .parseLong(getStringValue(propertyName, String.valueOf(defaultValue))); } catch (final NumberFormatException e) { LOGGER .log(Level.FINEST, new StringFormat("Could not parse long value for property <%s>", propertyName), e); return defaultValue; } }
/** * Gets the value of a property as an double. * * @param propertyName * Property name * @return Double value */ public double getDoubleValue(final String propertyName, final double defaultValue) { try { return Double.parseDouble(getStringValue(propertyName, String.valueOf(defaultValue))); } catch (final NumberFormatException e) { LOGGER .log(Level.FINEST, new StringFormat("Could not parse double value for property <%s>", propertyName), e); return defaultValue; } }
void setTypeMappedClass(final String mappedClassName) { if (!isBlank(mappedClassName)) { try { javaSqlTypeMappedClass = Class.forName(mappedClassName); } catch (final ClassNotFoundException e) { LOGGER.log(Level.FINE, new StringFormat("Could not load mapped class <%s>", mappedClassName), e); javaSqlTypeMappedClass = Object.class; } } else { javaSqlTypeMappedClass = Object.class; } }