@Override public AssociationStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .getValue(); } }
@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 GraphDatabaseServiceFactory load(Map<?, ?> properties, ClassLoaderService classLoaderService) { GraphDatabaseServiceFactory factory = new ConfigurationPropertyReader( properties, classLoaderService ) .property( EmbeddedNeo4jInternalProperties.NEO4J_GRAPHDB_FACTORYCLASS, GraphDatabaseServiceFactory.class ) .instantiate() .withDefaultImplementation( EmbeddedNeo4jGraphDatabaseFactory.class ) .getValue(); factory.initialize( properties ); return factory; } }
@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 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(); } } }
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 AssociationDocumentStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( MongoDBProperties.ASSOCIATION_DOCUMENT_STORAGE, AssociationDocumentStorageType.class ) .withDefault( AssociationDocumentStorageType.GLOBAL_COLLECTION ) .getValue(); } }
private ErrorHandler getErrorHandler(Map<?, ?> configurationValues, ServiceRegistryImplementor registry) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, registry.getService( ClassLoaderService.class ) ); return propertyReader.property( OgmProperties.ERROR_HANDLER, ErrorHandler.class ).instantiate().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 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 AssociationDocumentStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( MongoDBProperties.ASSOCIATION_DOCUMENT_STORAGE, AssociationDocumentStorageType.class ) .withDefault( AssociationDocumentStorageType.GLOBAL_COLLECTION ) .getValue(); } }
@Override public DatastoreProvider initiateService(Map configurationValues, ServiceRegistryImplementor registry) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, registry.getService( ClassLoaderService.class ) ); DatastoreProvider datastoreProvider = propertyReader.property( OgmProperties.DATASTORE_PROVIDER, DatastoreProvider.class ) .instantiate() .withDefaultImplementation( DEFAULT_DATASTORE_PROVIDER ) .withShortNameResolver( DatastoreProviderShortNameResolver.INSTANCE ) .getValue(); log.useDatastoreProvider( datastoreProvider.getClass() ); return datastoreProvider; }
@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(); }
@Override public MapStorageType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader .property( DocumentStoreProperties.MAP_STORAGE, MapStorageType.class ) .withDefault( DEFAULT_MAP_STORAGE ) .getValue(); } }
@Override public QueryParserService initiateService(SessionFactoryImplementor sessionFactory, SessionFactoryOptions sessionFactoryOptions, ServiceRegistryImplementor registry) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( registry.getService( ConfigurationService.class ).getSettings(), registry.getService( ClassLoaderService.class ) ); return propertyReader.property( InternalProperties.QUERY_PARSER_SERVICE, QueryParserService.class ) .instantiate() .withDefaultImplementation( registry.getService( DatastoreProvider.class ).getDefaultQueryParserServiceType() ) .getValue(); } }
@Override public CacheMappingType getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader.property( KeyValueStoreProperties.CACHE_MAPPING, CacheMappingType.class ) .withDefault( DEFAULT_CACHE_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 ReadPreference getDefaultValue(ConfigurationPropertyReader propertyReader) { return propertyReader .property( MongoDBProperties.READ_PREFERENCE, ReadPreferenceType.class ) .withDefault( DEFAULT_READ_PREFERENCE ) .getValue() .getReadPreference(); } }
@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(); } }