ObjectMapper mapper = new ObjectMapper(jsonFactory);
JsonNode root = mapper.readTree(jsonFile);
SimulationPlan simulation = new SimulationPlan();
simulation.setIntervalType(SimulationPlan.IntervalType.fromText(getString(root.get("intervalType"), "minutes")));
DateTimeService dateTimeService;
switch (simulation.getIntervalType()) {
case SECONDS:
simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 20L));
simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 2500L));
simulation.setMetricsServerConfiguration(createSecondsConfiguration());
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 30));
simulation.setSimulationRate(1440);
dateTimeService = new SecondsDateTimeService();
break;
case MINUTES:
simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 1250L));
simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 150000L));
simulation.setMetricsServerConfiguration(createMinutesConfiguration());
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 180));
simulation.setDateTimeService(new MinutesDateTimeService());
simulation.setSimulationRate(2400);
dateTimeService = new MinutesDateTimeService();
break;
default: // HOURS
simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 30000L));
simulation.setAggregationInterval(3600000L);
simulation.setMetricsServerConfiguration(new MetricsConfiguration());
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 1200));
simulation.setSimulationRate(1000);
dateTimeService = new DateTimeService();
}
simulation.setSimulationType(SimulationPlan.SimulationType.fromText(getString(root.get("simulationType"),
"threaded")));
if (SimulationType.SEQUENTIAL.equals(simulation.getSimulationType())) {
dateTimeService = new SimulatedDateTimeService();
}
dateTimeService.setConfiguration(simulation.getMetricsServerConfiguration());
simulation.setDateTimeService(dateTimeService);
simulation.setNumMeasurementCollectors(getInt(root.get("numMeasurementCollectors"), 5));
simulation.setNumReaders(getInt(root.get("numReaders"), 1));
simulation.setReaderThreadPoolSize(getInt(root.get("readerThreadPoolSize"), 1));