From 2befefc96781b6d5462f62be7e6841f8cf10cacb Mon Sep 17 00:00:00 2001 From: Chatura Dilan Date: Fri, 1 Jul 2016 15:45:59 +0530 Subject: [PATCH 1/3] Added OS build date --- .../mgt/common/device/details/DeviceInfo.java | 16 ++++++++++ .../dao/util/DeviceManagementDAOUtil.java | 1 + .../mgt/dao/impl/DeviceDetailsDAOImpl.java | 30 ++++++++++--------- .../search/mgt/dao/impl/SearchDAOImpl.java | 2 ++ .../search/mgt/impl/QueryBuilderImpl.java | 4 +-- .../mgt/core/search/mgt/impl/Utils.java | 1 + .../device/mgt/core/Search/util/Utils.java | 1 + .../src/test/resources/sql/h2.sql | 1 + .../devicemgt/app/modules/constants.js | 1 + .../src/test/resources/sql/CreateH2TestDB.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 | 2 ++ 15 files changed, 48 insertions(+), 16 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java index cc8913c6b6..343add988e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/device/details/DeviceInfo.java @@ -57,6 +57,9 @@ public class DeviceInfo implements Serializable { @ApiModelProperty(name = "osVersion", value = "Operating system version.", required = true) private String osVersion; + @ApiModelProperty(name = "osBuildDate", value = "Operating system build date.", required = true) + private String osBuildDate; + @ApiModelProperty(name = "batteryLevel", value = "Battery level of the device.", required = true) private Double batteryLevel; @@ -201,6 +204,19 @@ public class DeviceInfo implements Serializable { this.osVersion = osVersion; } + + public String getOsBuildDate() { + if (osBuildDate != null) { + return osBuildDate; + } else { + return ""; + } + } + + public void setOsBuildDate(String osBuildDate) { + this.osBuildDate = osBuildDate; + } + public Double getBatteryLevel() { if (batteryLevel != null) { return batteryLevel; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index 7c1a5a6dce..39b5670109 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -209,6 +209,7 @@ public final class DeviceManagementDAOUtil { deviceInfo.setDeviceModel(rs.getString("DEVICE_MODEL")); deviceInfo.setVendor(rs.getString("VENDOR")); deviceInfo.setOsVersion(rs.getString("OS_VERSION")); + deviceInfo.setOsBuildDate(rs.getString("OS_BUILD_DATE")); deviceInfo.setBatteryLevel(rs.getDouble("BATTERY_LEVEL")); deviceInfo.setInternalTotalMemory(rs.getDouble("INTERNAL_TOTAL_MEMORY")); deviceInfo.setInternalAvailableMemory(rs.getDouble("INTERNAL_AVAILABLE_MEMORY")); 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 b0460a7c34..0d45c19838 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 @@ -48,27 +48,28 @@ public class DeviceDetailsDAOImpl implements DeviceDetailsDAO { conn = this.getConnection(); stmt = conn.prepareStatement("INSERT INTO DM_DEVICE_DETAIL (DEVICE_ID, DEVICE_MODEL, " + - "VENDOR, OS_VERSION, BATTERY_LEVEL, INTERNAL_TOTAL_MEMORY, INTERNAL_AVAILABLE_MEMORY, " + + "VENDOR, OS_VERSION, OS_BUILD_DATE, BATTERY_LEVEL, INTERNAL_TOTAL_MEMORY, INTERNAL_AVAILABLE_MEMORY, " + "EXTERNAL_TOTAL_MEMORY, EXTERNAL_AVAILABLE_MEMORY, CONNECTION_TYPE, " + "SSID, CPU_USAGE, TOTAL_RAM_MEMORY, AVAILABLE_RAM_MEMORY, PLUGGED_IN, UPDATE_TIMESTAMP) " + - "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setInt(1, deviceId); stmt.setString(2, deviceInfo.getDeviceModel()); stmt.setString(3, deviceInfo.getVendor()); stmt.setString(4, deviceInfo.getOsVersion()); - stmt.setDouble(5, deviceInfo.getBatteryLevel()); - stmt.setDouble(6, deviceInfo.getInternalTotalMemory()); - stmt.setDouble(7, deviceInfo.getInternalAvailableMemory()); - stmt.setDouble(8, deviceInfo.getExternalTotalMemory()); - stmt.setDouble(9, deviceInfo.getExternalAvailableMemory()); - stmt.setString(10, deviceInfo.getConnectionType()); - stmt.setString(11, deviceInfo.getSsid()); - stmt.setDouble(12, deviceInfo.getCpuUsage()); - stmt.setDouble(13, deviceInfo.getTotalRAMMemory()); - stmt.setDouble(14, deviceInfo.getAvailableRAMMemory()); - stmt.setBoolean(15, deviceInfo.isPluggedIn()); - stmt.setLong(16, System.currentTimeMillis()); + stmt.setString(5, deviceInfo.getOsBuildDate()); + stmt.setDouble(6, deviceInfo.getBatteryLevel()); + stmt.setDouble(7, deviceInfo.getInternalTotalMemory()); + stmt.setDouble(8, deviceInfo.getInternalAvailableMemory()); + stmt.setDouble(9, deviceInfo.getExternalTotalMemory()); + stmt.setDouble(10, deviceInfo.getExternalAvailableMemory()); + stmt.setString(11, deviceInfo.getConnectionType()); + stmt.setString(12, deviceInfo.getSsid()); + stmt.setDouble(13, deviceInfo.getCpuUsage()); + stmt.setDouble(14, deviceInfo.getTotalRAMMemory()); + stmt.setDouble(15, deviceInfo.getAvailableRAMMemory()); + stmt.setBoolean(16, deviceInfo.isPluggedIn()); + stmt.setLong(17, System.currentTimeMillis()); stmt.execute(); @@ -131,6 +132,7 @@ public class DeviceDetailsDAOImpl implements DeviceDetailsDAO { deviceInfo.setDeviceModel(rs.getString("DEVICE_MODEL")); deviceInfo.setVendor(rs.getString("VENDOR")); deviceInfo.setOsVersion(rs.getString("OS_VERSION")); + deviceInfo.setOsBuildDate(rs.getString("OS_BUILD_DATE")); deviceInfo.setBatteryLevel(rs.getDouble("BATTERY_LEVEL")); deviceInfo.setInternalTotalMemory(rs.getDouble("INTERNAL_TOTAL_MEMORY")); deviceInfo.setInternalAvailableMemory(rs.getDouble("INTERNAL_AVAILABLE_MEMORY")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/dao/impl/SearchDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/dao/impl/SearchDAOImpl.java index fc162c59b9..1090e88c62 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/dao/impl/SearchDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/dao/impl/SearchDAOImpl.java @@ -79,6 +79,7 @@ public class SearchDAOImpl implements SearchDAO { deviceInfo.setInternalAvailableMemory(rs.getDouble("INTERNAL_AVAILABLE_MEMORY")); deviceInfo.setInternalTotalMemory(rs.getDouble("EXTERNAL_TOTAL_MEMORY")); deviceInfo.setOsVersion(rs.getString("OS_VERSION")); + deviceInfo.setOsBuildDate(rs.getString("OS_BUILD_DATE")); deviceInfo.setPluggedIn(rs.getBoolean("PLUGGED_IN")); deviceInfo.setSsid(rs.getString("SSID")); deviceInfo.setTotalRAMMemory(rs.getDouble("TOTAL_RAM_MEMORY")); @@ -156,6 +157,7 @@ public class SearchDAOImpl implements SearchDAO { deviceInfo.setInternalAvailableMemory(rs.getDouble("INTERNAL_AVAILABLE_MEMORY")); deviceInfo.setInternalTotalMemory(rs.getDouble("EXTERNAL_TOTAL_MEMORY")); deviceInfo.setOsVersion(rs.getString("OS_VERSION")); + deviceInfo.setOsBuildDate(rs.getString("OS_BUILD_DATE")); deviceInfo.setPluggedIn(rs.getBoolean("PLUGGED_IN")); deviceInfo.setSsid(rs.getString("SSID")); deviceInfo.setTotalRAMMemory(rs.getDouble("TOTAL_RAM_MEMORY")); 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 826e94d18c..b86e3c1bcc 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 @@ -192,7 +192,7 @@ public class QueryBuilderImpl implements QueryBuilder { return "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" + "D.DEVICE_TYPE_ID, D.DEVICE_IDENTIFICATION, DT.ID AS DEVICE_TYPE_ID, \n" + "DT.NAME AS DEVICE_TYPE_NAME, DD.DEVICE_ID, DD.DEVICE_MODEL, DD.VENDOR, \n" + - "DD.OS_VERSION, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" + + "DD.OS_VERSION, DD.OS_BUILD_DATE, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" + "DD.EXTERNAL_TOTAL_MEMORY, DD.EXTERNAL_AVAILABLE_MEMORY, DD.CONNECTION_TYPE, \n" + "DD.SSID, DD.CPU_USAGE, DD.TOTAL_RAM_MEMORY, DD.AVAILABLE_RAM_MEMORY, \n" + "DD.PLUGGED_IN, DD.UPDATE_TIMESTAMP, DL.LATITUDE, DL.LONGITUDE, DL.STREET1, DL.STREET2, DL.CITY, DL.ZIP, \n" + @@ -211,7 +211,7 @@ public class QueryBuilderImpl implements QueryBuilder { return "SELECT D.ID, D.DESCRIPTION, D.NAME, \n" + "D.DEVICE_TYPE_ID, D.DEVICE_IDENTIFICATION, DT.ID AS DEVICE_TYPE_ID, \n" + "DT.NAME AS DEVICE_TYPE_NAME, DD.DEVICE_ID, DD.DEVICE_MODEL, DD.VENDOR, \n" + - "DD.OS_VERSION, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" + + "DD.OS_VERSION, DD.OS_BUILD_DATE, DD.BATTERY_LEVEL, DD.INTERNAL_TOTAL_MEMORY, DD.INTERNAL_AVAILABLE_MEMORY,\n" + "DD.EXTERNAL_TOTAL_MEMORY, DD.EXTERNAL_AVAILABLE_MEMORY, DD.CONNECTION_TYPE, \n" + "DD.SSID, DD.CPU_USAGE, DD.TOTAL_RAM_MEMORY, DD.AVAILABLE_RAM_MEMORY, \n" + "DD.PLUGGED_IN, DD.UPDATE_TIMESTAMP, DL.LATITUDE, DL.LONGITUDE, DL.STREET1, DL.STREET2, DL.CITY, DL.ZIP, \n" + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/Utils.java index 4c73b33cf7..d28666ba88 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/Utils.java @@ -35,6 +35,7 @@ public class Utils { genericColumnsMap.put("deviceModel", "DEVICE_MODEL"); genericColumnsMap.put("vendor", "VENDOR"); genericColumnsMap.put("osVersion", "OS_VERSION"); + genericColumnsMap.put("osBuildDate", "OS_BUILD_DATE"); genericColumnsMap.put("batteryLevel", "BATTERY_LEVEL"); genericColumnsMap.put("internalTotalMemory", "INTERNAL_TOTAL_MEMORY"); genericColumnsMap.put("internalAvailableMemory", "INTERNAL_AVAILABLE_MEMORY"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/Search/util/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/Search/util/Utils.java index 27b5f349c0..8cc205f210 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/Search/util/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/Search/util/Utils.java @@ -52,6 +52,7 @@ public class Utils { deviceInfo.setMobileSignalStrength(0.67); deviceInfo.setOperator("Dialog"); deviceInfo.setOsVersion("Lolipop"); + deviceInfo.setOsBuildDate("1467366458"); deviceInfo.setPluggedIn(true); deviceInfo.setSsid("SSSSSS"); deviceInfo.setTotalRAMMemory(4.00); 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 a370c70ca1..9b734652da 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 @@ -469,6 +469,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL, + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL DECIMAL(4) NULL, INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL, INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js index 2ede7f9c2d..890a7e500e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/constants.js @@ -33,6 +33,7 @@ var DEVICE_VENDOR = "vendor"; var DEVICE_MODEL = "model"; var DEVICE_PRODUCT = "PRODUCT"; var DEVICE_OS_VERSION = "osVersion"; +var DEVICE_OS_BUILD_DATE = "osBuildDate"; var DEVICE_PROPERTIES = "properties"; var DEVICE_ENROLLMENT_INFO = "enrolmentInfo"; var DEVICE_STATUS = "status"; diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index d7ab39170b..bf0be00ccc 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -473,6 +473,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL, + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL DECIMAL(4) NULL, INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL, INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL, 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 d7ab39170b..bf0be00ccc 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 @@ -473,6 +473,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL, + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL DECIMAL(4) NULL, INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL, INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL, 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 68345b343b..a67d67f9e0 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 @@ -486,6 +486,7 @@ CREATE TABLE DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL, + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL DECIMAL(4) NULL, INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL, INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL, 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 d7f4efab06..40535450ac 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 @@ -507,6 +507,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL, + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL DECIMAL(4) NULL, INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL, INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL, 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 57f55c5d17..41f539cee0 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 @@ -825,6 +825,7 @@ CREATE TABLE DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR2(45) NULL, VENDOR VARCHAR2(45) NULL, OS_VERSION VARCHAR2(45) NULL, + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL NUMBER(4) NULL, INTERNAL_TOTAL_MEMORY NUMBER(30,3) NULL, INTERNAL_AVAILABLE_MEMORY NUMBER(30,3) NULL, 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 bfc4a7f062..c29d18e021 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 @@ -416,6 +416,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( DEVICE_MODEL VARCHAR(45) NULL, VENDOR VARCHAR(45) NULL, OS_VERSION VARCHAR(45) NULL, + + OS_BUILD_DATE VARCHAR(100) NULL, BATTERY_LEVEL DECIMAL(4) NULL, INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL, INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL, From 54498f41cdb1b8d1f9fdc28ada5f0c7a6632ee9f Mon Sep 17 00:00:00 2001 From: hasuniea Date: Mon, 4 Jul 2016 12:24:28 +0530 Subject: [PATCH 2/3] modifying scep utils --- .../pom.xml | 8 + .../mgt/core/scep/SCEPException.java | 5 +- .../mgt/core/scep/SCEPManager.java | 7 +- .../mgt/core/scep/SCEPManagerImpl.java | 11 +- .../mgt/core/scep/TenantedDeviceWrapper.java | 9 +- .../internal/SCEPManagerServiceComponent.java | 60 ----- .../AuthenticatorFrameworkDataHolder.java | 2 +- .../CertificateAuthenticator.java | 8 +- ...uthenticatorFrameworkServiceComponent.java | 215 ------------------ 9 files changed, 23 insertions(+), 302 deletions(-) rename components/{device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device => certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate}/mgt/core/scep/SCEPException.java (92%) rename components/{device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device => certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate}/mgt/core/scep/SCEPManager.java (87%) rename components/{device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device => certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate}/mgt/core/scep/SCEPManagerImpl.java (95%) rename components/{device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device => certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate}/mgt/core/scep/TenantedDeviceWrapper.java (89%) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java delete mode 100644 components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index b6abda03d1..0cd8544824 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -70,6 +70,9 @@ org.bouncycastle.operator.jcajce, org.bouncycastle.asn1.x500.style, org.bouncycastle.pkcs, + org.wso2.carbon.user.core.tenant, + org.wso2.carbon.user.api, + org.wso2.carbon.user.core.service, org.bouncycastle.util, org.jscep.message, @@ -171,6 +174,11 @@ swagger-annotations provided + + org.wso2.carbon + org.wso2.carbon.user.core + 4.4.3 + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPException.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPException.java similarity index 92% rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPException.java rename to components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPException.java index aed87dd1c6..936d99a5bf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPException.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -16,8 +16,7 @@ * under the License. */ - -package org.wso2.carbon.device.mgt.core.scep; +package org.wso2.carbon.certificate.mgt.core.scep; public class SCEPException extends Exception { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPManager.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPManager.java similarity index 87% rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPManager.java rename to components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPManager.java index d84f5e16c0..511f228054 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPManager.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -15,13 +15,10 @@ * specific language governing permissions and limitations * under the License. */ - - -package org.wso2.carbon.device.mgt.core.scep; +package org.wso2.carbon.certificate.mgt.core.scep; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; public interface SCEPManager { - TenantedDeviceWrapper getValidatedDevice(DeviceIdentifier deviceIdentifier) throws SCEPException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPManagerImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPManagerImpl.java similarity index 95% rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPManagerImpl.java rename to components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPManagerImpl.java index bdabe8b9d8..63bd2d2f60 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/SCEPManagerImpl.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/SCEPManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -15,9 +15,7 @@ * specific language governing permissions and limitations * under the License. */ - - -package org.wso2.carbon.device.mgt.core.scep; +package org.wso2.carbon.certificate.mgt.core.scep; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -35,7 +33,6 @@ import java.sql.SQLException; import java.util.HashMap; public class SCEPManagerImpl implements SCEPManager { - private DeviceDAO deviceDAO; private static final Log log = LogFactory.getLog(SCEPManagerImpl.class); @@ -45,14 +42,13 @@ public class SCEPManagerImpl implements SCEPManager { @Override public TenantedDeviceWrapper getValidatedDevice(DeviceIdentifier deviceIdentifier) throws SCEPException { - TenantedDeviceWrapper tenantedDeviceWrapper = new TenantedDeviceWrapper(); try { DeviceManagementDAOFactory.openConnection(); HashMap deviceHashMap = deviceDAO.getDevice(deviceIdentifier); Object[] keySet = deviceHashMap.keySet().toArray(); - if(keySet == null || keySet.length == 0) { + if (keySet == null || keySet.length == 0) { throw new SCEPException("Lookup device not found for the device identifier"); } @@ -75,7 +71,6 @@ public class SCEPManagerImpl implements SCEPManager { String tenantDomain = realmService.getTenantManager().getDomain(tenantId); tenantedDeviceWrapper.setTenantDomain(tenantDomain); - } catch (SQLException e) { throw new SCEPException("Error occurred while getting the datasource connection.", e); } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/TenantedDeviceWrapper.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/TenantedDeviceWrapper.java similarity index 89% rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/TenantedDeviceWrapper.java rename to components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/TenantedDeviceWrapper.java index ee7d4bb9f5..b57d3db405 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/scep/TenantedDeviceWrapper.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/scep/TenantedDeviceWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -15,15 +15,12 @@ * specific language governing permissions and limitations * under the License. */ - - -package org.wso2.carbon.device.mgt.core.scep; +package org.wso2.carbon.certificate.mgt.core.scep; import org.wso2.carbon.device.mgt.common.Device; public class TenantedDeviceWrapper { - - private Device device; + Device device; private int tenantId; private String tenantDomain; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java deleted file mode 100644 index f59c04586a..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.wso2.carbon.device.mgt.core.internal; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; -import org.wso2.carbon.device.mgt.core.scep.SCEPManager; -import org.wso2.carbon.device.mgt.core.scep.SCEPManagerImpl; - -/** - * @scr.component name="org.wso2.carbon.device.mgt.core.scep" immediate="true" - * @scr.reference name="app.mgt.service" - * interface="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setApplicationManagementProviderService" - * unbind="unsetApplicationManagementProviderService" - */ -public class SCEPManagerServiceComponent { - - private static final Log log = LogFactory.getLog(SCEPManagerServiceComponent.class); - - protected void activate(ComponentContext componentContext) { - - try { - if (log.isDebugEnabled()) { - log.debug("Initializing SCEP core bundle"); - } - - BundleContext bundleContext = componentContext.getBundleContext(); - bundleContext.registerService(SCEPManager.class.getName(), - new SCEPManagerImpl(), null); - - if (log.isDebugEnabled()) { - log.debug("SCEP core bundle has been successfully initialized"); - } - } catch (Throwable e) { - String msg = "Error occurred while initializing SCEP core bundle"; - log.error(msg, e); - } - } - - protected void deactivate(ComponentContext ctx) { - if (log.isDebugEnabled()) { - log.debug("Deactivating SCEP core bundle"); - } - } - - protected void unsetApplicationManagementProviderService(ApplicationManagementProviderService - applicationManagementProviderService) { - //do nothing - } - - protected void setApplicationManagementProviderService(ApplicationManagementProviderService - applicationManagementProviderService) { - //do nothing - } - -} diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticatorFrameworkDataHolder.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticatorFrameworkDataHolder.java index ba6b1a2f6c..75aa7dba86 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticatorFrameworkDataHolder.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticatorFrameworkDataHolder.java @@ -18,8 +18,8 @@ */ package org.wso2.carbon.webapp.authenticator.framework; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.device.mgt.core.scep.SCEPManager; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java index 30313d2499..067405622d 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java @@ -6,15 +6,15 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPException; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; +import org.wso2.carbon.certificate.mgt.core.scep.TenantedDeviceWrapper; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; -import org.wso2.carbon.device.mgt.core.scep.SCEPException; -import org.wso2.carbon.device.mgt.core.scep.SCEPManager; -import org.wso2.carbon.device.mgt.core.scep.TenantedDeviceWrapper; import org.wso2.carbon.webapp.authenticator.framework.AuthenticationException; -import org.wso2.carbon.webapp.authenticator.framework.AuthenticatorFrameworkDataHolder; import org.wso2.carbon.webapp.authenticator.framework.AuthenticationInfo; +import org.wso2.carbon.webapp.authenticator.framework.AuthenticatorFrameworkDataHolder; import org.wso2.carbon.webapp.authenticator.framework.Utils.Utils; import java.security.cert.X509Certificate; diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java deleted file mode 100644 index 40769e0b3f..0000000000 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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.wso2.carbon.webapp.authenticator.framework.internal; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.device.mgt.core.scep.SCEPManager; -import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; -import org.wso2.carbon.registry.core.service.TenantRegistryLoader; -import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; -import org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve; -import org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.webapp.authenticator.framework.AuthenticatorFrameworkDataHolder; -import org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticationValve; -import org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticatorRepository; -import org.wso2.carbon.webapp.authenticator.framework.authenticator.WebappAuthenticator; -import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig; -import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfigService; -import org.wso2.carbon.webapp.authenticator.framework.config.WebappAuthenticatorConfig; -import org.wso2.carbon.webapp.authenticator.framework.config.impl.AuthenticatorConfigServiceImpl; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -/** - * @scr.component name="org.wso2.carbon.webapp.authenticator" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="org.wso2.carbon.certificate.mgt" - * interface="org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService" - * policy="dynamic" - * cardinality="1..n" - * bind="setCertificateManagementService" - * unbind="unsetCertificateManagementService" - * @scr.reference name="org.wso2.carbon.device.mgt.core.scep" - * interface="org.wso2.carbon.device.mgt.core.scep.SCEPManager" - * policy="dynamic" - * cardinality="1..n" - * bind="setSCEPManagementService" - * unbind="unsetSCEPManagementService" - * @scr.reference name="identity.oauth2.validation.service" - * interface="org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOAuth2ValidationService" - * unbind="unsetOAuth2ValidationService" - * @scr.reference name="tenant.indexloader" - * interface="org.wso2.carbon.registry.indexing.service.TenantIndexingLoader" - * cardinality="1..1" - * policy="dynamic" - * bind="setTenantIndexLoader" - * unbind="unsetTenantIndexLoader" - * @scr.reference name="tenant.registryloader" - * interface="org.wso2.carbon.registry.core.service.TenantRegistryLoader" - * cardinality="1..1" policy="dynamic" - * bind="setTenantRegistryLoader" - * unbind="unsetTenantRegistryLoader" - */ -public class WebappAuthenticatorFrameworkServiceComponent { - - private static final Log log = LogFactory.getLog(WebappAuthenticatorFrameworkServiceComponent.class); - - @SuppressWarnings("unused") - protected void activate(ComponentContext componentContext) { - if (log.isDebugEnabled()) { - log.debug("Starting Web Application Authenticator Framework Bundle"); - } - try { - WebappAuthenticatorConfig.init(); - WebappAuthenticatorRepository repository = new WebappAuthenticatorRepository(); - for (AuthenticatorConfig config : WebappAuthenticatorConfig.getInstance().getAuthenticators()) { - WebappAuthenticator authenticator = - (WebappAuthenticator) Class.forName(config.getClassName()).newInstance(); - - if ((config.getParams() != null) && (!config.getParams().isEmpty())) { - Properties properties = new Properties(); - for (AuthenticatorConfig.Parameter param : config.getParams()) { - properties.setProperty(param.getName(), param.getValue()); - } - authenticator.setProperties(properties); - } - authenticator.init(); - repository.addAuthenticator(authenticator); - } - - //Register AuthenticatorConfigService to expose webapp-authenticator configs. - BundleContext bundleContext = componentContext.getBundleContext(); - AuthenticatorConfigService authenticatorConfigService = new AuthenticatorConfigServiceImpl(); - bundleContext.registerService(AuthenticatorConfigService.class.getName(), authenticatorConfigService, null); - - AuthenticatorFrameworkDataHolder.getInstance().setWebappAuthenticatorRepository(repository); - - List valves = new ArrayList(); - valves.add(new WebappAuthenticationValve()); - TomcatValveContainer.addValves(valves); - - if (log.isDebugEnabled()) { - log.debug("Web Application Authenticator Framework Bundle has been started successfully"); - } - } catch (Throwable e) { - log.error("Error occurred while initializing the bundle", e); - } - } - - @SuppressWarnings("unused") - protected void deactivate(ComponentContext componentContext) { - //do nothing - } - - protected void setRealmService(RealmService realmService) { - if (log.isDebugEnabled()) { - log.debug("RealmService acquired"); - } - AuthenticatorFrameworkDataHolder.getInstance().setRealmService(realmService); - } - - protected void unsetRealmService(RealmService realmService) { - AuthenticatorFrameworkDataHolder.getInstance().setRealmService(null); - } - - protected void setCertificateManagementService(CertificateManagementService certificateManagementService) { - if (log.isDebugEnabled()) { - log.debug("Setting certificate management service"); - } - AuthenticatorFrameworkDataHolder.getInstance().setCertificateManagementService(certificateManagementService); - } - - protected void unsetCertificateManagementService(CertificateManagementService certificateManagementService) { - if (log.isDebugEnabled()) { - log.debug("Removing certificate management service"); - } - - AuthenticatorFrameworkDataHolder.getInstance().setCertificateManagementService(null); - } - - protected void setSCEPManagementService(SCEPManager scepManager) { - if (log.isDebugEnabled()) { - log.debug("Setting SCEP management service"); - } - AuthenticatorFrameworkDataHolder.getInstance().setScepManager(scepManager); - } - - protected void unsetSCEPManagementService(SCEPManager scepManager) { - if (log.isDebugEnabled()) { - log.debug("Removing SCEP management service"); - } - - AuthenticatorFrameworkDataHolder.getInstance().setScepManager(null); - } - - /** - * Sets OAuth2TokenValidation Service. - * - * @param tokenValidationService An instance of OAuth2TokenValidationService - */ - protected void setOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { - if (log.isDebugEnabled()) { - log.debug("Setting OAuth2TokenValidationService Service"); - } - AuthenticatorFrameworkDataHolder.getInstance().setOAuth2TokenValidationService(tokenValidationService); - } - - /** - * Unsets OAuth2TokenValidation Service. - * - * @param tokenValidationService An instance of OAuth2TokenValidationService - */ - protected void unsetOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { - if (log.isDebugEnabled()) { - log.debug("Unsetting OAuth2TokenValidationService Service"); - } - AuthenticatorFrameworkDataHolder.getInstance().setOAuth2TokenValidationService(null); - } - - protected void setTenantIndexLoader(TenantIndexingLoader tenantIndexLoader) { - AuthenticatorFrameworkDataHolder.getInstance().setTenantIndexingLoader(tenantIndexLoader); - } - - protected void unsetTenantIndexLoader(TenantIndexingLoader tenantIndexLoader) { - AuthenticatorFrameworkDataHolder.getInstance().setTenantIndexingLoader(null); - } - - protected void setTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { - AuthenticatorFrameworkDataHolder.getInstance().setTenantRegistryLoader(tenantRegistryLoader); - } - - protected void unsetTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { - AuthenticatorFrameworkDataHolder.getInstance().setTenantRegistryLoader(null); - } -} From 646e8b68d87860694bbc6de8eb97fc53868af8e6 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Mon, 4 Jul 2016 12:40:48 +0530 Subject: [PATCH 3/3] remove unwanted package --- .../org.wso2.carbon.webapp.authenticator.framework/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index 5927c345da..94f0a0d933 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -99,7 +99,6 @@ org.wso2.carbon.device.mgt.core.permission.mgt, org.wso2.carbon.device.mgt.common, org.wso2.carbon.device.mgt.common.permission.mgt, - org.wso2.carbon.device.mgt.core.scep, org.apache.axis2, org.apache.axis2.client, org.apache.commons.codec.binary,