Add tenant based metering info to metering dashboard - STRATOS-1654 This closes #503
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c795440d Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c795440d Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c795440d Branch: refs/heads/master Commit: c795440d7c1e178c8171f980edc76fc76b53903e Parents: b9d18ca Author: Thanuja <[email protected]> Authored: Tue Feb 9 15:23:55 2016 +0530 Committer: Sajith <[email protected]> Committed: Tue Feb 9 18:01:21 2016 +0530 ---------------------------------------------------------------------- .../components/ApplicationSignUpHandler.java | 78 +- .../DASApplicationSignUpDataPublisher.java | 138 + .../management/StratosUserManagerUtils.java | 35 + .../manager/utils/StratosManagerConstants.java | 8 +- .../application/signup/ApplicationSignUp.java | 9 + .../Dashboard/metering-dashboard.json | 86 + .../application_signups_receiver.xml | 29 + .../artifact.xml | 24 + .../application_signups.xml | 71 + .../EventstoreApplicationSignUps/artifact.xml | 24 + .../application_signups_1.0.0.json | 33 + .../EventstreamApplicationSignups/artifact.xml | 24 + .../Application_Signups/css/bootstrap.min.css | 5935 ++++++ .../Application_Signups/css/d3.geomap.css | 43 + .../Application_Signups/css/igviz.css | 89 + .../Application_Signups/gadget.json | 19 + .../Application_Signups/index.xml | 89 + .../js/d3.geomap.dependencies.min.js | 8249 ++++++++ .../Application_Signups/js/d3.geomap.min.js | 538 + .../Application_Signups/js/d3.min.js | 6332 +++++++ .../Application_Signups/js/excanvas.min.js | 954 + .../Application_Signups/js/gadgetconf.js | 54 + .../Application_Signups/js/jquery.js | 9496 ++++++++++ .../Application_Signups/js/main.js | 157 + .../js/outputAdapterUiLibrary.js | 276 + .../Application_Signups/js/vega.js | 8006 ++++++++ .../GadgetApplicationSignUps/artifact.xml | 24 + .../css/jquery-ui.css | 1908 ++ .../Application_Signups_Filter/css/style.css | 249 + .../Application_Signups_Filter/gadget.json | 23 + .../Application_Signups_Filter/index.png | Bin 0 -> 6754 bytes .../Application_Signups_Filter/index.xml | 61 + .../js/application-signups-filter.js | 71 + .../Application_Signups_Filter/js/jquery-ui.js | 16753 +++++++++++++++++ .../GadgetApplicationSignUpsFilter/artifact.xml | 25 + .../application_signups.xml | 46 + .../SparkscriptsApplicationSignUps/artifact.xml | 24 + .../stratos-metering-service/artifacts.xml | 15 + .../database-scripts/mysql/metering-script.sql | 2 + .../database-scripts/oracle/metering-script.sql | 2 + .../jaggery-files/mysql/application-signups.jag | 55 + .../oracle/application-signups.jag | 56 + .../main/resources/StratosManagerService.wsdl | 2 +- 43 files changed, 60084 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java index dec94fb..33fa788 100644 --- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java +++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java @@ -25,6 +25,8 @@ import org.apache.commons.logging.LogFactory; import org.apache.stratos.manager.exception.ApplicationSignUpException; import org.apache.stratos.manager.messaging.publisher.ApplicationSignUpEventPublisher; import org.apache.stratos.manager.registry.RegistryManager; +import org.apache.stratos.manager.statistics.publisher.DASApplicationSignUpDataPublisher; +import org.apache.stratos.manager.user.management.StratosUserManagerUtils; import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp; import org.apache.stratos.messaging.domain.application.signup.ArtifactRepository; @@ -37,8 +39,11 @@ import java.util.List; public class ApplicationSignUpHandler { private static final Log log = LogFactory.getLog(ApplicationSignUpHandler.class); - private static final String APPLICATION_SIGNUP_RESOURCE_PATH = "/stratos.manager/application.signups/"; + private static final long DEFAULT_APPLICATION_SIGNUP_REMOVED_TIMESTAMP = -1; + private static final long DEFAULT_APPLICATION_SIGNUP_DURATION = 0; + private static DASApplicationSignUpDataPublisher applicationSignUpDataPublisher = DASApplicationSignUpDataPublisher + .getInstance(); private String prepareApplicationSignupResourcePath(String applicationId, int tenantId) { return APPLICATION_SIGNUP_RESOURCE_PATH + applicationId + "-tenant-" + tenantId; @@ -67,21 +72,34 @@ public class ApplicationSignUpHandler { try { if (log.isInfoEnabled()) { - log.info(String.format("Adding application signup: [application-id] %s [tenant-id] %d", - applicationId, tenantId)); + log.info(String.format("Adding application signup: [application-id] %s [tenant-id] %d", applicationId, + tenantId)); } if (applicationSignUpExist(applicationId, tenantId)) { - throw new RuntimeException(String.format("Tenant has already signed up for application: " + - "[application-id] %s [tenant-id] %d", applicationId, tenantId)); + throw new RuntimeException(String.format( + "Tenant has already signed up for application: " + "[application-id] %s [tenant-id] %d", + applicationId, tenantId)); } // Persist application signup String resourcePath = prepareApplicationSignupResourcePath(applicationId, tenantId); + long signUpAddedTimestamp = System.currentTimeMillis(); + applicationSignUp.setSignupAddedTimestamp(signUpAddedTimestamp); + RegistryManager.getInstance().persist(resourcePath, applicationSignUp); ApplicationSignUpEventPublisher.publishApplicationSignUpAddedEvent(applicationId, tenantId, clusterIdList); + if (applicationSignUpDataPublisher.isEnabled()) { + if (log.isInfoEnabled()) { + log.info("Publishing application signup added data to DAS"); + } + String tenantDomain = StratosUserManagerUtils.getTenantDomain(tenantId); + applicationSignUpDataPublisher.publish(applicationId, tenantId, tenantDomain, signUpAddedTimestamp, + DEFAULT_APPLICATION_SIGNUP_REMOVED_TIMESTAMP, DEFAULT_APPLICATION_SIGNUP_DURATION); + } + if (log.isInfoEnabled()) { log.info(String.format("Application signup added successfully: [application-id] %s [tenant-id] %d", applicationId, tenantId)); @@ -115,6 +133,7 @@ public class ApplicationSignUpHandler { /** * Check application signup availability. + * * @param applicationId * @return * @throws ApplicationSignUpException @@ -151,20 +170,33 @@ public class ApplicationSignUpHandler { public void removeApplicationSignUp(String applicationId, int tenantId) throws ApplicationSignUpException { try { if (log.isInfoEnabled()) { - log.info(String.format("Removing application signup: [application-id] %s [tenant-id] %d", - applicationId, tenantId)); + log.info(String.format("Removing application signup: [application-id] %s [tenant-id] %d", applicationId, + tenantId)); } if (!applicationSignUpExist(applicationId, tenantId)) { - throw new RuntimeException(String.format("Application signup not found: [application-id] %s " + - "[tenant-id] %d", applicationId, tenantId)); + throw new RuntimeException( + String.format("Application signup not found: [application-id] %s " + "[tenant-id] %d", + applicationId, tenantId)); } String resourcePath = prepareApplicationSignupResourcePath(applicationId, tenantId); + long signUpAddedTimestamp = ((ApplicationSignUp) RegistryManager.getInstance().read(resourcePath)) + .getSignupAddedTimestamp(); RegistryManager.getInstance().remove(resourcePath); ApplicationSignUpEventPublisher.publishApplicationSignUpRemovedEvent(applicationId, tenantId); + if (applicationSignUpDataPublisher.isEnabled()) { + if (log.isInfoEnabled()) { + log.info("Publishing application signup removed data to DAS"); + } + long signUpRemovedTimestamp = System.currentTimeMillis(); + String tenantDomain = StratosUserManagerUtils.getTenantDomain(tenantId); + applicationSignUpDataPublisher.publish(applicationId, tenantId, tenantDomain, signUpAddedTimestamp, + signUpRemovedTimestamp, signUpRemovedTimestamp - signUpAddedTimestamp); + } + if (log.isInfoEnabled()) { log.info(String.format("Application signup removed successfully: [application-id] %s [tenant-id] %d", applicationId, tenantId)); @@ -184,19 +216,21 @@ public class ApplicationSignUpHandler { * @return * @throws ApplicationSignUpException */ - public ApplicationSignUp getApplicationSignUp(String applicationId, int tenantId) throws ApplicationSignUpException { + public ApplicationSignUp getApplicationSignUp(String applicationId, int tenantId) + throws ApplicationSignUpException { try { if (log.isDebugEnabled()) { - log.debug(String.format("Get application signup: [application-id] %s [tenant-id] %d", - applicationId, tenantId)); + log.debug(String.format("Get application signup: [application-id] %s [tenant-id] %d", applicationId, + tenantId)); } String resourcePath = prepareApplicationSignupResourcePath(applicationId, tenantId); ApplicationSignUp applicationSignUp = (ApplicationSignUp) RegistryManager.getInstance().read(resourcePath); return applicationSignUp; } catch (Exception e) { - String message = String.format("Could not get application signup: [application-id] %s [tenant-id] %d", - applicationId, tenantId); + String message = String + .format("Could not get application signup: [application-id] %s [tenant-id] %d", applicationId, + tenantId); log.error(message, e); throw new ApplicationSignUpException(message, e); } @@ -224,8 +258,8 @@ public class ApplicationSignUpHandler { if (resourcePaths != null) { for (String resourcePath : resourcePaths) { if (resourcePath != null) { - ApplicationSignUp applicationSignUp = (ApplicationSignUp) - RegistryManager.getInstance().read(resourcePath); + ApplicationSignUp applicationSignUp = (ApplicationSignUp) RegistryManager.getInstance() + .read(resourcePath); if (applicationId.equals(applicationSignUp.getApplicationId())) { applicationSignUps.add(applicationSignUp); } @@ -259,8 +293,8 @@ public class ApplicationSignUpHandler { if (resourcePaths != null) { for (String resourcePath : resourcePaths) { if (resourcePath != null) { - ApplicationSignUp applicationSignUp = (ApplicationSignUp) - RegistryManager.getInstance().read(resourcePath); + ApplicationSignUp applicationSignUp = (ApplicationSignUp) RegistryManager.getInstance() + .read(resourcePath); applicationSignUps.add(applicationSignUp); } } @@ -281,7 +315,8 @@ public class ApplicationSignUpHandler { * @return * @throws ApplicationSignUpException */ - public List<ApplicationSignUp> getApplicationSignUpsForRepository(String repoUrl) throws ApplicationSignUpException { + public List<ApplicationSignUp> getApplicationSignUpsForRepository(String repoUrl) + throws ApplicationSignUpException { try { List<ApplicationSignUp> filteredResult = new ArrayList<ApplicationSignUp>(); @@ -322,8 +357,9 @@ public class ApplicationSignUpHandler { applicationId, tenantId)); } } catch (Exception e) { - String message = String.format("Could not get application signup: [application-id] %s [tenant-id] %d", - applicationId, tenantId); + String message = String + .format("Could not get application signup: [application-id] %s [tenant-id] %d", applicationId, + tenantId); log.error(message, e); throw new ApplicationSignUpException(message, e); } http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/statistics/publisher/DASApplicationSignUpDataPublisher.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/statistics/publisher/DASApplicationSignUpDataPublisher.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/statistics/publisher/DASApplicationSignUpDataPublisher.java new file mode 100644 index 0000000..27e53b0 --- /dev/null +++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/statistics/publisher/DASApplicationSignUpDataPublisher.java @@ -0,0 +1,138 @@ +/* + * 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. + */ + +package org.apache.stratos.manager.statistics.publisher; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.common.statistics.publisher.ThriftClientConfig; +import org.apache.stratos.common.statistics.publisher.ThriftStatisticsPublisher; +import org.apache.stratos.common.threading.StratosThreadPool; +import org.apache.stratos.manager.utils.StratosManagerConstants; +import org.wso2.carbon.databridge.commons.Attribute; +import org.wso2.carbon.databridge.commons.AttributeType; +import org.wso2.carbon.databridge.commons.StreamDefinition; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; + +/** + * Application signup data publisher. + */ +public class DASApplicationSignUpDataPublisher extends ThriftStatisticsPublisher { + + private static final Log log = LogFactory.getLog(DASApplicationSignUpDataPublisher.class); + + private static final String DATASTREAM_NAME = "application_signups"; + private static final String DATASTREAM_NICKNAME = "Application Signup Statistics"; + private static final String DATASTREAM_DESC = "Application signup statistics for generating metering information."; + private static final String VERSION = "1.0.0"; + private static final String APPLICATION_ID = "application_id"; + private static final String TENANT_ID = "tenant_id"; + private static final String TENANT_DOMAIN = "tenant_domain"; + private static final String START_TIME = "start_time"; + private static final String END_TIME = "end_time"; + private static final String DURATION = "duration"; + + private ExecutorService executorService; + + private static DASApplicationSignUpDataPublisher instance; + + public enum SignUpAction {Added, Removed} + + /** + * Constructor for initializing the data publisher. + */ + private DASApplicationSignUpDataPublisher() { + super(getStreamDefinition(), ThriftClientConfig.DAS_THRIFT_CLIENT_NAME); + int threadPoolSize = Integer.getInteger(StratosManagerConstants.STATS_PUBLISHER_THREAD_POOL_ID, + StratosManagerConstants.STATS_PUBLISHER_THREAD_POOL_SIZE); + executorService = StratosThreadPool + .getExecutorService(StratosManagerConstants.STATS_PUBLISHER_THREAD_POOL_ID, threadPoolSize); + } + + public static DASApplicationSignUpDataPublisher getInstance() { + if (instance == null) { + synchronized (DASApplicationSignUpDataPublisher.class) { + if (instance == null) { + instance = new DASApplicationSignUpDataPublisher(); + } + } + } + return instance; + } + + private static StreamDefinition getStreamDefinition() { + try { + // Create stream definition + StreamDefinition streamDefinition = new StreamDefinition(DATASTREAM_NAME, VERSION); + streamDefinition.setNickName(DATASTREAM_NICKNAME); + streamDefinition.setDescription(DATASTREAM_DESC); + List<Attribute> payloadData = new ArrayList<Attribute>(); + + // Set payload definition + payloadData.add(new Attribute(APPLICATION_ID, AttributeType.STRING)); + payloadData.add(new Attribute(TENANT_ID, AttributeType.INT)); + payloadData.add(new Attribute(TENANT_DOMAIN, AttributeType.STRING)); + payloadData.add(new Attribute(START_TIME, AttributeType.LONG)); + payloadData.add(new Attribute(END_TIME, AttributeType.LONG)); + payloadData.add(new Attribute(DURATION, AttributeType.LONG)); + + streamDefinition.setPayloadData(payloadData); + return streamDefinition; + } catch (Exception e) { + throw new RuntimeException("Could not create stream definition", e); + } + } + + /** + * Publish application signup statistics + * + * @param applicationId + * @param tenantId + * @param tenantDomain + * @param startTime + * @param endTime + * @param duration + */ + public void publish(final String applicationId, final int tenantId, final String tenantDomain, + final long startTime, final long endTime, final long duration) { + Runnable publisher = new Runnable() { + @Override public void run() { + if (log.isDebugEnabled()) { + log.debug(String.format("Publishing application signup statistics: [application_id] %s " + + "[tenant_id] %d [tenant_domain] %s [start_time] %d [end_time] %d " + + "[duration] %d ", applicationId, tenantId, tenantDomain, startTime, endTime, + duration)); + } + //adding payload data + List<Object> payload = new ArrayList<Object>(); + payload.add(applicationId); + payload.add(tenantId); + payload.add(tenantDomain); + payload.add(startTime); + payload.add(endTime); + payload.add(duration); + publish(payload.toArray()); + } + }; + executorService.execute(publisher); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java index 06fcfb7..22de1b9 100644 --- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java +++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java @@ -24,9 +24,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.common.beans.UserInfoBean; import org.apache.stratos.manager.user.management.exception.UserManagerException; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.UserCoreConstants; +import org.wso2.carbon.user.core.service.RealmService; +import org.wso2.carbon.user.core.tenant.Tenant; +import org.wso2.carbon.user.core.tenant.TenantManager; import java.util.ArrayList; import java.util.HashMap; @@ -205,4 +209,35 @@ public class StratosUserManagerUtils { throw new UserManagerException(msg, e); } } + + public static String getTenantDomain(int tenantId) { + if(tenantId == -1234) { + return "carbon.super"; + } + + TenantManager tenantManager = getTenantManager(); + Tenant[] tenants = null; + try { + tenants = (Tenant[]) tenantManager.getAllTenants(); + } catch (Exception e) { + String msg = "Error in retrieving the tenant information"; + log.error(msg, e); + } + + if(tenants != null) { + for(Tenant tenant : tenants) { + if(tenant.getId() == tenantId) { + return tenant.getDomain(); + } + } + } + log.warn(String.format("Could not find tenant domain: [tenant-id] %d", tenantId)); + return null; + } + + public static TenantManager getTenantManager() { + PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + RealmService realmService = (RealmService) carbonContext.getOSGiService(RealmService.class); + return realmService.getTenantManager(); + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/StratosManagerConstants.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/StratosManagerConstants.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/StratosManagerConstants.java index 171f689..62523f2 100644 --- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/StratosManagerConstants.java +++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/utils/StratosManagerConstants.java @@ -23,10 +23,6 @@ package org.apache.stratos.manager.utils; * Stratos manager constants. */ public class StratosManagerConstants { - - public static final String DEFAULT_CRON = "1 * * * * ? *"; - public static final String TENANT_SYNC_TASK_TYPE = "TENANT_SYNC_TASK_TYPE"; - public static final String TENANT_SYNC_TASK_NAME = "TENANT_SYNC_TASK"; - public static final String APPLICATION_SIGNUP_SYNC_TASK_TYPE = "APPLICATION_SIGNUP_SYNC_TASK_TYPE"; - public static final String APPLICATION_SIGNUP_SYNC_TASK_NAME = "APPLICATION_SIGNUP_SYNC_TASK"; + public static final String STATS_PUBLISHER_THREAD_POOL_ID = "stratos.manager.stats.publisher.thread.pool"; + public static final int STATS_PUBLISHER_THREAD_POOL_SIZE = 10; } http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java index 7029855..a523875 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java @@ -33,6 +33,7 @@ public class ApplicationSignUp implements Serializable { private ArtifactRepository[] artifactRepositories; private DomainMapping[] domainMappings; private String[] clusterIds; + private long signupAddedTimestamp; public int getTenantId() { return tenantId; @@ -73,4 +74,12 @@ public class ApplicationSignUp implements Serializable { public String[] getClusterIds() { return clusterIds; } + + public long getSignupAddedTimestamp() { + return signupAddedTimestamp; + } + + public void setSignupAddedTimestamp(long signupAddedTimestamp) { + this.signupAddedTimestamp = signupAddedTimestamp; + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/Dashboard/metering-dashboard.json ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/Dashboard/metering-dashboard.json b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/Dashboard/metering-dashboard.json index 7cf8d6b..02c5370 100644 --- a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/Dashboard/metering-dashboard.json +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/Dashboard/metering-dashboard.json @@ -221,6 +221,92 @@ }, "anon": {} } + }, + { + "id": "tenant-metering", + "title": "Tenant Metering", + "layout": { + "id": "single-column", + "title": "Single Column", + "description": "This is a layout generated through single-column.io", + "thumbnail": "store://layout/single-column/index.png", + "url": "store://layout/single-column/index.hbs", + "content": "<div class=\"container\">\n<div class=\"row\">\n <div id=\"a\" class=\"col-md-12 ues-component-box\"></div>\n <div id=\"b\" class=\"col-md-12 ues-component-box\"></div>\n <div id=\"c\" class=\"col-md-12 ues-component-box\"></div>\n</div>\n</div>\n" + }, + "isanon": false, + "content": { + "default": { + "a": [ + { + "id": "n0dcwgx88xe0zfr", + "content": { + "id": "Application_Signups_Filter", + "title": "", + "type": "gadget", + "thumbnail": "store://gadget/Application_Signups_Filter/index.png", + "data": { + "url": "store://gadget/Application_Signups_Filter/index.xml" + }, + "styles": { + "height": "100", + "borders": false, + "titlePosition": "left", + "title": "" + }, + "notify": { + "application-signups-filter": { + "type": "address", + "description": "This notifies applicationId" + } + }, + "cancel": { + "type": "boolean", + "description": "This notifies cancellation of state selection" + }, + "settings": {} + } + } + ], + "b": [ + { + "id": "2s1fvjnbib4t2o6r", + "content": { + "id": "Application_Signups", + "title": "Tenant Metering", + "type": "gadget", + "thumbnail": "local://images/gadgetIcon.png", + "data": { + "url": "local://store/carbon.super/gadget/Application_Signups/index.xml" + }, + "listen": { + "application-signups-filter": { + "type": "address", + "description": "Used to filter based on state", + "on": [ + { + "from": "n0dcwgx88xe0zfr", + "event": "application-signups-filter" + } + ] + }, + "auto-update": { + "type": "boolean", + "description": "Used to filter based on state" + } + }, + "styles": { + "height": "800", + "borders": true, + "titlePosition": "left", + "title": "Application Signups" + }, + "settings": {} + } + } + ] + }, + "anon": {} + } } ], "landing": "member-status", http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/application_signups_receiver.xml ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/application_signups_receiver.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/application_signups_receiver.xml new file mode 100644 index 0000000..2f550ae --- /dev/null +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/application_signups_receiver.xml @@ -0,0 +1,29 @@ +<?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. + +--> +<eventReceiver name="ApplicationSignUpsEventReceiver" statistics="disable" + trace="disable" xmlns="http://wso2.org/carbon/eventreceiver"> + <from eventAdapterType="wso2event"> + <property name="events.duplicated.in.cluster">false</property> + </from> + <mapping customMapping="disable" type="wso2event"/> + <to streamName="application_signups" version="1.0.0"/> +</eventReceiver> http://git-wip-us.apache.org/repos/asf/stratos/blob/c795440d/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/artifact.xml ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/artifact.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/artifact.xml new file mode 100644 index 0000000..5b227d7 --- /dev/null +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventreceiverApplicationSignUps/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="EventreceiverApplicationSignUps" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer"> + <file>application_signups_receiver.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/EventstoreApplicationSignUps/application_signups.xml ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstoreApplicationSignUps/application_signups.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstoreApplicationSignUps/application_signups.xml new file mode 100644 index 0000000..317d2bd --- /dev/null +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstoreApplicationSignUps/application_signups.xml @@ -0,0 +1,71 @@ +<?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. + +--> +<EventStoreConfiguration> + <TableSchema> + <ColumnDefinition> + <Name>application_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>tenant_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>INTEGER</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>tenant_domain</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>start_time</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>end_time</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>duration</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + </TableSchema> + <Source> + <StreamId>application_signups:1.0.0</StreamId> + </Source> + <RecordStoreName>EVENT_STORE</RecordStoreName> +</EventStoreConfiguration> \ 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/EventstoreApplicationSignUps/artifact.xml ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstoreApplicationSignUps/artifact.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstoreApplicationSignUps/artifact.xml new file mode 100644 index 0000000..4a689de --- /dev/null +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstoreApplicationSignUps/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="EventstoreApplicationSignUps" version="1.0.0" type="analytics/eventstore" 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/EventstreamApplicationSignups/application_signups_1.0.0.json ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstreamApplicationSignups/application_signups_1.0.0.json b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstreamApplicationSignups/application_signups_1.0.0.json new file mode 100644 index 0000000..0cc55fa --- /dev/null +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstreamApplicationSignups/application_signups_1.0.0.json @@ -0,0 +1,33 @@ +{ + "streamId": "application_signups:1.0.0", + "name": "application_signups", + "version": "1.0.0", + "nickName": "Application Signup Statistics", + "description": "Application signup statistics for generating metering information.", + "payloadData": [ + { + "name": "application_id", + "type": "STRING" + }, + { + "name": "tenant_id", + "type": "INT" + }, + { + "name": "tenant_domain", + "type": "STRING" + }, + { + "name": "start_time", + "type": "LONG" + }, + { + "name": "end_time", + "type": "LONG" + }, + { + "name": "duration", + "type": "LONG" + } + ] +} \ 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/EventstreamApplicationSignups/artifact.xml ---------------------------------------------------------------------- diff --git a/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstreamApplicationSignups/artifact.xml b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstreamApplicationSignups/artifact.xml new file mode 100644 index 0000000..f9a53df --- /dev/null +++ b/extensions/das/modules/artifacts/metering-dashboard/capps/stratos-metering-service/EventstreamApplicationSignups/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="EventstreamApplicationSignUps" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer"> + <file>application_signups_1.0.0.json</file> +</artifact> \ No newline at end of file
