service api changes

merge-requests/1/head
Rasika 10 years ago
parent 2b2ce0f35b
commit ae3a134f87

@ -277,7 +277,9 @@
</directory> </directory>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/deployment/server/webapps</outputDirectory> <outputDirectory>${pom.artifactId}-${pom.version}/repository/deployment/server/webapps</outputDirectory>
<includes> <includes>
<include>iotdevices.war</include> <include>devicecloud.war</include>
<include>firealarm.war</include>
<include>sensebot.war</include>
</includes> </includes>
</fileSet> </fileSet>

@ -32,18 +32,21 @@ var carbonHttpsServletTransport = carbon.server.address('https');
var result; var result;
if (uriMatcher.match("/{context}/api/device/sketch/")) { if (uriMatcher.match("/{context}/api/device/sketch/")) {
sketchType = request.getParameter("type"); sketchType = request.getParameter("type");
if(!sketchType){log.error("Sketch Type is empty");} if (!sketchType) {
log.error("Sketch Type is empty");
}
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);
if(!user){ if (!user) {
response.sendRedirect(dcProps.appContext + "login?#login-required"); response.sendRedirect(dcProps.appContext + "login?#login-required");
exit(); exit();
} }
//URL: /iotdevices/FireAlarmManager/device/firealarm/download
fireAlarmManagerService = carbonHttpsServletTransport + "/iotdevices/FireAlarmManager"; fireAlarmManagerService = carbonHttpsServletTransport + "/iotdevices/FireAlarmManager";
sketchDownloadEndPoint = fireAlarmManagerService + "/downloadSketch"; sketchDownloadEndPoint = fireAlarmManagerService + "/device/" + sketchType + "/download";
response.sendRedirect(sketchDownloadEndPoint + "?type="+sketchType+"&owner="+user.username); response.sendRedirect(sketchDownloadEndPoint + "?owner=" + user.username);
exit(); exit();
} }
@ -52,17 +55,18 @@ if (uriMatcher.match("/{context}/api/devices/")) {
var constants = require("/modules/constants.js"); var constants = require("/modules/constants.js");
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);
if(!user){ if (!user) {
response.sendRedirect(dcProps.appContext + "login?#login-required"); response.sendRedirect(dcProps.appContext + "login?#login-required");
exit(); exit();
} }
//URL: /iotdevices/DevicesManager/devices/username
devicesManagerService = carbonHttpsServletTransport + "/iotdevices/DevicesManager"; devicesManagerService = carbonHttpsServletTransport + "/iotdevices/DevicesManager";
listAllDevicesEndPoint = devicesManagerService + "/getDevices"; listAllDevicesEndPoint = devicesManagerService + "/devices/" + user.username;
var data = {}; var data = {};
//XMLHTTPRequest's GET //XMLHTTPRequest's GET
result = get(listAllDevicesEndPoint+"?username="+user.username, data ,"json"); result = get(listAllDevicesEndPoint, data, "json");
//response.sendRedirect(listAllDevicesEndPoint + "?username="+user.username); //response.sendRedirect(listAllDevicesEndPoint + "?username="+user.username);
//exit(); //exit();
@ -70,6 +74,6 @@ if (uriMatcher.match("/{context}/api/devices/")) {
// returning the result. // returning the result.
if (result) { if (result) {
print(result); print(result);
} }
%> %>

@ -27,15 +27,19 @@ var dcProps = require('/config/dc-props.js').config();
var downloadModule = require("/modules/download.js").downloadModule; var downloadModule = require("/modules/download.js").downloadModule;
var utility = require("/modules/utility.js").utility; 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; var result;
if (uriMatcher.match("/{context}/api/device/sketch/")) { if (uriMatcher.match("/{context}/api/device/sketch/")) {
sketchType = request.getParameter("type"); sketchType = request.getParameter("type");
if(!sketchType){log.error("Sketch Type is empty");} if(!sketchType){log.error("Sketch Type is empty");}
senseBotManagerService = "http://localhost:9763/iotdevices/SenseBotManager"; senseBotManagerService = carbonHttpsServletTransport+"/iotdevices/SenseBotManager";
sketchDownloadEndPoint = senseBotManagerService + "/downloadSketch"; sketchDownloadEndPoint = senseBotManagerService + "/downloadSketch/device/";
response.sendRedirect(sketchDownloadEndPoint + "?type="+sketchType+"&owner=anonymous"); response.sendRedirect(sketchDownloadEndPoint + sketchType + "?owner=anonymous");
exit(); exit();
} }

@ -1008,16 +1008,6 @@
</releases> </releases>
</repository> </repository>
<repository>
<id>wso2-staging</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/orgwso2carbonapimgt-009/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories> </repositories>
</project> </project>

Loading…
Cancel
Save