Repository: stratos
Updated Branches:
  refs/heads/master b9d18ca81 -> c795440d7


http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetApplicationSignUpsFilter/artifact.xml
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetApplicationSignUpsFilter/artifact.xml
 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetApplicationSignUpsFilter/artifact.xml
new file mode 100644
index 0000000..6cfb3e5
--- /dev/null
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/GadgetApplicationSignUpsFilter/artifact.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<artifact name="GadgetApplicationSignUpsFilter" version="1.0.0" 
type="dashboards/gadget"
+          serverRole="DataAnalyticsServer">
+    <file>Application_Signups_Filter</file>
+</artifact>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/application_signups.xml
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/application_signups.xml
 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/application_signups.xml
new file mode 100644
index 0000000..56c5155
--- /dev/null
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/application_signups.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ 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.
+
+-->
+<Analytics>
+    <Name>application_signups</Name>
+    <Script>
+        CREATE TEMPORARY TABLE application_signups
+        USING CarbonAnalytics
+        OPTIONS (tableName "APPLICATION_SIGNUPS");
+
+        CREATE TEMPORARY TABLE application_signups_new
+        USING CarbonAnalytics
+        OPTIONS (tableName "APPLICATION_SIGNUPS_NEW",
+        schema "application_id STRING, tenant_id INT, tenant_domain STRING, 
start_time LONG, end_time LONG,
+        duration LONG", primaryKeys "application_id, tenant_id, start_time");
+
+        INSERT INTO TABLE application_signups_new select application_id, 
tenant_id, tenant_domain, start_time,
+        end_time, (case when end_time=-1 then current_time(null) - start_time 
else duration end) as duration from
+        application_signups;
+
+        create temporary table application_usage
+        using CarbonJDBC options (dataSource 
"WSO2_ANALYTICS_PROCESSED_DATA_STORE_DB", tableName "APPLICATION_USAGE");
+
+        INSERT OVERWRITE TABLE application_usage select application_id, 
tenant_id, tenant_domain, start_time,
+        end_time, duration from application_signups_new;
+    </Script>
+    <CronExpression>29 * * * * ?</CronExpression>
+</Analytics>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/artifact.xml
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/artifact.xml
 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/artifact.xml
new file mode 100644
index 0000000..aed3aa0
--- /dev/null
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/SparkscriptsApplicationSignUps/artifact.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<artifact name="SparkscriptsApplicationSignUps" version="1.0.0" 
type="analytics/spark" serverRole="DataAnalyticsServer">
+    <file>application_signups.xml</file>
+</artifact>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/artifacts.xml
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/artifacts.xml
 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/artifacts.xml
index 616bfb0..4f68058 100644
--- 
a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/artifacts.xml
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/artifacts.xml
@@ -21,19 +21,33 @@
 -->
 <artifacts>
     <artifact name="stratos-metering-service" version="1.0.0" 
type="carbon/application">
+        <dependency artifact="EventstreamApplicationSignUps" version="1.0.0" 
include="true" serverRole="DataAnalyticsServer"/>
         <dependency artifact="EventstreamMemberInfo" version="1.0.0" 
include="true" serverRole="DataAnalyticsServer"/>
         <dependency artifact="EventstreamMemberLifecycle" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
+
+        <dependency artifact="EventstoreApplicationSignUps" version="1.0.0" 
include="true" serverRole="DataAnalyticsServer"/>
         <dependency artifact="EventstoreMemberInfo" version="1.0.0" 
include="true" serverRole="DataAnalyticsServer"/>
         <dependency artifact="EventstoreMemberLifecycle" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
+
+        <dependency artifact="EventreceiverApplicationSignUps" version="1.0.0" 
include="true"
+                    serverRole="DataAnalyticsServer"/>
         <dependency artifact="EventreceiverMemberInfo" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
         <dependency artifact="EventreceiverMemberLifecycle" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
+
+        <dependency artifact="SparkscriptsApplicationSignUps" version="1.0.0" 
include="true"
+                    serverRole="DataAnalyticsServer"/>
         <dependency artifact="SparkscriptsMemberInfo" version="1.0.0" 
include="true" serverRole="DataAnalyticsServer"/>
         <dependency artifact="SparkscriptsMemberLifecycle" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
+
+        <dependency artifact="GadgetApplicationSignUps" version="1.0.0" 
include="true"
+                    serverRole="DataAnalyticsServer"/>
+        <dependency artifact="GadgetApplicationSignUpsFilter" version="1.0.0" 
include="true"
+                    serverRole="DataAnalyticsServer"/>
         <dependency artifact="GadgetMemberCount" version="1.0.0" 
include="true" serverRole="DataAnalyticsServer"/>
         <dependency artifact="GadgetMemberInformation" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
@@ -42,6 +56,7 @@
                     serverRole="DataAnalyticsServer"/>
         <dependency artifact="GadgetMemberDetailsFilter" version="1.0.0" 
include="true"
                     serverRole="DataAnalyticsServer"/>
+
         <dependency artifact="Dashboard" version="1.0.0" include="true" 
serverRole="DataAnalyticsServer"/>
     </artifact>
 </artifacts>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/database-scripts/mysql/metering-script.sql
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/database-scripts/mysql/metering-script.sql
 
b/extensions/das/modules/artifacts/metering-dashboard/database-scripts/mysql/metering-script.sql
index b3fe0ff..f5b6ae1 100644
--- 
a/extensions/das/modules/artifacts/metering-dashboard/database-scripts/mysql/metering-script.sql
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/database-scripts/mysql/metering-script.sql
@@ -26,3 +26,5 @@ CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.MEMBER_COUNT(Time 
long, ApplicationI
 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));
+CREATE TABLE ANALYTICS_PROCESSED_DATA_STORE.APPLICATION_USAGE(ApplicationId 
VARCHAR(150), TenantId INT,
+TenantDomain VARCHAR(150), StartTime LONG, EndTime LONG, Duration LONG);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/database-scripts/oracle/metering-script.sql
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/database-scripts/oracle/metering-script.sql
 
b/extensions/das/modules/artifacts/metering-dashboard/database-scripts/oracle/metering-script.sql
index c5fd915..0b31a83 100644
--- 
a/extensions/das/modules/artifacts/metering-dashboard/database-scripts/oracle/metering-script.sql
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/database-scripts/oracle/metering-script.sql
@@ -25,5 +25,7 @@ TerminatedInstanceCount NUMBER(10));
 CREATE TABLE MEMBER_INFORMATION(MemberId VARCHAR2(150), InstanceType 
VARCHAR2(150), ImageId VARCHAR2(150), HostName
 VARCHAR2(150), PrivateIPAddresses VARCHAR2(150), PublicIPAddresses 
VARCHAR2(150), Hypervisor VARCHAR2(150), CPU
 VARCHAR2(10), RAM VARCHAR2(10), OSName VARCHAR2(150), OSVersion VARCHAR2(150));
+CREATE TABLE APPLICATION_USAGE(ApplicationId VARCHAR2(150), TenantId 
NUMBER(10), TenantDomain VARCHAR2(150),
+StartTime NUMBER(20), EndTime NUMBER(20), Duration NUMBER(20));
 
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/mysql/application-signups.jag
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/mysql/application-signups.jag
 
b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/mysql/application-signups.jag
new file mode 100644
index 0000000..56158ca
--- /dev/null
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/mysql/application-signups.jag
@@ -0,0 +1,55 @@
+<%
+/*
+ * 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.
+ *
+ */
+include('metering-authentication.jag');
+
+(function () {
+    var log = new Log();
+    var ALL_CLUSTERS = 'Select Application';
+
+    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;
+        var applicationId = request.getParameter("applicationId");
+        var ms_per_hour = 60 * 60 * 1000;
+        var time_hr_decimal = 2;
+        result = db.query("SELECT ApplicationId, TenantId, TenantDomain, 
ROUND(SUM(Duration)/" + ms_per_hour +
+                ",'" + time_hr_decimal + "') as Duration FROM 
APPLICATION_USAGE WHERE ApplicationId= ? GROUP BY " +
+                "ApplicationId, TenantId, TenantDomain ORDER BY TenantId", 
applicationId);
+        print(result);
+    }
+    catch (e) {
+        print(e.toString());
+    }
+    finally {
+        db.close();
+    }
+}());
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/oracle/application-signups.jag
----------------------------------------------------------------------
diff --git 
a/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/oracle/application-signups.jag
 
b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/oracle/application-signups.jag
new file mode 100644
index 0000000..7730429
--- /dev/null
+++ 
b/extensions/das/modules/artifacts/metering-dashboard/jaggery-files/oracle/application-signups.jag
@@ -0,0 +1,56 @@
+<%
+/*
+ * 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.
+ *
+ */
+include('metering-authentication.jag');
+
+(function () {
+    var log = new Log();
+    var ALL_CLUSTERS = 'Select Application';
+
+    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;
+        var applicationId = request.getParameter("applicationId");
+        var ms_per_hour = 60 * 60 * 1000;
+        var time_hr_decimal = 2;
+        result = db.query("SELECT ApplicationID \"ApplicationId\", TenantId 
\"TenantId\", TenantDomain " +
+                "\"TenantDomain\", ROUND(SUM(Duration)/" + ms_per_hour + ",'" 
+ time_hr_decimal + "') \"Duration\" " +
+                "FROM APPLICATION_USAGE WHERE ApplicationId= ? GROUP BY 
ApplicationId, TenantId, TenantDomain ORDER " +
+                "BY TenantId", applicationId);
+        print(result);
+    }
+    catch (e) {
+        print(e.toString());
+    }
+    finally {
+        db.close();
+    }
+}());
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
----------------------------------------------------------------------
diff --git 
a/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
 
b/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
index 514f492..48a448b 100644
--- 
a/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
+++ 
b/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
@@ -6,7 +6,7 @@
                     <xs:element minOccurs="0" name="applicationId" 
nillable="true" type="xs:string"/>
                     <xs:element maxOccurs="unbounded" minOccurs="0" 
name="artifactRepositories" nillable="true" type="ax249:ArtifactRepository"/>
                     <xs:element maxOccurs="unbounded" minOccurs="0" 
name="clusterIds" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" 
name="domainMappings" nillable="true" type="ax249:DomainMapping"/>
+                    <xs:element minOccurs="0" name="signupAddedTimestamp" 
type="xs:long"/>
                     <xs:element minOccurs="0" name="tenantId" type="xs:int"/>
                 </xs:sequence>
             </xs:complexType>

Reply via email to