Package org.hibernate.ogm.util.configurationreader.spi

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader


    return QueryParserService.class;
  }

  @Override
  public QueryParserService initiateService(SessionFactoryImplementor sessionFactory, Configuration configuration, ServiceRegistryImplementor registry) {
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configuration, registry.getService( ClassLoaderService.class ) );

    return propertyReader.property( InternalProperties.QUERY_PARSER_SERVICE, QueryParserService.class )
        .instantiate()
        .withDefaultImplementation( registry.getService( DatastoreProvider.class ).getDefaultQueryParserServiceType() )
        .getValue();
  }
View Full Code Here


   *
   * @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 );
  }
View Full Code Here

  }

  @Override
  public void configure(Map configurationValues) {
    ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    sessionFactoryOptions = new OptionsServiceContextImpl( OptionValueSources.getDefaultSources( propertyReader ) );
  }
View Full Code Here

    return new JBossStandAloneJtaPlatform();
  }

  //TODO OGM-370 get rid of this!!!
  private boolean isNeo4j(Map configuration, ClassLoaderService classLoaderService) {
    DatastoreProvider configuredProvider = new ConfigurationPropertyReader( configuration, classLoaderService )
      .property( OgmProperties.DATASTORE_PROVIDER, DatastoreProvider.class )
      .instantiate()
      .withShortNameResolver( new DatastoreProviderInitiator.DatastoreProviderShortNameResolver() )
      .getValue();
View Full Code Here

    return DatastoreProvider.class;
  }

  @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();
View Full Code Here

  @Override
  public void configure(Map configurationValues) {
    OptionsService optionsService = serviceRegistry.getService( OptionsService.class );
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    this.config = new MongoDBConfiguration( propertyReader, optionsService.context().getGlobalOptions() );
  }
View Full Code Here

  private Map<?, ?> configuration;

  @Override
  public void initialize(Map<?, ?> properties) {
    ConfigurationPropertyReader configurationPropertyReader = new ConfigurationPropertyReader( properties );

    this.dbLocation = configurationPropertyReader.property( Neo4jProperties.DATABASE_PATH, String.class )
        .required()
        .getValue();

    this.configurationLocation = configurationPropertyReader
        .property( Neo4jProperties.CONFIGURATION_RESOURCE_NAME, URL.class )
        .getValue();

    configuration = properties;
  }
View Full Code Here

  }

  private static class TestDocumentStoreConfiguration extends DocumentStoreConfiguration {

    public TestDocumentStoreConfiguration(Map<?, ?> configurationValues) {
      super( new ConfigurationPropertyReader( configurationValues ), 1234 );
    }
View Full Code Here

    // then
    assertThat( context.getUnique( NameExampleOption.class ) ).isEqualTo( "foobar" );
  }

  private List<OptionValueSource> getSources() {
    return OptionValueSources.getDefaultSources( new ConfigurationPropertyReader( cfg, new ClassLoaderServiceImpl() ) );
  }
View Full Code Here

  @Test
  public void shouldRetrievePropertyWithInstanceValue() {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", new MyServiceImpl() );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyServiceImpl.class );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.