Examples of MaskedProperty


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

  }
 
  public void testSerializability() throws IOException, ClassNotFoundException {
    Properties cfg = new Properties();
    cfg.setProperty( "base.key", "value" );
    MaskedProperty originalProps = new MaskedProperty( cfg, "base" );
    MaskedProperty theCopy = (MaskedProperty)
      SerializationTestHelper.duplicateBySerialization( originalProps );
    //this is also testing the logger (transient) has been restored:
    assertEquals( "value", theCopy.getProperty( "key" ) );
  }
View Full Code Here

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

    Properties rootProp = new Properties( defaultProp );
    rootProp.put( "some.long.dotted.prop1", "hello!" );
    rootProp.put( "hidden.long.dotted.prop2", "hello again" );
    Properties fallbackProp = new Properties();
    fallbackProp.put( "default.long.dotted.prop3", "hello!" );
    Properties masked = new MaskedProperty( rootProp, "some", fallbackProp );
   
    assertTrue( masked.keySet().contains( "long.dotted.prop1" ) );
    assertTrue( masked.keySet().contains( "default.long.dotted.prop3" ) );
    assertTrue( masked.keySet().contains( "inherited.prop" ) );
    assertFalse( masked.keySet().contains( "hidden.long.dotted.prop2" ) );
    assertFalse( masked.keySet().contains( "long.dotted.prop2" ) );
   
    Properties maskedAgain = new MaskedProperty( masked, "long.dotted", masked ); //falling back to same instance for **
    assertTrue( maskedAgain.keySet().contains( "prop1" ) );
    assertTrue( maskedAgain.keySet().contains( "long.dotted.prop1" ) ); //**: prop 1 should be visible in both ways
    assertTrue( maskedAgain.keySet().contains( "default.long.dotted.prop3" ) );
   
    Properties maskingAll = new MaskedProperty( masked, "secured" );
    assertTrue( maskingAll.keySet().isEmpty() );
    assertTrue( maskingAll.isEmpty() );
  }
View Full Code Here

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

  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

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

    NodeSelectorStrategyHolder masterNodeSelector = serviceManager.requestService( MasterSelectorServiceProvider.class, context );
    masterNodeSelector.setNodeSelectorStrategy( indexName, selectionStrategy );
    selectionStrategy.viewAccepted( messageSender.getView() ); // set current view?

    final boolean sync = BackendFactory.isConfiguredAsSync( props );
    final Properties jgroupsProperties = new MaskedProperty( props, JGROUPS_CONFIGURATION_SPACE );
    final boolean block = ConfigurationParseHelper.getBooleanValue( jgroupsProperties, BLOCK_WAITING_ACK, sync );

    final long messageTimeout = ConfigurationParseHelper.getLongValue( jgroupsProperties, MESSAGE_TIMEOUT_MS, DEFAULT_MESSAGE_TIMEOUT );

    log.jgroupsBlockWaitingForAck( indexName, block );
View Full Code Here

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

  public Lock getExclusiveWriteLock() {
    return delegatedBackend.getExclusiveWriteLock();
  }

  private static void assertLegacyOptionsNotUsed(Properties props, String indexName) {
    MaskedProperty jgroupsCfg = new MaskedProperty( props, "worker.backend.jgroups" );
    if ( jgroupsCfg.containsKey( "configurationFile" )
        || jgroupsCfg.containsKey( "configurationXml" )
        || jgroupsCfg.containsKey( "configurationString" )
        || jgroupsCfg.containsKey( "clusterName" ) ) {
      throw log.legacyJGroupsConfigurationDefined( indexName );
    }
  }
View Full Code Here

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

      return Executors.QUEUE_MAX_LENGTH;
    }
  }

  public static OptimizerStrategy getOptimizerStrategy(IndexManager callback, Properties indexProps) {
    MaskedProperty optimizerCfg = new MaskedProperty(indexProps, "optimizer" );
    String customImplementation = optimizerCfg.getProperty( "implementation" );
    if ( customImplementation != null && (! "default".equalsIgnoreCase( customImplementation ) ) ) {
      return ClassLoaderHelper.instanceFromName( OptimizerStrategy.class, customImplementation, callback.getClass(), "Optimizer Strategy" );
    }
    else {
      boolean incremental = optimizerCfg.containsKey( "operation_limit.max" )
        || optimizerCfg.containsKey( "transaction_limit.max" );
      OptimizerStrategy optimizerStrategy;
      if ( incremental ) {
        optimizerStrategy = new IncrementalOptimizerStrategy();
        optimizerStrategy.initialize( callback, optimizerCfg );
      }
View Full Code Here

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

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

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

          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

Examples of org.hibernate.search.util.configuration.impl.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

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

          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
TOP
Copyright © 2018 www.massapi.com. 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.