public static Map < String , String > populatePersistenceUnitProperties ( PropertyReader reader ) { String dbType = reader . getProperty ( EthConstants . DATABASE_TYPE ) ; String host = reader . getProperty ( EthConstants . DATABASE_HOST ) ; String port = reader . getProperty ( EthConstants . DATABASE_PORT ) ; String dbName = reader . getProperty ( EthConstants . DATABASE_NAME ) ; propertyNullCheck ( dbType , host , port , dbName ) ; String username = reader . getProperty ( EthConstants . DATABASE_USERNAME ) ; String pswd = reader . getProperty ( EthConstants . DATABASE_PASSWORD ) ; Map < String , String > props = new HashMap <> ( ) ; props . put ( EthConstants . KUNDERA_CLIENT_LOOKUP_CLASS , getKunderaClientToLookupClass ( dbType ) ) ; props . put ( EthConstants . KUNDERA_NODES , host ) ; props . put ( EthConstants . KUNDERA_PORT , port ) ; props . put ( EthConstants . KUNDERA_KEYSPACE , dbName ) ; props . put ( EthConstants . KUNDERA_DIALECT , dbType ) ; if ( username != null && ! username . isEmpty ( ) && pswd != null ) { props . put ( EthConstants . KUNDERA_USERNAME , username ) ; props . put ( EthConstants . KUNDERA_PASSWORD , pswd ) ; } if ( dbType . equalsIgnoreCase ( CASSANDRA ) ) { props . put ( CQL_VERSION , _3_0_0 ) ; } boolean schemaAutoGen = Boolean . parseBoolean ( reader . getProperty ( EthConstants . SCHEMA_AUTO_GENERATE ) ) ; boolean schemaDropExisting = Boolean . parseBoolean ( reader . getProperty ( EthConstants . SCHEMA_DROP_EXISTING ) ) ; if ( schemaAutoGen ) { if ( schemaDropExisting ) { props . put ( EthConstants . KUNDERA_DDL_AUTO_PREPARE , "create" ) ; } else { props . put ( EthConstants . KUNDERA_DDL_AUTO_PREPARE , "update" ) ; } } LOGGER . info ( "Kundera properties : " + props ) ; return props ; }
Populate persistence unit properties .