Skip to content

Commit

Permalink
HSEARCH-1428 Changing parameter type of MassIndexerFactory method to …
Browse files Browse the repository at this point in the history
…actually required type
  • Loading branch information
gunnarmorling authored and Sanne committed Oct 7, 2013
1 parent 4e1696a commit 4ccf8eb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
Expand Up @@ -22,7 +22,6 @@

import java.util.Properties;

import org.hibernate.SessionFactory;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.search.MassIndexer;
import org.hibernate.search.engine.spi.SearchFactoryImplementor;
Expand All @@ -42,10 +41,10 @@ public void initialize(Properties properties) {
}

@Override
public MassIndexer createMassIndexer(SearchFactoryImplementor searchFactory, SessionFactory sessionFactory,
public MassIndexer createMassIndexer(SearchFactoryImplementor searchFactory, SessionFactoryImplementor sessionFactory,
Class<?>... entities) {
final Class<?>[] types = entities.length == 0 ? OBJECT_ARRAY : entities;
return new MassIndexerImpl( searchFactory, (SessionFactoryImplementor)sessionFactory, types );
return new MassIndexerImpl( searchFactory, sessionFactory, types );
}

}
Expand Up @@ -220,7 +220,7 @@ public MassIndexer createIndexer(Class<?>... types) {
MutableSearchFactory msf = (MutableSearchFactory) getSearchFactoryImplementor();
ServiceManager serviceManager = msf.getServiceManager();
MassIndexerFactory service = serviceManager.requestService( MassIndexerFactoryProvider.class, null );
return service.createMassIndexer( getSearchFactoryImplementor(), getSessionFactory(), types );
return service.createMassIndexer( getSearchFactoryImplementor(), getFactory(), types );
}

@Override
Expand Down
Expand Up @@ -22,14 +22,16 @@

import java.util.Properties;

import org.hibernate.SessionFactory;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.search.MassIndexer;
import org.hibernate.search.engine.spi.SearchFactoryImplementor;

/**
* Contains methods that can be used to create a {@link MassIndexer}.
*
* @author Davide D'Alto <davide@hibernate.org>
*
* @since 4.3
*/
public interface MassIndexerFactory {

Expand All @@ -52,7 +54,7 @@ public interface MassIndexerFactory {
* the classes of the entities that are going to be indexed
* @return a new MassIndexer
*/
MassIndexer createMassIndexer(SearchFactoryImplementor searchFactory, SessionFactory sessionFactory,
MassIndexer createMassIndexer(SearchFactoryImplementor searchFactory, SessionFactoryImplementor sessionFactory,
Class<?>... entities);

}
Expand Up @@ -20,13 +20,17 @@
*/
package org.hibernate.search.test.batchindexing;

import static org.hamcrest.CoreMatchers.is;
import static org.hibernate.search.hcore.impl.MassIndexerFactoryProvider.MASS_INDEXER_FACTORY_CLASSNAME;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import java.util.Properties;
import java.util.concurrent.Future;

import org.hibernate.CacheMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.MassIndexer;
import org.hibernate.search.Search;
Expand All @@ -36,11 +40,6 @@
import org.hibernate.search.test.SearchTestCaseJUnit4;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hibernate.search.hcore.impl.MassIndexerFactoryProvider.MASS_INDEXER_FACTORY_CLASSNAME;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

/**
* @author Davide D'Alto <davide@hibernate.org>
*/
Expand Down Expand Up @@ -75,7 +74,6 @@ protected Class<?>[] getAnnotatedClasses() {
return new Class[] { Clock.class };
}

@SuppressWarnings("serial")
public static class NoopMassIndexerFactory implements MassIndexerFactory {

private boolean configurationReadable = false;
Expand All @@ -87,11 +85,10 @@ public void initialize(Properties properties) {
}

@Override
public MassIndexer createMassIndexer(SearchFactoryImplementor searchFactory, SessionFactory sessionFactory,
public MassIndexer createMassIndexer(SearchFactoryImplementor searchFactory, SessionFactoryImplementor sessionFactory,
Class<?>... entities) {
return new NoopMassIndexer( configurationReadable );
}

}

private static class NoopMassIndexer implements MassIndexer {
Expand Down

0 comments on commit 4ccf8eb

Please sign in to comment.