public static IDatabasePlatform createDatabasePlatform(
      ApplicationContext springContext,
      TypedProperties properties,
      DataSource dataSource,
      boolean waitOnAvailableDatabase) {
    if (dataSource == null) {
      String jndiName = properties.getProperty(ParameterConstants.DB_JNDI_NAME);
      if (StringUtils.isNotBlank(jndiName)) {
        try {
          log.info("Looking up datasource in jndi.  The jndi name is {}", jndiName);
          JndiObjectFactoryBean jndiFactory = new JndiObjectFactoryBean();
          jndiFactory.setJndiName(jndiName);
          jndiFactory.afterPropertiesSet();
          dataSource = (DataSource) jndiFactory.getObject();

          if (dataSource == null) {
            throw new SymmetricException(
                "Could not locate the configured datasource in jndi.  The jndi name is %s",
                jndiName);
          }
        } catch (IllegalArgumentException e) {
          throw new SymmetricException(
              "Could not locate the configured datasource in jndi.  The jndi name is %s",
              e, jndiName);
        } catch (NamingException e) {
          throw new SymmetricException(
              "Could not locate the configured datasource in jndi.  The jndi name is %s",
              e, jndiName);
        }
      }

      String springBeanName = properties.getProperty(ParameterConstants.DB_SPRING_BEAN_NAME);
      if (isNotBlank(springBeanName) && springContext != null) {
        log.info("Using datasource from spring.  The spring bean name is {}", springBeanName);
        dataSource = (DataSource) springContext.getBean(springBeanName);
      }

      if (dataSource == null) {
        dataSource =
            BasicDataSourceFactory.create(
                properties, SecurityServiceFactory.create(SecurityServiceType.CLIENT, properties));
      }
    }
    if (waitOnAvailableDatabase) {
      waitForAvailableDatabase(dataSource);
    }
    boolean delimitedIdentifierMode =
        properties.is(ParameterConstants.DB_DELIMITED_IDENTIFIER_MODE, true);
    boolean caseSensitive = !properties.is(ParameterConstants.DB_METADATA_IGNORE_CASE, true);
    return JdbcDatabasePlatformFactory.createNewPlatformInstance(
        dataSource, createSqlTemplateSettings(properties), delimitedIdentifierMode, caseSensitive);
  }
 public static BasicDataSource createBasicDataSource(File propsFile) {
   TypedProperties properties = createTypedPropertiesFactory(propsFile, null).reload();
   return BasicDataSourceFactory.create(
       properties, SecurityServiceFactory.create(SecurityServiceType.CLIENT, properties));
 }