All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.engine.impl.MutableEntityIndexBinding Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * Hibernate Search, full-text search for your domain model
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.search.engine.impl;

import org.apache.lucene.search.similarities.Similarity;
import org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity;
import org.hibernate.search.engine.spi.EntityIndexBinding;
import org.hibernate.search.indexes.impl.IndexManagerGroupHolder;
import org.hibernate.search.indexes.interceptor.EntityIndexingInterceptor;
import org.hibernate.search.indexes.spi.IndexManagerSelector;
import org.hibernate.search.indexes.spi.IndexManagerType;
import org.hibernate.search.spi.IndexedTypeSet;
import org.hibernate.search.store.ShardIdentifierProvider;

/**
 * @author Sanne Grinovero (C) 2011 Red Hat Inc.
 */
public class MutableEntityIndexBinding implements EntityIndexBinding {

	private final IndexManagerGroupHolder indexManagerGroupHolder;
	private final IndexManagerSelector indexManagerSelector;
	private final ShardIdentifierProvider shardIdentifierProvider;
	private DocumentBuilderIndexedEntity documentBuilder;
	private final EntityIndexingInterceptor entityIndexingInterceptor;

	public MutableEntityIndexBinding(
			IndexManagerGroupHolder indexManagerGroupHolder,
			IndexManagerSelector indexManagerSelector,
			ShardIdentifierProvider shardIdentifierProvider,
			EntityIndexingInterceptor entityIndexingInterceptor) {
		this.indexManagerGroupHolder = indexManagerGroupHolder;
		this.indexManagerSelector = indexManagerSelector;
		this.shardIdentifierProvider = shardIdentifierProvider;
		this.entityIndexingInterceptor = entityIndexingInterceptor;
	}

	/**
	 * Allows to set the document builder for this {@code EntityIndexBinding}.
	 *
	 * @param documentBuilder the new document builder instance
	 */
	public void setDocumentBuilderIndexedEntity(DocumentBuilderIndexedEntity documentBuilder) {
		this.documentBuilder = documentBuilder;
	}

	@Override
	public Similarity getSimilarity() {
		return indexManagerGroupHolder.getSimilarity();
	}

	@Override
	public IndexManagerSelector getIndexManagerSelector() {
		return indexManagerSelector;
	}

	@Override
	public ShardIdentifierProvider getShardIdentifierProvider() {
		return shardIdentifierProvider;
	}

	@Override
	public DocumentBuilderIndexedEntity getDocumentBuilder() {
		return documentBuilder;
	}

	@Override
	public void postInitialize(IndexedTypeSet indexedClasses) {
		documentBuilder.postInitialize( indexedClasses );
	}

	@Override
	public IndexManagerType getIndexManagerType() {
		return indexManagerGroupHolder.getIndexManagerType();
	}

	@Override
	public EntityIndexingInterceptor getEntityIndexingInterceptor() {
		return entityIndexingInterceptor;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy