/** * A convenience method for disabling logging. * @param resource * @throws IllegalArgumentException * if <code>resource</code> is a {@link StringResource} */ public static void deactivateLogging(SingleValueResource resource) throws IllegalArgumentException { RecordedData rd = getHistoricalData(resource); rd.setConfiguration(null); }
ValueResourceUtils.setValue((ValueResource) copy, ValueResourceUtils.getValue((ValueResource) source)); if (config.isCopyLoggingState() && source instanceof SingleValueResource) { if (LoggingUtils.isLoggingEnabled((SingleValueResource) source)) { final RecordedData rd = LoggingUtils.getHistoricalData((SingleValueResource) source); if (rd != null) { final RecordedDataConfiguration cfg = rd.getConfiguration(); type == StorageType.ON_VALUE_CHANGED ? -1 : cfg.getFixedInterval(); LoggingUtils.activateLogging((SingleValueResource) copy, updateIntv);
ResourceSimulation(ConfigPattern config, ReadOnlyTimeSeries input, ApplicationManager appMan) { this.config = config; this.resource = config.target.getLocationResource(); this.input = input; this.additive = config.additive.isActive() && config.additive.getValue(); if (!config.forecast.isActive()) { this.forecast = null; this.iterator = null; } else { final String scheduleName = config.forecast.getValue(); Schedule sched0 = resource.getSubResource(scheduleName); if (sched0 == null) sched0 = resource.getSubResource(scheduleName, AbsoluteSchedule.class).create(); this.forecast = sched0; sched0.activate(false); this.iterator = new CyclicIterator(input, appMan.getFrameworkTime()); } this.timer = appMan.createTimer(10000000, this); timerElapsed(timer); resource.activate(false); LoggingUtils.activateLogging(resource, -2); appMan.getLogger().debug("Simulation started for resource {}", resource); }
/** * Check whether logging is enabled for the resource. This is a convenience method, * the same check can be performed using only basic API methods, such as * {@link FloatResource#getHistoricalData()}, and the methods provided by {@link RecordedData} * and {@link RecordedDataConfiguration}. * @param resource * @return */ public static boolean isLoggingEnabled(SingleValueResource resource) { try { RecordedData rd = getHistoricalData(resource); if (rd == null || rd.getConfiguration() == null) return false; else return true; } catch (IllegalArgumentException e) { return false; } }
RecordedData rd = getHistoricalData(resource); RecordedDataConfiguration rcd = new RecordedDataConfiguration(); switch ((int) updateInterval) {