Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Commits List »

[hibernate-commits] Hibernate SVN: r14828 - in
 search/branches/jboss_cache_integration/src/java/org/hibernate/search:
 event and 3 other directories.

hibernate-commits

2008-06-30


Author LoginPost Reply
Author: navssurtani
Date: 2008-06-30 11:45:38 -0400 (Mon, 30 Jun 2008)
New Revision: 14828

Modified:
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/WorkerFactory.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/FullTextIndexEventListener.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/InitContext.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/SearchFactoryImpl.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/reader/ReaderProviderFactory.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/store/DirectoryProviderFactory.java
Log:
Changed all org.hibernate configurations to org.hibernate.search.Cfg

Modified: search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/WorkerFactory.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/WorkerFactory.java  2008-06-30 13:56:28 UTC (rev 14827)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/WorkerFactory.java  2008-06-30 15:45:38 UTC (rev 14828)
@@(protected) @@
import java.util.Map;
import java.util.Properties;

-import org.hibernate.cfg.Configuration;
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
+import org.hibernate.search.cfg.Cfg;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.backend.impl.TransactionalWorker;
import org.hibernate.util.ReflectHelper;
@@(protected) @@
*/
public abstract class WorkerFactory {

-  private static Properties getProperties(Configuration cfg) {
+  private static Properties getProperties(Cfg cfg) {
   Properties props = cfg.getProperties();
   Properties workerProperties = new Properties();
   for ( Map.Entry entry : props.entrySet() ) {
@@(protected) @@
   return workerProperties;
 }

-  public static Worker createWorker(Configuration cfg, SearchFactoryImplementor searchFactoryImplementor) {
+  public static Worker createWorker(Cfg cfg, SearchFactoryImplementor searchFactoryImplementor) {
   Properties props = getProperties( cfg );
   String impl = props.getProperty( Environment.WORKER_SCOPE );
   Worker worker;

Modified: search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/FullTextIndexEventListener.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/FullTextIndexEventListener.java  2008-06-30 13:56:28 UTC (rev 14827)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/FullTextIndexEventListener.java  2008-06-30 15:45:38 UTC (rev 14828)
@@(protected) @@
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.impl.SearchFactoryImpl;
import org.hibernate.search.transaction.EventSourceTransactionContext;
+import org.hibernate.search.cfg.Cfg;

import java.io.Serializable;

@@(protected) @@
  protected boolean used;
  protected SearchFactoryImplementor searchFactoryImplementor;

-  public void initialize(Configuration cfg)
+  public void initialize(Configuration hibernateConfig)
  {
+  }
+
+  public void intitialize (Cfg cfg)
+  {
    searchFactoryImplementor = SearchFactoryImpl.getSearchFactory(cfg);
    String indexingStrategy = searchFactoryImplementor.getIndexingStrategy();
    if ("event".equals(indexingStrategy))
@@(protected) @@
    {
      used = false;
    }
+
+
  }

  public SearchFactoryImplementor getSearchFactoryImplementor()

Modified: search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/InitContext.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/InitContext.java  2008-06-30 13:56:28 UTC (rev 14827)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/InitContext.java  2008-06-30 15:45:38 UTC (rev 14828)
@@(protected) @@
import org.hibernate.search.annotations.TokenFilterDef;
import org.hibernate.search.SearchException;
import org.hibernate.search.Environment;
+import org.hibernate.search.cfg.Cfg;
+import org.hibernate.search.cfg.CfgImpl;
import org.hibernate.search.util.DelegateNamedAnalyzer;
import org.hibernate.cfg.Configuration;
import org.hibernate.util.ReflectHelper;
@@(protected) @@
/**
* @author Emmanuel Bernard
*/
-public class InitContext {
-  private final Map<String, AnalyzerDef> analyzerDefs = new HashMap<String, AnalyzerDef>();
-  private final List<DelegateNamedAnalyzer> lazyAnalyzers = new ArrayList<DelegateNamedAnalyzer>();
-  private final Analyzer defaultAnalyzer;
-  private final Similarity defaultSimilarity;
+public class InitContext
+{
+  private final Map<String, AnalyzerDef> analyzerDefs = new HashMap<String, AnalyzerDef>();
+  private final List<DelegateNamedAnalyzer> lazyAnalyzers = new ArrayList<DelegateNamedAnalyzer>();
+  private final Analyzer defaultAnalyzer;
+  private final Similarity defaultSimilarity;

-  public InitContext(Configuration cfg) {
-    defaultAnalyzer = initAnalyzer(cfg);
-    defaultSimilarity = initSimilarity(cfg);
-  }
+  public InitContext(Configuration hibernateConfig)
+  {
+    this(new CfgImpl(hibernateConfig));
+  }

-  public void addAnalyzerDef(AnalyzerDef ann) {
-    //FIXME somehow remember where the analyzerDef comes from and raise an exception if an analyzerDef
-    //with the same name from two different places are added
-    //multiple adding from the same place is required to deal with inheritance hierarchy processed multiple times
-    if ( ann != null && analyzerDefs.put( ann.name(), ann ) != null ) {
-      //throw new SearchException("Multiple AnalyzerDef with the same name: " + name);
-    }
-  }
+  public InitContext(Cfg cfg)
+  {
+    defaultAnalyzer = initAnalyzer(cfg);
+    defaultSimilarity = initSimilarity(cfg);

-  public Analyzer buildLazyAnalyzer(String name) {
-    final DelegateNamedAnalyzer delegateNamedAnalyzer = new DelegateNamedAnalyzer( name );
-    lazyAnalyzers.add(delegateNamedAnalyzer);
-    return delegateNamedAnalyzer;
-  }

-  public List<DelegateNamedAnalyzer> getLazyAnalyzers() {
-    return lazyAnalyzers;
-  }
+  }

-  /**
-   * Initializes the Lucene analyzer to use by reading the analyzer class from the configuration and instantiating it.
-   *
-   * @param cfg
-   *        The current configuration.
-   * @return The Lucene analyzer to use for tokenisation.
-   */
-  private Analyzer initAnalyzer(Configuration cfg) {
-    Class analyzerClass;
-    String analyzerClassName = cfg.getProperty( Environment.ANALYZER_CLASS);
-    if (analyzerClassName != null) {
-      try {
-        analyzerClass = ReflectHelper.classForName(analyzerClassName);
-      } catch (Exception e) {
-        return buildLazyAnalyzer( analyzerClassName );
+  public void addAnalyzerDef(AnalyzerDef ann)
+  {
+    //FIXME somehow remember where the analyzerDef comes from and raise an exception if an analyzerDef
+    //with the same name from two different places are added
+    //multiple adding from the same place is required to deal with inheritance hierarchy processed multiple times
+    if (ann != null && analyzerDefs.put(ann.name(), ann) != null)
+    {
+      //throw new SearchException("Multiple AnalyzerDef with the same name: " + name);
+    }
+  }
+
+  public Analyzer buildLazyAnalyzer(String name)
+  {
+    final DelegateNamedAnalyzer delegateNamedAnalyzer = new DelegateNamedAnalyzer(name);
+    lazyAnalyzers.add(delegateNamedAnalyzer);
+    return delegateNamedAnalyzer;
+  }
+
+  public List<DelegateNamedAnalyzer> getLazyAnalyzers()
+  {
+    return lazyAnalyzers;
+  }
+
+  /**
+   * Initializes the Lucene analyzer to use by reading the analyzer class from the configuration and instantiating it.
+   *
+   * @param cfg The current configuration.
+   * @return The Lucene analyzer to use for tokenisation.
+   */
+  private Analyzer initAnalyzer(Cfg cfg)
+  {
+    Class analyzerClass;
+    String analyzerClassName = cfg.getProperty(Environment.ANALYZER_CLASS);
+    if (analyzerClassName != null)
+    {
+      try
+      {
+        analyzerClass = ReflectHelper.classForName(analyzerClassName);
+      }
+      catch (Exception e)
+      {
+        return buildLazyAnalyzer(analyzerClassName);
//        throw new SearchException("Lucene analyzer class '" + analyzerClassName + "' defined in property '"
//            + Environment.ANALYZER_CLASS + "' could not be found.", e);
-      }
-    } else {
-      analyzerClass = StandardAnalyzer.class;
-    }
-    // Initialize analyzer
-    Analyzer defaultAnalyzer;
-    try {
-      defaultAnalyzer = (Analyzer) analyzerClass.newInstance();
-    } catch (ClassCastException e) {
-      throw new SearchException("Lucene analyzer does not implement " + Analyzer.class.getName() + ": "
-          + analyzerClassName, e);
-    } catch (Exception e) {
-      throw new SearchException("Failed to instantiate lucene analyzer with type " + analyzerClassName, e);
-    }
-    return defaultAnalyzer;
-  }
+      }
+    }
+    else
+    {
+      analyzerClass = StandardAnalyzer.class;
+    }
+    // Initialize analyzer
+    Analyzer defaultAnalyzer;
+    try
+    {
+      defaultAnalyzer = (Analyzer) analyzerClass.newInstance();
+    }
+    catch (ClassCastException e)
+    {
+      throw new SearchException("Lucene analyzer does not implement " + Analyzer.class.getName() + ": "
+           + analyzerClassName, e);
+    }
+    catch (Exception e)
+    {
+      throw new SearchException("Failed to instantiate lucene analyzer with type " + analyzerClassName, e);
+    }
+    return defaultAnalyzer;
+  }

-  /**
-   * Initializes the Lucene similarity to use
-   */
-  private Similarity initSimilarity(Configuration cfg) {
-    Class similarityClass;
-    String similarityClassName = cfg.getProperty(Environment.SIMILARITY_CLASS);
-    if (similarityClassName != null) {
-      try {
-        similarityClass = ReflectHelper.classForName(similarityClassName);
-      } catch (Exception e) {
-        throw new SearchException("Lucene Similarity class '" + similarityClassName + "' defined in property '"
-            + Environment.SIMILARITY_CLASS + "' could not be found.", e);
-      }
-    }
-    else {
-      similarityClass = null;
-    }
+  /**
+   * Initializes the Lucene similarity to use
+   */
+  private Similarity initSimilarity(Cfg cfg)
+  {
+    Class similarityClass;
+    String similarityClassName = cfg.getProperty(Environment.SIMILARITY_CLASS);
+    if (similarityClassName != null)
+    {
+      try
+      {
+        similarityClass = ReflectHelper.classForName(similarityClassName);
+      }
+      catch (Exception e)
+      {
+        throw new SearchException("Lucene Similarity class '" + similarityClassName + "' defined in property '"
+             + Environment.SIMILARITY_CLASS + "' could not be found.", e);
+      }
+    }
+    else
+    {
+      similarityClass = null;
+    }

-    // Initialize similarity
-    if ( similarityClass == null ) {
-      return Similarity.getDefault();
-    }
-    else {
-      Similarity defaultSimilarity;
-      try {
-        defaultSimilarity = (Similarity) similarityClass.newInstance();
-      } catch (ClassCastException e) {
-        throw new SearchException("Lucene similarity does not extend " + Similarity.class.getName() + ": "
-            + similarityClassName, e);
-      } catch (Exception e) {
-        throw new SearchException("Failed to instantiate lucene similarity with type " + similarityClassName, e);
-      }
-      return defaultSimilarity;
-    }
-  }
+    // Initialize similarity
+    if (similarityClass == null)
+    {
+      return Similarity.getDefault();
+    }
+    else
+    {
+      Similarity defaultSimilarity;
+      try
+      {
+        defaultSimilarity = (Similarity) similarityClass.newInstance();
+      }
+      catch (ClassCastException e)
+      {
+        throw new SearchException("Lucene similarity does not extend " + Similarity.class.getName() + ": "
+             + similarityClassName, e);
+      }
+      catch (Exception e)
+      {
+        throw new SearchException("Failed to instantiate lucene similarity with type " + similarityClassName, e);
+      }
+      return defaultSimilarity;
+    }
+  }

-  public Analyzer getDefaultAnalyzer() {
-    return defaultAnalyzer;
-  }
+  public Analyzer getDefaultAnalyzer()
+  {
+    return defaultAnalyzer;
+  }

-  public Similarity getDefaultSimilarity() {
-    return defaultSimilarity;
-  }
+  public Similarity getDefaultSimilarity()
+  {
+    return defaultSimilarity;
+  }

-  public Map<String, Analyzer> initLazyAnalyzers() {
-    Map<String, Analyzer> initializedAnalyzers = new HashMap<String, Analyzer>( analyzerDefs.size() );
+  public Map<String, Analyzer> initLazyAnalyzers()
+  {
+    Map<String, Analyzer> initializedAnalyzers = new HashMap<String, Analyzer>(analyzerDefs.size());

-    for (DelegateNamedAnalyzer namedAnalyzer : lazyAnalyzers) {
-      String name = namedAnalyzer.getName();
-      if ( initializedAnalyzers.containsKey( name ) ) {
-        namedAnalyzer.setDelegate( initializedAnalyzers.get( name ) );
-      }
-      else {
-        if ( analyzerDefs.containsKey( name ) ) {
-          final Analyzer analyzer = buildAnalyzer( analyzerDefs.get( name ) );
-          namedAnalyzer.setDelegate( analyzer );
-          initializedAnalyzers.put( name, analyzer );
-        }
-        else {
-          throw new SearchException("Analyzer found with an unknown definition: " + name);
-        }
-      }
-    }
+    for (DelegateNamedAnalyzer namedAnalyzer : lazyAnalyzers)
+    {
+      String name = namedAnalyzer.getName();
+      if (initializedAnalyzers.containsKey(name))
+      {
+        namedAnalyzer.setDelegate(initializedAnalyzers.get(name));
+      }
+      else
+      {
+        if (analyzerDefs.containsKey(name))
+        {
+          final Analyzer analyzer = buildAnalyzer(analyzerDefs.get(name));
+          namedAnalyzer.setDelegate(analyzer);
+          initializedAnalyzers.put(name, analyzer);
+        }
+        else
+        {
+          throw new SearchException("Analyzer found with an unknown definition: " + name);
+        }
+      }
+    }

-    //initialize the remaining definitions
-    for ( Map.Entry<String, AnalyzerDef> entry : analyzerDefs.entrySet() ) {
-      if ( ! initializedAnalyzers.containsKey( entry.getKey() ) ) {
-        final Analyzer analyzer = buildAnalyzer( entry.getValue() );
-        initializedAnalyzers.put( entry.getKey(), analyzer );
-      }
-    }
-    return Collections.unmodifiableMap( initializedAnalyzers );
-  }
+    //initialize the remaining definitions
+    for (Map.Entry<String, AnalyzerDef> entry : analyzerDefs.entrySet())
+    {
+      if (!initializedAnalyzers.containsKey(entry.getKey()))
+      {
+        final Analyzer analyzer = buildAnalyzer(entry.getValue());
+        initializedAnalyzers.put(entry.getKey(), analyzer);
+      }
+    }
+    return Collections.unmodifiableMap(initializedAnalyzers);
+  }

-  private Analyzer buildAnalyzer(AnalyzerDef analyzerDef) {
-    TokenizerDef token = analyzerDef.tokenizer();
-    TokenizerFactory tokenFactory = (TokenizerFactory) instantiate( token.factory() );
-    tokenFactory.init( getMapOfParameters( token.params() ) );
+  private Analyzer buildAnalyzer(AnalyzerDef analyzerDef)
+  {
+    TokenizerDef token = analyzerDef.tokenizer();
+    TokenizerFactory tokenFactory = (TokenizerFactory) instantiate(token.factory());
+    tokenFactory.init(getMapOfParameters(token.params()));

-    final int length = analyzerDef.filters().length;
-    TokenFilterFactory[] filters = new TokenFilterFactory[length];
-    for ( int index = 0 ; index < length ; index++ ) {
-      TokenFilterDef filterDef = analyzerDef.filters()[index];
-      filters[index] = (TokenFilterFactory) instantiate( filterDef.factory() );
-      filters[index].init( getMapOfParameters( filterDef.params() ) );
-    }
-    return new TokenizerChain(tokenFactory, filters);
-  }
+    final int length = analyzerDef.filters().length;
+    TokenFilterFactory[] filters = new TokenFilterFactory[length];
+    for (int index = 0; index < length; index++)
+    {
+      TokenFilterDef filterDef = analyzerDef.filters()[index];
+      filters[index] = (TokenFilterFactory) instantiate(filterDef.factory());
+      filters[index].init(getMapOfParameters(filterDef.params()));
+    }
+    return new TokenizerChain(tokenFactory, filters);
+  }

-  private Object instantiate(Class clazz) {
-    try {
-      return clazz.newInstance();
-    }
-    catch (IllegalAccessException e) {
-      throw new SearchException( "Unable to instantiate class: " + clazz, e );
-    }
-    catch (InstantiationException e) {
-      throw new SearchException( "Unable to instantiate class: " + clazz, e );
-    }
-  }
+  private Object instantiate(Class clazz)
+  {
+    try
+    {
+      return clazz.newInstance();
+    }
+    catch (IllegalAccessException e)
+    {
+      throw new SearchException("Unable to instantiate class: " + clazz, e);
+    }
+    catch (InstantiationException e)
+    {
+      throw new SearchException("Unable to instantiate class: " + clazz, e);
+    }
+  }

-  private Map<String, String> getMapOfParameters(Parameter[] params) {
-    Map<String, String> mapOfParams = new HashMap<String, String>( params.length );
-    for (Parameter param : params) {
-      mapOfParams.put( param.name(), param.value() );
-    }
-    return Collections.unmodifiableMap( mapOfParams );
+  private Map<String, String> getMapOfParameters(Parameter[] params)
+  {
+    Map<String, String> mapOfParams = new HashMap<String, String>(params.length);
+    for (Parameter param : params)
+    {
+      mapOfParams.put(param.name(), param.value());
+    }
+    return Collections.unmodifiableMap(mapOfParams );
 }
}

Modified: search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/SearchFactoryImpl.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/SearchFactoryImpl.java  2008-06-30 13:56:28 UTC (rev 14827)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/SearchFactoryImpl.java  2008-06-30 15:45:38 UTC (rev 14828)
@@(protected) @@
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
import org.hibernate.search.Version;
+import org.hibernate.search.cfg.Cfg;
+import org.hibernate.search.cfg.CfgImpl;
import org.hibernate.search.annotations.Factory;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
@@(protected) @@
/**
* @author Emmanuel Bernard
*/
-public class SearchFactoryImpl implements SearchFactoryImplementor {
-  private static final ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>> contexts =
-      new ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>>();
+public class SearchFactoryImpl implements SearchFactoryImplementor
+{
+  private static final ThreadLocal<WeakHashMap<Cfg, SearchFactoryImpl>> contexts =
+       new ThreadLocal<WeakHashMap<Cfg, SearchFactoryImpl>>();

-  static {
-    Version.touch();
-  }
+  static
+  {
+    Version.touch();
+  }

-  private final Logger log = LoggerFactory.getLogger( SearchFactoryImpl.class );
+  private final Logger log = LoggerFactory.getLogger(SearchFactoryImpl.class);

-  private final Map<Class, DocumentBuilder<Object>> documentBuilders = new HashMap<Class, DocumentBuilder<Object>>();
-  //keep track of the index modifiers per DirectoryProvider since multiple entity can use the same directory provider
-  private final Map<DirectoryProvider, DirectoryProviderData> dirProviderData = new HashMap<DirectoryProvider, DirectoryProviderData>();
-  private final Worker worker;
-  private final ReaderProvider readerProvider;
-  private BackendQueueProcessorFactory backendQueueProcessorFactory;
-  private final Map<String, FilterDef> filterDefinitions = new HashMap<String, FilterDef>();
-  private final FilterCachingStrategy filterCachingStrategy;
-  private Map<String, Analyzer> analyzers;
-  private final AtomicBoolean stopped = new AtomicBoolean( false );
+  private final Map<Class, DocumentBuilder<Object>> documentBuilders = new HashMap<Class, DocumentBuilder<Object>>();
+  //keep track of the index modifiers per DirectoryProvider since multiple entity can use the same directory provider
+  private final Map<DirectoryProvider, DirectoryProviderData> dirProviderData = new HashMap<DirectoryProvider, DirectoryProviderData>();
+  private final Worker worker;
+  private final ReaderProvider readerProvider;
+  private BackendQueueProcessorFactory backendQueueProcessorFactory;
+  private final Map<String, FilterDef> filterDefinitions = new HashMap<String, FilterDef>();
+  private final FilterCachingStrategy filterCachingStrategy;
+  private Map<String, Analyzer> analyzers;
+  private final AtomicBoolean stopped = new AtomicBoolean(false);

-  /**
-   * Each directory provider (index) can have its own performance settings.
-   */
-  private Map<DirectoryProvider, LuceneIndexingParameters> dirProviderIndexingParams =
-    new HashMap<DirectoryProvider, LuceneIndexingParameters>();
-  private final String indexingStrategy;
+  /**
+   * Each directory provider (index) can have its own performance settings.
+   */
+  private Map<DirectoryProvider, LuceneIndexingParameters> dirProviderIndexingParams =
+       new HashMap<DirectoryProvider, LuceneIndexingParameters>();
+  private final String indexingStrategy;


-  public BackendQueueProcessorFactory getBackendQueueProcessorFactory() {
-    return backendQueueProcessorFactory;
-  }
+  public BackendQueueProcessorFactory getBackendQueueProcessorFactory()
+  {
+    return backendQueueProcessorFactory;
+  }

-  public void setBackendQueueProcessorFactory(BackendQueueProcessorFactory backendQueueProcessorFactory) {
-    this.backendQueueProcessorFactory = backendQueueProcessorFactory;
-  }
+  public void setBackendQueueProcessorFactory(BackendQueueProcessorFactory backendQueueProcessorFactory)
+  {
+    this.backendQueueProcessorFactory = backendQueueProcessorFactory;
+  }

-  @SuppressWarnings( "unchecked" )
-  public SearchFactoryImpl(Configuration cfg) {
-    //yuk
-    ReflectionManager reflectionManager = getReflectionManager( cfg );
-    this.indexingStrategy = defineIndexingStrategy( cfg ); //need to be done before the document builds
-    initDocumentBuilders( cfg, reflectionManager );
+  @SuppressWarnings("unchecked")
+  public SearchFactoryImpl(Configuration hibernateConfig)
+  {
+    this (new CfgImpl(hibernateConfig));
+  }

-    Set<Class> indexedClasses = documentBuilders.keySet();
-    for (DocumentBuilder builder : documentBuilders.values()) {
-      builder.postInitialize( indexedClasses );
-    }
-    this.worker = WorkerFactory.createWorker( cfg, this );
-    this.readerProvider = ReaderProviderFactory.createReaderProvider( cfg, this );
-    this.filterCachingStrategy = buildFilterCachingStrategy( cfg.getProperties() );
-  }
+  public SearchFactoryImpl(Cfg cfg)
+  {
+    //yuk
+    ReflectionManager reflectionManager = getReflectionManager(cfg);
+    this.indexingStrategy = defineIndexingStrategy(cfg); //need to be done before the document builds
+    initDocumentBuilders(cfg, reflectionManager);

-  private static String defineIndexingStrategy(Configuration cfg) {
-    String indexingStrategy = cfg.getProperties().getProperty( Environment.INDEXING_STRATEGY, "event" );
-    if ( ! ("event".equals( indexingStrategy ) || "manual".equals( indexingStrategy ) ) ) {
-      throw new SearchException( Environment.INDEXING_STRATEGY + " unknown: " + indexingStrategy );
-    }
-    return indexingStrategy;
-  }
+    Set<Class> indexedClasses = documentBuilders.keySet();
+    for (DocumentBuilder builder : documentBuilders.values())
+    {
+      builder.postInitialize(indexedClasses);
+    }
+    this.worker = WorkerFactory.createWorker(cfg, this);
+    this.readerProvider = ReaderProviderFactory.createReaderProvider(cfg, this);
+    this.filterCachingStrategy = buildFilterCachingStrategy(cfg.getProperties());

-  public String getIndexingStrategy() {
-    return indexingStrategy;
-  }

-  public void close() {
-    if ( stopped.compareAndSet( false, true) ) {
-      try {
-        worker.close();
-      }
-      catch (Exception e) {
-        log.error( "Worker raises an exception on close()", e );
-      }
-      //TODO move to DirectoryProviderFactory for cleaner
-      for (DirectoryProvider dp : getDirectoryProviders() ) {
-        try {
-          dp.stop();
-        }
-        catch (Exception e) {
-          log.error( "DirectoryProvider raises an exception on stop() ", e );
-        }
-      }
-    }
-  }
+  }

-  public void addClassToDirectoryProvider(Class clazz, DirectoryProvider<?> directoryProvider) {
-    DirectoryProviderData data = dirProviderData.get(directoryProvider);
-    if (data == null) {
-      data = new DirectoryProviderData();
-      dirProviderData.put( directoryProvider, data );
-    }
-    data.classes.add(clazz);
-  }
+  private static String defineIndexingStrategy(Cfg cfg)
+  {
+    String indexingStrategy = cfg.getProperties().getProperty(Environment.INDEXING_STRATEGY, "event");
+    if (!("event".equals(indexingStrategy) || "manual".equals(indexingStrategy)))
+    {
+      throw new SearchException(Environment.INDEXING_STRATEGY + " unknown: " + indexingStrategy);
+    }
+    return indexingStrategy;
+  }

-  public Set<Class> getClassesInDirectoryProvider(DirectoryProvider<?> directoryProvider) {
-    return Collections.unmodifiableSet( dirProviderData.get(directoryProvider).classes );
-  }
+  public String getIndexingStrategy()
+  {
+    return indexingStrategy;
+  }

-  private void bindFilterDefs(XClass mappedXClass) {
-    FullTextFilterDef defAnn = mappedXClass.getAnnotation( FullTextFilterDef.class );
-    if ( defAnn != null ) {
-      bindFilterDef( defAnn, mappedXClass );
-    }
-    FullTextFilterDefs defsAnn = mappedXClass.getAnnotation( FullTextFilterDefs.class );
-    if (defsAnn != null) {
-      for ( FullTextFilterDef def : defsAnn.value() ) {
-        bindFilterDef( def, mappedXClass );
-      }
-    }
-  }
+  public void close()
+  {
+    if (stopped.compareAndSet(false, true))
+    {
+      try
+      {
+        worker.close();
+      }
+      catch (Exception e)
+      {
+        log.error("Worker raises an exception on close()", e);
+      }
+      //TODO move to DirectoryProviderFactory for cleaner
+      for (DirectoryProvider dp : getDirectoryProviders())
+      {
+        try
+        {
+          dp.stop();
+        }
+        catch (Exception e)
+        {
+          log.error("DirectoryProvider raises an exception on stop() ", e);
+        }
+      }
+    }
+  }

-  private void bindFilterDef(FullTextFilterDef defAnn, XClass mappedXClass) {
-    if ( filterDefinitions.containsKey( defAnn.name() ) ) {
-      throw new SearchException("Multiple definition of @FullTextFilterDef.name=" + defAnn.name() + ": "
-          + mappedXClass.getName() );
-    }
-    FilterDef filterDef = new FilterDef();
-    filterDef.setImpl( defAnn.impl() );
-    filterDef.setCache( defAnn.cache() );
-    try {
-      filterDef.getImpl().newInstance();
-    }
-    catch (IllegalAccessException e) {
-      throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
-    }
-    catch (InstantiationException e) {
-      throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
-    }
-    for ( Method method : filterDef.getImpl().getMethods() ) {
-      if ( method.isAnnotationPresent( Factory.class ) ) {
-        if ( filterDef.getFactoryMethod() != null ) {
-          throw new SearchException("Multiple @Factory methods found" + defAnn.name() + ": "
-              + filterDef.getImpl().getName() + "." + method.getName() );
-        }
-        if ( !method.isAccessible() ) method.setAccessible( true );
-        filterDef.setFactoryMethod( method );
-      }
-      if ( method.isAnnotationPresent( Key.class ) ) {
-        if ( filterDef.getKeyMethod() != null ) {
-          throw new SearchException("Multiple @Key methods found" + defAnn.name() + ": "
-              + filterDef.getImpl().getName() + "." + method.getName() );
-        }
-        if ( !method.isAccessible() ) method.setAccessible( true );
-        filterDef.setKeyMethod( method );
-      }
+  public void addClassToDirectoryProvider(Class clazz, DirectoryProvider<?> directoryProvider)
+  {
+    DirectoryProviderData data = dirProviderData.get(directoryProvider);
+    if (data == null)
+    {
+      data = new DirectoryProviderData();
+      dirProviderData.put(directoryProvider, data);
+    }
+    data.classes.add(clazz);
+  }

-      String name = method.getName();
-      if ( name.startsWith( "set" ) && method.getParameterTypes().length == 1 ) {
-        filterDef.addSetter( Introspector.decapitalize( name.substring( 3 ) ), method );
-      }
-    }
-    filterDefinitions.put( defAnn.name(), filterDef );
-  }
+  public Set<Class> getClassesInDirectoryProvider(DirectoryProvider<?> directoryProvider)
+  {
+    return Collections.unmodifiableSet(dirProviderData.get(directoryProvider).classes);
+  }

-  //code doesn't have to be multithreaded because SF creation is not.
-  //this is not a public API, should really only be used during the SessionFActory building
-  //FIXME this is ugly, impl.staticmethod, fix that
-  public static SearchFactoryImpl getSearchFactory(Configuration cfg) {
-    WeakHashMap<Configuration, SearchFactoryImpl> contextMap = contexts.get();
-    if ( contextMap == null ) {
-      contextMap = new WeakHashMap<Configuration, SearchFactoryImpl>( 2 );
-      contexts.set( contextMap );
-    }
-    SearchFactoryImpl searchFactory = contextMap.get( cfg );
-    if ( searchFactory == null ) {
-      searchFactory = new SearchFactoryImpl( cfg );
-      contextMap.put( cfg, searchFactory );
-    }
-    return searchFactory;
-  }
+  private void bindFilterDefs(XClass mappedXClass)
+  {
+    FullTextFilterDef defAnn = mappedXClass.getAnnotation(FullTextFilterDef.class);
+    if (defAnn != null)
+    {
+      bindFilterDef(defAnn, mappedXClass);
+    }
+    FullTextFilterDefs defsAnn = mappedXClass.getAnnotation(FullTextFilterDefs.class);
+    if (defsAnn != null)
+    {
+      for (FullTextFilterDef def : defsAnn.value())
+      {
+        bindFilterDef(def, mappedXClass);
+      }
+    }
+  }

+  private void bindFilterDef(FullTextFilterDef defAnn, XClass mappedXClass)
+  {
+    if (filterDefinitions.containsKey(defAnn.name()))
+    {
+      throw new SearchException("Multiple definition of @FullTextFilterDef.name=" + defAnn.name() + ": "
+           + mappedXClass.getName());
+    }
+    FilterDef filterDef = new FilterDef();
+    filterDef.setImpl(defAnn.impl());
+    filterDef.setCache(defAnn.cache());
+    try
+    {
+      filterDef.getImpl().newInstance();
+    }
+    catch (IllegalAccessException e)
+    {
+      throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
+    }
+    catch (InstantiationException e)
+    {
+      throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
+    }
+    for (Method method : filterDef.getImpl().getMethods())
+    {
+      if (method.isAnnotationPresent(Factory.class))
+      {
+        if (filterDef.getFactoryMethod() != null)
+        {
+          throw new SearchException("Multiple @Factory methods found" + defAnn.name() + ": "
+               + filterDef.getImpl().getName() + "." + method.getName());
+        }
+        if (!method.isAccessible()) method.setAccessible(true);
+        filterDef.setFactoryMethod(method);
+      }
+      if (method.isAnnotationPresent(Key.class))
+      {
+        if (filterDef.getKeyMethod() != null)
+        {
+          throw new SearchException("Multiple @Key methods found" + defAnn.name() + ": "
+               + filterDef.getImpl().getName() + "." + method.getName());
+        }
+        if (!method.isAccessible()) method.setAccessible(true);
+        filterDef.setKeyMethod(method);
+      }

-  public Map<Class, DocumentBuilder<Object>> getDocumentBuilders() {
-    return documentBuilders;
-  }
+      String name = method.getName();
+      if (name.startsWith("set") && method.getParameterTypes().length == 1)
+      {
+        filterDef.addSetter(Introspector.decapitalize(name.substring(3)), method);
+      }
+    }
+    filterDefinitions.put(defAnn.name(), filterDef);
+  }

-  public Set<DirectoryProvider> getDirectoryProviders() {
-    return this.dirProviderData.keySet();
-  }
+  //code doesn't have to be multithreaded because SF creation is not.
+  //this is not a public API, should really only be used during the SessionFActory building
+  //FIXME this is ugly, impl.staticmethod, fix that
+  public static SearchFactoryImpl getSearchFactory(Cfg cfg)
+  {
+    WeakHashMap<Cfg, SearchFactoryImpl> contextMap = contexts.get();
+    if (contextMap == null)
+    {
+      contextMap = new WeakHashMap<Cfg, SearchFactoryImpl>(2);
+      contexts.set(contextMap);
+    }
+    SearchFactoryImpl searchFactory = contextMap.get(cfg);
+    if (searchFactory == null)
+    {
+      searchFactory = new SearchFactoryImpl(cfg);
+      contextMap.put(cfg, searchFactory);
+    }
+    return searchFactory;
+  }

-  public Worker getWorker() {
-    return worker;
-  }

-  public void addOptimizerStrategy(DirectoryProvider<?> provider, OptimizerStrategy optimizerStrategy) {
-    DirectoryProviderData data = dirProviderData.get(provider);
-    if (data == null) {
-      data = new DirectoryProviderData();
-      dirProviderData.put( provider, data );
-    }
-    data.optimizerStrategy = optimizerStrategy;
-  }
+  public Map<Class, DocumentBuilder<Object>> getDocumentBuilders()
+  {
+    return documentBuilders;
+  }

-  public void addIndexingParameters(DirectoryProvider<?> provider, LuceneIndexingParameters indexingParams) {
-    dirProviderIndexingParams.put( provider, indexingParams );
-  }
+  public Set<DirectoryProvider> getDirectoryProviders()
+  {
+    return this.dirProviderData.keySet();
+  }

-  public OptimizerStrategy getOptimizerStrategy(DirectoryProvider<?> provider) {
-    return dirProviderData.get( provider ).optimizerStrategy;
-  }
+  public Worker getWorker()
+  {
+    return worker;
+  }

-  public LuceneIndexingParameters getIndexingParameters(DirectoryProvider<?> provider ) {
-    return dirProviderIndexingParams.get( provider );
-  }
+  public void addOptimizerStrategy(DirectoryProvider<?> provider, OptimizerStrategy optimizerStrategy)
+  {
+    DirectoryProviderData data = dirProviderData.get(provider);
+    if (data == null)
+    {
+      data = new DirectoryProviderData();
+      dirProviderData.put(provider, data);
+    }
+    data.optimizerStrategy = optimizerStrategy;
+  }

-  public ReaderProvider getReaderProvider() {
-    return readerProvider;
-  }
+  public void addIndexingParameters(DirectoryProvider<?> provider, LuceneIndexingParameters indexingParams)
+  {
+    dirProviderIndexingParams.put(provider, indexingParams);
+  }

-  //not happy about having it as a helper class but I don't want cfg to be associated with the SearchFactory
-  public static ReflectionManager getReflectionManager(Configuration cfg) {
-    ReflectionManager reflectionManager;
-    try {
-      //TODO introduce a ReflectionManagerHolder interface to avoid reflection
-      //I want to avoid hard link between HAN and Validator for such a simple need
-      //reuse the existing reflectionManager one when possible
-      reflectionManager =
-          (ReflectionManager) cfg.getClass().getMethod( "getReflectionManager" ).invoke( cfg );
+  public OptimizerStrategy getOptimizerStrategy(DirectoryProvider<?> provider)
+  {
+    return dirProviderData.get(provider).optimizerStrategy;
+  }

-    }
-    catch (Exception e) {
-      reflectionManager = new JavaReflectionManager();
-    }
-    return reflectionManager;
-  }
+  public LuceneIndexingParameters getIndexingParameters(DirectoryProvider<?> provider)
+  {
+    return dirProviderIndexingParams.get(provider);
+  }

-  public DirectoryProvider[] getDirectoryProviders(Class entity) {
-    DocumentBuilder<Object> documentBuilder = getDocumentBuilders().get( entity );
-    return documentBuilder == null ? null : documentBuilder.getDirectoryProviders();
-  }
+  public ReaderProvider getReaderProvider()
+  {
+    return readerProvider;
+  }

-  public void optimize() {
-    Set<Class> clazzs = getDocumentBuilders().keySet();
-    for (Class clazz : clazzs) {
-      optimize( clazz );
-    }
-  }
+  //not happy about having it as a helper class but I don't want cfg to be associated with the SearchFactory
+  public static ReflectionManager getReflectionManager(Cfg cfg)
+  {
+    ReflectionManager reflectionManager;
+    try
+    {
+      //TODO introduce a ReflectionManagerHolder interface to avoid reflection
+      //I want to avoid hard link between HAN and Validator for such a simple need
+      //reuse the existing reflectionManager one when possible
+      reflectionManager =
+           (ReflectionManager) cfg.getClass().getMethod("getReflectionManager").invoke(cfg);

-  public void optimize(Class entityType) {
-    if ( ! getDocumentBuilders().containsKey( entityType ) ) {
-      throw new SearchException("Entity not indexed: " + entityType);
-    }
-    List<LuceneWork> queue = new ArrayList<LuceneWork>(1);
-    queue.add( new OptimizeLuceneWork( entityType ) );
-    getBackendQueueProcessorFactory().getProcessor( queue ).run();
-  }
+    }
+    catch (Exception e)
+    {
+      reflectionManager = new JavaReflectionManager();
+    }
+    return reflectionManager;
+  }

-  public Analyzer getAnalyzer(String name) {
-    final Analyzer analyzer = analyzers.get( name );
-    if ( analyzer == null) throw new SearchException( "Unknown Analyzer definition: " + name);
-    return analyzer;
-  }
+  public DirectoryProvider[] getDirectoryProviders(Class entity)
+  {
+    DocumentBuilder<Object> documentBuilder = getDocumentBuilders().get(entity);
+    return documentBuilder == null ? null : documentBuilder.getDirectoryProviders();
+  }

-  private void initDocumentBuilders(Configuration cfg, ReflectionManager reflectionManager) {
-    InitContext context = new InitContext( cfg );
-    Iterator iter = cfg.getClassMappings();
-    DirectoryProviderFactory factory = new DirectoryProviderFactory();
+  public void optimize()
+  {
+    Set<Class> clazzs = getDocumentBuilders().keySet();
+    for (Class clazz : clazzs)
+    {
+      optimize(clazz);
+    }
+  }

-    while ( iter.hasNext() ) {
-      PersistentClass clazz = (PersistentClass) iter.next();
-      Class<?> mappedClass = clazz.getMappedClass();
-      if (mappedClass != null) {
-        XClass mappedXClass = reflectionManager.toXClass(mappedClass);
-        if ( mappedXClass != null) {
-          if ( mappedXClass.isAnnotationPresent( Indexed.class ) ) {
-            DirectoryProviderFactory.DirectoryProviders providers = factory.createDirectoryProviders( mappedXClass, cfg, this, reflectionManager );
+  public void optimize(Class entityType)
+  {
+    if (!getDocumentBuilders().containsKey(entityType))
+    {
+      throw new SearchException("Entity not indexed: " + entityType);
+    }
+    List<LuceneWork> queue = new ArrayList<LuceneWork>(1);
+    queue.add(new OptimizeLuceneWork(entityType));
+    getBackendQueueProcessorFactory().getProcessor(queue).run();
+  }

-            final DocumentBuilder<Object> documentBuilder = new DocumentBuilder<Object>(
-                mappedXClass, context, providers.getProviders(), providers.getSelectionStrategy(),
-                reflectionManager
-            );
+  public Analyzer getAnalyzer(String name)
+  {
+    final Analyzer analyzer = analyzers.get(name);
+    if (analyzer == null) throw new SearchException("Unknown Analyzer definition: " + name);
+    return analyzer;
+  }

-            documentBuilders.put( mappedClass, documentBuilder );
-          }
-          bindFilterDefs(mappedXClass);
-          //TODO should analyzer def for classes at tyher sqme level???
-        }
-      }
-    }
-    analyzers = context.initLazyAnalyzers();
-    factory.startDirectoryProviders();
-  }
+  private void initDocumentBuilders(Cfg cfg, ReflectionManager reflectionManager)
+  {
+    InitContext context = new InitContext(cfg);
+    Iterator iter = cfg.getClassMappings();
+    DirectoryProviderFactory factory = new DirectoryProviderFactory();

-  private static FilterCachingStrategy buildFilterCachingStrategy(Properties properties) {
-    FilterCachingStrategy filterCachingStrategy;
-    String impl = properties.getProperty( Environment.FILTER_CACHING_STRATEGY );
-    if ( StringHelper.isEmpty( impl ) || "mru".equalsIgnoreCase( impl ) ) {
-      filterCachingStrategy = new MRUFilterCachingStrategy();
-    }
-    else {
-      try {
-        Class filterCachingStrategyClass = org.hibernate.annotations.common.util.ReflectHelper.classForName( impl, SearchFactoryImpl.class );
-        filterCachingStrategy = (FilterCachingStrategy) filterCachingStrategyClass.newInstance();
-      }
-      catch (ClassNotFoundException e) {
-        throw new SearchException( "Unable to find filterCachingStrategy class: " + impl, e );
-      }
-      catch (IllegalAccessException e) {
-        throw new SearchException( "Unable to instantiate filterCachingStrategy class: " + impl, e );
-      }
-      catch (InstantiationException e) {
-        throw new SearchException( "Unable to instantiate filterCachingStrategy class: " + impl, e );
-      }
-    }
-    filterCachingStrategy.initialize( properties );
-    return filterCachingStrategy;
-  }
+    while (iter.hasNext())
+    {
+      PersistentClass clazz = (PersistentClass) iter.next();
+      Class<?> mappedClass = clazz.getMappedClass();
+      if (mappedClass != null)
+      {
+        XClass mappedXClass = reflectionManager.toXClass(mappedClass);
+        if (mappedXClass != null)
+        {
+          if (mappedXClass.isAnnotationPresent(Indexed.class))
+          {
+            DirectoryProviderFactory.DirectoryProviders providers = factory.createDirectoryProviders(mappedXClass, cfg, this, reflectionManager);

-  public FilterCachingStrategy getFilterCachingStrategy() {
-    return filterCachingStrategy;
-  }
+            final DocumentBuilder<Object> documentBuilder = new DocumentBuilder<Object>(
+                 mappedXClass, context, providers.getProviders(), providers.getSelectionStrategy(),
+                 reflectionManager
+            );

-  public FilterDef getFilterDefinition(String name) {
-    return filterDefinitions.get( name );
-  }
+            documentBuilders.put(mappedClass, documentBuilder);
+          }
+          bindFilterDefs(mappedXClass);
+          //TODO should analyzer def for classes at tyher sqme level???
+        }
+      }
+    }
+    analyzers = context.initLazyAnalyzers();
+    factory.startDirectoryProviders();
+  }

-  private static class DirectoryProviderData {
-    public final Lock dirLock = new ReentrantLock();
-    public OptimizerStrategy optimizerStrategy;
-    public Set<Class> classes = new HashSet<Class>(2);
-  }
+  private static FilterCachingStrategy buildFilterCachingStrategy(Properties properties)
+  {
+    FilterCachingStrategy filterCachingStrategy;
+    String impl = properties.getProperty(Environment.FILTER_CACHING_STRATEGY);
+    if (StringHelper.isEmpty(impl) || "mru".equalsIgnoreCase(impl))
+    {
+      filterCachingStrategy = new MRUFilterCachingStrategy();
+    }
+    else
+    {
+      try
+      {
+        Class filterCachingStrategyClass = org.hibernate.annotations.common.util.ReflectHelper.classForName(impl, SearchFactoryImpl.class);
+        filterCachingStrategy = (FilterCachingStrategy) filterCachingStrategyClass.newInstance();
+      }
+      catch (ClassNotFoundException e)
+      {
+        throw new SearchException("Unable to find filterCachingStrategy class: " + impl, e);
+      }
+      catch (IllegalAccessException e)
+      {
+        throw new SearchException("Unable to instantiate filterCachingStrategy class: " + impl, e);
+      }
+      catch (InstantiationException e)
+      {
+        throw new SearchException("Unable to instantiate filterCachingStrategy class: " + impl, e);
+      }
+    }
+    filterCachingStrategy.initialize(properties);
+    return filterCachingStrategy;
+  }

-  public Lock getDirectoryProviderLock(DirectoryProvider dp) {
-    return this.dirProviderData.get( dp ).dirLock;
-  }
+  public FilterCachingStrategy getFilterCachingStrategy()
+  {
+    return filterCachingStrategy;
+  }

-  public void addDirectoryProvider(DirectoryProvider<?> provider) {
-    this.dirProviderData.put( provider, new DirectoryProviderData() );
-  }
-  
+  public FilterDef getFilterDefinition(String name)
+  {
+    return filterDefinitions.get(name);
+  }
+
+  private static class DirectoryProviderData
+  {
+    public final Lock dirLock = new ReentrantLock();
+    public OptimizerStrategy optimizerStrategy;
+    public Set<Class> classes = new HashSet<Class>(2);
+  }
+
+  public Lock getDirectoryProviderLock(DirectoryProvider dp)
+  {
+    return this.dirProviderData.get(dp).dirLock;
+  }
+
+  public void addDirectoryProvider(DirectoryProvider<?> provider)
+  {
+    this.dirProviderData.put(provider, new DirectoryProviderData());
+  }
+
}

Modified: search/branches/jboss_cache_integration/src/java/org/hibernate/search/reader/ReaderProviderFactory.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/reader/ReaderProviderFactory.java  2008-06-30 13:56:28 UTC (rev 14827)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/reader/ReaderProviderFactory.java  2008-06-30 15:45:38 UTC (rev 14828)
@@(protected) @@
import org.hibernate.cfg.Configuration;
import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
+import org.hibernate.search.cfg.Cfg;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
@@(protected) @@
*/
public abstract class ReaderProviderFactory {

-  private static Properties getProperties(Configuration cfg) {
+  private static Properties getProperties(Cfg cfg) {
   Properties props = cfg.getProperties();
   Properties workerProperties = new Properties();
   for (Map.Entry entry : props.entrySet()) {
@@(protected) @@
   return workerProperties;
 }

-  public static ReaderProvider createReaderProvider(Configuration cfg, SearchFactoryImplementor searchFactoryImplementor) {
+  public static ReaderProvider createReaderProvider(Cfg cfg, SearchFactoryImplementor searchFactoryImplementor) {
   Properties props = getProperties( cfg );
   String impl = props.getProperty( Environment.READER_STRATEGY );
   ReaderProvider readerProvider;

Modified: search/branches/jboss_cache_integration/src/java/org/hibernate/search/store/DirectoryProviderFactory.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/store/DirectoryProviderFactory.java  2008-06-30 13:56:28 UTC (rev 14827)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/store/DirectoryProviderFactory.java  2008-06-30 15:45:38 UTC (rev 14828)
@@(protected) @@
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.search.SearchException;
+import org.hibernate.search.cfg.Cfg;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.backend.LuceneIndexingParameters;
import org.hibernate.search.backend.configuration.ConfigurationParseHelper;
@@(protected) @@
 private static final String SHARDING_STRATEGY = "sharding_strategy";
 private static final String NBR_OF_SHARDS = SHARDING_STRATEGY + ".nbr_of_shards";

-  public DirectoryProviders createDirectoryProviders(XClass entity, Configuration cfg,
+  public DirectoryProviders createDirectoryProviders(XClass entity, Cfg cfg,
                           SearchFactoryImplementor searchFactoryImplementor,
                           ReflectionManager reflectionManager) {
   //get properties
@@(protected) @@
  * 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(Configuration cfg, String directoryProviderName) {
+  private static Properties[] getDirectoryProperties(Cfg cfg, String directoryProviderName) {
   Properties rootCfg = new MaskedProperty( cfg.getProperties(), "hibernate.search" );
   Properties globalProperties = new MaskedProperty( rootCfg, "default" );
   Properties directoryLocalProperties = new MaskedProperty( rootCfg, directoryProviderName, globalProperties );
@@(protected) @@
   }
 }

-  private static String getDirectoryProviderName(XClass clazz, Configuration cfg) {
+  private static String getDirectoryProviderName(XClass clazz, org.hibernate.search.cfg.Cfg cfg) {
   //yuk
   ReflectionManager reflectionManager = SearchFactoryImpl.getReflectionManager(cfg);
   //get the most specialized (ie subclass > superclass) non default index name

_______________________________________________
hibernate-commits mailing list
hibernate-commits@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-commits
©2008 gg3721.com - Jax Systems, LLC, U.S.A.