AccessSensorService
, MockAccessSensorService
public abstract class AbstractAccessSensorService
extends java.lang.Object
getDataFromSensor()
method.AccessSensorService
,
MockAccessSensorService
Modifier and Type | Field | Description |
---|---|---|
protected BorderRouterRepository |
borderRouterRepository |
|
protected org.springframework.context.ApplicationContext |
context |
|
private static org.apache.log4j.Logger |
logger |
|
protected SensorDataRepository |
sensorDataRepository |
|
protected SensorRepository |
sensorRepository |
Constructor | Description |
---|---|
AbstractAccessSensorService() |
Modifier and Type | Method | Description |
---|---|---|
DataPackage |
getAllCurrentSensorData() |
Fetch data from each sensor, map the data to well formatted Java Object.
|
abstract SensorDataEntity |
getDataFromSensor(java.lang.String sensorIp) |
For the input sensor IP, get current data from the sensor, map the data
to a
SensorDataEntity object. |
BorderRouterWrapper |
getDataFromSensorForBorderRouter(BorderRouterEntity borderRouter) |
Get current data from sensors connected to the input border router.
|
boolean |
saveAllCurrentDataFromSensor() |
Fetch and save the current data set of each sensor in database.
|
SensorDataEntity |
saveDataFromSensor(java.lang.String sensorIp) |
Fetch current data from the input sensor IP, store the data into database.
|
@Autowired protected SensorRepository sensorRepository
@Autowired protected SensorDataRepository sensorDataRepository
@Autowired protected org.springframework.context.ApplicationContext context
@Autowired protected BorderRouterRepository borderRouterRepository
private static final org.apache.log4j.Logger logger
public abstract SensorDataEntity getDataFromSensor(java.lang.String sensorIp) throws com.fasterxml.jackson.core.JsonProcessingException
SensorDataEntity
object. For the data types, use the global
dataTypeList
bean to decide what kind of data to fetch.sensorIp
- The IPv6 address of the sensor you want to fetch from.SensorDataEntity
object contains the data.com.fasterxml.jackson.core.JsonProcessingException
@Transactional public DataPackage getAllCurrentSensorData() throws com.fasterxml.jackson.core.JsonProcessingException
BorderRouterWrapper
com.fasterxml.jackson.core.JsonProcessingException
@Transactional public SensorDataEntity saveDataFromSensor(java.lang.String sensorIp) throws com.fasterxml.jackson.core.JsonProcessingException
sensorIp
- The IPv6 address of the sensor you want to fetch from.SensorDataEntity
object contains the data.com.fasterxml.jackson.core.JsonProcessingException
@Transactional public BorderRouterWrapper getDataFromSensorForBorderRouter(BorderRouterEntity borderRouter) throws com.fasterxml.jackson.core.JsonProcessingException
borderRouter
- The instance of border router you want to fetch data from.BorderRouterWrapper
that contains data.java.lang.NullPointerException
- if the input borderRouter entity is null.com.fasterxml.jackson.core.JsonProcessingException
@Transactional public boolean saveAllCurrentDataFromSensor() throws com.fasterxml.jackson.core.JsonProcessingException
true
if there are sensors in database, return false
if there is no sensor in database.com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception