Author: sannegrinovero
Date: 2008-05-29 11:18:15 -0400 (Thu, 29 May 2008)
New Revision: 14713
Modified:
search/trunk/src/java/org/hibernate/search/annotations/ClassBridge.java
search/trunk/src/java/org/hibernate/search/annotations/FieldBridge.java
search/trunk/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java
search/trunk/src/java/org/hibernate/search/backend/QueueingProcessor.java
search/trunk/src/java/org/hibernate/search/backend/Work.java
search/trunk/src/java/org/hibernate/search/backend/configuration/MaskedProperty.java
search/trunk/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
search/trunk/src/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java
search/trunk/src/java/org/hibernate/search/backend/impl/TransactionalWorker.java
search/trunk/src/java/org/hibernate/search/backend/impl/jms/AbstractJMSHibernateSearchController.java
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneBackendQueueProcessor.java
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java
search/trunk/src/java/org/hibernate/search/bridge/String2FieldBridgeAdaptor.java
search/trunk/src/java/org/hibernate/search/bridge/TwoWayString2FieldBridgeAdaptor.java
search/trunk/src/java/org/hibernate/search/bridge/builtin/DateBridge.java
search/trunk/src/java/org/hibernate/search/engine/DocumentExtractor.java
search/trunk/src/java/org/hibernate/search/engine/EntityInfo.java
search/trunk/src/java/org/hibernate/search/event/FullTextIndexEventListener.java
search/trunk/src/java/org/hibernate/search/filter/ChainedFilter.java
search/trunk/src/java/org/hibernate/search/filter/StandardFilterKey.java
search/trunk/src/java/org/hibernate/search/impl/FullTextSessionImpl.java
search/trunk/src/java/org/hibernate/search/impl/InitContext.java
search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java
search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java
search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
search/trunk/src/java/org/hibernate/search/query/FullTextFilterImpl.java
search/trunk/src/java/org/hibernate/search/query/IteratorImpl.java
search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java
search/trunk/src/java/org/hibernate/search/reader/CacheableMultiReader.java
search/trunk/src/java/org/hibernate/search/store/DirectoryProviderFactory.java
search/trunk/src/java/org/hibernate/search/store/DirectoryProviderHelper.java
search/trunk/src/test/org/hibernate/search/test/bridge/UnresolvedBridgeTest.java
Log:
general code review: unused imports deleted, typos in comments and error messages, some
"final" added to fields.
Modified: search/trunk/src/java/org/hibernate/search/annotations/ClassBridge.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/annotations/ClassBridge.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/annotations/ClassBridge.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -10,7 +10,7 @@
/**
* This annotation allows a user to apply an implementation
* class to a Lucene document to manipulate it in any way
- * the usersees fit.
+ * the user sees fit.
*
* @author John Griffin
*/
@@ -48,7 +48,7 @@
TermVector termVector() default TermVector.NO;
/**
- * A float value of the amount of lucene defined
+ * A float value of the amount of Lucene defined
* boost to apply to a field.
*/
Boost boost() default @Boost(value=1.0F);
@@ -60,7 +60,7 @@
public Class impl() default void.class;
/**
- * Array of fields to work with. The imnpl class
+ * Array of fields to work with. The impl class
* above will work on these fields.
*/
public Parameter[] params() default {};
Modified: search/trunk/src/java/org/hibernate/search/annotations/FieldBridge.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/annotations/FieldBridge.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/annotations/FieldBridge.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -16,7 +16,7 @@
@Target( {ElementType.FIELD, ElementType.METHOD} )
@Documented
public @interface FieldBridge {
- //defaault to embed @FieldBridge in @Field
+ //default to embed @FieldBridge in @Field
public Class impl() default void.class;
public Parameter[] params() default {};
Modified:
search/trunk/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -27,8 +27,9 @@
public class LuceneIndexingParameters implements Serializable {
private static final long serialVersionUID = 5424606407623591663L;
- private static Logger log = LoggerFactory.getLogger( LuceneIndexingParameters.class );
+ private final Logger log = LoggerFactory.getLogger( LuceneIndexingParameters.class );
+
// value keyword
public static final String EXPLICIT_DEFAULT_VALUE = "default";
// property path keywords
Modified: search/trunk/src/java/org/hibernate/search/backend/QueueingProcessor.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/backend/QueueingProcessor.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/backend/QueueingProcessor.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -1,11 +1,6 @@
//$Id$
package org.hibernate.search.backend;
-import java.util.List;
-import java.io.Serializable;
-
-import org.hibernate.search.backend.LuceneWork;
-
/**
* Pile work operations
* No thread safety has to be implemented, the queue being scoped already
@@ -18,7 +13,7 @@
public interface QueueingProcessor {
/**
* Add a work
- * TODO move that womewhere else, it does not really fit here
+ * TODO move that somewhere else, it does not really fit here
*/
void add(Work work, WorkQueue workQueue);
Modified: search/trunk/src/java/org/hibernate/search/backend/Work.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/backend/Work.java 2008-05-29 15:14:13 UTC
(rev 14712)
+++ search/trunk/src/java/org/hibernate/search/backend/Work.java 2008-05-29 15:18:15 UTC
(rev 14713)
@@ -11,31 +11,33 @@
* @author Emmanuel Bernard
*/
public class Work {
- private Object entity;
- private Class entityClass;
- private Serializable id;
- private XMember idGetter;
- private WorkType type;
+ private final Object entity;
+ private final Class entityClass;
+ private final Serializable id;
+ private final XMember idGetter;
+ private final WorkType type;
-
public Work(Object entity, Serializable id, WorkType type) {
- this.entity = entity;
- this.id = id;
- this.type = type;
+ this( entity, null, id, null, type );
}
public Work(Class entityType, Serializable id, WorkType type) {
- this.entityClass = entityType;
- this.id = id;
- this.type = type;
+ this( null, entityType, id, null, type );
}
public Work(Object entity, XMember idGetter, WorkType type) {
+ this( entity, null, null, idGetter, type );
+ }
+
+ private Work(Object entity, Class entityClass, Serializable id,
+ XMember idGetter, WorkType type) {
this.entity = entity;
+ this.entityClass = entityClass;
+ this.id = id;
this.idGetter = idGetter;
this.type = type;
}
-
+
public Class getEntityClass() {
return entityClass;
}
Modified:
search/trunk/src/java/org/hibernate/search/backend/configuration/MaskedProperty.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/configuration/MaskedProperty.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/configuration/MaskedProperty.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -28,8 +28,8 @@
public class MaskedProperty extends Properties implements Serializable {
private static final long serialVersionUID = -593307257383085113L;
- private static Logger log = LoggerFactory.getLogger( MaskedProperty.class );
+ private final Logger log = LoggerFactory.getLogger( MaskedProperty.class );
private final Properties masked;
private final Properties fallBack;
private final String radix;
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -1,7 +1,6 @@
//$Id$
package org.hibernate.search.backend.impl;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -148,7 +147,6 @@
//TODO implements parallel batchWorkers (one per Directory)
public void performWorks(WorkQueue workQueue) {
-
Runnable processor = backendQueueProcessorFactory.getProcessor(
workQueue.getSealedQueue() );
if ( sync ) {
processor.run();
@@ -167,10 +165,10 @@
if ( executorService != null && !executorService.isShutdown() ) {
executorService.shutdown();
try {
- executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS );
+ executorService.awaitTermination( Long.MAX_VALUE, TimeUnit.SECONDS );
}
catch (InterruptedException e) {
- log.error("Unable to property shut down asynchronous indexing work", e);
+ log.error( "Unable to properly shut down asynchronous indexing work", e );
}
}
}
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -10,14 +10,14 @@
import org.hibernate.search.util.WeakIdentityHashMap;
/**
- * Execute some work inside a transaction sychronization
+ * Execute some work inside a transaction synchronization
*
* @author Emmanuel Bernard
*/
public class PostTransactionWorkQueueSynchronization implements Synchronization {
- private QueueingProcessor queueingProcessor;
+ private final QueueingProcessor queueingProcessor;
private boolean consumed;
- private WeakIdentityHashMap queuePerTransaction;
+ private final WeakIdentityHashMap queuePerTransaction;
private WorkQueue queue = new WorkQueue();
/**
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/TransactionalWorker.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/impl/TransactionalWorker.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/impl/TransactionalWorker.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -23,7 +23,7 @@
*/
public class TransactionalWorker implements Worker {
//not a synchronized map since for a given transaction, we have not concurrent access
- protected WeakIdentityHashMap synchronizationPerTransaction = new
WeakIdentityHashMap();
+ protected final WeakIdentityHashMap synchronizationPerTransaction = new
WeakIdentityHashMap();
private QueueingProcessor queueingProcessor;
public void performWork(Work work, EventSource session) {
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/jms/AbstractJMSHibernateSearchController.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/impl/jms/AbstractJMSHibernateSearchController.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/impl/jms/AbstractJMSHibernateSearchController.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -26,7 +26,7 @@
* @author Emmanuel Bernard
*/
public abstract class AbstractJMSHibernateSearchController implements MessageListener {
- private static Logger log = LoggerFactory.getLogger(
AbstractJMSHibernateSearchController.class );
+ private static final Logger log = LoggerFactory.getLogger(
AbstractJMSHibernateSearchController.class );
/**
* return the current or give a new session
@@ -83,7 +83,7 @@
}
private Runnable getWorker(List<LuceneWork> queue) {
- //FIXME casting sucks becasue we do not control what get session from
+ //FIXME casting sucks because we do not control what get session from
Session session = getSession();
Runnable processor = null;
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneBackendQueueProcessor.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneBackendQueueProcessor.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneBackendQueueProcessor.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -32,10 +32,10 @@
/**
* Class logger.
*/
- private static Logger log = LoggerFactory.getLogger( LuceneBackendQueueProcessor.class
);
+ private static final Logger log = LoggerFactory.getLogger(
LuceneBackendQueueProcessor.class );
- private List<LuceneWork> queue;
- private SearchFactoryImplementor searchFactoryImplementor;
+ private final List<LuceneWork> queue;
+ private final SearchFactoryImplementor searchFactoryImplementor;
public LuceneBackendQueueProcessor(List<LuceneWork> queue,
SearchFactoryImplementor searchFactoryImplementor) {
this.queue = queue;
@@ -70,7 +70,7 @@
work.getIdInString(),
work.getDocument()
);
- queueWithFlatDPs.add( new LuceneWorker.WorkWithPayload(work, provider) );
+ queueWithFlatDPs.add( new LuceneWorker.WorkWithPayload( work, provider ) );
}
else if ( DeleteLuceneWork.class.isAssignableFrom( work.getClass() ) ) {
DirectoryProvider[] providers = shardingStrategy.getDirectoryProvidersForDeletion(
@@ -79,20 +79,20 @@
work.getIdInString()
);
for (DirectoryProvider provider : providers) {
- queueWithFlatDPs.add( new LuceneWorker.WorkWithPayload(work, provider) );
+ queueWithFlatDPs.add( new LuceneWorker.WorkWithPayload( work, provider ) );
}
}
else if ( OptimizeLuceneWork.class.isAssignableFrom( work.getClass() ) ) {
DirectoryProvider[] providers =
shardingStrategy.getDirectoryProvidersForAllShards();
for (DirectoryProvider provider : providers) {
- queueWithFlatDPs.add( new LuceneWorker.WorkWithPayload(work, provider) );
+ queueWithFlatDPs.add( new LuceneWorker.WorkWithPayload( work, provider ) );
}
}
else {
throw new AssertionFailure( "Unknown work type: " + work.getClass() );
}
}
- deadlockFreeQueue(queueWithFlatDPs, searchFactoryImplementor);
+ deadlockFreeQueue( queueWithFlatDPs, searchFactoryImplementor );
checkForBatchIndexing(workspace);
for ( LuceneWorker.WorkWithPayload luceneWork : queueWithFlatDPs ) {
worker.performWork( luceneWork );
@@ -107,9 +107,9 @@
private void checkForBatchIndexing(Workspace workspace) {
for ( LuceneWork luceneWork : queue ) {
// if there is at least a single batch index job we put the work space into batch
indexing mode.
- if(luceneWork.isBatch()){
- log.trace("Setting batch indexing mode.");
- workspace.setBatch(true);
+ if( luceneWork.isBatch() ){
+ log.trace( "Setting batch indexing mode." );
+ workspace.setBatch( true );
break;
}
}
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/backend/impl/lucene/LuceneWorker.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -30,7 +30,7 @@
* @author John Griffin
*/
public class LuceneWorker {
- private Workspace workspace;
+ private final Workspace workspace;
private static final Logger log = LoggerFactory.getLogger( LuceneWorker.class );
public LuceneWorker(Workspace workspace) {
@@ -145,16 +145,14 @@
}
public static class WorkWithPayload {
- private LuceneWork work;
- private DirectoryProvider provider;
+ private final LuceneWork work;
+ private final DirectoryProvider provider;
-
public WorkWithPayload(LuceneWork work, DirectoryProvider provider) {
this.work = work;
this.provider = provider;
}
-
public LuceneWork getWork() {
return work;
}
Modified:
search/trunk/src/java/org/hibernate/search/bridge/String2FieldBridgeAdaptor.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/bridge/String2FieldBridgeAdaptor.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/bridge/String2FieldBridgeAdaptor.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -11,7 +11,7 @@
* @author Emmanuel Bernard
*/
public class String2FieldBridgeAdaptor implements FieldBridge {
- private StringBridge stringBridge;
+ private final StringBridge stringBridge;
public String2FieldBridgeAdaptor(StringBridge stringBridge) {
this.stringBridge = stringBridge;
Modified:
search/trunk/src/java/org/hibernate/search/bridge/TwoWayString2FieldBridgeAdaptor.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/bridge/TwoWayString2FieldBridgeAdaptor.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/bridge/TwoWayString2FieldBridgeAdaptor.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -12,7 +12,7 @@
//TODO use Generics to avoid double declaration of stringBridge
public class TwoWayString2FieldBridgeAdaptor extends String2FieldBridgeAdaptor implements
TwoWayFieldBridge {
- private TwoWayStringBridge stringBridge;
+ private final TwoWayStringBridge stringBridge;
public TwoWayString2FieldBridgeAdaptor(TwoWayStringBridge stringBridge) {
super( stringBridge );
Modified: search/trunk/src/java/org/hibernate/search/bridge/builtin/DateBridge.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/bridge/builtin/DateBridge.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/bridge/builtin/DateBridge.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -9,11 +9,8 @@
import org.apache.lucene.document.DateTools;
import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
-import org.hibernate.search.bridge.StringBridge;
import org.hibernate.search.bridge.ParameterizedBridge;
-import org.hibernate.search.bridge.String2FieldBridgeAdaptor;
import org.hibernate.search.annotations.Resolution;
-import org.hibernate.search.bridge.TwoWayString2FieldBridgeAdaptor;
import org.hibernate.search.bridge.TwoWayStringBridge;
import org.hibernate.util.StringHelper;
Modified: search/trunk/src/java/org/hibernate/search/engine/DocumentExtractor.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/engine/DocumentExtractor.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/engine/DocumentExtractor.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -1,14 +1,12 @@
//$Id$
package org.hibernate.search.engine;
-import java.util.ArrayList;
-import java.util.List;
import java.io.IOException;
+import java.io.Serializable;
import org.apache.lucene.document.Document;
import org.apache.lucene.search.Hits;
import org.hibernate.search.engine.EntityInfo;
-import org.hibernate.search.FullTextQuery;
import org.hibernate.search.ProjectionConstants;
/**
@@ -16,8 +14,8 @@
* @author John Griffin
*/
public class DocumentExtractor {
- private SearchFactoryImplementor searchFactoryImplementor;
- private String[] projection;
+ private final SearchFactoryImplementor searchFactoryImplementor;
+ private final String[] projection;
public DocumentExtractor(SearchFactoryImplementor searchFactoryImplementor, String...
projection) {
this.searchFactoryImplementor = searchFactoryImplementor;
@@ -25,18 +23,19 @@
}
private EntityInfo extract(Document document) {
- EntityInfo entityInfo = new EntityInfo();
- entityInfo.clazz = DocumentBuilder.getDocumentClass( document );
- entityInfo.id = DocumentBuilder.getDocumentId( searchFactoryImplementor,
entityInfo.clazz, document );
+ Class clazz = DocumentBuilder.getDocumentClass( document );
+ Serializable id = DocumentBuilder.getDocumentId( searchFactoryImplementor, clazz,
document );
+ Object[] projected = null;
if ( projection != null && projection.length > 0 ) {
- entityInfo.projection = DocumentBuilder.getDocumentFields( searchFactoryImplementor,
entityInfo.clazz, document, projection );
+ projected = DocumentBuilder.getDocumentFields( searchFactoryImplementor, clazz,
document, projection );
}
+ EntityInfo entityInfo = new EntityInfo( clazz, id, projected );
return entityInfo;
}
public EntityInfo extract(Hits hits, int index) throws IOException {
Document doc = hits.doc( index );
- //TODO if we are lonly looking for score (unlikely), avoid accessing doc (lazy load)
+ //TODO if we are only looking for score (unlikely), avoid accessing doc (lazy load)
EntityInfo entityInfo = extract( doc );
Object[] eip = entityInfo.projection;
@@ -60,9 +59,6 @@
else if ( ProjectionConstants.THIS.equals( projection[x] ) ) {
//THIS could be projected more than once
//THIS loading delayed to the Loader phase
- if (entityInfo.indexesOfThis == null) {
- entityInfo.indexesOfThis = new ArrayList<Integer>(1);
- }
entityInfo.indexesOfThis.add(x);
}
}
Modified: search/trunk/src/java/org/hibernate/search/engine/EntityInfo.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/engine/EntityInfo.java 2008-05-29 15:14:13
UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/engine/EntityInfo.java 2008-05-29 15:18:15
UTC (rev 14713)
@@ -2,6 +2,7 @@
package org.hibernate.search.engine;
import java.io.Serializable;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -10,8 +11,16 @@
*/
//TODO Move to egine?
public class EntityInfo {
- public Class clazz;
- public Serializable id;
- public Object[] projection;
- public List<Integer> indexesOfThis;
+
+ public final Class clazz;
+ public final Serializable id;
+ public final Object[] projection;
+ public final List<Integer> indexesOfThis = new LinkedList<Integer>();
+
+ public EntityInfo(Class clazz, Serializable id, Object[] projection) {
+ this.clazz = clazz;
+ this.id = id;
+ this.projection = projection;
+ }
+
}
Modified:
search/trunk/src/java/org/hibernate/search/event/FullTextIndexEventListener.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/event/FullTextIndexEventListener.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/event/FullTextIndexEventListener.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -18,8 +18,6 @@
import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.Environment;
-import org.hibernate.search.SearchException;
/**
* This listener supports setting a parent directory for all generated index files.
@@ -63,7 +61,7 @@
if (used) {
final Object entity = event.getEntity();
DocumentBuilder<Object> builder =
searchFactoryImplementor.getDocumentBuilders().get( entity.getClass() );
- //not strictly necessary but a smal optimization
+ //not strictly necessary but a small optimization
if ( builder != null ) {
Serializable id = event.getId();
processWork( entity, id, WorkType.ADD, event );
@@ -74,7 +72,7 @@
public void onPostUpdate(PostUpdateEvent event) {
if (used) {
final Object entity = event.getEntity();
- //not strictly necessary but a smal optimization
+ //not strictly necessary but a small optimization
DocumentBuilder<Object> builder =
searchFactoryImplementor.getDocumentBuilders().get( entity.getClass() );
if ( builder != null ) {
Serializable id = event.getId();
Modified: search/trunk/src/java/org/hibernate/search/filter/ChainedFilter.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/filter/ChainedFilter.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/filter/ChainedFilter.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -14,9 +14,10 @@
* @author Emmanuel Bernard
*/
public class ChainedFilter extends Filter {
- private List<Filter> chainedFilters = new ArrayList<Filter>();
+ private static final long serialVersionUID = -6153052295766531920L;
+
+ private final List<Filter> chainedFilters = new ArrayList<Filter>();
-
public void addFilter(Filter filter) {
this.chainedFilters.add( filter );
}
@@ -32,7 +33,6 @@
return result;
}
-
public String toString() {
StringBuilder sb = new StringBuilder("ChainedFilter [");
for (Filter filter : chainedFilters) {
Modified: search/trunk/src/java/org/hibernate/search/filter/StandardFilterKey.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/filter/StandardFilterKey.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/filter/StandardFilterKey.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -1,10 +1,6 @@
// $Id$
package org.hibernate.search.filter;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
@@ -16,7 +12,7 @@
* @author Emmanuel Bernard
*/
public class StandardFilterKey extends FilterKey {
- private List parameters = new ArrayList();
+ private final List parameters = new ArrayList();
private boolean implSet;
Modified: search/trunk/src/java/org/hibernate/search/impl/FullTextSessionImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/impl/FullTextSessionImpl.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/impl/FullTextSessionImpl.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -7,8 +7,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
import org.hibernate.CacheMode;
import org.hibernate.Criteria;
@@ -45,7 +43,6 @@
import org.hibernate.search.FullTextQuery;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.SearchFactory;
-import org.hibernate.search.SearchException;
import org.hibernate.search.backend.Work;
import org.hibernate.search.backend.WorkType;
import org.hibernate.search.engine.DocumentBuilder;
Modified: search/trunk/src/java/org/hibernate/search/impl/InitContext.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/impl/InitContext.java 2008-05-29 15:14:13
UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/impl/InitContext.java 2008-05-29 15:18:15
UTC (rev 14713)
@@ -27,8 +27,8 @@
* @author Emmanuel Bernard
*/
public class InitContext {
- private Map<String, AnalyzerDef> analyzerDefs = new HashMap<String,
AnalyzerDef>();
- private List<DelegateNamedAnalyzer> lazyAnalyzers = new
ArrayList<DelegateNamedAnalyzer>();
+ 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;
@@ -57,7 +57,7 @@
}
/**
- * Initilises the Lucene analyzer to use by reading the analyzer class from the
configuration and instantiating it.
+ * Initializes the Lucene analyzer to use by reading the analyzer class from the
configuration and instantiating it.
*
* @param cfg
* The current configuration.
@@ -91,7 +91,7 @@
}
/**
- * Initilises the Lucene similarity to use
+ * Initializes the Lucene similarity to use
*/
private Similarity initSimilarity(Configuration cfg) {
Class similarityClass;
Modified: search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -51,25 +51,25 @@
* @author Emmanuel Bernard
*/
public class SearchFactoryImpl implements SearchFactoryImplementor {
- private static ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>>
contexts =
+ private static final ThreadLocal<WeakHashMap<Configuration,
SearchFactoryImpl>> contexts =
new ThreadLocal<WeakHashMap<Configuration, SearchFactoryImpl>>();
static {
Version.touch();
}
- private final Logger log = LoggerFactory.getLogger( SearchFactoryImpl.class );
+ private static final Logger log = LoggerFactory.getLogger( SearchFactoryImpl.class );
- private Map<Class, DocumentBuilder<Object>> documentBuilders = new
HashMap<Class, DocumentBuilder<Object>>();
+ 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 Map<DirectoryProvider, ReentrantLock> lockableDirectoryProviders =
+ private final Map<DirectoryProvider, ReentrantLock> lockableDirectoryProviders =
new HashMap<DirectoryProvider, ReentrantLock>();
- private Map<DirectoryProvider, OptimizerStrategy> dirProviderOptimizerStrategies
=
+ private final Map<DirectoryProvider, OptimizerStrategy>
dirProviderOptimizerStrategies =
new HashMap<DirectoryProvider, OptimizerStrategy>();
private Worker worker;
private ReaderProvider readerProvider;
private BackendQueueProcessorFactory backendQueueProcessorFactory;
- private Map<String, FilterDef> filterDefinitions = new HashMap<String,
FilterDef>();
+ private final Map<String, FilterDef> filterDefinitions = new HashMap<String,
FilterDef>();
private FilterCachingStrategy filterCachingStrategy;
private Map<String, Analyzer> analyzers;
private boolean stopped = false;
Modified:
search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -20,7 +20,7 @@
* @author Emmanuel Bernard
*/
public class FullTextEntityManagerImpl implements FullTextEntityManager, Serializable {
- private EntityManager em;
+ private final EntityManager em;
private FullTextSession ftSession;
public FullTextEntityManagerImpl(EntityManager em) {
Modified: search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -42,7 +42,7 @@
*/
public class FullTextQueryImpl implements FullTextQuery {
private final org.hibernate.search.FullTextQuery query;
- private Session session;
+ private final Session session;
public FullTextQueryImpl(org.hibernate.search.FullTextQuery query, Session session) {
this.query = query;
@@ -91,11 +91,11 @@
return query.list();
}
catch (QueryExecutionRequestException he) {
- //TODO when an illegal state exceptio should be raised?
+ //TODO when an illegal state exception should be raised?
throw new IllegalStateException(he);
}
catch( TypeMismatchException e ) {
- //TODO when an illegal arg exceptio should be raised?
+ //TODO when an illegal arg exception should be raised?
throw new IllegalArgumentException(e);
}
catch (SearchException he) {
Modified: search/trunk/src/java/org/hibernate/search/query/FullTextFilterImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/query/FullTextFilterImpl.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/query/FullTextFilterImpl.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -10,7 +10,7 @@
* @author Emmanuel Bernard
*/
public class FullTextFilterImpl implements FullTextFilter {
- private Map<String, Object> parameters = new HashMap<String, Object>();
+ private final Map<String, Object> parameters = new HashMap<String,
Object>();
private String name;
public void setName(String name) {
Modified: search/trunk/src/java/org/hibernate/search/query/IteratorImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/query/IteratorImpl.java 2008-05-29 15:14:13
UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/query/IteratorImpl.java 2008-05-29 15:18:15
UTC (rev 14713)
@@ -19,7 +19,7 @@
private final int size;
private Object next;
private int nextObjectIndex = -1;
- private Loader loader;
+ private final Loader loader;
public IteratorImpl(List<EntityInfo> entityInfos, Loader loader) {
this.entityInfos = entityInfos;
@@ -58,7 +58,7 @@
}
public void remove() {
- //TODO this is theorically doable
+ //TODO this is theoretically doable
throw new UnsupportedOperationException( "Cannot remove from a lucene query
iterator" );
}
}
Modified: search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/query/ScrollableResultsImpl.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -50,7 +50,7 @@
* @author John Griffin
*/
public class ScrollableResultsImpl implements ScrollableResults {
- private static Logger log = LoggerFactory.getLogger( ScrollableResultsImpl.class );
+ private static final Logger log = LoggerFactory.getLogger( ScrollableResultsImpl.class
);
private final IndexSearcher searcher;
private final SearchFactory searchFactory;
private final Hits hits;
@@ -58,10 +58,10 @@
private final int max;
private final int fetchSize;
private int current;
- private EntityInfo[] entityInfos;
- private Loader loader;
- private DocumentExtractor documentExtractor;
- private Map<EntityInfo, Object[]> resultContext;
+ private final EntityInfo[] entityInfos;
+ private final Loader loader;
+ private final DocumentExtractor documentExtractor;
+ private final Map<EntityInfo, Object[]> resultContext;
public ScrollableResultsImpl(
IndexSearcher searcher, Hits hits, int first, int max, int fetchSize,
DocumentExtractor extractor,
Modified: search/trunk/src/java/org/hibernate/search/reader/CacheableMultiReader.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/reader/CacheableMultiReader.java 2008-05-29
15:14:13 UTC (rev 14712)
+++ search/trunk/src/java/org/hibernate/search/reader/CacheableMultiReader.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -16,7 +16,7 @@
// This is package private as the intention of the Lucene team seems to be to not
// expose this publically (it's a protected member in Lucene 2.3)
- IndexReader[] subReaders;
+ final IndexReader[] subReaders;
public CacheableMultiReader(IndexReader[] subReaders) throws IOException {
super( subReaders );
Modified: search/trunk/src/java/org/hibernate/search/store/DirectoryProviderFactory.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/store/DirectoryProviderFactory.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/store/DirectoryProviderFactory.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -45,7 +45,7 @@
*/
public class DirectoryProviderFactory {
- private List<DirectoryProvider<?>> providers = new
ArrayList<DirectoryProvider<?>>();
+ private final List<DirectoryProvider<?>> providers = new
ArrayList<DirectoryProvider<?>>();
private static String DEFAULT_DIRECTORY_PROVIDER = FSDirectoryProvider.class.getName();
private static final String SHARDING_STRATEGY = "sharding_strategy";
@@ -252,8 +252,8 @@
}
public class DirectoryProviders {
- private IndexShardingStrategy shardingStrategy;
- private DirectoryProvider[] providers;
+ private final IndexShardingStrategy shardingStrategy;
+ private final DirectoryProvider[] providers;
public DirectoryProviders(IndexShardingStrategy shardingStrategy, DirectoryProvider[]
providers) {
this.shardingStrategy = shardingStrategy;
Modified: search/trunk/src/java/org/hibernate/search/store/DirectoryProviderHelper.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/store/DirectoryProviderHelper.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/java/org/hibernate/search/store/DirectoryProviderHelper.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -59,7 +59,7 @@
makeSanityCheckedDirectory( rootDir, directoryProviderName, needWritePermissions );
sourceDirectory = new File( root, relative );
makeSanityCheckedDirectory( sourceDirectory, directoryProviderName,
needWritePermissions );
- log.debug( "Get directory from root + relative" );
+ log.debug( "Got directory from root + relative" );
}
return sourceDirectory;
}
Modified:
search/trunk/src/test/org/hibernate/search/test/bridge/UnresolvedBridgeTest.java
===================================================================
---
search/trunk/src/test/org/hibernate/search/test/bridge/UnresolvedBridgeTest.java 2008-05-29
15:14:13 UTC (rev 14712)
+++
search/trunk/src/test/org/hibernate/search/test/bridge/UnresolvedBridgeTest.java 2008-05-29
15:18:15 UTC (rev 14713)
@@ -1,19 +1,11 @@
//$Id$
package org.hibernate.search.test.bridge;
-import java.io.InputStream;
-
-import org.hibernate.search.test.SearchTestCase;
import org.hibernate.search.SearchException;
import org.hibernate.search.store.RAMDirectoryProvider;
-import org.hibernate.Session;
-import org.hibernate.dialect.Dialect;
import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.cfg.Configuration;
import junit.framework.TestCase;
-
/**
* @author Emmanuel Bernard
*/