Package org.hibernate.search.util.configuration.impl

Examples of org.hibernate.search.util.configuration.impl.MaskedProperty


      throw log.assertionFailureCannotCastToWorkerBuilderContext( searchFactory.getClass() );
    }

    Properties properties = entityIndexBinding.getProperties();
    if ( shardName != null ) {
      properties = new MaskedProperty( properties, shardName, properties );
    }

    indexManager = createIndexManager(
        indexName,
        entityIndexBinding.getDocumentBuilder().getBeanClass(),
View Full Code Here


   * If the index is sharded, the Properties index matches the shard index
   *
   * @return an array of index properties
   */
  private static Properties[] getIndexProperties(SearchConfiguration cfg, String indexName) {
    Properties rootCfg = new MaskedProperty( cfg.getProperties(), "hibernate.search" );
    Properties globalProperties = new MaskedProperty( rootCfg, "default" );
    Properties directoryLocalProperties = new MaskedProperty( rootCfg, indexName, globalProperties );
    String shardsCountValue = directoryLocalProperties.getProperty( NBR_OF_SHARDS );

    if ( shardsCountValue == null ) {
      // no shard finished.
      return new Properties[] { directoryLocalProperties };
    }
    else {
      // count shards
      int shardsCount = ConfigurationParseHelper.parseInt(
          shardsCountValue, "'" + shardsCountValue + "' is not a valid value for " + NBR_OF_SHARDS
      );

      if ( shardsCount <= 0 ) {
        throw log.getInvalidShardCountException( shardsCount );
      }

      // create shard-specific Props
      Properties[] shardLocalProperties = new Properties[shardsCount];
      for ( int i = 0; i < shardsCount; i++ ) {
        shardLocalProperties[i] = new MaskedProperty(
            directoryLocalProperties, Integer.toString( i ), directoryLocalProperties
        );
      }
      return shardLocalProperties;
    }
View Full Code Here

        ShardIdentifierProvider.class,
        shardIdentityProviderName,
        DirectoryProviderFactory.class.getClassLoader(),
        "ShardIdentifierProvider"
    );
    shardIdentifierProvider.initialize( new MaskedProperty( indexProperty, SHARDING_STRATEGY ), context );

    return shardIdentifierProvider;
  }
View Full Code Here

          DirectoryProviderFactory.class.getClassLoader(),
          "IndexShardingStrategy"
      );
    }
    shardingStrategy.initialize(
        new MaskedProperty( indexProps[0], SHARDING_STRATEGY ), indexManagers
    );
    return shardingStrategy;
  }
View Full Code Here

          IndexShardingStrategy.class,
          shardingStrategyName, DirectoryProviderFactory.class, "IndexShardingStrategy"
      );
    }
    shardingStrategy.initialize(
        new MaskedProperty( indexProps[0], SHARDING_STRATEGY ), providers
    );
   
    //define the Similarity implementation:
    // warning: it can also be set by an annotation at class level
    final String similarityClassName = indexProps[0].getProperty( Environment.SIMILARITY_CLASS_PER_INDEX );
View Full Code Here

   * hibernate.search.indexname.n has priority over hibernate.search.indexname which has priority over hibernate.search.default
   * If the Index is not sharded, a single Properties is returned
   * If the index is sharded, the Properties index matches the shard index
   */
  private static Properties[] getDirectoryProperties(SearchConfiguration cfg, String directoryProviderName) {
    Properties rootCfg = new MaskedProperty( cfg.getProperties(), "hibernate.search" );
    Properties globalProperties = new MaskedProperty( rootCfg, "default" );
    Properties directoryLocalProperties = new MaskedProperty( rootCfg, directoryProviderName, globalProperties );
    final String shardsCountValue = directoryLocalProperties.getProperty( NBR_OF_SHARDS );
    if ( shardsCountValue == null ) {
      // no shards: finished.
      return new Properties[] { directoryLocalProperties };
    }
    else {
      // count shards
      int shardsCount = ConfigurationParseHelper.parseInt(
          shardsCountValue, shardsCountValue + " is not a number"
      );
      // create shard-specific Props
      Properties[] shardLocalProperties = new Properties[shardsCount];
      for ( int i = 0; i < shardsCount; i++ ) {
        shardLocalProperties[i] = new MaskedProperty(
            directoryLocalProperties, Integer.toString( i ), directoryLocalProperties
        );
      }
      return shardLocalProperties;
    }
View Full Code Here

          IndexShardingStrategy.class,
          shardingStrategyName, DirectoryProviderFactory.class, "IndexShardingStrategy"
      );
    }
    shardingStrategy.initialize(
        new MaskedProperty( indexProps[0], SHARDING_STRATEGY ), providers
    );
   
    //define the Similarity implementation:
    // warning: it can also be set by an annotation at class level
    final String similarityClassName = indexProps[0].getProperty( Environment.SIMILARITY_CLASS_PER_INDEX );
View Full Code Here

   * hibernate.search.indexname.n has priority over hibernate.search.indexname which has priority over hibernate.search.default
   * If the Index is not sharded, a single Properties is returned
   * If the index is sharded, the Properties index matches the shard index
   */
  private static Properties[] getDirectoryProperties(SearchConfiguration cfg, String directoryProviderName) {
    Properties rootCfg = new MaskedProperty( cfg.getProperties(), "hibernate.search" );
    Properties globalProperties = new MaskedProperty( rootCfg, "default" );
    Properties directoryLocalProperties = new MaskedProperty( rootCfg, directoryProviderName, globalProperties );
    final String shardsCountValue = directoryLocalProperties.getProperty( NBR_OF_SHARDS );
    if ( shardsCountValue == null ) {
      // no shards: finished.
      return new Properties[] { directoryLocalProperties };
    }
    else {
      // count shards
      int shardsCount = ConfigurationParseHelper.parseInt(
          shardsCountValue, shardsCountValue + " is not a number"
      );
      // create shard-specific Props
      Properties[] shardLocalProperties = new Properties[shardsCount];
      for ( int i = 0; i < shardsCount; i++ ) {
        shardLocalProperties[i] = new MaskedProperty(
            directoryLocalProperties, Integer.toString( i ), directoryLocalProperties
        );
      }
      return shardLocalProperties;
    }
View Full Code Here

   * @param directoryBasedIndexManager
   * @param cfg
   * @return
   */
  public static DirectoryBasedReaderManager createDirectoryBasedReaderManager(DirectoryBasedIndexManager indexManager, Properties cfg) {
    Properties props = new MaskedProperty( cfg, Environment.READER_PREFIX );
    String impl = props.getProperty( "strategy" );
    DirectoryBasedReaderManager readerProvider;
    if ( StringHelper.isEmpty( impl ) ) {
      readerProvider = new SharingBufferReaderProvider();
    }
    else if ( "not-shared".equalsIgnoreCase( impl ) ) {
View Full Code Here

    Properties cfg = this.configurationProperties;
    if ( forceToNumWriterThreads != null ) {
      cfg = new Properties( cfg );
      cfg.put( DefaultBatchBackend.CONCURRENT_WRITERS, forceToNumWriterThreads.toString() );
    }
    Properties batchBackendConfiguration = new MaskedProperty(
        cfg, Environment.BATCH_BACKEND
    );
    batchBackend.initialize( batchBackendConfiguration, progressMonitor, this );
    return batchBackend;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.util.configuration.impl.MaskedProperty

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.