Package org.hibernate.ogm.util.configurationreader.impl

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


public class ConfigurationService implements Service {

  private final boolean isOn;

  public ConfigurationService(Map config) {
    isOn = new ConfigurationPropertyReader( config )
      .property( InternalProperties.OGM_ON, boolean.class )
      .withDefault( false )
      .getValue();
  }
View Full Code Here


    return QueryParserService.class;
  }

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

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

    this.registry = serviceRegistry;
  }

  @Override
  public void configure(Map configurationValues) {
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues );

    ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );

    OptionsServiceContext context = propertyReader.property( InternalProperties.OGM_OPTION_CONTEXT, OptionsServiceContext.class )
        .instantiate()
        .withClassLoaderService( classLoaderService )
        .getValue();
    OptionConfigurator configurator = propertyReader.property( OgmProperties.OPTION_CONFIGURATOR, OptionConfigurator.class )
        .instantiate()
        .withClassLoaderService( classLoaderService )
        .getValue();

    if ( context != null && configurator != null ) {
View Full Code Here

  private final String password;
  private final boolean createDatabase;
  private final AssociationStorageType associationStorage;

  public DocumentStoreConfiguration(Map<?, ?> configurationValues, int defaultPort) {
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues );

    this.host = propertyReader.property( OgmProperties.HOST, String.class )
        .withDefault( DEFAULT_HOST )
        .getValue();

    this.port =  propertyReader.property( OgmProperties.PORT, int.class )
        .withDefault( defaultPort )
        .withValidator( Validators.PORT )
        .getValue();

    this.databaseName = propertyReader.property( OgmProperties.DATABASE, String.class )
        .required()
        .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();

    associationStorage = propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class )
        .withDefault( DEFAULT_ASSOCIATION_STORAGE )
        .getValue();
  }
View Full Code Here

  }

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

    return propertyReader.property( OgmProperties.GRID_DIALECT, GridDialect.class )
        .instantiate()
        .withClassLoaderService( registry.getService( ClassLoaderService.class ) )
        .withDefaultImplementation( registry.getService( DatastoreProvider.class ).getDefaultDialect() )
        .withInstantiator( new GridDialectInstantiator( datastore, registry.getService( EventListenerRegistry.class ) ) )
        .getValue();
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 )
      .property( OgmProperties.DATASTORE_PROVIDER, DatastoreProvider.class )
      .instantiate()
      .withClassLoaderService( classLoaderService )
      .withShortNameResolver( new DatastoreProviderInitiator.DatastoreProviderShortNameResolver() )
      .getValue();
View Full Code Here

    return DatastoreProvider.class;
  }

  @Override
  public DatastoreProvider initiateService(SessionFactoryImplementor sessionFactory, Configuration configuration, ServiceRegistryImplementor registry) {
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configuration );

    DatastoreProvider datastoreProvider = propertyReader.property( OgmProperties.DATASTORE_PROVIDER, DatastoreProvider.class )
        .instantiate()
        .withClassLoaderService( registry.getService( ClassLoaderService.class ) )
        .withDefaultImplementation( DEFAULT_DATASTORE_PROVIDER )
        .withShortNameResolver( DatastoreProviderShortNameResolver.INSTANCE )
        .getValue();
View Full Code Here

   *
   * @see Environment
   * @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();
  }
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 cfg) {
    graphDbFactory = new Neo4jGraphDatabaseServiceFactoryProvider().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();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.util.configurationreader.impl.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.