@Override public AssociationStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .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(); } }
/** * 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(); }
@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(); } }
@Override public ReadConcern getDefaultValue(ConfigurationPropertyReader propertyReader) { ReadConcernType readConcernType = propertyReader.property( MongoDBProperties.READ_CONCERN, ReadConcernType.class ) .withDefault( ReadConcernType.DEFAULT ) .getValue(); return readConcernType.getReadConcern(); } }
@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(); } }
/** * 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 ); } }
/** * 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(); }
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(); }
/** * Initialize the internal values from the given {@link Map}. * * @param configurationMap The values to use as configuration */ public void initialize(Map configurationMap, ClassLoaderService classLoaderService) { ConfigurationPropertyReader configurationPropertyReader = new ConfigurationPropertyReader( configurationMap, classLoaderService ); this.url = configurationPropertyReader .property( IgniteProperties.CONFIGURATION_RESOURCE_NAME, URL.class ) .withDefault( IgniteProviderConfiguration.class.getClassLoader().getResource( DEFAULT_CONFIG ) ) .getValue(); String configBuilderClassName = configurationPropertyReader .property( IgniteProperties.CONFIGURATION_CLASS_NAME, String.class ) .getValue(); if ( configBuilderClassName != null ) { this.configBuilder = configurationPropertyReader .property( IgniteProperties.CONFIGURATION_CLASS_NAME, IgniteConfigurationBuilder.class ) .instantiate() .getValue(); } this.instanceName = configurationPropertyReader .property( IgniteProperties.IGNITE_INSTANCE_NAME, String.class ) .getValue(); }
@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(); } } }