From aa63b5f592bd167141aa280c34330ea81374855f Mon Sep 17 00:00:00 2001 From: geethkokila Date: Tue, 29 Mar 2016 17:48:36 +0530 Subject: [PATCH] Fixing the application memory usage and adding location based search --- .../mgt/common/app/mgt/Application.java | 10 +++++ .../mgt/core/dao/impl/ApplicationDAOImpl.java | 17 ++++--- .../mgt/dao/impl/DeviceDetailsDAOImpl.java | 2 +- .../impl/DeviceInformationManagerImpl.java | 9 ---- .../device/mgt/core/search/mgt/Constants.java | 1 + .../mgt/core/search/mgt/QueryBuilder.java | 2 + .../core/search/mgt/impl/ProcessorImpl.java | 7 +++ .../search/mgt/impl/QueryBuilderImpl.java | 44 ++++++++++++------- .../mgt/impl/ResultSetAggregatorImpl.java | 17 ++++++- .../src/test/resources/sql/h2.sql | 1 + .../src/main/resources/dbscripts/cdm/h2.sql | 1 + .../main/resources/dbscripts/cdm/mssql.sql | 1 + .../main/resources/dbscripts/cdm/mysql.sql | 1 + .../main/resources/dbscripts/cdm/oracle.sql | 1 + .../resources/dbscripts/cdm/postgresql.sql | 1 + 15 files changed, 81 insertions(+), 34 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/Application.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/Application.java index cdcba75a72a..0d45f903bd2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/Application.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/Application.java @@ -36,6 +36,8 @@ public class Application implements Serializable { private Properties appProperties; private String applicationIdentifier; + private int memoryUsage; + public String getType() { return type; } @@ -111,6 +113,14 @@ public class Application implements Serializable { this.applicationIdentifier = applicationIdentifier; } + public int getMemoryUsage() { + return memoryUsage; + } + + public void setMemoryUsage(int memoryUsage) { + this.memoryUsage = memoryUsage; + } + public boolean equals(Object o) { if (this == o) { return true; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationDAOImpl.java index e20f152933f..f6b320682b9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/ApplicationDAOImpl.java @@ -47,8 +47,8 @@ public class ApplicationDAOImpl implements ApplicationDAO { try { conn = this.getConnection(); stmt = conn.prepareStatement("INSERT INTO DM_APPLICATION (NAME, PLATFORM, CATEGORY, " + - "VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID,APP_PROPERTIES,APP_IDENTIFIER) " + - "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,?)"); + "VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID, APP_PROPERTIES, APP_IDENTIFIER, MEMORY_USAGE) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, application.getName()); stmt.setString(2, application.getPlatform()); @@ -65,6 +65,7 @@ public class ApplicationDAOImpl implements ApplicationDAO { stmt.setBytes(9, bao.toByteArray()); stmt.setString(10, application.getApplicationIdentifier()); + stmt.setInt(11, application.getMemoryUsage()); stmt.execute(); rs = stmt.getGeneratedKeys(); @@ -108,8 +109,8 @@ public class ApplicationDAOImpl implements ApplicationDAO { try { conn = this.getConnection(); stmt = conn.prepareStatement("INSERT INTO DM_APPLICATION (NAME, PLATFORM, CATEGORY, " + - "VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID,APP_PROPERTIES,APP_IDENTIFIER) " + - "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,?)", new String[] {"id"}); + "VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID,APP_PROPERTIES, APP_IDENTIFIER, MEMORY_USAGE) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new String[]{"id"}); for (Application application : applications) { @@ -129,6 +130,7 @@ public class ApplicationDAOImpl implements ApplicationDAO { stmt.setBytes(9, bao.toByteArray()); stmt.setString(10, application.getApplicationIdentifier()); + stmt.setInt(11, application.getMemoryUsage()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); @@ -170,7 +172,7 @@ public class ApplicationDAOImpl implements ApplicationDAO { conn = this.getConnection(); conn.setAutoCommit(false); stmt = conn.prepareStatement("DELETE DM_APPLICATION WHERE APP_IDENTIFIER = ? AND TENANT_ID = ?", - new String[] {"id"}); + new String[]{"id"}); for (Application app : apps) { stmt.setString(1, app.getApplicationIdentifier()); @@ -206,7 +208,7 @@ public class ApplicationDAOImpl implements ApplicationDAO { try { conn = this.getConnection(); stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " + - "LOCATION_URL, IMAGE_URL, APP_PROPERTIES, TENANT_ID FROM DM_APPLICATION WHERE APP_IDENTIFIER = ? " + + "LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, TENANT_ID FROM DM_APPLICATION WHERE APP_IDENTIFIER = ? " + "AND TENANT_ID = ?"); stmt.setString(1, identifier); stmt.setInt(2, tenantId); @@ -238,7 +240,7 @@ public class ApplicationDAOImpl implements ApplicationDAO { try { conn = this.getConnection(); stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " + - "LOCATION_URL, IMAGE_URL, APP_PROPERTIES, TENANT_ID From DM_APPLICATION app " + + "LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, TENANT_ID From DM_APPLICATION app " + "INNER JOIN " + "(Select APPLICATION_ID From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " + "ON " + @@ -284,6 +286,7 @@ public class ApplicationDAOImpl implements ApplicationDAO { application.setLocationUrl(rs.getString("LOCATION_URL")); application.setPlatform(rs.getString("PLATFORM")); application.setVersion(rs.getString("VERSION")); + application.setMemoryUsage(rs.getInt("MEMORY_USAGE")); application.setApplicationIdentifier(rs.getString("APP_IDENTIFIER")); } catch (IOException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java index 6ca1735035d..a6822ce5aee 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java @@ -86,7 +86,7 @@ public class DeviceDetailsDAOImpl implements DeviceDetailsDAO { @Override public void addDeviceProperties(Map propertyMap, int deviceId) throws DeviceDetailsMgtDAOException { - if(propertyMap.isEmpty()){ + if (propertyMap.isEmpty()) { log.warn("Property map of device id :" + deviceId + " is empty."); return; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index cfd55a1b016..d5111df20da 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -136,14 +136,5 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { } } -// @Override -// public void addDeviceApplications(DeviceApplication deviceApplication) throws DeviceDetailsMgtException { -// -// } -// -// @Override -// public DeviceApplication getDeviceApplication(DeviceIdentifier deviceIdentifier) throws DeviceDetailsMgtException { -// return null; -// } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java index 873dfa82ed1..d8b7ada7b4b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java @@ -24,4 +24,5 @@ public class Constants { public static String GENERAL = "GENERAL"; public static String PROP_AND = "PROP_AND"; public static String PROP_OR = "PROP_OR"; + public static String LOCATION = "LOCATION"; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/QueryBuilder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/QueryBuilder.java index a6850ed1fc4..db028edc192 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/QueryBuilder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/QueryBuilder.java @@ -32,6 +32,8 @@ public interface QueryBuilder { String processOR(List conditions) throws InvalidOperatorException; + List processLocation(Condition condition) throws InvalidOperatorException; + List processANDProperties(List conditions) throws InvalidOperatorException; List processORProperties(List conditions) throws InvalidOperatorException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java index 9dc4e85059d..4a97f1fdbe6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java @@ -47,6 +47,7 @@ public class ProcessorImpl implements Processor { List generalDevices = new ArrayList<>(); List> allANDDevices = new ArrayList<>(); List> allORDevices = new ArrayList<>(); + List locationDevices = new ArrayList<>(); try { Map> queries = queryBuilder.buildQueries(searchContext.getConditions()); DeviceManagementDAOFactory.openConnection(); @@ -66,6 +67,10 @@ public class ProcessorImpl implements Processor { allORDevices.add(orDevices); } } + if (queries.containsKey(Constants.LOCATION)) { + locationDevices = searchDAO.searchDevicePropertyTable( + queries.get(Constants.LOCATION).get(0)); + } } catch (InvalidOperatorException e) { throw new SearchMgtException("Invalid operator was provided, so cannot execute the search.", e); } catch (SQLException e) { @@ -84,6 +89,7 @@ public class ProcessorImpl implements Processor { deviceWrappers.put(Constants.GENERAL, generalDevices); deviceWrappers.put(Constants.PROP_AND, this.processANDSearch(allANDDevices)); deviceWrappers.put(Constants.PROP_OR, this.processORSearch(allORDevices)); + deviceWrappers.put(Constants.LOCATION, locationDevices); return aggregator.aggregate(deviceWrappers); } @@ -157,5 +163,6 @@ public class ProcessorImpl implements Processor { } return maps; } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java index 98ecc2d8fd9..fcc2e263723 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java @@ -44,9 +44,13 @@ public class QueryBuilderImpl implements QueryBuilder { List orColumns = new ArrayList<>(); List otherANDColumns = new ArrayList<>(); List otherORColumns = new ArrayList<>(); + Condition locConditon = new Condition(); if (conditions.size() == 1) { - if (Utils.getDeviceDetailsColumnNames().containsKey(conditions.get(0)) || + + if (conditions.get(0).getKey().equalsIgnoreCase(Constants.LOCATION)) { + locConditon = conditions.get(0); + } else if (Utils.getDeviceDetailsColumnNames().containsKey(conditions.get(0)) || Utils.getDeviceLocationColumnNames().containsKey(conditions.get(0))) { andColumns.add(conditions.get(0)); } else { @@ -54,7 +58,9 @@ public class QueryBuilderImpl implements QueryBuilder { } } else { for (Condition con : conditions) { - if (Utils.getDeviceDetailsColumnNames().containsKey(con.getKey()) || + if (con.getKey().equalsIgnoreCase(Constants.LOCATION)) { + locConditon = con; + } else if (Utils.getDeviceDetailsColumnNames().containsKey(con.getKey()) || Utils.getDeviceLocationColumnNames().containsKey(con.getKey())) { if (con.getState().equals(Condition.State.AND)) { andColumns.add(con); @@ -80,11 +86,13 @@ public class QueryBuilderImpl implements QueryBuilder { this.processOR(orColumns))); queries.put(Constants.PROP_AND, this.processANDProperties(otherANDColumns)); queries.put(Constants.PROP_OR, this.processORProperties(otherORColumns)); + queries.put(Constants.LOCATION, this.processLocation(locConditon)); if (log.isDebugEnabled()) { log.debug("General Query : " + queries.get(Constants.GENERAL)); log.debug("Property with AND Query : " + queries.get(Constants.PROP_AND)); log.debug("Property with OR Query : " + queries.get(Constants.PROP_OR)); + log.debug("Location related Query : " + queries.get(Constants.LOCATION)); } return queries; @@ -125,6 +133,13 @@ public class QueryBuilderImpl implements QueryBuilder { return querySuffix; } + @Override + public List processLocation(Condition condition) throws InvalidOperatorException { + List queryList = new ArrayList<>(); + queryList.add(this.buildLocationQuery(condition.getValue())); + return queryList; + } + @Override public List processANDProperties(List conditions) throws InvalidOperatorException { return this.getQueryList(conditions); @@ -146,6 +161,18 @@ public class QueryBuilderImpl implements QueryBuilder { return queryList; } + private String buildLocationQuery(String location) { + + String query = this.getGenericQueryPart(); + query = query + " OR STREET1 LIKE \'%" + location + "%\'"; + query = query + " OR STREET2 LIKE \'%" + location + "%\'"; + query = query + " OR CITY LIKE \'%" + location + "%\'"; + query = query + " OR STATE LIKE \'%" + location + "%\'"; + query = query + " OR COUNTRY LIKE \'%" + location + "%\'"; + query = query + " OR ZIP LIKE \'%" + location + "%\'"; + return query; + } + private String getGenericQueryPart() { return "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" + @@ -159,18 +186,6 @@ public class QueryBuilderImpl implements QueryBuilder { "DM_DEVICE_TYPE AS DT WHERE D.TENANT_ID = " + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); -// CREATE TABLE IF NOT EXISTS DM_DEVICE ( -// ID INTEGER auto_increment NOT NULL, -// DESCRIPTION TEXT DEFAULT NULL, -// NAME VARCHAR(100) DEFAULT NULL, -// DEVICE_TYPE_ID INT(11) DEFAULT NULL, -// DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL, -// TENANT_ID INTEGER DEFAULT 0, -// PRIMARY KEY (ID), -// CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID ) -// REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION -// ); - } @@ -190,4 +205,3 @@ public class QueryBuilderImpl implements QueryBuilder { } } - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java index 468a9cba804..069b1630acb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java @@ -36,15 +36,28 @@ public class ResultSetAggregatorImpl implements ResultSetAggregator { Map generalQueryMap = this.convertToMap(deviceWrappers.get(Constants.GENERAL)); Map andMap = this.convertToMap(deviceWrappers.get(Constants.PROP_AND)); Map orMap = this.convertToMap(deviceWrappers.get(Constants.PROP_OR)); + Map locationMap = this.convertToMap(deviceWrappers.get(Constants.LOCATION)); + List finalResult = new ArrayList<>(); for (Integer a : andMap.keySet()) { if (generalQueryMap.containsKey(a)) { - finalResult.add(andMap.get(a)); + if (!finalResult.contains(a)) { + finalResult.add(andMap.get(a)); + } } } for (Integer a : orMap.keySet()) { - finalResult.add(orMap.get(a)); + if (!finalResult.contains(a)) { + finalResult.add(orMap.get(a)); + } + } + + for (Integer a : locationMap.keySet()) { + if (!finalResult.contains(a)) { + finalResult.add(locationMap.get(a)); + } } + return finalResult; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql index d172e2f5d27..09a41be82f8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql @@ -360,6 +360,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( LOCATION_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL, APP_PROPERTIES BLOB NULL, + MEMORY_USAGE DECIMAL(5) NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql index 3a268960d14..196b08158dc 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -361,6 +361,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( LOCATION_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL, APP_PROPERTIES BLOB NULL, + MEMORY_USAGE INTEGER(10) NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql index bb55d058623..91104f46418 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -349,6 +349,7 @@ CREATE TABLE DM_APPLICATION ( LOCATION_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL, APP_PROPERTIES VARBINARY(max) NULL, + MEMORY_USAGE INTEGER(10) NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql index 545f939108f..22494de2448 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -356,6 +356,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( LOCATION_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL, APP_PROPERTIES BLOB NULL, + MEMORY_USAGE INTEGER(10) NULL, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) )ENGINE = InnoDB; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql index 728233d24b3..b781fb0311f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -576,6 +576,7 @@ CREATE TABLE DM_APPLICATION ( LOCATION_URL VARCHAR2(100) DEFAULT NULL, IMAGE_URL VARCHAR2(100) DEFAULT NULL, APP_PROPERTIES BLOB NULL, + MEMORY_USAGE NUMBER(10) NULL, TENANT_ID NUMBER(10) NOT NULL, CONSTRAINT PK_DM_APPLICATION PRIMARY KEY (ID) ) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql index a1581e19d3f..607a19c4610 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -313,6 +313,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( LOCATION_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL, APP_PROPERTIES BYTEA NULL, + MEMORY_USAGE INTEGER NULL, TENANT_ID INTEGER NOT NULL );