@Test public void testgetModelState() { IModelInstance<?> modelstate = null; Calendar cal = Calendar.getInstance(); Date date = cal.getTime(); modelstate = hp.getModelState(date); assertNotNull(modelstate); }
@Override public IModelInstance<?> getModelState(Date time) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Model Requested for time: {0}", time.toString()); Pair<Date, IModelInstance<?>> modelraw = databaseconn .getLatestSnapshot(time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got model for time: {0}", time.toString()); IModelInstance<IAcmeSystem> model = null; if (modelraw != null) { model = (IModelInstance<IAcmeSystem>) modelraw .getValue(); ArrayList<IRainbowMessage> events = (ArrayList<IRainbowMessage>) databaseconn .getModelEventRange(modelraw.getKey(), time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got {0} events to apply to the model", events.size()); for (IRainbowMessage event : events) { try { IAcmeCommand<?> command = deserializer.deserialize(event, model.getModelInstance()); synchronized (copyLock) { command.execute(); } }catch (IllegalStateException | AcmeException | RainbowDeserializationException ex) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.SEVERE, null, ex); } } } return model; }
HistoryProvider implements IHistoryProvider { @Override public IModelInstance<?> getModelState(Date time) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Model Requested for time: {0}", time.toString()); Pair<Date, IModelInstance<?>> modelraw = databaseconn .getLatestSnapshot(time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got model for time: {0}", time.toString()); IModelInstance<IAcmeSystem> model = null; if (modelraw != null) { model = (IModelInstance<IAcmeSystem>) modelraw .getValue(); ArrayList<IRainbowMessage> events = (ArrayList<IRainbowMessage>) databaseconn .getModelEventRange(modelraw.getKey(), time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got {0} events to apply to the model", events.size()); for (IRainbowMessage event : events) { try { IAcmeCommand<?> command = deserializer.deserialize(event, model.getModelInstance()); synchronized (copyLock) { command.execute(); } }catch (IllegalStateException | AcmeException | RainbowDeserializationException ex) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.SEVERE, null, ex); } } } return model; } }
HistoryProvider implements IHistoryProvider { @Override public IModelInstance<?> getModelState(Date time) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Model Requested for time: {0}", time.toString()); Pair<Date, IModelInstance<?>> modelraw = databaseconn .getLatestSnapshot(time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got model for time: {0}", time.toString()); IModelInstance<IAcmeSystem> model = null; if (modelraw != null) { model = (IModelInstance<IAcmeSystem>) modelraw .getValue(); ArrayList<IRainbowMessage> events = (ArrayList<IRainbowMessage>) databaseconn .getModelEventRange(modelraw.getKey(), time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got {0} events to apply to the model", events.size()); for (IRainbowMessage event : events) { try { IAcmeCommand<?> command = deserializer.deserialize(event, model.getModelInstance()); synchronized (copyLock) { command.execute(); } }catch (IllegalStateException | AcmeException | RainbowDeserializationException ex) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.SEVERE, null, ex); } } } return model; } HistoryProvider(IDatabaseConnector databaseCon);  HistoryProvider(ISystemViewProvider acmeSystemViewProvider,
            ISystemConfiguration systemConfig); }
HistoryProvider implements IHistoryProvider { @Override public IModelInstance<?> getModelState(Date time) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Model Requested for time: {0}", time.toString()); Pair<Date, IModelInstance<?>> modelraw = databaseconn .getLatestSnapshot(time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got model for time: {0}", time.toString()); IModelInstance<IAcmeSystem> model = null; if (modelraw != null) { model = (IModelInstance<IAcmeSystem>) modelraw .getValue(); ArrayList<IRainbowMessage> events = (ArrayList<IRainbowMessage>) databaseconn .getModelEventRange(modelraw.getKey(), time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got {0} events to apply to the model", events.size()); for (IRainbowMessage event : events) { try { IAcmeCommand<?> command = deserializer.deserialize(event, model.getModelInstance()); synchronized (copyLock) { command.execute(); } }catch (IllegalStateException | AcmeException | RainbowDeserializationException ex) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.SEVERE, null, ex); } } } return model; } HistoryProvider(IDatabaseConnector databaseCon);  HistoryProvider(ISystemViewProvider acmeSystemViewProvider,
            ISystemConfiguration systemConfig); @Override IModelInstance<?> getModelState(Date time); @Override ArrayList<IRainbowMessage> getEventRange(Date startTime, Date endTime); @Override ArrayList<IRainbowMessage> getEventRangeByType(String channel,
            Date startTime, Date endTime); @Override ArrayList<IRainbowMessage> getModelEventRange(Date startTime,
            Date endTime); @Override IRainbowMessage getEvent(Date time); @Override void setSession(String name); @Override ArrayList<String> getSessionList(); String getReadSession(); @Override Date getStartDate(); @Override boolean currentSessionIsWriteSession(); @Override Date getMaxDate(); @Override List<IRainbowMessage> getNumberOfEventsBefore(Date endTime,
            int numEvents); @Override void closeDatabaseConnection(); }
HistoryProvider implements IHistoryProvider { @Override public IModelInstance<?> getModelState(Date time) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Model Requested for time: {0}", time.toString()); Pair<Date, IModelInstance<?>> modelraw = databaseconn .getLatestSnapshot(time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got model for time: {0}", time.toString()); IModelInstance<IAcmeSystem> model = null; if (modelraw != null) { model = (IModelInstance<IAcmeSystem>) modelraw .getValue(); ArrayList<IRainbowMessage> events = (ArrayList<IRainbowMessage>) databaseconn .getModelEventRange(modelraw.getKey(), time); Logger.getLogger(HistoryProvider.class.getName()).log( Level.INFO, "Got {0} events to apply to the model", events.size()); for (IRainbowMessage event : events) { try { IAcmeCommand<?> command = deserializer.deserialize(event, model.getModelInstance()); synchronized (copyLock) { command.execute(); } }catch (IllegalStateException | AcmeException | RainbowDeserializationException ex) { Logger.getLogger(HistoryProvider.class.getName()).log( Level.SEVERE, null, ex); } } } return model; } HistoryProvider(IDatabaseConnector databaseCon);  HistoryProvider(ISystemViewProvider acmeSystemViewProvider,
            ISystemConfiguration systemConfig); @Override IModelInstance<?> getModelState(Date time); @Override ArrayList<IRainbowMessage> getEventRange(Date startTime, Date endTime); @Override ArrayList<IRainbowMessage> getEventRangeByType(String channel,
            Date startTime, Date endTime); @Override ArrayList<IRainbowMessage> getModelEventRange(Date startTime,
            Date endTime); @Override IRainbowMessage getEvent(Date time); @Override void setSession(String name); @Override ArrayList<String> getSessionList(); String getReadSession(); @Override Date getStartDate(); @Override boolean currentSessionIsWriteSession(); @Override Date getMaxDate(); @Override List<IRainbowMessage> getNumberOfEventsBefore(Date endTime,
            int numEvents); @Override void closeDatabaseConnection();  }