org.hibernate.search.store
Class ShardIdentifierProviderTemplate

java.lang.Object
  extended by org.hibernate.search.store.ShardIdentifierProviderTemplate
All Implemented Interfaces:
ShardIdentifierProvider

public abstract class ShardIdentifierProviderTemplate
extends Object
implements ShardIdentifierProvider

Recommended parent class to create custom ShardIdentifierProvider implementations. Sub-classes must provide a no-arg constructor.

Author:
Sanne Grinovero

Constructor Summary
ShardIdentifierProviderTemplate()
           
 
Method Summary
protected  void addShard(String shardName)
           
 Set<String> getAllShardIdentifiers()
          Returns the list of all currently known shard identifiers.
 Set<String> getShardIdentifiersForQuery(FullTextFilterImplementor[] fullTextFilters)
          Potentially suited to be overridden if you are able to narrow down the shard selection based on the active FullTextFilters.
 void initialize(Properties properties, BuildContext buildContext)
          Initialize this provider.
protected abstract  Set<String> loadInitialShardNames(Properties properties, BuildContext buildContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.search.store.ShardIdentifierProvider
getShardIdentifier
 

Constructor Detail

ShardIdentifierProviderTemplate

public ShardIdentifierProviderTemplate()
Method Detail

initialize

public final void initialize(Properties properties,
                             BuildContext buildContext)
Description copied from interface: ShardIdentifierProvider
Initialize this provider.
This method is invoked only once per instance and before any other method is invoked.

Specified by:
initialize in interface ShardIdentifierProvider
Parameters:
properties - The configuration properties
buildContext - The build context available during bootstrapping

loadInitialShardNames

protected abstract Set<String> loadInitialShardNames(Properties properties,
                                                     BuildContext buildContext)

addShard

protected final void addShard(String shardName)

getAllShardIdentifiers

public final Set<String> getAllShardIdentifiers()
Description copied from interface: ShardIdentifierProvider
Returns the list of all currently known shard identifiers.
Note: The list can vary between calls!
Concurrency: this method could be invoked concurrently. That means you could have multiple invocations of ShardIdentifierProvider.getShardIdentifier(Class, Serializable, String, Document), ShardIdentifierProvider.getShardIdentifiersForQuery(FullTextFilterImplementor[]), ShardIdentifierProvider.getAllShardIdentifiers().

Specified by:
getAllShardIdentifiers in interface ShardIdentifierProvider
Returns:
the set of all currently known shard identifiers.

getShardIdentifiersForQuery

public Set<String> getShardIdentifiersForQuery(FullTextFilterImplementor[] fullTextFilters)
Potentially suited to be overridden if you are able to narrow down the shard selection based on the active FullTextFilters.

Specified by:
getShardIdentifiersForQuery in interface ShardIdentifierProvider
Parameters:
fullTextFilters - the filters which are applied to the current query
Returns:
the set of shard identifiers this query should target


Copyright © 2006–2013 Hibernate. All rights reserved.