You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/10/22 08:53:43 UTC

[1/5] stratos git commit: Adding authentication logic to metering api calls

Repository: stratos
Updated Branches:
  refs/heads/stratos-4.1.x 5066438a0 -> 57d497dc4


Adding authentication logic to metering api calls


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/62874667
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/62874667
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/62874667

Branch: refs/heads/stratos-4.1.x
Commit: 62874667eb463e1ea937873615b4585d5ae3e799
Parents: 5066438
Author: Thanuja <th...@wso2.com>
Authored: Wed Oct 21 12:16:08 2015 +0530
Committer: Thanuja <th...@wso2.com>
Committed: Wed Oct 21 12:16:08 2015 +0530

----------------------------------------------------------------------
 .../jaggery-files/applications.jag              |  5 +-
 .../jaggery-files/clusters.jag                  |  5 +-
 .../jaggery-files/member-count.jag              | 22 ++----
 .../jaggery-files/member-info.jag               | 21 ++----
 .../jaggery-files/member-status.jag             | 21 ++----
 .../jaggery-files/metering-authentication.jag   | 75 ++++++++++++++++++++
 .../metering-dashboard/jaggery-files/schema.jag | 63 ----------------
 7 files changed, 91 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/applications.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/applications.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/applications.jag
index c2f6b97..851885a 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/applications.jag
+++ b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/applications.jag
@@ -18,10 +18,9 @@
  * under the License.
  *
  */
-(function () {
-    var log = new Log();
-    var HTTP_INTERNAL_ERROR = 500;
+include('metering-authentication.jag');
 
+(function () {
     var db = new Database("WSO2_ANALYTICS_PROCESSED_DATA_STORE_DB");
 
     try {

http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/clusters.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/clusters.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/clusters.jag
index cdfe745..fe863df 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/clusters.jag
+++ b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/clusters.jag
@@ -18,10 +18,9 @@
  * under the License.
  *
  */
-(function () {
-    var log = new Log();
-    var HTTP_INTERNAL_ERROR = 500;
+include('metering-authentication.jag');
 
+(function () {
     var db = new Database("WSO2_ANALYTICS_PROCESSED_DATA_STORE_DB");
 
     try {

http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-count.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-count.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-count.jag
index 4d403a2..6850012 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-count.jag
+++ b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-count.jag
@@ -18,22 +18,10 @@
  * under the License.
  *
  */
+include('metering-authentication.jag');
+
 (function () {
     var log = new Log();
-    var TABLE_NAME = "tableName";
-
-    var HTTP_INTERNAL_ERROR = 500;
-
-    var carbon = require('carbon');
-    var configs = require('/configs/designer.json');
-
-    var tableName = encodeURIComponent(request.getParameter(TABLE_NAME));
-    if (tableName == null) {
-        log.error("Table name param is not provided!");
-        response.status = HTTP_INTERNAL_ERROR;
-        print('{ "status": "Failed", "message": "Table name param is empty" }');
-        return;
-    }
 
     var TIME_INTERVAL_1 = '30 Min';
     var TIME_INTERVAL_2 = '1 Hour';
@@ -42,8 +30,6 @@
     var TIME_INTERVAL_5 = '1 Month';
     var ALL_CLUSTERS = 'All Clusters';
 
-    var carbon = require('carbon');
-    var configs = require('/configs/designer.json');
     var content = request.getContent();
     var contentAsString = null;
     if (content != '' && content != null) {
@@ -87,9 +73,9 @@
         var clusterId = request.getParameter("clusterId");
 
         if (clusterId == ALL_CLUSTERS) {
-            result = db.query("SELECT FROM_UNIXTIME(CEILING( Time/('" + x_axis_interval + "'*1000)) *'" + x_axis_interval + "', '" + time_format + "') AS Time, SUM(CreatedInstanceCount) AS CreatedInstanceCount , SUM(InitializedInstanceCount) AS InitializedInstanceCount , SUM(ActiveInstanceCount) AS ActiveInstanceCount, SUM(TerminatedInstanceCount) AS TerminatedInstanceCount FROM " + tableName + " WHERE ApplicationId=? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) GROUP BY FROM_UNIXTIME( CEILING( Time/('" + x_axis_interval + "'*1000)) *'"+x_axis_interval+"', '%Y:%m:%d %h:%i'), ApplicationId", applicationId);
+            result = db.query("SELECT FROM_UNIXTIME(CEILING( Time/('" + x_axis_interval + "'*1000)) *'" + x_axis_interval + "', '" + time_format + "') AS Time, SUM(CreatedInstanceCount) AS CreatedInstanceCount , SUM(InitializedInstanceCount) AS InitializedInstanceCount , SUM(ActiveInstanceCount) AS ActiveInstanceCount, SUM(TerminatedInstanceCount) AS TerminatedInstanceCount FROM MEMBER_COUNT WHERE ApplicationId=? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) GROUP BY FROM_UNIXTIME( CEILING( Time/('" + x_axis_interval + "'*1000)) *'"+x_axis_interval+"', '" + time_format + "'), ApplicationId", applicationId);
         } else {
-            result = db.query("SELECT FROM_UNIXTIME(CEILING( Time/('" + x_axis_interval + "'*1000)) *'" + x_axis_interval + "', '" + time_format + "') AS Time, SUM(CreatedInstanceCount) AS CreatedInstanceCount , SUM(InitializedInstanceCount) AS InitializedInstanceCount , SUM(ActiveInstanceCount) AS ActiveInstanceCount, SUM(TerminatedInstanceCount) AS TerminatedInstanceCount FROM " + tableName + " WHERE ApplicationId=? AND ClusterAlias=? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) GROUP BY FROM_UNIXTIME( CEILING( Time/('" + x_axis_interval + "'*1000)) *'"+x_axis_interval+"', '%Y:%m:%d %h:%i')",applicationId, clusterId);
+            result = db.query("SELECT FROM_UNIXTIME(CEILING( Time/('" + x_axis_interval + "'*1000)) *'" + x_axis_interval + "', '" + time_format + "') AS Time, SUM(CreatedInstanceCount) AS CreatedInstanceCount , SUM(InitializedInstanceCount) AS InitializedInstanceCount , SUM(ActiveInstanceCount) AS ActiveInstanceCount, SUM(TerminatedInstanceCount) AS TerminatedInstanceCount FROM MEMBER_COUNT WHERE ApplicationId=? AND ClusterAlias=? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) GROUP BY FROM_UNIXTIME( CEILING( Time/('" + x_axis_interval + "'*1000)) *'"+x_axis_interval+"', '" + time_format + "')", applicationId, clusterId);
         }
         print(result);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-info.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-info.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-info.jag
index ed7f8e6..68337f8 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-info.jag
+++ b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-info.jag
@@ -18,23 +18,10 @@
  * under the License.
  *
  */
+include('metering-authentication.jag');
+
 (function () {
     var log = new Log();
-    var TABLE_NAME = "tableName";
-
-    var HTTP_INTERNAL_ERROR = 500;
-
-    var carbon = require('carbon');
-    var configs = require('/configs/designer.json');
-
-    var tableName = encodeURIComponent(request.getParameter(TABLE_NAME));
-    if (tableName == null) {
-        log.error("Table name param is not provided!");
-        response.status = HTTP_INTERNAL_ERROR;
-        print('{ "status": "Failed", "message": "Table name param is empty" }');
-        return;
-    }
-
     var ALL_CLUSTERS = 'All Clusters';
 
     var content = request.getContent();
@@ -54,9 +41,9 @@
         var clusterId = request.getParameter("clusterId");
 
         if (clusterId == ALL_CLUSTERS) {
-            result = db.query("SELECT * FROM " + tableName + " WHERE MemberId IN (SELECT DISTINCT MemberId FROM ANALYTICS_PROCESSED_DATA_STORE.MEMBER_STATUS WHERE ApplicationId= ?)", applicationId);
+            result = db.query("SELECT * FROM MEMBER_INFORMATION WHERE MemberId IN (SELECT DISTINCT MemberId FROM ANALYTICS_PROCESSED_DATA_STORE.MEMBER_STATUS WHERE ApplicationId= ?)", applicationId);
         } else {
-            result = db.query("SELECT * FROM " + tableName + " WHERE MemberId IN (SELECT DISTINCT MemberId FROM ANALYTICS_PROCESSED_DATA_STORE.MEMBER_STATUS WHERE ApplicationId= ? AND ClusterAlias= ?)", applicationId, clusterId);
+            result = db.query("SELECT * FROM MEMBER_INFORMATION WHERE MemberId IN (SELECT DISTINCT MemberId FROM ANALYTICS_PROCESSED_DATA_STORE.MEMBER_STATUS WHERE ApplicationId= ? AND ClusterAlias= ?)", applicationId, clusterId);
         }
         print(result);
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-status.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-status.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-status.jag
index be40e78..2aff4ac 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-status.jag
+++ b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/member-status.jag
@@ -18,13 +18,11 @@
  * under the License.
  *
  */
+include('metering-authentication.jag');
+
 (function () {
     var log = new Log();
 
-    var TABLE_NAME = "tableName";
-
-    var HTTP_INTERNAL_ERROR = 500;
-
     var TIME_INTERVAL_1 = '30 Min';
     var TIME_INTERVAL_2 = '1 Hour';
     var TIME_INTERVAL_3 = '1 Day';
@@ -32,17 +30,6 @@
     var TIME_INTERVAL_5 = '1 Month';
     var ALL_CLUSTERS = 'All Clusters';
 
-    var carbon = require('carbon');
-    var configs = require('/configs/designer.json');
-
-    var tableName = encodeURIComponent(request.getParameter(TABLE_NAME));
-    if (tableName == null) {
-        log.error("Table name param is not provided!");
-        response.status = HTTP_INTERNAL_ERROR;
-        print('{ "status": "Failed", "message": "Table name param is empty" }');
-        return;
-    }
-
     var content = request.getContent();
     var contentAsString = null;
     if (content != '' && content != null) {
@@ -74,9 +61,9 @@
         var clusterId = request.getParameter("clusterId");
 
         if (clusterId == ALL_CLUSTERS) {
-            result = db.query("SELECT FROM_UNIXTIME(Time/1000, '%Y:%m:%d %h:%i:%s') AS Time, MemberId, MemberStatus FROM " + tableName + " WHERE ApplicationId= ? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) ORDER BY MemberID, Time", applicationId);
+            result = db.query("SELECT FROM_UNIXTIME(Time/1000, '%Y:%m:%d %h:%i:%s') AS Time, MemberId, MemberStatus FROM MEMBER_STATUS WHERE ApplicationId= ? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) ORDER BY MemberID, Time", applicationId);
         }else {
-            result = db.query("SELECT FROM_UNIXTIME(Time/1000, '%Y:%m:%d %h:%i:%s') AS Time, MemberId, MemberStatus FROM " + tableName + " WHERE ApplicationId= ? AND ClusterAlias= ? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) ORDER BY MemberID, Time", applicationId, clusterId);
+            result = db.query("SELECT FROM_UNIXTIME(Time/1000, '%Y:%m:%d %h:%i:%s') AS Time, MemberId, MemberStatus FROM MEMBER_STATUS WHERE ApplicationId= ? AND ClusterAlias= ? AND Time > ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000-'" + interval + "' ) AND Time <= ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) ORDER BY MemberID, Time", applicationId, clusterId);
         }
         print(result);
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/metering-authentication.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/metering-authentication.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/metering-authentication.jag
new file mode 100644
index 0000000..78db550
--- /dev/null
+++ b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/metering-authentication.jag
@@ -0,0 +1,75 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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.
+ *
+ */
+(function () {
+    var log = new Log();
+
+    var HTTPS_TRANSPORT = "https";
+    var AUTHORIZATION_HEADER = "Authorization";
+    var ANALYTICS_SERVICE = "/services/AnalyticsWebService";
+    var AUTHENTICATION_SERVICE = "/services/AuthenticationAdmin";
+    var AUTH_TOKEN = "authToken";
+    var LOCALHOST = "localhost";
+    var HTTP_USER_NOT_AUTHENTICATED = 403;
+
+    var carbon = require('carbon');
+    var configs = require('/configs/designer.json');
+    var HTTPConstants = Packages.org.apache.axis2.transport.http.HTTPConstants;
+    var AnalyticsWebServiceStub = Packages.org.wso2.carbon.analytics.webservice.stub.AnalyticsWebServiceStub;
+    var AuthenticationAdminStub = Packages.org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
+
+    var analyticsWSUrl = carbon.server.address(HTTPS_TRANSPORT) + ANALYTICS_SERVICE;
+    var authenticationWSUrl = carbon.server.address(HTTPS_TRANSPORT) + AUTHENTICATION_SERVICE;
+    var analyticsStub;
+    try {
+        analyticsStub = new AnalyticsWebServiceStub(analyticsWSUrl);
+    } catch (e) {
+        if (log.isDebugEnabled()) {
+            log.debug("Unable to instantiate AnalyticsWebServiceStub instance. This could be a CEP server. Returning");
+        }
+        return;
+    }
+    var serviceClient = analyticsStub._getServiceClient();
+    var options = serviceClient.getOptions();
+    options.setManageSession(true);
+
+    var authParam = request.getHeader(AUTHORIZATION_HEADER);
+    if (authParam != null) {
+        credentials = JSUtils.authenticate(authParam);
+        authenticationAdminStub = new AuthenticationAdminStub(authenticationWSUrl);
+        authenticationAdminStub.login(credentials[0], credentials[1], LOCALHOST);
+        var serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext()
+                .getServiceContext();
+        var sessionCookie = serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
+        options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
+    } else {
+        var token = session.get(AUTH_TOKEN);
+        if (token != null) {
+            options.setProperty(HTTPConstants.COOKIE_STRING, token);
+        } else {
+            log.error("user is not authenticated!");
+            response.status = HTTP_USER_NOT_AUTHENTICATED;
+            print('{ "status": "Failed", "message": "User is not authenticated." }');
+            return;
+        }
+    }
+});
+
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/62874667/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/schema.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/schema.jag b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/schema.jag
deleted file mode 100644
index 2d076d5..0000000
--- a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/schema.jag
+++ /dev/null
@@ -1,63 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF 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.
- *
- */
-(function () {
-    var log = new Log();
-
-    var TABLE_NAME = "tableName";
-
-    var HTTP_INTERNAL_ERROR = 500;
-
-    var carbon = require('carbon');
-    var configs = require('/configs/designer.json');
-
-    var tableName = encodeURIComponent(request.getParameter(TABLE_NAME));
-    if (tableName == null) {
-        log.error("Table name param is not provided!");
-        response.status = HTTP_INTERNAL_ERROR;
-        print('{ "status": "Failed", "message": "Table name param is empty" }');
-        return;
-    }
-
-    var content = request.getContent();
-    var contentAsString = null;
-    if (content != '' && content != null) {
-        contentAsString = stringify(content);
-        if (log.isDebugEnabled()) {
-            log.debug("Value of content: " + contentAsString);
-        }
-    }
-
-    var db = new Database("WSO2_ANALYTICS_PROCESSED_DATA_STORE_DB");
-
-    try {
-        var result = db.query("SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='ANALYTICS_PROCESSED_DATA_STORE' AND TABLE_NAME = ?", tableName);
-        if (result != null) {
-            print(result);
-        }
-    }
-    catch (e) {
-        print(e.toString());
-    }
-    finally {
-        db.close();
-    }
-}());
-%>
\ No newline at end of file


[2/5] stratos git commit: Removing datasource and fiter variables from gadgets

Posted by ra...@apache.org.
Removing datasource and fiter variables from gadgets


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/f41b6cef
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/f41b6cef
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/f41b6cef

Branch: refs/heads/stratos-4.1.x
Commit: f41b6cef3fd389eaaba431c6371afd3503d98e04
Parents: 6287466
Author: Thanuja <th...@wso2.com>
Authored: Wed Oct 21 13:00:28 2015 +0530
Committer: Thanuja <th...@wso2.com>
Committed: Wed Oct 21 13:00:28 2015 +0530

----------------------------------------------------------------------
 .../GadgetMemberCount/Member_Count/js/gadgetconf.js           | 1 -
 .../GadgetMemberCount/Member_Count/js/main.js                 | 5 +----
 .../Member_Information/js/gadgetconf.js                       | 1 -
 .../GadgetMemberInformation/Member_Information/js/main.js     | 7 ++-----
 .../GadgetMemberStatus/Member_Status/js/gadgetconf.js         | 1 -
 .../GadgetMemberStatus/Member_Status/js/main.js               | 7 ++-----
 6 files changed, 5 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/f41b6cef/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/gadgetconf.js
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/gadgetconf.js b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/gadgetconf.js
index 5cee4a2..503e038 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/gadgetconf.js
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/gadgetconf.js
@@ -21,7 +21,6 @@
 var gadgetConfig = {
     "id": "Member_Count",
     "title": "Member_Count",
-    "datasource": "MEMBER_COUNT",
     "type": "batch",
     "columns": [
         {

http://git-wip-us.apache.org/repos/asf/stratos/blob/f41b6cef/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/main.js
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/main.js b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/main.js
index 86bf4db..928eef7 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/main.js
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberCount/Member_Count/js/main.js
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-var datasource, type, columns, filter, maxUpdateValue;
+var type, columns, maxUpdateValue;
 
 var REFRESH_INTERVAL = 5000;
 var dataLoaded = true;
@@ -27,8 +27,6 @@ var applicationId = '';
 var clusterId = '';
 
 //loading gadget configuration
-datasource = gadgetConfig.datasource;
-filter = gadgetConfig.filter;
 type = gadgetConfig.type;
 var counter = 0;
 maxUpdateValue = gadgetConfig.maxUpdateValue;
@@ -71,7 +69,6 @@ function fetchData(callback) {
 
     if (application != "") {
         var request = {
-            tableName: datasource,
             applicationId: application,
             clusterId: cluster,
             time: time

http://git-wip-us.apache.org/repos/asf/stratos/blob/f41b6cef/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/gadgetconf.js
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/gadgetconf.js b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/gadgetconf.js
index a8e3ff4..813c13a 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/gadgetconf.js
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/gadgetconf.js
@@ -21,7 +21,6 @@
 var gadgetConfig = {
     "id": "Member_Information",
     "title": "Member Information",
-    "datasource": "MEMBER_INFORMATION",
     "type": "batch",
     "columns": [
         {

http://git-wip-us.apache.org/repos/asf/stratos/blob/f41b6cef/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/main.js
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/main.js b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/main.js
index 54cfea1..095b91a 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/main.js
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberInformation/Member_Information/js/main.js
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-var datasource, type, columns, filter, maxUpdateValue;
+var type, columns, maxUpdateValue;
 
 var REFRESH_INTERVAL = 5000;
 var dataLoaded = true;
@@ -27,8 +27,6 @@ var applicationId = '';
 var clusterId = '';
 
 //this needs to be loaded from an autogenerated
-datasource = gadgetConfig.datasource;
-filter = gadgetConfig.filter;
 type = gadgetConfig.type;
 var counter = 0;
 maxUpdateValue = gadgetConfig.maxUpdateValue;
@@ -43,7 +41,7 @@ gadgets.HubSettings.onConnect = function () {
 
 
 //first, fetch datasource schema
-getColumns(datasource);
+getColumns();
 
 //load data immediately
 fetchData(drawChart);
@@ -70,7 +68,6 @@ function fetchData(callback) {
 
     if (application != "") {
         var request = {
-            tableName: datasource,
             applicationId: application,
             clusterId: cluster
         };

http://git-wip-us.apache.org/repos/asf/stratos/blob/f41b6cef/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/gadgetconf.js
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/gadgetconf.js b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/gadgetconf.js
index 7a47acc..886ed4d 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/gadgetconf.js
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/gadgetconf.js
@@ -21,7 +21,6 @@
 var gadgetConfig = {
     "id": "Member_Status",
     "title": "Member Status",
-    "datasource": "MEMBER_STATUS",
     "type": "batch",
     "columns": [
         {

http://git-wip-us.apache.org/repos/asf/stratos/blob/f41b6cef/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/main.js
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/main.js b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/main.js
index a103dd6..3e9a270 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/main.js
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetMemberStatus/Member_Status/js/main.js
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-var datasource, type, columns, filter, maxUpdateValue;
+var type, columns, maxUpdateValue;
 
 var REFRESH_INTERVAL = 5000;
 var dataLoaded = true;
@@ -28,8 +28,6 @@ var applicationId = '';
 var clusterId = '';
 
 //this needs to be loaded from an autogenerated
-datasource = gadgetConfig.datasource;
-filter = gadgetConfig.filter;
 type = gadgetConfig.type;
 var counter = 0;
 maxUpdateValue = gadgetConfig.maxUpdateValue;
@@ -43,7 +41,7 @@ gadgets.HubSettings.onConnect = function () {
     });
 };
 
-getColumns(datasource);
+getColumns();
 
 //load data immediately
 fetchData(drawChart);
@@ -71,7 +69,6 @@ function fetchData(callback) {
 
     if (application != "") {
         var request = {
-            tableName: datasource,
             applicationId: application,
             clusterId: cluster,
             time: time


[5/5] stratos git commit: Renaming metering service capps artifact id

Posted by ra...@apache.org.
Renaming metering service capps artifact id


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/57d497dc
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/57d497dc
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/57d497dc

Branch: refs/heads/stratos-4.1.x
Commit: 57d497dc4f419e004a83928785e761fb31c97b87
Parents: 8dd03d5
Author: Thanuja <th...@wso2.com>
Authored: Wed Oct 21 15:54:08 2015 +0530
Committer: Thanuja <th...@wso2.com>
Committed: Wed Oct 21 15:54:08 2015 +0530

----------------------------------------------------------------------
 extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/57d497dc/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
index 5e327e6..8cde109 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
@@ -30,7 +30,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>org.apache.stratos.metering.service.capps</artifactId>
+    <artifactId>metering-service-capps</artifactId>
     <name>Apache Stratos - Metering Service CApps</name>
     <description>Apache Stratos Metering Service CApps</description>
     <packaging>pom</packaging>


[3/5] stratos git commit: Updating license header in dashboard.jag file

Posted by ra...@apache.org.
Updating license header in dashboard.jag file


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5c1f7ba8
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5c1f7ba8
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5c1f7ba8

Branch: refs/heads/stratos-4.1.x
Commit: 5c1f7ba88c86be503b29def9f86093c3e961a18b
Parents: f41b6ce
Author: Thanuja <th...@wso2.com>
Authored: Wed Oct 21 13:04:28 2015 +0530
Committer: Thanuja <th...@wso2.com>
Committed: Wed Oct 21 13:04:28 2015 +0530

----------------------------------------------------------------------
 .../metering-dashboard/ues-patch/dashboard.jag  | 39 ++++++++++----------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/5c1f7ba8/extensions/das/modules/artifacts/metering-dashboard/ues-patch/dashboard.jag
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/ues-patch/dashboard.jag b/extensions/das/modules/artifacts/metering-dashboard/ues-patch/dashboard.jag
index 6117cdd..43ed75b 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/ues-patch/dashboard.jag
+++ b/extensions/das/modules/artifacts/metering-dashboard/ues-patch/dashboard.jag
@@ -1,23 +1,24 @@
 <!doctype html>
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF 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.
- *
- */
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF 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.
+
+-->
 <html lang="en">
 <head>
     <meta charset="utf-8">


[4/5] stratos git commit: Updating metering-dashboard README, mysql script and CAppa pom files

Posted by ra...@apache.org.
Updating metering-dashboard README, mysql script and CAppa pom files


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8dd03d52
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8dd03d52
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8dd03d52

Branch: refs/heads/stratos-4.1.x
Commit: 8dd03d520fa2620c43c4fed0e440b4b66e113b5a
Parents: 5c1f7ba
Author: Thanuja <th...@wso2.com>
Authored: Wed Oct 21 13:10:29 2015 +0530
Committer: Thanuja <th...@wso2.com>
Committed: Wed Oct 21 13:10:29 2015 +0530

----------------------------------------------------------------------
 .../artifacts/metering-dashboard/README.md      | 19 ++++++++--------
 .../artifacts/metering-dashboard/capps/pom.xml  |  8 +++----
 .../metering-dashboard/metering-mysqlscript.sql | 24 ++++++++++++++++++++
 .../metering-dashboard/mysqlscript.sql          | 22 ------------------
 4 files changed, 38 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/8dd03d52/extensions/das/modules/artifacts/metering-dashboard/README.md
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/README.md b/extensions/das/modules/artifacts/metering-dashboard/README.md
index 2207b8f..21ea33f 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/README.md
+++ b/extensions/das/modules/artifacts/metering-dashboard/README.md
@@ -1,12 +1,13 @@
 # Apache Stratos Metering Dashboard
 
-This directory contains following artifacts:
-(1) capps - Includes stratos-metering-service car file which bundles all Event Stream, Event receiver, Even Store, Gadgets and Dashboard artifacts.
-(2) jaggery-files
-(3) ues-patch
+This directory contains following artifacts: <br/>
+(1) capps - Includes stratos-metering-service car file which bundles all Event Stream, Event receiver, Even Store, Gadgets, SparkScripts and Dashboard artifacts. <br/>
+(2) jaggery-files <br/>
+(3) ues-patch <br/>
 
-Follow the below steps to generate the metering dashboard:
-1. Add the jaggery files which can be found inside directory 'jaggery-files' to DAS server path '/jaggeryapps/portal/controllers/apis'
-2. Create MySQL database and tables using queries in 'mysqlscript.sql' manually.
-3. Apply ues-patch to DAS server as mentioned in its README file.
-3. Add stratos-metering-service car file to DAS server to generate the metering dashboard.
\ No newline at end of file
+Follow the below steps to generate the metering dashboard: <br/>
+1. Follow instruction given in <Stratos-SOURCE-HOME>/extensions/das/stratos-das-extension/README.md file to add stratos-das-extension jar to DAS. <br/>
+2. Add jaggery files which can be found in <Stratos-DAS-Distribution>/metering-dashboard/jaggery-files/ to DAS server path <DAS_HOME/repository/deployment/server/jaggeryapps/portal/controllers/apis/ <br/>
+3. Create MySQL database and tables using queries in <Stratos-DAS-Distribution>/metering-dashboard/metering-mysqlscript.sql manually. <br/>
+4. Apply ues-patch files in <Stratos-DAS-Distribution>/metering-dashboard/ues-patch/ to DAS as mentioned in its README file. <br/>
+5. Add stratos-metering-service car file in <Stratos-DAS-Distribution>/metering-dashboard/ to <DAS-HOME>/repository/deployment/server/carbonapps/ to generate the metering dashboard. <br/>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/8dd03d52/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
index a6c062e..5e327e6 100644
--- a/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
+++ b/extensions/das/modules/artifacts/metering-dashboard/capps/pom.xml
@@ -23,16 +23,16 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
-        <artifactId>stratos-das-extension</artifactId>
         <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-das-extension</artifactId>
         <version>4.1.5-SNAPSHOT</version>
         <relativePath>../../../../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>metering-service-capps</artifactId>
-    <name>Apache Stratos - Metering Service Composite Applications</name>
-    <description>Apache Stratos Metering Service Composite Applications</description>
+    <artifactId>org.apache.stratos.metering.service.capps</artifactId>
+    <name>Apache Stratos - Metering Service CApps</name>
+    <description>Apache Stratos Metering Service CApps</description>
     <packaging>pom</packaging>
 
     <build>

http://git-wip-us.apache.org/repos/asf/stratos/blob/8dd03d52/extensions/das/modules/artifacts/metering-dashboard/metering-mysqlscript.sql
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/metering-mysqlscript.sql b/extensions/das/modules/artifacts/metering-dashboard/metering-mysqlscript.sql
new file mode 100644
index 0000000..c84d38f
--- /dev/null
+++ b/extensions/das/modules/artifacts/metering-dashboard/metering-mysqlscript.sql
@@ -0,0 +1,24 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF 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.
+*/
+CREATE DATABASE IF NOT EXISTS ANALYTICS_FS_DB;
+CREATE DATABASE IF NOT EXISTS ANALYTICS_EVENT_STORE;
+CREATE DATABASE IF NOT EXISTS ANALYTICS_PROCESSED_DATA_STORE;
+CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_STATUS(Time long, ApplicationId VARCHAR(150), ClusterAlias VARCHAR(150), MemberId VARCHAR(150), MemberStatus VARCHAR(50));
+CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_COUNT(Time long, ApplicationId VARCHAR(150), ClusterAlias VARCHAR(150), CreatedInstanceCount int, InitializedInstanceCount int, ActiveInstanceCount int, TerminatedInstanceCount int);
+CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_INFORMATION(MemberId VARCHAR(150), InstanceType VARCHAR(150), ImageId VARCHAR(150), HostName VARCHAR(150), PrivateIPAddresses VARCHAR(150), PublicIPAddresses VARCHAR(150), Hypervisor VARCHAR(150), CPU VARCHAR(10) , RAM VARCHAR(10), OSName VARCHAR(150), OSVersion VARCHAR(150));

http://git-wip-us.apache.org/repos/asf/stratos/blob/8dd03d52/extensions/das/modules/artifacts/metering-dashboard/mysqlscript.sql
----------------------------------------------------------------------
diff --git a/extensions/das/modules/artifacts/metering-dashboard/mysqlscript.sql b/extensions/das/modules/artifacts/metering-dashboard/mysqlscript.sql
deleted file mode 100644
index f916f95..0000000
--- a/extensions/das/modules/artifacts/metering-dashboard/mysqlscript.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF 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.
-*/
-CREATE DATABASE ANALYTICS_PROCESSED_DATA_STORE;
-CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_STATUS(Time long, ApplicationId VARCHAR(150), ClusterAlias VARCHAR(150), MemberId VARCHAR(150), MemberStatus VARCHAR(50));
-CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_COUNT(Time long, ApplicationId VARCHAR(150), ClusterAlias VARCHAR(150), CreatedInstanceCount int, InitializedInstanceCount int, ActiveInstanceCount int, TerminatedInstanceCount int);
-CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_INFORMATION(MemberId VARCHAR(150), InstanceType VARCHAR(150), ImageId VARCHAR(150), HostName VARCHAR(150), PrivateIPAddresses VARCHAR(150), PublicIPAddresses VARCHAR(150), Hypervisor VARCHAR(150), CPU VARCHAR(10) , RAM VARCHAR(10), OSName VARCHAR(150), OSVersion VARCHAR(150));