From e7c5ef78d086294534376fd25eabb34aacbbccbe Mon Sep 17 00:00:00 2001 From: charitha Date: Mon, 16 May 2016 17:03:36 +0530 Subject: [PATCH] Removed unnecessary jaggery apis --- .../devicemgt/api/operation-api.jag | 62 ------------------- .../jaggeryapps/devicemgt/api/policy-api.jag | 55 ---------------- .../jaggeryapps/devicemgt/jaggery.conf | 4 -- 3 files changed, 121 deletions(-) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag deleted file mode 100644 index 16d01c99a8f..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/operation-api.jag +++ /dev/null @@ -1,62 +0,0 @@ -<% -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("/api/operation-api.jag"); - -var utility = require('/app/modules/utility.js').utility; -var constants = require('/app/modules/constants.js'); -var operationModule = require("/app/modules/operation.js").operationModule; - -response.contentType = 'application/json'; - -var user = session.get(constants.USER_SESSION_KEY); - -var result; - -if (!user) { - response.sendRedirect("/devicemgt/login?#login-required"); - exit(); -} else { - if (uriMatcher.match("/{context}/api/operations/{deviceType}/stats")) { - var deviceType = uriMatcher.elements().deviceType; - var deviceId = request.getParameter("deviceId"); - var monitorOperations = operationModule.getMonitorOperations(deviceType); - var stats = []; - result = {}; - for (var op in monitorOperations) { - result = operationModule.handleGETOperation(deviceType, monitorOperations[op].operation, monitorOperations[op].name, deviceId); - stats.push(result.data); - } - result.data = stats; - } else if (uriMatcher.match("/{context}/api/operations/{deviceType}/{operation}")) { - var deviceType = uriMatcher.elements().deviceType; - var operation = uriMatcher.elements().operation; - var deviceId = request.getParameter("deviceId"); - var params = request.getAllParameters(); - result = operationModule.handlePOSTOperation(deviceType, operation, deviceId, params); - } -} - -// returning the result. -if (result) { - print(result); -} -%> diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag deleted file mode 100644 index fb9e2215d22..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag +++ /dev/null @@ -1,55 +0,0 @@ -<% -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -var uri = request.getRequestURI(); -var uriMatcher = new URIMatcher(String(uri)); - -var log = new Log("api/policy-api.jag"); - -var constants = require("/app/modules/constants.js"); -var policyModule = require("/app/modules/policy.js").policyModule; - -var deviceType, deviceId; - -var user = session.get(constants.USER_SESSION_KEY); - -var responseProcessor = require('utils').response; -response.contentType = 'application/json'; - -if (!user) { - response = responseProcessor.buildErrorResponse(response, 401, "Unauthorized"); -} else { - if (uriMatcher.match("/{context}/api/policies/add")) { - var content = request.getContent(); - var policyName = content.policyName; - var policyDefinition = content.profile.policyDefinition; - var policyDescription = content.profile.policyDescription; - deviceType = content.profile.deviceType.name; - deviceId = content.deviceId; - try { - response.content = policyModule.addPolicy(policyName, deviceType, policyDefinition, - policyDescription, deviceId); - } catch (e) { - log.error("Exception occurred while trying to add new policy under name:" + policyName, e); - // http status code 500 refers to - Internal Server Error. - responseProcessor.buildErrorResponse(response, 500, "Internal server error"); - } - } -} -%> diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf index 10170e94574..28ddcefb6c1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf @@ -11,10 +11,6 @@ "url": "/api/groups/*", "path": "/api/group-api.jag" }, - { - "url": "/api/operations/*", - "path": "/api/operation-api.jag" - }, { "url": "/api/policies/*", "path": "/api/policy-api.jag"