Package ome.services.eventlogs
Class EventLogLoader
- java.lang.Object
-
- ome.services.eventlogs.EventLogLoader
-
- All Implemented Interfaces:
java.lang.Iterable<ome.model.meta.EventLog>
,java.util.EventListener
,java.util.Iterator<ome.model.meta.EventLog>
,org.springframework.context.ApplicationListener
- Direct Known Subclasses:
AllEntitiesPseudoLogLoader
,AllEventsLogLoader
,PersistentEventLogLoader
public abstract class EventLogLoader extends java.lang.Object implements java.util.Iterator<ome.model.meta.EventLog>, java.lang.Iterable<ome.model.meta.EventLog>, org.springframework.context.ApplicationListener
Data access object for theFullTextIndexer
which provides anIterator
interface forEventLog
instances to be properly indexed. Also supports the concept of batches. AfterbatchSize
queries,- Since:
- 3.0-Beta3
-
-
Field Summary
Fields Modifier and Type Field Description protected int
batchSize
static int
DEFAULT_BATCH_SIZE
Currently 100.protected java.util.List<java.lang.String>
excludes
Array of class types which will get excluded from indexing.protected org.slf4j.Logger
log
protected java.lang.String
query
Query string to be kept in sync withexcludes
.protected ome.api.IQuery
queryService
-
Constructor Summary
Constructors Constructor Description EventLogLoader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
addEventLog(java.lang.Class<? extends ome.model.IObject> cls, long id)
Adds anEventLog
for the givenClass
and id to the backlog.int
getBatchSize()
boolean
hasNext()
Tests for available objects.boolean
isStopSet()
Returns true if the stop flag has been set on this instance.java.util.Iterator<ome.model.meta.EventLog>
iterator()
ome.model.meta.EventLog
lastEventLog()
abstract long
more()
Should return an estimate of how many moreEventLog
instances are available for processing.ome.model.meta.EventLog
next()
ome.model.meta.EventLog
nextEventLog(long id)
Returns theEventLog
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 ofEventLog
instances will be loaded in a single run.void
setExcludes(java.lang.String[] excludes)
Spring injectorvoid
setQueryService(ome.api.IQuery queryService)
Spring injectorvoid
setStop(boolean stop)
Called by controlling objects (a worker thread) in order to free up the thread.
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
Currently 100.- See Also:
- Constant Field Values
-
batchSize
protected int batchSize
-
excludes
protected java.util.List<java.lang.String> excludes
Array of class types which will get excluded from indexing.
-
query
protected java.lang.String query
Query string to be kept in sync withexcludes
.- See Also:
initQueryString()
-
queryService
protected ome.api.IQuery queryService
-
-
Method Detail
-
setBatchSize
public void setBatchSize(int batchSize)
Set the number ofEventLog
instances will be loaded in a single run. If not set,DEFAULT_BATCH_SIZE
will be used.- Parameters:
batchSize
-
-
getBatchSize
public int getBatchSize()
-
setExcludes
public void setExcludes(java.lang.String[] excludes)
Spring injector
-
setQueryService
public void setQueryService(ome.api.IQuery queryService)
Spring injector
-
hasNext
public boolean hasNext()
Tests for available objects. Ifcount
is -1, then this batch has ended (set innext()
) 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; otherwisequery()
is called to load a neweventLog
. Otherwise, just tests that field for null.- Specified by:
hasNext
in interfacejava.util.Iterator<ome.model.meta.EventLog>
-
next
public ome.model.meta.EventLog next()
Returns the currentlog
instance which may be loaded by a call tohasNext()
if necessary. IfhasNext()
returns false, aNoSuchElementException
will be thrown.- Specified by:
next
in interfacejava.util.Iterator<ome.model.meta.EventLog>
-
remove
public final void remove()
- Specified by:
remove
in interfacejava.util.Iterator<ome.model.meta.EventLog>
-
rollback
public void rollback(ome.model.meta.EventLog el)
-
query
protected abstract ome.model.meta.EventLog query()
-
iterator
public java.util.Iterator<ome.model.meta.EventLog> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<ome.model.meta.EventLog>
-
more
public abstract long more()
Should return an estimate of how many moreEventLog
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 thanLong.MAX_VALUE
. Use 0 to stop execution.
-
nextEventLog
public final ome.model.meta.EventLog nextEventLog(long id)
Returns theEventLog
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.
-
lastEventLog
public final ome.model.meta.EventLog lastEventLog()
-
addEventLog
public boolean addEventLog(java.lang.Class<? extends ome.model.IObject> cls, long id)
Adds anEventLog
for the givenClass
and id to the backlog.
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent arg0)
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener
-
isStopSet
public boolean isStopSet()
Returns true if the stop flag has been set on this instance.
-
setStop
public void setStop(boolean stop)
Called by controlling objects (a worker thread) in order to free up the thread.
-
-