Package org.powertac.logtool.common
Class DomainObjectReader
- java.lang.Object
-
- org.powertac.logtool.common.DomainObjectReader
-
@Service public class DomainObjectReader extends Object
Processor for state log entries; creates domain object instances, stores them in repositories as well as in a master repo indexed by id value.- Author:
- John Collins
-
-
Constructor Summary
Constructors Constructor Description DomainObjectReader()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getById(long id)
int
getTimeslotPause()
Object
readObject(String line)
Converts a line from the log to an object.void
registerMessageListener(LogtoolContext listener, Class<?> type)
Registers the given LogtoolContext as a messageListener.void
registerNewObjectListener(NewObjectListener listener, Class<?> type)
Registers a NewObjectListener.void
setSchema(HashMap<String,String[]> schema)
Sets the schema for this log.void
setTimeslotPause(int msec)
Sets the per-timeslot pause value in msec
-
-
-
Method Detail
-
setTimeslotPause
public void setTimeslotPause(int msec)
Sets the per-timeslot pause value in msec
-
getTimeslotPause
public int getTimeslotPause()
-
registerNewObjectListener
public void registerNewObjectListener(NewObjectListener listener, Class<?> type)
Registers a NewObjectListener. The listener will be called with each newly-created object of the given type. If type is null, then the listener will be called for each new object.
-
registerMessageListener
public void registerMessageListener(LogtoolContext listener, Class<?> type)
Registers the given LogtoolContext as a messageListener. Incoming messages must be dispatched using util.MessageDispatcher
-
readObject
public Object readObject(String line) throws MissingDomainObject
Converts a line from the log to an object. Each line is of the form
ms:class::id::method{::arg}*
Note that some objects cannot be resolved in the order they appear in a logfile, because they have forward dependencies. This means that a failure to resolve an object does not necessarily mean it's bogus, but could mean that it could be resolved at a later time, typically within one or a very few input lines.- Throws:
MissingDomainObject
-
getById
public Object getById(long id)
-
-