From ce2e3a9a053e8aa3ae491a8046c1651d6e256011 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Wed, 23 Dec 2015 10:17:31 +0530 Subject: [PATCH 01/10] Added feature annotation --- .../pom.xml | 5 ++++ .../service/impl/AndroidSenseService.java | 24 ++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 69bb002679..3181026d16 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -171,6 +171,11 @@ + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + provided + diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index b99470644a..2e95c7a865 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -18,6 +18,7 @@ package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.annotations.device.DeviceType; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService; @@ -29,18 +30,11 @@ import org.wso2.carbon.device.mgt.iot.DeviceManagement; import org.wso2.carbon.device.mgt.iot.androidsense.plugin.constants.AndroidSenseConstants; import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.DeviceJSON; import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.SensorJSON; -import org.wso2.carbon.device.mgt.iot.apimgt.AccessTokenInfo; -import org.wso2.carbon.device.mgt.iot.apimgt.TokenClient; -import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppAccount; -import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppConfig; -import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppServerClient; -import org.wso2.carbon.device.mgt.iot.exception.AccessTokenException; import org.wso2.carbon.device.mgt.iot.exception.DeviceControllerException; import org.wso2.carbon.device.mgt.iot.sensormgt.SensorDataManager; import org.wso2.carbon.device.mgt.iot.sensormgt.SensorRecord; -import org.wso2.carbon.device.mgt.iot.util.ZipArchive; -import org.wso2.carbon.device.mgt.iot.util.ZipUtil; import org.wso2.carbon.utils.CarbonUtils; +import org.wso2.carbon.apimgt.annotations.device.feature.Feature; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.*; @@ -48,11 +42,9 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.File; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; import java.util.Date; -import java.util.UUID; +@DeviceType( value = "android_sense" ) public class AndroidSenseService { private static final String BATTERY_STREAM_DEFINITION = "org.wso2.iot.devices.battery"; @@ -361,6 +353,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readlight", name = "Light", description = "Read Light data from the device", type = "monitor") public SensorRecord readLight( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -380,6 +373,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readbattery", name = "Battery", description = "Read Battery data from the device", type = "monitor") public SensorRecord readBattery( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -399,6 +393,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readgps", name = "gps", description = "Read GPS data from the device", type = "monitor") public SensorRecord readGPS( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -418,6 +413,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readmagnetic", name = "Magnetic", description = "Read Magnetic data from the device", type = "monitor") public SensorRecord readMagnetic( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -437,6 +433,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readaccelerometer", name = "Accelerometer", description = "Read Accelerometer data from the device", type = "monitor") public SensorRecord readAccelerometer( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -456,6 +453,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readrotation", name = "Rotation", description = "Read Rotational Vector data from the device", type = "monitor") public SensorRecord readRotation( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -475,6 +473,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readproximity", name = "Proximity", description = "Read Proximity data from the device", type = "monitor") public SensorRecord readProximity( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -494,6 +493,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readgyroscope", name = "Gyroscope", description = "Read Gyroscope data from the device", type = "monitor") public SensorRecord readGyroscope( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -513,6 +513,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readpressure", name = "Pressure", description = "Read Pressure data from the device", type = "monitor") public SensorRecord readPressure( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { @@ -532,6 +533,7 @@ public class AndroidSenseService { @GET @Consumes("application/json") @Produces("application/json") + @Feature(code = "readgravity", name = "Gravity", description = "Read Gravity data from the device", type = "monitor") public SensorRecord readGravity( @HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId, @Context HttpServletResponse response) { From cd46ef34654976e4a04fee855badf292efc97086 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Wed, 23 Dec 2015 15:13:34 +0530 Subject: [PATCH 02/10] Added feature annotation --- .../service/impl/AndroidSenseService.java | 2 + .../src/main/webapp/WEB-INF/web.xml | 56 +++++++++---------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 2e95c7a865..0e2ffcba7f 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -18,6 +18,7 @@ package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.device.DeviceType; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfigurationException; @@ -45,6 +46,7 @@ import java.io.File; import java.util.Date; @DeviceType( value = "android_sense" ) +@API( name="android_sense", version="1.0.0", context="/android_sense") public class AndroidSenseService { private static final String BATTERY_STREAM_DEFINITION = "org.wso2.iot.devices.battery"; diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml index db5733aaff..d3b03b4c27 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml @@ -29,34 +29,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + managed-api-enabled + true + + + managed-api-owner + admin + + + managed-api-name + android_sense + + + managed-api-endpoint + http://localhost:9763/android_sense + + + managed-api-version + 1.0.0 + + + managed-api-context + /android_sense + + + managed-api-isSecured + true + From b430590543653e14906566ccbb8222451cfa5e79 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Wed, 23 Dec 2015 17:25:04 +0530 Subject: [PATCH 03/10] Corrected _war -> _mgt --- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 78595f59f2..1a07767662 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -192,7 +192,7 @@ maven-war-plugin - android_sense_war + android_sense_mgt From 151d7ba087696aa1be096206b8da13f9cc7c3c68 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Mon, 4 Jan 2016 10:33:57 +0530 Subject: [PATCH 04/10] arranged to ascending order --- .../service/impl/AndroidSenseService.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 0e2ffcba7f..92e14a1012 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -49,27 +49,27 @@ import java.util.Date; @API( name="android_sense", version="1.0.0", context="/android_sense") public class AndroidSenseService { + private static final String ACCELEROMETER_STREAM_DEFINITION = "org.wso2.iot.devices.accelerometer"; private static final String BATTERY_STREAM_DEFINITION = "org.wso2.iot.devices.battery"; - private static final String LIGHT_STREAM_DEFINITION = "org.wso2.iot.devices.light"; private static final String GPS_STREAM_DEFINITION = "org.wso2.iot.devices.gps"; - private static final String MAGNETIC_STREAM_DEFINITION = "org.wso2.iot.devices.magnetic"; - private static final String ACCELEROMETER_STREAM_DEFINITION = "org.wso2.iot.devices.accelerometer"; + private static final String GRAVITY_STREAM_DEFINITION = "org.wso2.iot.devices.gravity"; private static final String GYROSCOPE_STREAM_DEFINITION = "org.wso2.iot.devices.gyroscope"; + private static final String LIGHT_STREAM_DEFINITION = "org.wso2.iot.devices.light"; + private static final String MAGNETIC_STREAM_DEFINITION = "org.wso2.iot.devices.magnetic"; private static final String PRESSURE_STREAM_DEFINITION = "org.wso2.iot.devices.pressure"; - private static final String GRAVITY_STREAM_DEFINITION = "org.wso2.iot.devices.gravity"; - private static final String ROTATION_STREAM_DEFINITION = "org.wso2.iot.devices.rotation"; private static final String PROXIMITY_STREAM_DEFINITION = "org.wso2.iot.devices.proximity"; + private static final String ROTATION_STREAM_DEFINITION = "org.wso2.iot.devices.rotation"; private static final String SENSOR_ACCELEROMETER = "accelerometer"; - private static final String SENSOR_GYROSCOPE = "gyroscope"; - private static final String SENSOR_PRESSURE = "pressure"; + private static final String SENSOR_BATTERY = "battery"; + private static final String SENSOR_GPS = "gps"; private static final String SENSOR_GRAVITY = "gravity"; - private static final String SENSOR_ROTATION = "rotation"; + private static final String SENSOR_GYROSCOPE = "gyroscope"; private static final String SENSOR_LIGHT = "light"; - private static final String SENSOR_GPS = "gps"; - private static final String SENSOR_PROXIMITY = "proximity"; - private static final String SENSOR_BATTERY = "battery"; private static final String SENSOR_MAGNETIC = "magnetic"; + private static final String SENSOR_PRESSURE = "pressure"; + private static final String SENSOR_PROXIMITY = "proximity"; + private static final String SENSOR_ROTATION = "rotation"; private static Log log = LogFactory.getLog(AndroidSenseService.class); //TODO; replace this tenant domain From 5b24ebab9860e2965b3c54975ec9dbdb1ab9b506 Mon Sep 17 00:00:00 2001 From: NuwanSameera Date: Mon, 4 Jan 2016 15:50:46 +0530 Subject: [PATCH 05/10] Digital display device type view updates --- .../type-view.hbs | 70 ++++++++----------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs b/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs index 593c1326e6..73d0e4527e 100644 --- a/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs +++ b/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs @@ -34,14 +34,17 @@
+ View API   Download