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(); } }
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; } }
public static List<OptionValueSource> getDefaultSources(ConfigurationPropertyReader propertyReader) { AppendableConfigurationContext programmaticOptions = propertyReader.property( InternalProperties.OGM_OPTION_CONTEXT, AppendableConfigurationContext.class ) .instantiate() .getValue(); OptionConfigurator configurator = propertyReader.property( OgmProperties.OPTION_CONFIGURATOR, OptionConfigurator.class ) .instantiate() .getValue(); if ( configurator != null ) { if ( programmaticOptions != null ) { throw log.ambigiousOptionConfiguration( OgmProperties.OPTION_CONFIGURATOR ); } programmaticOptions = invokeOptionConfigurator( configurator ); } return programmaticOptions != null ? Arrays.<OptionValueSource>asList( new ProgrammaticOptionValueSource( programmaticOptions ), new AnnotationOptionValueSource(), new ConfigurationOptionValueSource( propertyReader ) ) : Arrays.<OptionValueSource>asList( new AnnotationOptionValueSource(), new ConfigurationOptionValueSource( propertyReader ) ); }
@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 GridDialect initiateService(Map configurationValues, ServiceRegistryImplementor registry) { DatastoreProvider datastore = registry.getService( DatastoreProvider.class ); boolean errorHandlerConfigured = configurationValues.containsKey( OgmProperties.ERROR_HANDLER ); EventContextManager eventContext = registry.getService( EventContextManager.class ); ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, registry.getService( ClassLoaderService.class ) ); return ( (DefaultClassPropertyReaderContext<GridDialect>) propertyReader.property( OgmProperties.GRID_DIALECT, GridDialect.class ) .instantiate() ) .withDefaultImplementation( registry.getService( DatastoreProvider.class ).getDefaultDialect() ) .withInstantiator( new GridDialectInstantiator( datastore, errorHandlerConfigured, eventContext ) ) .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(); } } }
/** * 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 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(); } }
.instantiate() .getValue(); .instantiate() .getValue();