public LuceneIndexingParameters(Properties sourceProps) { Properties indexingParameters = new MaskedProperty( sourceProps, PROP_GROUP ); indexParameters = new ParameterSet( indexingParameters ); }
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 ); } }
@Override public synchronized String toString() { HashMap fake = new HashMap(); Enumeration<?> names = propertyNames(); while ( names.hasMoreElements() ) { Object nextElement = names.nextElement(); fake.put( nextElement, this.getProperty( nextElement.toString() ) ); } return fake.toString(); }
public static OptimizerStrategy getOptimizerStrategy(IndexManager callback, Properties indexProperties, WorkerBuildContext buildContext) { MaskedProperty maskedProperty = new MaskedProperty( indexProperties, "optimizer" ); String optimizerImplClassName = maskedProperty.getProperty( "implementation" ); if ( optimizerImplClassName != null && ( !"default".equalsIgnoreCase( optimizerImplClassName ) ) ) { ServiceManager serviceManager = buildContext.getServiceManager(); return ClassLoaderHelper.instanceFromName( OptimizerStrategy.class, optimizerImplClassName, "Optimizer Strategy", serviceManager ); } else { boolean incremental = maskedProperty.containsKey( "operation_limit.max" ) || maskedProperty.containsKey( "transaction_limit.max" ); OptimizerStrategy optimizerStrategy; if ( incremental ) { optimizerStrategy = new IncrementalOptimizerStrategy(); optimizerStrategy.initialize( callback, maskedProperty ); } else { optimizerStrategy = new ExplicitOnlyOptimizerStrategy(); } return optimizerStrategy; } }
@Test public void testSerializability() throws IOException, ClassNotFoundException { Properties properties = new Properties(); properties.setProperty( "base.key", "value" ); MaskedProperty originalProps = new MaskedProperty( properties, "base" ); MaskedProperty theCopy = SerializationTestHelper.duplicateBySerialization( originalProps ); //this is also testing the logger (transient) has been restored: assertEquals( "value", theCopy.getProperty( "key" ) ); }
@Override public synchronized Set<Object> keySet() { initPropertyNames(); return propertyNames; }
@Override public String getProperty(String key, String defaultValue) { String val = getProperty( key ); return ( val == null ) ? defaultValue : val; }
public static OptimizerStrategy getOptimizerStrategy(IndexManager callback, Properties indexProperties, WorkerBuildContext buildContext) { MaskedProperty maskedProperty = new MaskedProperty( indexProperties, "optimizer" ); String optimizerImplClassName = maskedProperty.getProperty( "implementation" ); if ( optimizerImplClassName != null && ( !"default".equalsIgnoreCase( optimizerImplClassName ) ) ) { ServiceManager serviceManager = buildContext.getServiceManager(); return ClassLoaderHelper.instanceFromName( OptimizerStrategy.class, optimizerImplClassName, "Optimizer Strategy", serviceManager ); } else { boolean incremental = maskedProperty.containsKey( "operation_limit.max" ) || maskedProperty.containsKey( "transaction_limit.max" ); OptimizerStrategy optimizerStrategy; if ( incremental ) { optimizerStrategy = new IncrementalOptimizerStrategy(); optimizerStrategy.initialize( callback, maskedProperty ); } else { optimizerStrategy = new ExplicitOnlyOptimizerStrategy(); } return optimizerStrategy; } }
@Override public synchronized Set<Object> keySet() { initPropertyNames(); return propertyNames; }
@Override public String getProperty(String key, String defaultValue) { String val = getProperty( key ); return ( val == null ) ? defaultValue : val; }
public LuceneIndexingParameters(Properties sourceProps) { Properties indexingParameters = new MaskedProperty( sourceProps, PROP_GROUP ); indexParameters = new ParameterSet( indexingParameters ); }
@Override public synchronized String toString() { HashMap fake = new HashMap(); Enumeration<?> names = propertyNames(); while ( names.hasMoreElements() ) { Object nextElement = names.nextElement(); fake.put( nextElement, this.getProperty( nextElement.toString() ) ); } return fake.toString(); }
@Override public synchronized boolean contains(Object value) { initPropertyNames(); return propertyNames.contains( value ); }
/** * Check if a given properties is set. * * @param key the property key * @return {@code true} if the property is set, {@code false} otherwise * @throws IllegalArgumentException if the key is not a String instance */ @Override public synchronized boolean containsKey(Object key) { if ( !( key instanceof String ) ) { throw new IllegalArgumentException( "key must be a String" ); } return getProperty( key.toString() ) != null; }
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 ); shardLocalProperties[i] = new MaskedProperty( directoryLocalProperties, Integer.toString( i ), directoryLocalProperties );
@Override public synchronized int size() { initPropertyNames(); return propertyNames.size(); }
/** * Check if a given properties is set. * * @param key the property key * @return {@code true} if the property is set, {@code false} otherwise * @throws IllegalArgumentException if the key is not a String instance */ @Override public synchronized boolean containsKey(Object key) { if ( !( key instanceof String ) ) { throw new IllegalArgumentException( "key must be a String" ); } return getProperty( key.toString() ) != null; }
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 ); shardLocalProperties[i] = new MaskedProperty( directoryLocalProperties, Integer.toString( i ), directoryLocalProperties );
@Override public synchronized boolean isEmpty() { initPropertyNames(); return propertyNames.isEmpty(); }
IndexManager getOrCreateIndexManager(String shardName, Properties indexProperties, IndexedTypeIdentifier entityType, WorkerBuildContext context) { String indexName = indexNameBase; if ( shardName != null ) { indexName += INDEX_SHARD_ID_SEPARATOR + shardName; } IndexManager indexManager = indexManagersRegistry.get( indexName ); if ( indexManager != null ) { indexManager.addContainedEntity( entityType ); return indexManager; } synchronized (this) { indexManager = indexManagersRegistry.get( indexName ); if ( indexManager != null ) { indexManager.addContainedEntity( entityType ); return indexManager; } if ( shardName != null ) { indexProperties = new MaskedProperty( indexProperties, shardName, indexProperties ); } indexManager = doCreateIndexManager( indexName, entityType, indexProperties, context ); } return indexManager; }