Package org.platformlayer.jdbc

Source Code of org.platformlayer.jdbc.DataSourceBuilderBase

package org.platformlayer.jdbc;

import java.util.Properties;

import javax.inject.Inject;

import com.fathomdb.jdbc.DatabaseStatistics;

public abstract class DataSourceBuilderBase implements DataSourceBuilder {
  @Inject
  DatabaseStatistics databaseStatistics;

  protected Properties buildDbProperties(JdbcConfiguration jdbcConfig) {
    Properties jdbcProperties = new Properties();
    if (jdbcConfig.extraProperties != null) {
      jdbcProperties.putAll(jdbcConfig.extraProperties);
    }

    if (jdbcProperties.containsKey("ssl.keys")) {
      String trustKeys = (String) jdbcProperties.remove("ssl.keys");

      // http://jdbc.postgresql.org/documentation/80/ssl-factory.html
      jdbcProperties.put("sslfactory", TrustedKeysSSLSocketFactory.class.getName());
      jdbcProperties.put("sslfactoryarg", trustKeys);
    }
    return jdbcProperties;
  }
}
TOP

Related Classes of org.platformlayer.jdbc.DataSourceBuilderBase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.