ome.services.fulltext
Class FullTextIndexer

java.lang.Object
  extended by ome.services.util.Executor.Descriptive
      extended by ome.services.util.Executor.SimpleWork
          extended by ome.services.fulltext.FullTextIndexer
All Implemented Interfaces:
Executor.Work

public class FullTextIndexer
extends Executor.SimpleWork

Simple action which can be done in an asynchronous thread in order to index Hibernate entities. Attempts to index each EventLog passed from the EventLogLoader multiple times on failure. Eventually

Since:
3.0-Beta3
Author:
Josh Moore, josh at glencoesoftware.com

Field Summary
protected  EventLogLoader loader
           
protected  int reps
           
 
Fields inherited from class ome.services.util.Executor.Descriptive
description
 
Constructor Summary
FullTextIndexer(EventLogLoader ll)
           
 
Method Summary
protected  Class asClassOrNull(String str)
           
 int doIndexing(org.hibernate.search.FullTextSession session)
           
 boolean doMore(int count)
          Default implementation suggests doing more if fewer than reps runs have been made and if there are still more than EventLogLoader.batchSize x 100 backlog entries.
 Object doWork(org.hibernate.Session session, ServiceFactory sf)
          Runs doIndexing(FullTextSession) within a Lucene transaction.
protected  ome.model.IObject get(org.hibernate.Session session, Class type, long id)
           
 void setRepetitions(int reps)
          Spring injector.
 void setSqlAction(ome.util.SqlAction sql)
          Since these instances are used repeatedly, we need to check for already set SqlAction
 
Methods inherited from class ome.services.util.Executor.SimpleWork
getSqlAction
 
Methods inherited from class ome.services.util.Executor.Descriptive
description
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ome.services.util.Executor.Work
description
 

Field Detail

loader

protected final EventLogLoader loader

reps

protected int reps
Constructor Detail

FullTextIndexer

public FullTextIndexer(EventLogLoader ll)
Method Detail

setRepetitions

public void setRepetitions(int reps)
Spring injector. Sets the number of indexing runs will be made if there is a substantial backlog.


setSqlAction

public void setSqlAction(ome.util.SqlAction sql)
Since these instances are used repeatedly, we need to check for already set SqlAction

Overrides:
setSqlAction in class Executor.SimpleWork

doWork

@Transactional(readOnly=false,
               isolation=SERIALIZABLE)
public Object doWork(org.hibernate.Session session,
                                   ServiceFactory sf)
Runs doIndexing(FullTextSession) within a Lucene transaction. doIndexing(FullTextSession) will also be called

Parameters:
session - non null.
sf - non null.
Returns:
Any results which will be used by non-wrapped code.

doIndexing

public int doIndexing(org.hibernate.search.FullTextSession session)

doMore

public boolean doMore(int count)
Default implementation suggests doing more if fewer than reps runs have been made and if there are still more than EventLogLoader.batchSize x 100 backlog entries. This is based on the assumption that indexing runs roughly 120 times an hour, so if there are more than an hours worth of batches, do extra work to catch up.


asClassOrNull

protected Class asClassOrNull(String str)

get

protected ome.model.IObject get(org.hibernate.Session session,
                                Class type,
                                long id)


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.