Updated Branches:
  refs/heads/master 89fb391c1 -> a240bd2b4

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/a240bd2b/components/org.apache.stratos.manager.console/util/utility.jag
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/util/utility.jag 
b/components/org.apache.stratos.manager.console/util/utility.jag
deleted file mode 100644
index e943e10..0000000
--- a/components/org.apache.stratos.manager.console/util/utility.jag
+++ /dev/null
@@ -1,146 +0,0 @@
-<%
-
-function E4XtoJSON(xml, ignored) {
-    var r, children = xml.*, attributes = xml.@*, length = children.length();
-    if(length == 0) {
-        r = xml.toString();
-    } else if(length == 1) {
-        var text = xml.text().toString();
-        if(text) {
-            r = text;
-        }
-    }
-    if(r == undefined) {
-        r = {};
-        for each (var child in children) {
-             var name = child.localName();
-             var json = E4XtoJSON(child, ignored);
-             var value = r[name];
-             if(value) {
-               if(value.length) {
-                 value.push(json);
-               } else {
-                 r[name] = [value, json]
-               }
-             } else {
-               r[name] = json;
-             }
-        }
-    }
-    if(attributes.length()) {
-        var a = {}, c = 0;
-        for each (var attribute in attributes) {
-          var name = attribute.localName();
-          if(ignored && ignored.indexOf(name) == -1) {
-            a["_" + name] = attribute.toString();
-            c ++;
-          }
-        }
-        if(c) {
-          if(r) a._ = r;
-          return a;
-        }
-    }
-    return r;
-}
-
-function sortNumber(jsonArray, property, ascending, zeroLast) {
-    jsonArray.sort(function (a, b) {
-        var aProp = parseFloat(a[property]);
-        var bProp = parseFloat(b[property]);
-
-        if(zeroLast){
-             if(aProp == 0){
-                aProp = 500000;
-             }
-             if(bProp == 0 ){
-                bProp = 500000;
-             }
-        }
-
-        return aProp === bProp ? 0 : ( ascending ? (aProp >= bProp ? 1 : -1 ) 
: (aProp >= bProp ? -1 : 1 ));
-    });
-
-    return jsonArray;
-}
-
-
-
-
-function getServerUrl(){
-    var serverUrl = "https://localhost:9453/services";;
-    serverUrl = serverUrl + "/UserProfileMgtService";
-
-    return serverUrl;
-}
-
-consoleAppUtil = new function(){
-    var log = new Log();
-
-    this.getAvailableCartridges = function(){
-
-    };
-
-    this.getSubscribedCartridges = function(){
-
-    }
-
-    this.makeRequest = function(httpMethod,urlPostFix,data){
-        var config = require('/config/console.js').config();
-        var backendServerURL = config.backendServerConfiguration.url;
-        // getting the access token from the session.
-        var endpoint = backendServerURL + urlPostfix;
-        var accessToken = this.getAccessTokenFromSession();
-        // the header values are constant
-        var headers = {
-            "Authorization": "Bearer "+accessToken,
-            "Content-Type": "application/json"
-        };
-        var type = "json"; // response format
-        var response;
-        switch (httpMethod){
-            case  "GET":
-               response = get(endpoint,{},headers,type);
-               break;
-            case   "POST":
-                response = post(endpoint,data,headers,type);
-                break;
-            case    "PUT":
-                response = put(endpoint,data,headers,type);
-                break;
-            case    "DELETE":
-                response = del(endpoint,data,headers,type);
-                break;
-            default :
-                log.error("Error in the programme flow.");
-        }
-        log.debug(response.data);
-        return response;
-    };
-
-
-
-    this.getOauthAccessToken = function(encodedSAMLToken,basicAuthToken){
-        var config = require('/config/console.js').config();
-        var endpoint = config.oauthConfiguration.tokenEndpoint;
-        var headers = {
-            "Authorization": "Basic "+basicAuthToken,
-            "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
-        };
-        var data = {
-            grant_type:"urn:ietf:params:oauth:grant-type:saml2-bearer",
-            assertion:encodedSAMLToken
-        };
-        var response = post(endpoint,data,headers,"json");
-        log.debug(response);
-        return response;
-    };
-
-    this.getAccessTokenFromSession = function(){
-        return session.get("access_token");
-    };
-};
-
-
-
-%>
\ No newline at end of file

Reply via email to