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
Modifier and Type Method Description ObjectgetById(long id)intgetTimeslotPause()ObjectreadObject(String line)Converts a line from the log to an object.voidregisterMessageListener(LogtoolContext listener, Class<?> type)Registers the given LogtoolContext as a messageListener.voidregisterNewObjectListener(NewObjectListener listener, Class<?> type)Registers a NewObjectListener.voidsetSchema(HashMap<String,String[]> schema)Sets the schema for this log.voidsetTimeslotPause(int msec)Sets the per-timeslot pause value in msec
-
Constructor Details
-
DomainObjectReader
public DomainObjectReader()Default constructor
-
-
Method Details
-
setTimeslotPause
public void setTimeslotPause(int msec)Sets the per-timeslot pause value in msec -
getTimeslotPause
public int getTimeslotPause() -
registerNewObjectListener
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
Registers the given LogtoolContext as a messageListener. Incoming messages must be dispatched using util.MessageDispatcher -
setSchema
Sets the schema for this log. -
readObject
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
-