From ae3a134f87d89922e8703e9e59b4a1becd3671de Mon Sep 17 00:00:00 2001 From: Rasika Date: Sat, 6 Jun 2015 22:44:25 +0530 Subject: [PATCH] service api changes --- modules/distribution/src/assembly/bin.xml | 4 ++- .../jaggeryapps/iot/api/device-api.jag | 30 +++++++++++-------- .../jaggeryapps/sensebot/api/device-api.jag | 10 +++++-- pom.xml | 10 ------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index 3d5566c0..52d4c11e 100644 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -277,7 +277,9 @@ ${pom.artifactId}-${pom.version}/repository/deployment/server/webapps - iotdevices.war + devicecloud.war + firealarm.war + sensebot.war diff --git a/modules/distribution/src/repository/jaggeryapps/iot/api/device-api.jag b/modules/distribution/src/repository/jaggeryapps/iot/api/device-api.jag index e8a48ea0..4fb5b99d 100644 --- a/modules/distribution/src/repository/jaggeryapps/iot/api/device-api.jag +++ b/modules/distribution/src/repository/jaggeryapps/iot/api/device-api.jag @@ -32,18 +32,21 @@ var carbonHttpsServletTransport = carbon.server.address('https'); var result; if (uriMatcher.match("/{context}/api/device/sketch/")) { - sketchType = request.getParameter("type"); - if(!sketchType){log.error("Sketch Type is empty");} + sketchType = request.getParameter("type"); + if (!sketchType) { + log.error("Sketch Type is empty"); + } - var user = session.get(constants.USER_SESSION_KEY); - if(!user){ - response.sendRedirect(dcProps.appContext + "login?#login-required"); - exit(); - } + var user = session.get(constants.USER_SESSION_KEY); + if (!user) { + response.sendRedirect(dcProps.appContext + "login?#login-required"); + exit(); + } + //URL: /iotdevices/FireAlarmManager/device/firealarm/download fireAlarmManagerService = carbonHttpsServletTransport + "/iotdevices/FireAlarmManager"; - sketchDownloadEndPoint = fireAlarmManagerService + "/downloadSketch"; - response.sendRedirect(sketchDownloadEndPoint + "?type="+sketchType+"&owner="+user.username); + sketchDownloadEndPoint = fireAlarmManagerService + "/device/" + sketchType + "/download"; + response.sendRedirect(sketchDownloadEndPoint + "?owner=" + user.username); exit(); } @@ -52,17 +55,18 @@ if (uriMatcher.match("/{context}/api/devices/")) { var constants = require("/modules/constants.js"); var user = session.get(constants.USER_SESSION_KEY); - if(!user){ + if (!user) { response.sendRedirect(dcProps.appContext + "login?#login-required"); exit(); } + //URL: /iotdevices/DevicesManager/devices/username devicesManagerService = carbonHttpsServletTransport + "/iotdevices/DevicesManager"; - listAllDevicesEndPoint = devicesManagerService + "/getDevices"; + listAllDevicesEndPoint = devicesManagerService + "/devices/" + user.username; var data = {}; //XMLHTTPRequest's GET - result = get(listAllDevicesEndPoint+"?username="+user.username, data ,"json"); + result = get(listAllDevicesEndPoint, data, "json"); //response.sendRedirect(listAllDevicesEndPoint + "?username="+user.username); //exit(); @@ -70,6 +74,6 @@ if (uriMatcher.match("/{context}/api/devices/")) { // returning the result. if (result) { - print(result); + print(result); } %> diff --git a/modules/distribution/src/repository/jaggeryapps/sensebot/api/device-api.jag b/modules/distribution/src/repository/jaggeryapps/sensebot/api/device-api.jag index 0a5c8ef4..28809f2b 100644 --- a/modules/distribution/src/repository/jaggeryapps/sensebot/api/device-api.jag +++ b/modules/distribution/src/repository/jaggeryapps/sensebot/api/device-api.jag @@ -27,15 +27,19 @@ var dcProps = require('/config/dc-props.js').config(); var downloadModule = require("/modules/download.js").downloadModule; var utility = require("/modules/utility.js").utility; +var carbon = require('carbon'); +var carbonHttpServletTransport = carbon.server.address('http'); +var carbonHttpsServletTransport = carbon.server.address('https'); + var result; if (uriMatcher.match("/{context}/api/device/sketch/")) { sketchType = request.getParameter("type"); if(!sketchType){log.error("Sketch Type is empty");} - senseBotManagerService = "http://localhost:9763/iotdevices/SenseBotManager"; - sketchDownloadEndPoint = senseBotManagerService + "/downloadSketch"; - response.sendRedirect(sketchDownloadEndPoint + "?type="+sketchType+"&owner=anonymous"); + senseBotManagerService = carbonHttpsServletTransport+"/iotdevices/SenseBotManager"; + sketchDownloadEndPoint = senseBotManagerService + "/downloadSketch/device/"; + response.sendRedirect(sketchDownloadEndPoint + sketchType + "?owner=anonymous"); exit(); } diff --git a/pom.xml b/pom.xml index 793ceeb8..33d8415e 100644 --- a/pom.xml +++ b/pom.xml @@ -1008,16 +1008,6 @@ - - wso2-staging - WSO2 internal Repository - http://maven.wso2.org/nexus/content/repositories/orgwso2carbonapimgt-009/ - - true - daily - ignore - -