ome.services.fulltext
Class EventLogLoader

java.lang.Object
  extended by ome.services.fulltext.EventLogLoader
All Implemented Interfaces:
Iterable<ome.model.meta.EventLog>, EventListener, Iterator<ome.model.meta.EventLog>, org.springframework.context.ApplicationListener
Direct Known Subclasses:
AllEntitiesPseudoLogLoader, AllEventsLogLoader, PersistentEventLogLoader

public abstract class EventLogLoader
extends Object
implements Iterator<ome.model.meta.EventLog>, Iterable<ome.model.meta.EventLog>, org.springframework.context.ApplicationListener

Data access object for the FullTextIndexer which provides an Iterator interface for EventLog instances to be properly indexed. Also supports the concept of batches. After batchSize queries,

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

Field Summary
protected  int batchSize
           
static int DEFAULT_BATCH_SIZE
          Currently 100.
protected  List<String> excludes
          Array of class types which will get excluded from indexing.
protected  IQuery queryService
           
 
Constructor Summary
EventLogLoader()
           
 
Method Summary
 boolean addEventLog(Class<? extends ome.model.IObject> cls, long id)
          Adds an EventLog for the given Class and id to the backlog.
 boolean hasNext()
          Tests for available objects.
 Iterator<ome.model.meta.EventLog> iterator()
           
 ome.model.meta.EventLog lastEventLog()
           
abstract  long more()
          Should return an estimate of how many more EventLog instances are available for processing.
 ome.model.meta.EventLog next()
          Returns the current log instance which may be loaded by a call to hasNext() if necessary.
 ome.model.meta.EventLog nextEventLog(long id)
          Returns the EventLog with the next id after the given argument or null if none exists.
 void onApplicationEvent(org.springframework.context.ApplicationEvent arg0)
           
protected abstract  ome.model.meta.EventLog query()
           
 void remove()
           
 void rollback(ome.model.meta.EventLog el)
           
 void setBatchSize(int batchSize)
          Set the number of EventLog instances will be loaded in a single run.
 void setExcludes(String[] excludes)
          Spring injector
 void setQueryService(IQuery queryService)
          Spring injector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BATCH_SIZE

public static final int DEFAULT_BATCH_SIZE
Currently 100.

See Also:
Constant Field Values

batchSize

protected int batchSize

excludes

protected List<String> excludes
Array of class types which will get excluded from indexing.


queryService

protected IQuery queryService
Constructor Detail

EventLogLoader

public EventLogLoader()
Method Detail

setBatchSize

public void setBatchSize(int batchSize)
Set the number of EventLog instances will be loaded in a single run. If not set, DEFAULT_BATCH_SIZE will be used.

Parameters:
batchSize -

setExcludes

public void setExcludes(String[] excludes)
Spring injector


setQueryService

public void setQueryService(IQuery queryService)
Spring injector


hasNext

public boolean hasNext()
Tests for available objects. If count is -1, then this batch has ended (set in next()) and false will be returned, EventBacklog will be ready to be switched over to an "adding" state if empty, andcount is also reset so further calls can finish normally; otherwise query() is called to load a new eventLog. Otherwise, just tests that field for null.

Specified by:
hasNext in interface Iterator<ome.model.meta.EventLog>

next

public ome.model.meta.EventLog next()
Returns the current log instance which may be loaded by a call to hasNext() if necessary. If hasNext() returns false, a NoSuchElementException will be thrown.

Specified by:
next in interface Iterator<ome.model.meta.EventLog>

remove

public final void remove()
Specified by:
remove in interface Iterator<ome.model.meta.EventLog>

rollback

public void rollback(ome.model.meta.EventLog el)

query

protected abstract ome.model.meta.EventLog query()

iterator

public Iterator<ome.model.meta.EventLog> iterator()
Specified by:
iterator in interface Iterable<ome.model.meta.EventLog>

more

public abstract long more()
Should return an estimate of how many more EventLog instances are available for processing. Some implementations may attempt to take extra measures if the number is too large. Use 1 for a constant rather than Long.MAX_VALUE. Use 0 to stop execution.


nextEventLog

public final ome.model.meta.EventLog nextEventLog(long id)
Returns the EventLog with the next id after the given argument or null if none exists. This method will only return "true" EventLog instances, with a valid id. The excludes list is used to filter out unwanted EventLog isntances.


lastEventLog

public final ome.model.meta.EventLog lastEventLog()

addEventLog

public boolean addEventLog(Class<? extends ome.model.IObject> cls,
                           long id)
Adds an EventLog for the given Class and id to the backlog.


onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent arg0)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener


OmeroJava Api

Version: Beta-4.1.1-r5927-b91

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