Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Commits List »

[hibernate-commits] Hibernate SVN: r14914 - in
 search/branches/jboss_cache_integration/src/java/org/hibernate/search:
 backend/impl and 5 other directories.

hibernate-commits

2008-07-10


Author LoginPost Reply
Author: navssurtani
Date: 2008-07-10 10:14:26 -0400 (Thu, 10 Jul 2008)
New Revision: 14914

Added:
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/TransactionalContext.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/impl/EventSourceTransactionalContext.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfiguration.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/ContextHolder.java
Removed:
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/Cfg.java
 search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/CfgImpl.java
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:
Re-patched with trunk

Added: search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/TransactionalContext.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/TransactionalContext.java                  (rev 0)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/TransactionalContext.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
+package org.hibernate.search.backend;
+
+import javax.transaction.Synchronization;
+
+/**
+ * Contract needed by Hibernate Search to bach changes per transaction
+ *
+ * @author Navin Surtani - navin@(protected)
+ */
+public interface TransactionalContext {
+  /**
+   * @return A boolean whether a transaction is in progress or not.
+   */
+  public boolean isTransactionInProgress();
+
+  /**
+   * @return a transaction object.
+   */
+  public Object getTransactionIdentifier();
+
+  public void registerSynchronization(Synchronization synchronization);
+}

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-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/WorkerFactory.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@

import org.hibernate.search.Environment;
import org.hibernate.search.SearchException;
-import org.hibernate.search.cfg.Cfg;
+import org.hibernate.search.cfg.SearchConfiguration;
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(Cfg cfg) {
+  private static Properties getProperties(SearchConfiguration cfg) {
   Properties props = cfg.getProperties();
   Properties workerProperties = new Properties();
   for ( Map.Entry entry : props.entrySet() ) {
@@(protected) @@
   return workerProperties;
 }

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

Added: search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/impl/EventSourceTransactionalContext.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/impl/EventSourceTransactionalContext.java                  (rev 0)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/backend/impl/EventSourceTransactionalContext.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
+package org.hibernate.search.backend.impl;
+
+import java.io.Serializable;
+import javax.transaction.Synchronization;
+
+import org.hibernate.Transaction;
+import org.hibernate.search.backend.TransactionalContext;
+import org.hibernate.event.EventSource;
+
+/**
+ * Implementation of the transactional context on top of an EventSource (Session)
+ *
+ * @author Navin Surtani - navin@(protected)
+ */
+public class EventSourceTransactionalContext implements TransactionalContext, Serializable {
+  private EventSource eventSource;
+
+  public EventSourceTransactionalContext(EventSource eventSource) {
+    this.eventSource = eventSource;
+  }
+
+  public Object getTransactionIdentifier() {
+    return eventSource.getTransaction();
+  }
+
+  public void registerSynchronization(Synchronization synchronization) {
+    Transaction transaction = eventSource.getTransaction();
+    transaction.registerSynchronization( synchronization );
+  }
+
+  public boolean isTransactionInProgress() {
+    return eventSource.isTransactionInProgress();
+  }
+
+}

Deleted: search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/Cfg.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/Cfg.java  2008-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/Cfg.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
-package org.hibernate.search.cfg;
-
-import org.hibernate.mapping.PersistentClass;
-
-import java.util.Iterator;
-import java.util.Properties;
-
-/**
- * Interface that is used for the JBossCache integration. In Hibernate Search, it delegates back to Hibernate Core.
- *
- * @author Navin Surtani - navin@(protected)
- */
-public interface Cfg
-{
-  /**
-   * Returns an iterator of class mappings.
-   *
-   * @return iterator of class mappings.
-   */
-
-  Iterator getClassMappings();
-
-  /**
-   * Returns a {@(protected).
-   *
-   * @param name
-   * @return org.hibernate.mapping.PersistentClass
-   */
-
-  PersistentClass getClassMapping(String name);
-
-  /**
-   * Gets a property from a String.
-   *
-   * @param propertyName - as a String.
-   * @return the property as a String.
-   */
-
-  String getProperty(String propertyName);
-
-  /**
-   * Gets the properties as a java.util.Properties object.
-   *
-   * @return a java.util.Properties object.
-   * @see java.util.Properties object
-   */
-
-  Properties getProperties();
-
-
-}

Deleted: search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/CfgImpl.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/CfgImpl.java  2008-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/CfgImpl.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
-package org.hibernate.search.cfg;
-
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.cfg.Configuration;
-
-import java.util.Iterator;
-import java.util.Properties;
-
-/**
- * @author Navin Surtani - navin@(protected)
- */
-public class CfgImpl implements Cfg
-{
-  private Configuration cfg;
-  private Properties properties;
-
-  public CfgImpl(Configuration cfg)
-  {
-    if (cfg == null) throw new NullPointerException("Configuration is null");
-    this.cfg = cfg;
-  }
-
-  public Iterator getClassMappings()
-  {
-    return cfg.getClassMappings();
-  }
-
-  public PersistentClass getClassMapping(String name)
-  {
-    return cfg.getClassMapping(name);
-  }
-
-  public String getProperty(String propertyName)
-  {
-    return cfg.getProperty(propertyName);
-  }
-
-  public Properties getProperties()
-  {
-    return cfg.getProperties();
-  }
-
-}

Added: search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfiguration.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfiguration.java                  (rev 0)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfiguration.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
+package org.hibernate.search.cfg;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
+
+/**
+ * Provides configuration to Hibernate Search
+ *
+ * @author Navin Surtani - navin@(protected)
+ */
+public interface SearchConfiguration {
+  /**
+   * Returns an iterator over the list of indexed classes
+   * FIXME navssurtani should be Iterator<Class>
+   *
+   * @return iterator of indexed classes.
+   */
+
+  Iterator getClassMappings();
+
+  /**
+   * Returns a {@(protected).
+   * TODO: should it be Iteratable, should it be <Class>
+   *
+   * @param name
+   * @return org.hibernate.mapping.PersistentClass
+   */
+
+  PersistentClass getClassMapping(String name);
+
+  /**
+   * Gets a configuration property from its name
+   * or null if not present
+   *
+   * @param propertyName - as a String.
+   * @return the property as a String
+   */
+
+  String getProperty(String propertyName);
+
+  /**
+   * Gets properties as a java.util.Properties object.
+   *
+   * @return a java.util.Properties object.
+   * @see java.util.Properties object
+   */
+  Properties getProperties();
+
+  /**
+   * Returns a reflection manager if already available in the environment
+   * null otherwise
+   * @return ReflectionManager
+   */
+  ReflectionManager getReflectionManager();
+
+
+}

Added: search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java                  (rev 0)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
+package org.hibernate.search.cfg;
+
+import java.util.Properties;
+import java.util.Iterator;
+
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.annotations.common.reflection.ReflectionManager;
+import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
+
+/**
+ * Search configuration implementation wrapping an Hibernate Core configuration
+ *
+ * @author Emmanuel Bernard
+ */
+public class SearchConfigurationFromHibernateCore implements SearchConfiguration {
+  private org.hibernate.cfg.Configuration cfg;
+  private ReflectionManager reflectionManager;
+
+  public SearchConfigurationFromHibernateCore(org.hibernate.cfg.Configuration cfg) {
+    if ( cfg == null ) throw new NullPointerException( "Configuration is null" );
+    this.cfg = cfg;
+  }
+
+  public Iterator getClassMappings() {
+    return cfg.getClassMappings();
+  }
+
+  public PersistentClass getClassMapping(String name) {
+    return cfg.getClassMapping( name );
+  }
+
+  public String getProperty(String propertyName) {
+    return cfg.getProperty( propertyName );
+  }
+
+  public Properties getProperties() {
+    return cfg.getProperties();
+  }
+
+  public ReflectionManager getReflectionManager() {
+    if (reflectionManager == null) {
+      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 );
+
+      }
+      catch (Exception e) {
+        reflectionManager = new JavaReflectionManager();
+      }
+    }
+    return reflectionManager;
+  }
+}

Added: search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/ContextHolder.java
===================================================================
--- search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/ContextHolder.java                  (rev 0)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/ContextHolder.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
+package org.hibernate.search.event;
+
+import java.util.WeakHashMap;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.search.impl.SearchFactoryImpl;
+import org.hibernate.search.cfg.SearchConfigurationFromHibernateCore;
+
+/**
+ * Holds already built SearchFactory per Hibernate Configuration object
+ * concurrent threads do not share this information
+ *
+ * @author Emmanuel Bernard
+ */
+public class ContextHolder {
+  private static final ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>> contexts =
+      new ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>>();
+
+  //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
+  public static SearchFactoryImpl getOrBuildSearchFactory(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( new SearchConfigurationFromHibernateCore(cfg) );
+      contextMap.put( cfg, searchFactory );
+    }
+    return searchFactory;
+  }
+}

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-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/event/FullTextIndexEventListener.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@
import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.cfg.Cfg;
+import org.hibernate.search.cfg.SearchConfiguration;
import org.hibernate.search.transaction.EventSourceTransactionContext;
import org.hibernate.engine.EntityEntry;
import org.slf4j.Logger;
@@(protected) @@
  {
  }

-  public void intitialize (Cfg cfg)
+  public void intitialize (SearchConfiguration cfg)
  {
    searchFactoryImplementor = SearchFactoryImpl.getSearchFactory(cfg);
    String indexingStrategy = searchFactoryImplementor.getIndexingStrategy();

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-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/InitContext.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(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.SearchConfiguration;
import org.hibernate.search.util.DelegateNamedAnalyzer;
-import org.hibernate.cfg.Configuration;
import org.hibernate.util.ReflectHelper;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@(protected) @@
 private final Analyzer defaultAnalyzer;
 private final Similarity defaultSimilarity;

-  public InitContext(Cfg cfg) {
+  public InitContext(SearchConfiguration cfg) {
   defaultAnalyzer = initAnalyzer(cfg);
   defaultSimilarity = initSimilarity(cfg);
 }
@@(protected) @@
  *        The current configuration.
  * @return The Lucene analyzer to use for tokenisation.
  */
-  private Analyzer initAnalyzer(Cfg cfg) {
+  private Analyzer initAnalyzer(SearchConfiguration cfg) {
   Class analyzerClass;
   String analyzerClassName = cfg.getProperty( Environment.ANALYZER_CLASS);
   if (analyzerClassName != null) {
@@(protected) @@
 /**
  * Initializes the Lucene similarity to use
  */
-  private Similarity initSimilarity(Cfg cfg) {
+  private Similarity initSimilarity(SearchConfiguration cfg) {
   Class similarityClass;
   String similarityClassName = cfg.getProperty(Environment.SIMILARITY_CLASS);
   if (similarityClassName != null) {

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-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/impl/SearchFactoryImpl.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(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.cfg.SearchConfiguration;
+import org.hibernate.search.cfg.SearchConfigurationFromHibernateCore;
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<Cfg, SearchFactoryImpl>> contexts =
-      new ThreadLocal<WeakHashMap<Cfg, SearchFactoryImpl>>();
+  private static final ThreadLocal<WeakHashMap<SearchConfiguration, SearchFactoryImpl>> contexts =
+      new ThreadLocal<WeakHashMap<SearchConfiguration, SearchFactoryImpl>>();

 static {
   Version.touch();
@@(protected) @@
 private final String indexingStrategy;


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

@@(protected) @@
 }

  public SearchFactoryImpl(Configuration hibernateConfiguration) {
-    this(new CfgImpl(hibernateConfiguration));
+    this(new SearchConfigurationFromHibernateCore(hibernateConfiguration));
  }

  @SuppressWarnings( "unchecked" )
-  public SearchFactoryImpl(Cfg cfg) {
+  public SearchFactoryImpl(SearchConfiguration cfg) {
   //yuk
   ReflectionManager reflectionManager = getReflectionManager( cfg );
   this.indexingStrategy = defineIndexingStrategy( cfg ); //need to be done before the document builds
@@(protected) @@
   this.filterCachingStrategy = buildFilterCachingStrategy( cfg.getProperties() );
 }

-  private static String defineIndexingStrategy(Cfg cfg) {
+  private static String defineIndexingStrategy(SearchConfiguration 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 );
@@(protected) @@
 //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();
+  public static SearchFactoryImpl getSearchFactory(SearchConfiguration cfg) {
+    WeakHashMap<SearchConfiguration, SearchFactoryImpl> contextMap = contexts.get();
   if ( contextMap == null ) {
-      contextMap = new WeakHashMap<Cfg, SearchFactoryImpl>( 2 );
+      contextMap = new WeakHashMap<SearchConfiguration, SearchFactoryImpl>( 2 );
     contexts.set( contextMap );
   }
   SearchFactoryImpl searchFactory = contextMap.get( cfg );
@@(protected) @@
 }

 //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) {
+  public static ReflectionManager getReflectionManager(SearchConfiguration cfg) {
   ReflectionManager reflectionManager;
   try {
     //TODO introduce a ReflectionManagerHolder interface to avoid reflection
@@(protected) @@
   return analyzer;
 }

-  private void initDocumentBuilders(Cfg cfg, ReflectionManager reflectionManager) {
+  private void initDocumentBuilders(SearchConfiguration cfg, ReflectionManager reflectionManager) {
   InitContext context = new InitContext( cfg );
   Iterator iter = cfg.getClassMappings();
   DirectoryProviderFactory factory = new DirectoryProviderFactory();

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-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/reader/ReaderProviderFactory.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(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.cfg.SearchConfiguration;
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(Cfg cfg) {
+  private static Properties getProperties(SearchConfiguration cfg) {
   Properties props = cfg.getProperties();
   Properties workerProperties = new Properties();
   for (Map.Entry entry : props.entrySet()) {
@@(protected) @@
   return workerProperties;
 }

-  public static ReaderProvider createReaderProvider(Cfg cfg, SearchFactoryImplementor searchFactoryImplementor) {
+  public static ReaderProvider createReaderProvider(SearchConfiguration 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-07-10 14:13:04 UTC (rev 14913)
+++ search/branches/jboss_cache_integration/src/java/org/hibernate/search/store/DirectoryProviderFactory.java  2008-07-10 14:14:26 UTC (rev 14914)
@@(protected) @@

import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
-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.cfg.SearchConfiguration;
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, Cfg cfg,
+  public DirectoryProviders createDirectoryProviders(XClass entity, SearchConfiguration 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(Cfg cfg, String directoryProviderName) {
+  private static Properties[] getDirectoryProperties(SearchConfiguration 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, Cfg cfg) {
+  private static String getDirectoryProviderName(XClass clazz, SearchConfiguration 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.