From 0b800b86153d55a28ed9b7afa24f3eca2df4396b Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Wed, 28 Oct 2015 18:49:47 +0530 Subject: [PATCH 1/6] Bug fixes --- .../pom.xml | 2 +- .../mgt/core/impl/CertificateGenerator.java | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) 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 a253cc9a7f..b4c1513c04 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 @@ -58,7 +58,7 @@ org.apache.commons.logging, javax.security.auth.x500, javax.xml.parsers, - org.apache.commons.codec.binary, + org.apache.commons.codec.binary;version="${version.commons.codec}", org.bouncycastle.asn1, org.bouncycastle.asn1.x500, org.bouncycastle.asn1.x509, diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java index c97d84472d..a9c79553db 100755 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java @@ -348,19 +348,19 @@ public class CertificateGenerator { Date validityBeginDate = commonUtil.getValidityStartDate(); Date validityEndDate = commonUtil.getValidityEndDate(); - X500Name certSubject = request.getSubject(); + X500Name certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); Attribute attributes[] = request.getAttributes(); - if (certSubject == null) { - certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); - } else { - org.bouncycastle.asn1.x500.RDN[] rdn = certSubject.getRDNs(); - - if (rdn == null || rdn.length == 0) { - certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); - } - } - +// if (certSubject == null) { +// certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); +// } else { +// org.bouncycastle.asn1.x500.RDN[] rdn = certSubject.getRDNs(); +// +// if (rdn == null || rdn.length == 0) { +// certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); +// } +// } + X509v3CertificateBuilder certificateBuilder = new X509v3CertificateBuilder( new X500Name(issueSubject), CommonUtil.generateSerialNumber(), validityBeginDate, validityEndDate, certSubject, request.getSubjectPublicKeyInfo()); From bbc11321001283325dc82e99c29c666d41cf0cb6 Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Wed, 28 Oct 2015 19:24:05 +0530 Subject: [PATCH 2/6] Commenting previous lines --- .../certificate/mgt/core/impl/CertificateGenerator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java index a9c79553db..7735922f51 100755 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java @@ -349,6 +349,8 @@ public class CertificateGenerator { Date validityEndDate = commonUtil.getValidityEndDate(); X500Name certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); + //X500Name certSubject = request.getSubject(); + Attribute attributes[] = request.getAttributes(); // if (certSubject == null) { @@ -360,7 +362,7 @@ public class CertificateGenerator { // certSubject = new X500Name(ConfigurationUtil.DEFAULT_PRINCIPAL); // } // } - + X509v3CertificateBuilder certificateBuilder = new X509v3CertificateBuilder( new X500Name(issueSubject), CommonUtil.generateSerialNumber(), validityBeginDate, validityEndDate, certSubject, request.getSubjectPublicKeyInfo()); From 5c2b7c9624e6a0c72f3f3edf4b72e460eaa5b310 Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Wed, 28 Oct 2015 20:06:10 +0530 Subject: [PATCH 3/6] Removing commons codec version --- .../org.wso2.carbon.certificate.mgt.core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b4c1513c04..a253cc9a7f 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 @@ -58,7 +58,7 @@ org.apache.commons.logging, javax.security.auth.x500, javax.xml.parsers, - org.apache.commons.codec.binary;version="${version.commons.codec}", + org.apache.commons.codec.binary, org.bouncycastle.asn1, org.bouncycastle.asn1.x500, org.bouncycastle.asn1.x509, From 79cc441c7166f1053c21440e1b864475d6d46d9f Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 28 Oct 2015 20:42:43 +0530 Subject: [PATCH 4/6] Renaming postgres.sql to postgresql.sql --- .../main/resources/dbscripts/cdm/{postgres.sql => postgresql.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/{postgres.sql => postgresql.sql} (100%) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgres.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgres.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql From 8a1dba166aad361435dcd56c5da2716042266b4b Mon Sep 17 00:00:00 2001 From: harshanl Date: Wed, 28 Oct 2015 22:09:01 +0530 Subject: [PATCH 5/6] Updated FeatureMgr spec --- .../org/wso2/carbon/device/mgt/common/FeatureManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/FeatureManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/FeatureManager.java index 16d2f4063f..884311e935 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/FeatureManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/FeatureManager.java @@ -24,10 +24,14 @@ public interface FeatureManager { boolean addFeature(Feature feature) throws DeviceManagementException; + boolean addFeatures(List features) throws DeviceManagementException; + Feature getFeature(String name) throws DeviceManagementException; List getFeatures() throws DeviceManagementException; boolean removeFeature(String name) throws DeviceManagementException; + boolean addSupportedFeaturesToDB() throws DeviceManagementException; + } From 0282cff5b36746ee16c3d88d01c73b6d7d5d333c Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 28 Oct 2015 22:39:47 +0530 Subject: [PATCH 6/6] Adding missing auto_increment declaration in DEVICE_TYPE table config and script clean up --- .../src/main/resources/dbscripts/cdm/mssql.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/mysql.sql | 14 +++++++------- .../src/main/resources/dbscripts/cdm/oracle.sql | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) 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 5ddcee39fd..3e528bbbaa 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 @@ -2,7 +2,7 @@ /* OBTAIN A LICENSE AT WWW.SQLINES.COM FOR FULL CONVERSION. THANK YOU. */ CREATE TABLE DM_DEVICE_TYPE ( - ID INT identity NOT NULL, + ID INT IDENTITY NOT NULL, NAME VARCHAR(300) DEFAULT NULL, PRIMARY KEY (ID) ); @@ -406,4 +406,4 @@ CREATE TABLE DM_NOTIFICATION ( -- TO:DO - Remo... *** SQLINES FOR EVALUATION USE ONLY *** --Insert into D... *** SQLINES FOR EVALUATION USE ONLY *** ---Insert into D... *** SQLINES FOR EVALUATION USE ONLY *** \ No newline at end of file +--Insert into D... *** SQLINES FOR EVALUATION USE ONLY *** 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 eb887f68c6..56bf241c20 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 @@ -2,8 +2,8 @@ -- Table `DM_DEVICE_TYPE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `DM_DEVICE_TYPE` ( - `ID` INT(11) NOT NULL , - `NAME` VARCHAR(300) DEFAULT NULL , + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(300) NOT NULL , PRIMARY KEY (`ID`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; @@ -13,12 +13,12 @@ DEFAULT CHARACTER SET = latin1; -- Table `DM_DEVICE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `DM_DEVICE` ( - `ID` VARCHAR(20) NOT NULL , + `ID` VARCHAR(20) NOT NULL AUTO_INCREMENT , `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, + `NAME` VARCHAR(100) NOT NULL , + `DEVICE_TYPE_ID` INT(11) NOT NULL , + `DEVICE_IDENTIFICATION` VARCHAR(300) NOT NULL , + `TENANT_ID` INTEGER NOT NULL, PRIMARY KEY (`ID`) , INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2_idx` (`DEVICE_TYPE_ID` ASC) , CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2` 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 2982217eec..ef8909f917 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 @@ -2,7 +2,7 @@ /* OBTAIN A LICENSE AT WWW.SQLINES.COM FOR FULL CONVERSION. THANK YOU. */ CREATE TABLE DM_DEVICE_TYPE ( - ID NUMBER(10) NOT NULL, + ID NUMBER(10) NOT NULL, NAME VARCHAR2(300) DEFAULT NULL, PRIMARY KEY (ID) ); @@ -632,4 +632,4 @@ END; -- TO:DO - Remo... *** SQLINES FOR EVALUATION USE ONLY *** --Insert into D... *** SQLINES FOR EVALUATION USE ONLY *** ---Insert into D... *** SQLINES FOR EVALUATION USE ONLY *** \ No newline at end of file +--Insert into D... *** SQLINES FOR EVALUATION USE ONLY ***