Package org.hibernate.search.backend.configuration

Examples of org.hibernate.search.backend.configuration.MaskedProperty


   * 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


    else {
      shardingStrategy = PluginLoader.instanceFromName( IndexShardingStrategy.class,
          shardingStrategyName, DirectoryProviderFactory.class, "IndexShardingStrategy" );
    }
    shardingStrategy.initialize(
        new MaskedProperty( indexProps[0], SHARDING_STRATEGY ), providers );
    return new DirectoryProviders( shardingStrategy, providers );
  }
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

      batchBackend = PluginLoader.instanceFromName(
          BatchBackend.class, impl, ImmutableSearchFactory.class,
          "batchbackend"
      );
    }
    Properties batchBackendConfiguration = new MaskedProperty(
        this.configurationProperties, Environment.BATCH_BACKEND
    );
    batchBackend.initialize( batchBackendConfiguration, progressMonitor, this );
    return batchBackend;
  }
View Full Code Here

        throw new SearchException( "ShardingStrategy class does not implement IndexShardingStrategy: "
            + shardingStrategyName, e );
      }
    }
    shardingStrategy.initialize(
        new MaskedProperty( indexProps[0], SHARDING_STRATEGY ), providers );
    return new DirectoryProviders( shardingStrategy, providers );
  }
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

  private final ParameterSet transactionIndexParameters;
  private final ParameterSet batchIndexParameters;
 
  public LuceneIndexingParameters( Properties sourceProps ) {
    //prefer keys under "indexwriter" but fallback for backwards compatibility:
    Properties indexingParameters = new MaskedProperty( sourceProps, PROP_GROUP, sourceProps );
    //get keys for "transaction"
    Properties transactionProps = new MaskedProperty( indexingParameters, TRANSACTION );
    //get keys for "batch" (defaulting to transaction)
    Properties batchProps = new MaskedProperty( indexingParameters, BATCH, transactionProps ); //TODO to close HSEARCH-201 just remove 3° parameter
    transactionIndexParameters = new ParameterSet( transactionProps, TRANSACTION );
    batchIndexParameters = new ParameterSet( batchProps, BATCH );
    doSanityChecks( transactionIndexParameters, batchIndexParameters );
  }
View Full Code Here

    else {
      shardingStrategy = ClassLoaderHelper.instanceFromName( IndexShardingStrategy.class,
          shardingStrategyName, DirectoryProviderFactory.class, "IndexShardingStrategy" );
    }
    shardingStrategy.initialize(
        new MaskedProperty( indexProps[0], SHARDING_STRATEGY ), providers );
    final String similarityClassName = indexProps[0].getProperty( Environment.SIMILARITY_CLASS_PER_INDEX );
    Similarity similarityInstance = null;
    if ( similarityClassName != null ) {
      similarityInstance = ClassLoaderHelper.instanceFromName(
          Similarity.class,
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

TOP

Related Classes of org.hibernate.search.backend.configuration.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.