From f1a22397a307a693d28713cf193bd3c270df3cca Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Thu, 14 Jan 2016 14:39:56 +0530 Subject: [PATCH 1/2] connected cup agent added --- .../{connected-cup-agent => agent}/pom.xml | 2 +- .../org/coffeeking/agent/datasense/PushLevel.java | 0 .../coffeeking/agent/datasense/PushTemperature.java | 0 .../agent/transport/TransportHandler.java | 0 .../agent/transport/TransportHandlerException.java | 0 .../mqtt/ConnectedCupMQttTransportHandler.java | 0 .../agent/transport/mqtt/MQTTTransportHandler.java | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/main/webapp/bootstrap.min.css | 0 .../src/main/webapp/coffeecup.png | Bin .../src/main/webapp/css/bootstrap.min.css | 0 .../src/main/webapp/css/jquery-ui.css | 0 .../src/main/webapp/images/coffeecup.png | Bin .../src/main/webapp/index.jsp | 0 .../src/main/webapp/jquery-1.12.0.min.js | 0 .../src/main/webapp/jquery-ui.css | 0 .../src/main/webapp/jquery-ui.js | 0 .../src/main/webapp/js/libs/jquery-1.12.0.min.js | 0 .../src/main/webapp/js/libs/jquery-ui.js | 0 modules/samples/connectedcup/component/pom.xml | 1 + 20 files changed, 2 insertions(+), 1 deletion(-) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/pom.xml (98%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/java/org/coffeeking/agent/datasense/PushLevel.java (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/java/org/coffeeking/agent/datasense/PushTemperature.java (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/java/org/coffeeking/agent/transport/TransportHandler.java (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/java/org/coffeeking/agent/transport/TransportHandlerException.java (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/java/org/coffeeking/agent/transport/mqtt/ConnectedCupMQttTransportHandler.java (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/java/org/coffeeking/agent/transport/mqtt/MQTTTransportHandler.java (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/WEB-INF/web.xml (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/bootstrap.min.css (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/coffeecup.png (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/css/bootstrap.min.css (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/css/jquery-ui.css (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/images/coffeecup.png (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/index.jsp (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/jquery-1.12.0.min.js (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/jquery-ui.css (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/jquery-ui.js (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/js/libs/jquery-1.12.0.min.js (100%) rename modules/samples/connectedcup/component/{connected-cup-agent => agent}/src/main/webapp/js/libs/jquery-ui.js (100%) diff --git a/modules/samples/connectedcup/component/connected-cup-agent/pom.xml b/modules/samples/connectedcup/component/agent/pom.xml similarity index 98% rename from modules/samples/connectedcup/component/connected-cup-agent/pom.xml rename to modules/samples/connectedcup/component/agent/pom.xml index a2415794..e3308618 100644 --- a/modules/samples/connectedcup/component/connected-cup-agent/pom.xml +++ b/modules/samples/connectedcup/component/agent/pom.xml @@ -7,7 +7,7 @@ ../pom.xml 4.0.0 - org.coffeking.agent + org.coffeeking.agent war 1.9.2-SNAPSHOT connected-cup-agent Maven Webapp diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/datasense/PushLevel.java b/modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/datasense/PushLevel.java similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/datasense/PushLevel.java rename to modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/datasense/PushLevel.java diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/datasense/PushTemperature.java b/modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/datasense/PushTemperature.java similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/datasense/PushTemperature.java rename to modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/datasense/PushTemperature.java diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/TransportHandler.java b/modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/TransportHandler.java similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/TransportHandler.java rename to modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/TransportHandler.java diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/TransportHandlerException.java b/modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/TransportHandlerException.java similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/TransportHandlerException.java rename to modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/TransportHandlerException.java diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/mqtt/ConnectedCupMQttTransportHandler.java b/modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/mqtt/ConnectedCupMQttTransportHandler.java similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/mqtt/ConnectedCupMQttTransportHandler.java rename to modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/mqtt/ConnectedCupMQttTransportHandler.java diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/mqtt/MQTTTransportHandler.java b/modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/mqtt/MQTTTransportHandler.java similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/java/org/coffeeking/agent/transport/mqtt/MQTTTransportHandler.java rename to modules/samples/connectedcup/component/agent/src/main/java/org/coffeeking/agent/transport/mqtt/MQTTTransportHandler.java diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/WEB-INF/web.xml b/modules/samples/connectedcup/component/agent/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/WEB-INF/web.xml rename to modules/samples/connectedcup/component/agent/src/main/webapp/WEB-INF/web.xml diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/bootstrap.min.css b/modules/samples/connectedcup/component/agent/src/main/webapp/bootstrap.min.css similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/bootstrap.min.css rename to modules/samples/connectedcup/component/agent/src/main/webapp/bootstrap.min.css diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/coffeecup.png b/modules/samples/connectedcup/component/agent/src/main/webapp/coffeecup.png similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/coffeecup.png rename to modules/samples/connectedcup/component/agent/src/main/webapp/coffeecup.png diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/css/bootstrap.min.css b/modules/samples/connectedcup/component/agent/src/main/webapp/css/bootstrap.min.css similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/css/bootstrap.min.css rename to modules/samples/connectedcup/component/agent/src/main/webapp/css/bootstrap.min.css diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/css/jquery-ui.css b/modules/samples/connectedcup/component/agent/src/main/webapp/css/jquery-ui.css similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/css/jquery-ui.css rename to modules/samples/connectedcup/component/agent/src/main/webapp/css/jquery-ui.css diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/images/coffeecup.png b/modules/samples/connectedcup/component/agent/src/main/webapp/images/coffeecup.png similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/images/coffeecup.png rename to modules/samples/connectedcup/component/agent/src/main/webapp/images/coffeecup.png diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/index.jsp b/modules/samples/connectedcup/component/agent/src/main/webapp/index.jsp similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/index.jsp rename to modules/samples/connectedcup/component/agent/src/main/webapp/index.jsp diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/jquery-1.12.0.min.js b/modules/samples/connectedcup/component/agent/src/main/webapp/jquery-1.12.0.min.js similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/jquery-1.12.0.min.js rename to modules/samples/connectedcup/component/agent/src/main/webapp/jquery-1.12.0.min.js diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/jquery-ui.css b/modules/samples/connectedcup/component/agent/src/main/webapp/jquery-ui.css similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/jquery-ui.css rename to modules/samples/connectedcup/component/agent/src/main/webapp/jquery-ui.css diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/jquery-ui.js b/modules/samples/connectedcup/component/agent/src/main/webapp/jquery-ui.js similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/jquery-ui.js rename to modules/samples/connectedcup/component/agent/src/main/webapp/jquery-ui.js diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/js/libs/jquery-1.12.0.min.js b/modules/samples/connectedcup/component/agent/src/main/webapp/js/libs/jquery-1.12.0.min.js similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/js/libs/jquery-1.12.0.min.js rename to modules/samples/connectedcup/component/agent/src/main/webapp/js/libs/jquery-1.12.0.min.js diff --git a/modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/js/libs/jquery-ui.js b/modules/samples/connectedcup/component/agent/src/main/webapp/js/libs/jquery-ui.js similarity index 100% rename from modules/samples/connectedcup/component/connected-cup-agent/src/main/webapp/js/libs/jquery-ui.js rename to modules/samples/connectedcup/component/agent/src/main/webapp/js/libs/jquery-ui.js diff --git a/modules/samples/connectedcup/component/pom.xml b/modules/samples/connectedcup/component/pom.xml index 45869d0a..f32b6827 100644 --- a/modules/samples/connectedcup/component/pom.xml +++ b/modules/samples/connectedcup/component/pom.xml @@ -40,6 +40,7 @@ plugin controller manager + agent From 5770ecab2fc23687cd316ee288ae3c9e52d252d5 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Thu, 14 Jan 2016 15:04:56 +0530 Subject: [PATCH 2/2] fixed to get the server ip when starting the agent --- .../device-view.hbs | 2 +- .../device-view.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs index ee2213f7..c26c6d41 100644 --- a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs +++ b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs @@ -18,7 +18,7 @@ diff --git a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js index 23d67125..530e0710 100644 --- a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js +++ b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js @@ -22,6 +22,9 @@ function onRequest(context) { var deviceType = context.uriParams.deviceType; var deviceId = request.getParameter("id"); + var property = require("process").getProperty; + var serverIp = property("carbon.local.ip"); + if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); @@ -29,7 +32,8 @@ function onRequest(context) { if (device && device.status != "error") { log.info(device); var deviceProperties = device.properties; - device.accessToken = deviceProperties.accessToken + device.accessToken = deviceProperties.accessToken; + device.ip = serverIp; return {"device": device}; } }