@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; }
@Override public AssociationStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .getValue(); } }
@Override public AssociationDocumentStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( MongoDBProperties.ASSOCIATION_DOCUMENT_STORAGE, AssociationDocumentStorageType.class ) .withDefault( AssociationDocumentStorageType.GLOBAL_COLLECTION ) .getValue(); } }
@Override public CacheMappingType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( KeyValueStoreProperties.CACHE_MAPPING, CacheMappingType.class ) .withDefault( DEFAULT_CACHE_STORAGE ) .getValue(); } }
@Override public AssociationDocumentStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( MongoDBProperties.ASSOCIATION_DOCUMENT_STORAGE, AssociationDocumentStorageType.class ) .withDefault( AssociationDocumentStorageType.GLOBAL_COLLECTION ) .getValue(); } }
@Override public MapStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader .property( DocumentStoreProperties.MAP_STORAGE, MapStorageType.class ) .withDefault( DEFAULT_MAP_STORAGE ) .getValue(); } }
/** * Initialize the internal values from the given {@link Map}. * * @param configurationMap The values to use as configuration */ public void initialize(Map configurationMap) { this.url = new ConfigurationPropertyReader( configurationMap ) .property( EhcacheProperties.CONFIGURATION_RESOURCE_NAME, URL.class ) .withDefault( EhcacheConfiguration.class.getClassLoader().getResource( DEFAULT_CONFIG ) ) .getValue(); }
/** * Initialize the internal values form the given {@link Map}. * * @param configurationMap * The values to use as configuration */ public void initConfiguration(Map<?, ?> configurationMap) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationMap ); this.configUrl = propertyReader .property( InfinispanProperties.CONFIGURATION_RESOURCE_NAME, URL.class ) .withDefault( InfinispanConfiguration.class.getClassLoader().getResource( INFINISPAN_DEFAULT_CONFIG ) ) .getValue(); this.jndi = propertyReader .property( InfinispanProperties.CACHE_MANAGER_JNDI_NAME, String.class ) .getValue(); log.tracef( "Initializing Infinispan from configuration file at %1$s", configUrl ); } }
/** * Initialize the internal values form the given {@link Map}. * * @param configurationMap * The values to use as configuration */ public void initConfiguration(Map<?, ?> configurationMap) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationMap ); this.configUrl = propertyReader .property( InfinispanProperties.CONFIGURATION_RESOURCE_NAME, URL.class ) .withDefault( InfinispanConfiguration.class.getClassLoader().getResource( INFINISPAN_DEFAULT_CONFIG ) ) .getValue(); this.jndi = propertyReader .property( InfinispanProperties.CACHE_MANAGER_JNDI_NAME, String.class ) .getValue(); log.tracef( "Initializing Infinispan from configuration file at %1$s", configUrl ); } }
@Override public ReadConcern getDefaultValue(ConfigurationPropertyReader propertyReader) { ReadConcernType readConcernType = propertyReader.property( MongoDBProperties.READ_CONCERN, ReadConcernType.class ) .withDefault( ReadConcernType.DEFAULT ) .getValue(); return readConcernType.getReadConcern(); } }
private boolean isOgmEnabled(Map<?, ?> settings) { Boolean ogmEnabled = new ConfigurationPropertyReader( settings ) .property( OgmProperties.ENABLED, Boolean.class ) .getValue(); if ( ogmEnabled == null ) { return isOgmImplicitEnabled( settings ); } return ogmEnabled; }
@Override public ReadConcern getDefaultValue(ConfigurationPropertyReader propertyReader) { ReadConcernType readConcernType = propertyReader.property( MongoDBProperties.READ_CONCERN, ReadConcernType.class ) .withDefault( ReadConcernType.DEFAULT ) .getValue(); return readConcernType.getReadConcern(); } }
@Override public ReadPreference getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader .property( MongoDBProperties.READ_PREFERENCE, ReadPreferenceType.class ) .withDefault( DEFAULT_READ_PREFERENCE ) .getValue() .getReadPreference(); } }
@Override public ReadPreference getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader .property( MongoDBProperties.READ_PREFERENCE, ReadPreferenceType.class ) .withDefault( DEFAULT_READ_PREFERENCE ) .getValue() .getReadPreference(); } }
@Override public WriteConcern getDefaultValue(ConfigurationPropertyReader propertyReader) { WriteConcernType writeConcernType = propertyReader.property( MongoDBProperties.WRITE_CONCERN, WriteConcernType.class ) .withDefault( DEFAULT_WRITE_CONCERN ) .getValue(); // load/instantiate custom type if ( writeConcernType == WriteConcernType.CUSTOM ) { return propertyReader.property( MongoDBProperties.WRITE_CONCERN_TYPE, WriteConcern.class ) .instantiate() .required() .getValue(); } // take pre-defined value else { return writeConcernType.getWriteConcern(); } } }
@Override public WriteConcern getDefaultValue(ConfigurationPropertyReader propertyReader) { WriteConcernType writeConcernType = propertyReader.property( MongoDBProperties.WRITE_CONCERN, WriteConcernType.class ) .withDefault( DEFAULT_WRITE_CONCERN ) .getValue(); // load/instantiate custom type if ( writeConcernType == WriteConcernType.CUSTOM ) { return propertyReader.property( MongoDBProperties.WRITE_CONCERN_TYPE, WriteConcern.class ) .instantiate() .required() .getValue(); } // take pre-defined value else { return writeConcernType.getWriteConcern(); } } }
/** * Creates a new {@link MongoDBConfiguration}. * * @param propertyReader provides access to configuration values given via {@code persistence.xml} etc. * @param globalOptions global settings given via an option configurator */ public MongoDBConfiguration(ConfigurationPropertyReader propertyReader, OptionsContext globalOptions) { super( propertyReader, DEFAULT_PORT ); this.propertyReader = propertyReader; this.authenticationMechanism = propertyReader.property( MongoDBProperties.AUTHENTICATION_MECHANISM, AuthenticationMechanismType.class ) .withDefault( AuthenticationMechanismType.BEST ) .getValue(); this.authenticationDatabaseName = propertyReader.property( MongoDBProperties.AUTHENTICATION_DATABASE, String.class ) .withDefault( DEFAULT_AUTHENTICATION_DATABASE ) .getValue(); this.writeConcern = globalOptions.getUnique( WriteConcernOption.class ); this.readConcern = globalOptions.getUnique( ReadConcernOption.class ); this.readPreference = globalOptions.getUnique( ReadPreferenceOption.class ); }
/** * Creates a new {@link MongoDBConfiguration}. * * @param propertyReader provides access to configuration values given via {@code persistence.xml} etc. * @param globalOptions global settings given via an option configurator */ public MongoDBConfiguration(ConfigurationPropertyReader propertyReader, OptionsContext globalOptions) { super( propertyReader, DEFAULT_PORT ); this.propertyReader = propertyReader; this.authenticationMechanism = propertyReader.property( MongoDBProperties.AUTHENTICATION_MECHANISM, AuthenticationMechanismType.class ) .withDefault( AuthenticationMechanismType.BEST ) .getValue(); this.authenticationDatabaseName = propertyReader.property( MongoDBProperties.AUTHENTICATION_DATABASE, String.class ) .withDefault( DEFAULT_AUTHENTICATION_DATABASE ) .getValue(); this.writeConcern = globalOptions.getUnique( WriteConcernOption.class ); this.readConcern = globalOptions.getUnique( ReadConcernOption.class ); this.readPreference = globalOptions.getUnique( ReadPreferenceOption.class ); }
@Override public void configure(Map configurationValues) { configuration = new RemoteNeo4jConfiguration( new ConfigurationPropertyReader( configurationValues ), defaultPort ); sequenceCacheMaxSize = new ConfigurationPropertyReader( configurationValues ) .property( Neo4jProperties.SEQUENCE_QUERY_CACHE_MAX_SIZE, int.class ) .withDefault( DEFAULT_SEQUENCE_QUERY_CACHE_MAX_SIZE ) .getValue(); }
@Override public void configure(Map cfg) { graphDbFactory = new EmbeddedNeo4jGraphDatabaseServiceFactoryProvider().load( cfg, registry.getService( ClassLoaderService.class ) ); sequenceCacheMaxSize = new ConfigurationPropertyReader( cfg ) .property( Neo4jProperties.SEQUENCE_QUERY_CACHE_MAX_SIZE, int.class ) .withDefault( DEFAULT_SEQUENCE_QUERY_CACHE_MAX_SIZE ) .getValue(); }