@Test (expected = IllegalArgumentException.class) public void testNullRegistration() { StatusCache cache = new StatusCache(); cache.registerSensor(null); }
public synchronized void registerSensor(Sensor sensor) { if (sensor == null) { throw new IllegalArgumentException("Null sensor parameter is not allowed."); } if (isShutdownInProcess) { return; } Sensor previous = sensors.put(sensor.getSensorID(), sensor); Logger initLog = Logger.getLogger(Constants.SENSOR_INIT_LOG_CATEGORY); if (previous != null) { initLog.error( "Duplicate registration of sensor ID {0}. Sensor ''{1}'' has replaced ''{2}''.", sensor.getSensorID(), sensor.getName(), previous.getName() ); } sensorMap.init(sensor); initLog.info("Registered sensor : {0}", sensor.toString()); }
StatusCache implements DeployerCommandListener, DeployerSensorListener { public synchronized void registerSensor(Sensor sensor) { if (sensor == null) { throw new IllegalArgumentException("Null sensor parameter is not allowed."); } if (isShutdownInProcess) { return; } Sensor previous = sensors.put(sensor.getSensorID(), sensor); Logger initLog = Logger.getLogger(Constants.SENSOR_INIT_LOG_CATEGORY); if (previous != null) { initLog.error( "Duplicate registration of sensor ID {0}. Sensor ''{1}'' has replaced ''{2}''.", sensor.getSensorID(), sensor.getName(), previous.getName() ); } sensorMap.init(sensor); initLog.info("Registered sensor : {0}", sensor.toString()); } }
StatusCache implements DeployerCommandListener, DeployerSensorListener { public synchronized void registerSensor(Sensor sensor) { if (sensor == null) { throw new IllegalArgumentException("Null sensor parameter is not allowed."); } if (isShutdownInProcess) { return; } Sensor previous = sensors.put(sensor.getSensorID(), sensor); Logger initLog = Logger.getLogger(Constants.SENSOR_INIT_LOG_CATEGORY); if (previous != null) { initLog.error( "Duplicate registration of sensor ID {0}. Sensor ''{1}'' has replaced ''{2}''.", sensor.getSensorID(), sensor.getName(), previous.getName() ); } sensorMap.init(sensor); initLog.info("Registered sensor : {0}", sensor.toString()); } StatusCache();  StatusCache(ChangedStatusTable cst, EventProcessorChain epc); }
StatusCache implements DeployerCommandListener, DeployerSensorListener { public synchronized void registerSensor(Sensor sensor) { if (sensor == null) { throw new IllegalArgumentException("Null sensor parameter is not allowed."); } if (isShutdownInProcess) { return; } Sensor previous = sensors.put(sensor.getSensorID(), sensor); Logger initLog = Logger.getLogger(Constants.SENSOR_INIT_LOG_CATEGORY); if (previous != null) { initLog.error( "Duplicate registration of sensor ID {0}. Sensor ''{1}'' has replaced ''{2}''.", sensor.getSensorID(), sensor.getName(), previous.getName() ); } sensorMap.init(sensor); initLog.info("Registered sensor : {0}", sensor.toString()); } StatusCache();  StatusCache(ChangedStatusTable cst, EventProcessorChain epc); @Override void onCommandsDeployed(Set<Command> commands); @Override void onSensorsDeployed(Set<Sensor> sensors); void start(); synchronized void registerSensor(Sensor sensor); Sensor getSensor(int id); synchronized void shutdown(); synchronized void update(Event event); Map<Integer, String> queryStatus(Set<Integer> sensorIDs); String queryStatus(Integer sensorID); Event queryStatus(String name); Iterator<Event> getStateSnapshot(); void initializeEventContext(Set<Command> commands); Integer sensorIDFromName(String sensorName); }
StatusCache implements DeployerCommandListener, DeployerSensorListener { public synchronized void registerSensor(Sensor sensor) { if (sensor == null) { throw new IllegalArgumentException("Null sensor parameter is not allowed."); } if (isShutdownInProcess) { return; } Sensor previous = sensors.put(sensor.getSensorID(), sensor); Logger initLog = Logger.getLogger(Constants.SENSOR_INIT_LOG_CATEGORY); if (previous != null) { initLog.error( "Duplicate registration of sensor ID {0}. Sensor ''{1}'' has replaced ''{2}''.", sensor.getSensorID(), sensor.getName(), previous.getName() ); } sensorMap.init(sensor); initLog.info("Registered sensor : {0}", sensor.toString()); } StatusCache();  StatusCache(ChangedStatusTable cst, EventProcessorChain epc); @Override void onCommandsDeployed(Set<Command> commands); @Override void onSensorsDeployed(Set<Sensor> sensors); void start(); synchronized void registerSensor(Sensor sensor); Sensor getSensor(int id); synchronized void shutdown(); synchronized void update(Event event); Map<Integer, String> queryStatus(Set<Integer> sensorIDs); String queryStatus(Integer sensorID); Event queryStatus(String name); Iterator<Event> getStateSnapshot(); void initializeEventContext(Set<Command> commands); Integer sensorIDFromName(String sensorName);  }