@Override public void initialize(Map<?, ?> properties) { ConfigurationPropertyReader configurationPropertyReader = new ConfigurationPropertyReader( properties ); String path = configurationPropertyReader.property( Neo4jProperties.DATABASE_PATH, String.class ) .required() .getValue(); this.dbLocation = new File( path ); this.configurationLocation = configurationPropertyReader .property( Neo4jProperties.CONFIGURATION_RESOURCE_NAME, URL.class ) .getValue(); configuration = properties; }
public DocumentStoreConfiguration(ConfigurationPropertyReader propertyReader, int defaultPort) { String host = propertyReader.property( OgmProperties.HOST, String.class ) .withDefault( DEFAULT_HOST ) .getValue(); Integer port = propertyReader.property( OgmProperties.PORT, Integer.class ) .withValidator( Validators.PORT ) .withDefault( null ) .getValue(); hosts = HostParser.parse( host, port, defaultPort ); this.nativeClientResource = propertyReader.property( OgmProperties.NATIVE_CLIENT_RESOURCE, String.class ) .withDefault( null ) .getValue(); PropertyReaderContext<String> databaseNamePropertyReader = propertyReader.property( OgmProperties.DATABASE, String.class ); if ( nativeClientResource == null ) { // Require databaseName property, if nativeClientResource is not defined databaseNamePropertyReader.required(); } this.databaseName = databaseNamePropertyReader.getValue(); this.username = propertyReader.property( OgmProperties.USERNAME, String.class ).getValue(); this.password = propertyReader.property( OgmProperties.PASSWORD, String.class ).getValue(); this.createDatabase = propertyReader.property( OgmProperties.CREATE_DATABASE, boolean.class ) .withDefault( false ) .getValue(); }