diff --git a/README.md b/README.md index 7b2b7e1b8c..3d821b7761 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # carbon-device-mgt
- - Java7
- - Java8 + - Java8
WSO2 CONNECTED DEVICE MANAGEMENT COMPONENTS diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 9ff08be75c..4a903cf6cc 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index 392ba3ac8e..7f1c19bc73 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index eb88843ab9..fdb9f1a016 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index cdd76623df..8acc92772d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java index a36dc0f647..f149868e76 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java @@ -124,8 +124,9 @@ public class Utils { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new APIMCertificateMGTException("Error occurred while parsing file, while converting " + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index d0aff28bdc..cf751f1595 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java index 8655a4d6a2..58f39f1a5b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/configs/APIMConfigReader.java @@ -79,6 +79,7 @@ public class APIMConfigReader { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 7138418320..d0c406c0ff 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index ddaf5ff72f..7bd0d2c666 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/WebappPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/WebappPublisherUtil.java index 17e2edb9a8..5d9a948e59 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/WebappPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/WebappPublisherUtil.java @@ -35,6 +35,7 @@ public class WebappPublisherUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 2fe4079659..059a9bc00c 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index b0d8423f0f..b16ca5081b 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index 0db5e35ee2..24b95a8453 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml index d5cda0e93c..053d08e1d3 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml @@ -24,7 +24,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 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 9b87fc96ee..cb52353a7e 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 @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java index 1af981f3cc..5e5f02c7f0 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagementConstants.java @@ -38,7 +38,7 @@ public final class CertificateManagementConstants { public static final String RSA_PRIVATE_KEY_BEGIN_TEXT = "-----BEGIN RSA PRIVATE KEY-----\n"; public static final String RSA_PRIVATE_KEY_END_TEXT = "-----END RSA PRIVATE KEY-----"; public static final String EMPTY_TEXT = ""; - public static final int RSA_KEY_LENGTH = 1024; + public static final int RSA_KEY_LENGTH = 2048; public static final class DataBaseTypes { private DataBaseTypes() { diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagerUtil.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagerUtil.java index b24bf12f84..5bdf641500 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagerUtil.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/util/CertificateManagerUtil.java @@ -47,8 +47,9 @@ public class CertificateManagerUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new CertificateManagementException("Error occurred while parsing file, while converting " + diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index 37dbaed8cd..7294bc0499 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -25,39 +25,128 @@ - - 8 - 100 - 20 - 1000 - + + 1000 + 60000 + 60000 + true + + org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.FCMBasedPushNotificationProvider + + org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider + org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider + org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider + + + + false + https://localhost:9443 admin admin + + https://localhost:9443 + admin + admin + - org.wso2.carbon.policy.mgt - true - 60000 - 5 - 8 - 20 - + org.wso2.carbon.policy.mgt + true + 60000 + 5 + 8 + 20 + + + Simple true - + + + 20 + 20 + 20 + 20 + 20 + 20 + + true + + + true + 600 + + 10000 + true 86400 - - true - 300 - + + + + jdbc/DM_ARCHIVAL_DS + + + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivalTask + + 0 0 0 1/1 * ? * + + 30 + 1000 + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivedDataDeletionTask + + 0 0 3 1/1 * ? * + + 365 + + + + + false + + + false + false + + false + + + + + * + + + + + + true + wss://localhost:9443 + 2 + 100 + 20 + 15 + 640 + + BYOD,COPE diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml index da1cd06086..76e5c27a9d 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml @@ -24,7 +24,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index dcee5a5c36..87116512b4 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 960e77fd3b..7a94b5d5b8 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java index 4611deb8f3..7240c38f23 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java @@ -36,6 +36,7 @@ public class DeviceTypeConfigUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index cc293d837b..73412ae9d7 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 6469050a5a..7e1a22f8a4 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index 10770512c4..d2f8663864 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 5351720f0e..31e180e3d9 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 7fd736a93a..471af1e6ee 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index e49aeeb8d6..ed03d6183d 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 7de02e5199..0b18feed78 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherUtil.java index 086b04c4a7..a86b38ee1d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherUtil.java @@ -36,8 +36,9 @@ public class DataPublisherUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new DataPublisherConfigurationException("Error occurred while parsing file, while converting " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index c89a17b079..f1eb04a814 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/ActivityIdList.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/ActivityIdList.java new file mode 100644 index 0000000000..4dce0fc628 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/ActivityIdList.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2018, 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.device.mgt.jaxrs.common; + +import java.util.Arrays; +import java.util.List; + +public class ActivityIdList { + + private String ids; + private List idList; + + public ActivityIdList(String ids) { + this.ids = ids; + if (ids != null) { + String[] splits = ids.split(","); + if (splits.length > 0 && splits.length < 11 && splits[0] != null && !splits[0].isEmpty()) { + idList = Arrays.asList(splits); + } + } + } + + public List getIdList() { + return idList; + } + + public String getIds() { + return ids; + } +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 655559713a..302869e107 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -18,16 +18,33 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Extension; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Info; +import io.swagger.annotations.ResponseHeader; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Tag; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.common.ActivityIdList; import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -139,6 +156,68 @@ public interface ActivityInfoProviderService { required = false) @HeaderParam("If-Modified-Since") String ifModifiedSince); + @GET + @Path("/ids") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting Details of activities for given set of activity/operation Ids", + notes = "Retrieve the details of specific activity/operation Ids, such as the meta information of " + + "an operation, including the responses from the devices.", + tags = "Activity Info Provider", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched the activity details.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 400, + message = "Bad Request. \n Activity Ids shouldn't be empty", + response = ErrorResponse.class), + @ApiResponse( + code = 401, + message = "Unauthorized. \n Unauthorized operation! Only admin role can perform this " + + "operation."), + @ApiResponse( + code = 404, + message = "Not Found. \n No activity found with the given IDs.", + response = ErrorResponse.class), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n ErrorResponse occurred while fetching the activity " + + "list for the supplied ids.", + response = ErrorResponse.class) + }) + Response getActivities( + @ApiParam( + name = "ids", + value = "Comma separated activity/operation ids", + required = true, + defaultValue = "ACTIVITY_0") + @QueryParam("ids") ActivityIdList activityIdList); + @GET @Path("/{id}/{devicetype}/{deviceid}") diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java index 4b1d7bee50..45ad77ee78 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -26,13 +26,20 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementExcept import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.common.ActivityIdList; import org.wso2.carbon.device.mgt.jaxrs.service.api.ActivityInfoProviderService; import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.user.api.UserStoreException; import javax.validation.constraints.Size; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.text.ParseException; @@ -79,6 +86,55 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService } } + @GET + @Override + @Path("/ids") + public Response getActivities(@QueryParam("ids") ActivityIdList activityIdList) { + + List idList; + idList = activityIdList.getIdList(); + if (idList == null || idList.isEmpty()) { + String msg = "Activity Ids shouldn't be empty"; + log.error(msg); + return Response.status(400).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } + Response validationFailedResponse = validateAdminUser(); + if (validationFailedResponse == null) { + List activities; + ActivityList activityList = new ActivityList(); + DeviceManagementProviderService dmService; + try { + for (String id : idList) { + RequestValidationUtil.validateActivityId(id); + } + dmService = DeviceMgtAPIUtils.getDeviceManagementService(); + activities = dmService.getOperationByActivityIds(idList); + if (!activities.isEmpty()) { + activityList.setList(activities); + int count = activities.size(); + if (log.isDebugEnabled()) { + log.debug("Number of activities : " + count); + } + activityList.setCount(count); + return Response.ok().entity(activityList).build(); + } else { + String msg = "No activity found with the given IDs."; + log.error(msg); + return Response.status(404).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } + } catch (OperationManagementException e) { + String msg = "ErrorResponse occurred while fetching the activity list for the supplied ids."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } + } else { + return validationFailedResponse; + } + } + @GET @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index 311dd44a06..b9070a0df2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -70,7 +70,7 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { @PathParam("deviceType") String deviceType, @QueryParam("from") long from, @QueryParam("to") long to) { try { - if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) { + if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { return Response.status(Response.Status.BAD_REQUEST.getStatusCode()) .entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build(); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java index d6e921c0ca..7c1b5dc86a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java @@ -188,24 +188,24 @@ public class RequestValidationUtil { public static void validateActivityId(String activityId) { if (activityId == null || activityId.isEmpty()) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Activity Id " + - "cannot be null or empty. It should be in the form of " + + throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder().setCode(400l) + .setMessage("Activity Id cannot be null or empty. It should be in the form of " + "'[ACTIVITY][_][any-positive-integer]' instead").build()); } String[] splits = activityId.split("_"); - if (splits == null || splits[0] == null || splits[0].isEmpty() || !"ACTIVITY".equals(splits[0]) || - splits[1] == null || splits[0].isEmpty()) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( - "Activity Id should be in the form of '[ACTIVITY][_][any-positive-integer]'").build()); - } - try { - Long.parseLong(splits[1]); - } catch (NumberFormatException e) { - throw new InputValidationException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage( - "Activity Id should be in the form of '[ACTIVITY][_][any-positive-integer]'").build()); + if (splits.length > 1 && splits[0] != null && !splits[0].isEmpty() && "ACTIVITY".equals(splits[0])) { + try { + Long.parseLong(splits[1]); + } catch (NumberFormatException e) { + throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder().setCode(400l) + .setMessage( + "Activity Id should be in the form of '[ACTIVITY][_][any-positive-integer]'") + .build()); + } + } else { + throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder().setCode(400l) + .setMessage("Activity Id should be in the form of '[ACTIVITY][_][any-positive-integer]'") + .build()); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImplTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImplTest.java new file mode 100644 index 0000000000..0db0ac07b7 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImplTest.java @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2018, 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.device.mgt.jaxrs.service.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.testng.Assert; +import org.testng.IObjectFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.ObjectFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.wso2.carbon.device.mgt.jaxrs.common.ActivityIdList; +import org.wso2.carbon.device.mgt.jaxrs.service.api.ActivityInfoProviderService; +import org.wso2.carbon.device.mgt.jaxrs.service.api.DeviceManagementService; +import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; +import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; +import org.wso2.carbon.policy.mgt.core.util.PolicyManagerUtil; + +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; + +import static org.mockito.MockitoAnnotations.initMocks; + +/** + * This is a test class for {@link ActivityProviderServiceImpl}. + */ +@PowerMockIgnore("javax.ws.rs.*") +@SuppressStaticInitializationFor({ "org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils", + "org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.context.PrivilegedCarbonContext" }) +@PrepareForTest({ DeviceMgtAPIUtils.class, PolicyManagerUtil.class, PrivilegedCarbonContext.class }) +public class ActivityProviderServiceImplTest { + + private static final Log log = LogFactory.getLog(ActivityProviderServiceImplTest.class); + private static final String TEST_ACTIVITY_ID = "ACTIVITY_1"; + private static final String IF_MODIFIED_SINCE = "01Aug2018"; + private static final String DEVICE_TYPE = "android"; + private static final String DEVICE_ID = "1234567"; + private static final String OPERATION_CODE = "111222"; + private static final int OFFSET = 0; + private static final int LIMIT = 5; + private static final String TEST_ACTIVITY_ID_LIST = "ACTIVITY_1,ACTIVITY_2"; + private static final List idList = new ArrayList(); + private static final List activities = new ArrayList<>(); + private static final ActivityIdList activityList = new ActivityIdList(TEST_ACTIVITY_ID_LIST); + private static final ActivityIdList activityListEmpty = new ActivityIdList(""); + + private List idList1; + private Activity activity; + private List activities1; + + private DeviceManagementService deviceManagementService; + private DeviceAccessAuthorizationService deviceAccessAuthorizationService; + private DeviceManagementProviderService deviceManagementProviderService; + private ActivityInfoProviderService activityInfoProviderService; + private DeviceIdentifier deviceIdentifier; + + @ObjectFactory + public IObjectFactory getObjectFactory() { + return new org.powermock.modules.testng.PowerMockObjectFactory(); + } + + @BeforeClass + public void init() { + log.info("Initializing ActivityProviderServiceImplTest tests"); + initMocks(this); + this.deviceManagementProviderService = Mockito.mock(DeviceManagementProviderServiceImpl.class, + Mockito.RETURNS_MOCKS); + this.deviceIdentifier = new DeviceIdentifier(); + this.deviceManagementService = new DeviceManagementServiceImpl(); + this.activityInfoProviderService = new ActivityProviderServiceImpl(); + this.deviceAccessAuthorizationService = Mockito.mock(DeviceAccessAuthorizationServiceImpl.class); + idList.add("ACTIVITY_1"); + idList.add("ACTIVITY_2"); + this.activity = new Activity(); + Activity activity1 = new Activity(); + Activity activity2 = new Activity(); + activity1.setActivityId("ACTIVITY_1"); + activity2.setActivityId("ACTIVITY_2"); + activities.add(activity1); + activities.add(activity2); + } + + @Test(description = + "This method tests getting details of an activity with an admin user with an existing" + + " activity Id") + public void testGetActivitiesWithValidAdminUserWithValidId() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getOperationByActivityId(TEST_ACTIVITY_ID)) + .thenReturn(activity); + Response response = this.activityInfoProviderService.getActivity(TEST_ACTIVITY_ID, IF_MODIFIED_SINCE); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests getting details of an activity with an invalid admin user") + public void testGetActivitiesWithInvalidAdminUserWithValidId() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(false); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getOperationByActivityId(TEST_ACTIVITY_ID)) + .thenReturn(activity); + Response response = this.activityInfoProviderService.getActivity(TEST_ACTIVITY_ID, IF_MODIFIED_SINCE); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.UNAUTHORIZED.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests getting details of an activity which does not exists") + public void testGetActivitiesWithNonExistingActivityID() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getOperationByActivityId(TEST_ACTIVITY_ID)) + .thenReturn(null); + Response response = this.activityInfoProviderService.getActivity(TEST_ACTIVITY_ID, IF_MODIFIED_SINCE); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests the getActivity method under negative conditions.") + public void testGetActivitiesWithOperationManagementException() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getOperationByActivityId(Mockito.any())).thenThrow( + new OperationManagementException()); + Response response = this.activityInfoProviderService.getActivity(TEST_ACTIVITY_ID, IF_MODIFIED_SINCE); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests getting details of list of given activity IDs") + public void testGetActivitiesWithActivityIdList() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getOperationByActivityIds(idList)).thenReturn( + activities); + Response response = this.activityInfoProviderService.getActivities(activityList); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests trying to get details activity IDs when call with empty list") + public void testGetActivitiesWithEmptyActivityIdList() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + Response response = this.activityInfoProviderService.getActivities(activityListEmpty); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests trying to get details of a list activity IDs which does not exists") + public void testGetActivitiesWithNonExistingActivityIdList() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService.getOperationByActivityIds(idList1)).thenReturn( + activities1); + Response response = this.activityInfoProviderService.getActivities(activityList); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests getting details of an activity for a given device") + public void testGetActivitiesByDevice() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when(this.deviceManagementProviderService + .getOperationByActivityIdAndDevice(TEST_ACTIVITY_ID, deviceIdentifier)).thenReturn(activity); + Response response = this.activityInfoProviderService.getActivityByDevice(TEST_ACTIVITY_ID, + DEVICE_TYPE, DEVICE_ID, IF_MODIFIED_SINCE); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests getting details of an activity for a given device") + public void testGetActivities() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(true); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when( + this.deviceManagementProviderService.getFilteredActivities(OPERATION_CODE, OFFSET, LIMIT)) + .thenReturn(activities); + Response response = this.activityInfoProviderService.getActivities(OPERATION_CODE, OFFSET, LIMIT); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + + @Test(description = "This method tests getting details of an activity for a given device") + public void testGetActivitiesForInvalidUser() throws OperationManagementException { + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "isAdmin")).toReturn(false); + PowerMockito.stub(PowerMockito.method(RequestValidationUtil.class, "validateActivityId")); + PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) + .toReturn(this.deviceManagementProviderService); + Mockito.when( + this.deviceManagementProviderService.getFilteredActivities(OPERATION_CODE, OFFSET, LIMIT)) + .thenReturn(activities); + Response response = this.activityInfoProviderService.getActivities(OPERATION_CODE, OFFSET, LIMIT); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.UNAUTHORIZED.getStatusCode()); + Mockito.reset(this.deviceManagementProviderService); + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 49b8f92576..e0fc64fa7d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/GeneralConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/GeneralConfig.java new file mode 100644 index 0000000000..f9e75b4450 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/general/GeneralConfig.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018, 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.device.mgt.common.general; + +public class GeneralConfig { + + private boolean policyMonitoringEnabled; + + public boolean isPolicyMonitoringEnabled() { + return policyMonitoringEnabled; + } + + public void setPolicyMonitoringEnabled(boolean policyMonitoringEnabled) { + this.policyMonitoringEnabled = policyMonitoringEnabled; + } +} + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java index 19443007ae..6dc9d55305 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java @@ -91,6 +91,8 @@ public interface OperationManager { Activity getOperationByActivityId(String activity) throws OperationManagementException; + List getOperationByActivityIds(List idList) throws OperationManagementException; + Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId) throws OperationManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java index 8cbe049245..b14a5ab920 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java @@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.common.spi; import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; +import org.wso2.carbon.device.mgt.common.general.GeneralConfig; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -52,4 +53,6 @@ public interface DeviceManagementService { DeviceStatusTaskPluginConfig getDeviceStatusTaskPluginConfig(); + GeneralConfig getGeneralConfig(); + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 05afd13f68..1f4105c732 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml @@ -170,7 +170,6 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.analytics.data.publisher - provided org.slf4j diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java index 175ad8488f..df57f65af4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java @@ -17,10 +17,11 @@ */ package org.wso2.carbon.device.mgt.core.config; +import org.wso2.carbon.device.mgt.core.config.analytics.OperationAnalyticsConfiguration; import org.wso2.carbon.device.mgt.core.config.archival.ArchivalConfiguration; import org.wso2.carbon.device.mgt.core.config.cache.CertificateCacheConfiguration; -import org.wso2.carbon.device.mgt.core.config.geo.location.OperationAnalyticsConfiguration; import org.wso2.carbon.device.mgt.core.config.cache.DeviceCacheConfiguration; +import org.wso2.carbon.device.mgt.core.config.geo.location.GeoLocationConfiguration; import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations; import org.wso2.carbon.device.mgt.core.config.keymanager.KeyManagerConfigurations; import org.wso2.carbon.device.mgt.core.config.pagination.PaginationConfiguration; @@ -53,6 +54,7 @@ public final class DeviceManagementConfig { private DeviceCacheConfiguration deviceCacheConfiguration; private CertificateCacheConfiguration certificateCacheConfiguration; private OperationAnalyticsConfiguration operationAnalyticsConfiguration; + private GeoLocationConfiguration geoLocationConfiguration; private String defaultGroupsConfiguration; private RemoteSessionConfiguration remoteSessionConfiguration; private ArchivalConfiguration archivalConfiguration; @@ -167,6 +169,15 @@ public final class DeviceManagementConfig { this.operationAnalyticsConfiguration = operationAnalyticsConfiguration; } + @XmlElement(name = "GeoLocationConfiguration", required = true) + public GeoLocationConfiguration getGeoLocationConfiguration() { + return geoLocationConfiguration; + } + + public void setGeoLocationConfiguration(GeoLocationConfiguration geoLocationConfiguration) { + this.geoLocationConfiguration = geoLocationConfiguration; + } + @XmlElement(name = "DefaultGroupsConfiguration", required = true) public String getDefaultGroupsConfiguration() { return defaultGroupsConfiguration; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/analytics/OperationAnalyticsConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/analytics/OperationAnalyticsConfiguration.java new file mode 100644 index 0000000000..b523b72b66 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/analytics/OperationAnalyticsConfiguration.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2018, 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.device.mgt.core.config.analytics; + +import org.wso2.carbon.device.mgt.core.config.analytics.operation.OperationResponseConfigurations; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * This class represents the information related to Device Operation Analytics configuration. + */ +@XmlRootElement(name = "OperationAnalyticsConfiguration") +public class OperationAnalyticsConfiguration { + + private boolean isPublishDeviceInfoResponseEnabled; + private boolean isPublishLocationResponseEnabled; + private OperationResponseConfigurations operationResponseConfigurations; + + public boolean isPublishDeviceInfoResponseEnabled() { + return isPublishDeviceInfoResponseEnabled; + } + + @XmlElement(name = "PublishDeviceInfoResponse", required = true) + public void setPublishDeviceInfoResponseEnabled(boolean publishDeviceInfoResponseEnabled) { + this.isPublishDeviceInfoResponseEnabled = publishDeviceInfoResponseEnabled; + } + + public boolean isPublishLocationResponseEnabled() { + return isPublishLocationResponseEnabled; + } + + @XmlElement(name = "PublishLocationResponse", required = true) + public void setPublishLocationResponseEnabled(boolean publishLocationResponseEnabled) { + this.isPublishLocationResponseEnabled = publishLocationResponseEnabled; + } + + public OperationResponseConfigurations getOperationResponseConfigurations() { + return operationResponseConfigurations; + } + + @XmlElement(name = "PublishOperationResponse", required = true) + public void setOperationResponseConfigurations( + OperationResponseConfigurations operationResponseConfigurations) { + this.operationResponseConfigurations = operationResponseConfigurations; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/analytics/operation/OperationResponseConfigurations.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/analytics/operation/OperationResponseConfigurations.java new file mode 100644 index 0000000000..af09cbd930 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/analytics/operation/OperationResponseConfigurations.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018, 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.device.mgt.core.config.analytics.operation; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +/** + * This class represents the information related to Operation response configuration. + */ +@XmlRootElement(name = "PublishOperationResponse") +public class OperationResponseConfigurations { + + private boolean enabled; + private List operations; + + public boolean isEnabled() { + return enabled; + } + + @XmlElement(name = "Enabled", required = true) + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public List getOperations() { + return operations; + } + + @XmlElementWrapper(name = "Operations", required = true) + @XmlElement(name = "Operation", required = true) + public void setOperations(List operations) { + this.operations = operations; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java similarity index 51% rename from components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java rename to components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java index 8cc2053e64..d81b525df0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2018, 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 @@ -22,29 +22,19 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** - * This class represents the information related to Device Operation Analytics configuration. + * This class represents the information related to Geo Location configuration. */ -@XmlRootElement(name = "OperationAnalyticsConfiguration") -public class OperationAnalyticsConfiguration { +@XmlRootElement(name = "GeoLocationConfiguration") +public class GeoLocationConfiguration { - private boolean publishOperationResponse; - private boolean isEnabled; + private boolean enabled; - public boolean getPublishOperationResponse() { - return publishOperationResponse; + public boolean getEnabled() { + return enabled; } - @XmlElement(name = "PublishOperationResponse", required = true) - public void setPublishOperationResponse(boolean publishOperationResponse) { - this.publishOperationResponse = publishOperationResponse; - } - - public boolean getIsEnabled() { - return isEnabled; - } - - @XmlElement(name = "isEnabled", required = true) + @XmlElement(name = "Enabled", required = true) public void setEnabled(boolean enabled) { - isEnabled = enabled; + this.enabled = enabled; } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java index 986eae6532..0d4712ca01 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java @@ -31,6 +31,9 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; import java.io.StringReader; import java.io.StringWriter; import java.nio.charset.Charset; @@ -80,14 +83,19 @@ public class PlatformConfigurationManagementServiceImpl try { resource = ConfigurationManagerUtil.getRegistryResource(resourcePath); if(resource != null){ - JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class); - Unmarshaller unmarshaller = context.createUnmarshaller(); - return (PlatformConfiguration) unmarshaller.unmarshal( + XMLInputFactory factory = XMLInputFactory.newFactory(); + factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); + factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); + XMLStreamReader reader = factory.createXMLStreamReader( new StringReader(new String((byte[]) resource.getContent(), Charset .forName(ConfigurationManagerConstants.CharSets.CHARSET_UTF8)))); + + JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class); + Unmarshaller unmarshaller = context.createUnmarshaller(); + return (PlatformConfiguration) unmarshaller.unmarshal(reader); } return new PlatformConfiguration(); - } catch (JAXBException e) { + } catch (JAXBException | XMLStreamException e) { throw new ConfigurationManagementException( "Error occurred while parsing the Tenant configuration : " + e.getMessage(), e); } catch (RegistryException 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/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 0a7f22dbf0..385ab18477 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 @@ -74,7 +74,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceDetailsDAO.addDeviceProperties(deviceInfo.getDeviceDetailsMap(), device.getId()); DeviceManagementDAOFactory.commitTransaction(); - if (DeviceManagerUtil.isPublishOperationResponseEnabled()) { + if (DeviceManagerUtil.isPublishDeviceInfoResponseEnabled()) { Object[] metaData = {device.getDeviceIdentifier(), device.getType()}; Object[] payload = new Object[]{ Calendar.getInstance().getTimeInMillis(), @@ -192,7 +192,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { deviceDAO.updateDevice(device, CarbonContext.getThreadLocalCarbonContext().getTenantId()); deviceDetailsDAO.deleteDeviceLocation(deviceLocation.getDeviceId()); deviceDetailsDAO.addDeviceLocation(deviceLocation); - if (DeviceManagerUtil.isPublishOperationResponseEnabled()) { + if (DeviceManagerUtil.isPublishLocationResponseEnabled()) { Object[] metaData = {device.getDeviceIdentifier(), device.getType()}; Object[] payload = new Object[]{ deviceLocation.getUpdatedTime().getTime(), diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 3f80da9693..86c9fa2bbc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -155,6 +155,7 @@ public class OperationManagerImpl implements OperationManager { boolean hasExistingTaskOperation; int enrolmentId; + List devices = new ArrayList<>(); if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == operationDto. getControl()) { isNotRepeated = true; @@ -164,6 +165,7 @@ public class OperationManagerImpl implements OperationManager { String operationCode = operationDto.getCode(); for (DeviceIdentifier deviceId : authorizedDeviceList) { Device device = getDevice(deviceId); + devices.add(device); enrolmentId = device.getEnrolmentInfo().getId(); //Do not repeat the task operations if (isScheduledOperation) { @@ -181,30 +183,46 @@ public class OperationManagerImpl implements OperationManager { } else { operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled); } - /* - If notification strategy has not enable to send push notification using scheduler task - we will send notification immediately - */ - if (notificationStrategy != null && !isScheduled) { + } + OperationManagementDAOFactory.commitTransaction(); + + /* + If notification strategy has not enable to send push notification using scheduler task we will send + notification immediately. This is done in separate loop inorder to prevent overlap with DB insert + operations with the possible db update operations trigger followed by pending operation call. + Otherwise device may call pending operation while DB is locked for write and deadlock can occur. + */ + if (notificationStrategy != null && !isScheduled) { + for (Device device : devices) { + DeviceIdentifier deviceId = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()); + if (log.isDebugEnabled()) { + log.debug("Sending push notification to " + deviceId + " from add operation method."); + } + operation.setId(operationId); + operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId); try { - if (log.isDebugEnabled()) { - log.debug("Sending push notification to " + deviceId + " from add operation method."); - } - operation.setId(operationId); - operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId); notificationStrategy.execute(new NotificationContext(deviceId, operation)); - operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.COMPLETED); } catch (PushNotificationExecutionFailedException e) { - log.error("Error occurred while sending push notifications to " + - deviceId.getType() + " device carrying id '" + - deviceId + "'", e); - // Reschedule if push notification failed. - operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED); + log.error("Error occurred while sending push notifications to " + deviceId.getType() + + " device carrying id '" + deviceId + "'", e); + /* + Reschedule if push notification failed. Doing db transactions in atomic way to prevent + deadlocks. + */ + enrolmentId = device.getEnrolmentInfo().getId(); + try { + operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon + .device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED); + OperationManagementDAOFactory.commitTransaction(); + } catch (OperationManagementDAOException ex) { + // Not throwing this exception in order to keep sending remaining notifications if any. + log.error("Error occurred while setting push notification status to SCHEDULED.", ex); + OperationManagementDAOFactory.rollbackTransaction(); + } } } } - OperationManagementDAOFactory.commitTransaction(); Activity activity = new Activity(); activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId); activity.setCode(operationCode); @@ -737,6 +755,35 @@ public class OperationManagerImpl implements OperationManager { } } + @Override + public List getOperationByActivityIds(List activities) + throws OperationManagementException { + List operationIds = new ArrayList<>(); + for (String id : activities) { + int operationId = Integer.parseInt( + id.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, "")); + if (operationId == 0) { + throw new IllegalArgumentException("Operation ID cannot be null or zero (0)."); + } else { + operationIds.add(operationId); + } + } + + try { + OperationManagementDAOFactory.openConnection(); + return operationDAO.getActivityList(operationIds); + } catch (SQLException e) { + throw new OperationManagementException( + "Error occurred while opening a connection to the data source.", e); + } catch (OperationManagementDAOException e) { + throw new OperationManagementException( + "Error occurred while retrieving the operation with activity Id '" + activities + .toString(), e); + } finally { + OperationManagementDAOFactory.closeConnection(); + } + } + public Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId) throws OperationManagementException { // This parses the operation id from activity id (ex : ACTIVITY_23) and converts to the integer. int operationId = Integer.parseInt( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java index 14dfc68090..908068b394 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationDAO.java @@ -61,6 +61,8 @@ public interface OperationDAO { Activity getActivity(int operationId) throws OperationManagementDAOException; + List getActivityList(List operationIds) throws OperationManagementDAOException; + Activity getActivityByDevice(int operationId, int deviceId) throws OperationManagementDAOException; List getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementDAOException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index d897f861db..6c7225b80d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -309,6 +309,133 @@ public class GenericOperationDAOImpl implements OperationDAO { return activity; } + + @Override + public List getActivityList(List activityIds) throws OperationManagementDAOException { + PreparedStatement stmt = null; + ResultSet rs = null; + Activity activity; + List activities = new ArrayList<>(); + Object[] data = activityIds.toArray(); + + try { + Connection conn = OperationManagementDAOFactory.getConnection(); + String sql = + "SELECT eom.ENROLMENT_ID, eom.OPERATION_ID, eom.ID AS EOM_MAPPING_ID, " + + "dor.ID AS OP_RES_ID, de.DEVICE_ID, d.DEVICE_IDENTIFICATION, d.DEVICE_TYPE_ID, " + + "dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, " + + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, " + + "dor.OPERATION_RESPONSE, dor.RECEIVED_TIMESTAMP FROM " + + "DM_ENROLMENT_OP_MAPPING eom INNER JOIN DM_OPERATION op " + + "ON op.ID=eom.OPERATION_ID INNER JOIN DM_ENROLMENT de " + + "ON de.ID=eom.ENROLMENT_ID INNER JOIN DM_DEVICE d ON d.ID=de.DEVICE_ID \n" + + "INNER JOIN DM_DEVICE_TYPE dt ON dt.ID=d.DEVICE_TYPE_ID\n" + + "LEFT JOIN DM_DEVICE_OPERATION_RESPONSE dor ON dor.ENROLMENT_ID=de.id \n" + + "AND dor.OPERATION_ID = eom.OPERATION_ID WHERE eom.OPERATION_ID " + + "IN (SELECT * FROM TABLE(x INT = ?)) AND de.TENANT_ID = ?"; + + stmt = conn.prepareStatement(sql); + stmt.setObject(1, data); + + stmt.setInt(2, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); + rs = stmt.executeQuery(); + + int operationId = 0; + int enrolmentId = 0; + int responseId = 0; + ActivityStatus activityStatus = new ActivityStatus(); + while (rs.next()) { + activity = new Activity(); + + if (operationId != rs.getInt("OPERATION_ID")) { + activities.add(activity); + List statusList = new ArrayList<>(); + activityStatus = new ActivityStatus(); + + operationId = rs.getInt("OPERATION_ID"); + enrolmentId = rs.getInt("ENROLMENT_ID"); + + activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); + activity.setCreatedTimeStamp( + new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); + activity.setCode(rs.getString("OPERATION_CODE")); + + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); + deviceIdentifier.setType(rs.getString("DEVICE_TYPE_NAME")); + + activityStatus.setDeviceIdentifier(deviceIdentifier); + + activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS"))); + + List operationResponses = new ArrayList<>(); + if (rs.getInt("UPDATED_TIMESTAMP") != 0) { + activityStatus.setUpdatedTimestamp( + new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); + + } + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { + operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); + responseId = rs.getInt("OP_RES_ID"); + } + activityStatus.setResponses(operationResponses); + statusList.add(activityStatus); + activity.setActivityStatus(statusList); + activity.setActivityId(OperationDAOUtil.getActivityId(rs.getInt("OPERATION_ID"))); + } + + if (operationId == rs.getInt("OPERATION_ID") && enrolmentId != rs.getInt("ENROLMENT_ID")) { + activityStatus = new ActivityStatus(); + + activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); + activity.setCreatedTimeStamp( + new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); + activity.setCode(rs.getString("OPERATION_CODE")); + + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); + deviceIdentifier.setType(rs.getString("DEVICE_TYPE_NAME")); + activityStatus.setDeviceIdentifier(deviceIdentifier); + + activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS"))); + + List operationResponses = new ArrayList<>(); + if (rs.getInt("UPDATED_TIMESTAMP") != 0) { + activityStatus.setUpdatedTimestamp( + new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); + } + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { + operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); + responseId = rs.getInt("OP_RES_ID"); + } + activityStatus.setResponses(operationResponses); + activity.getActivityStatus().add(activityStatus); + + enrolmentId = rs.getInt("ENROLMENT_ID"); + } + + if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID") && rs.getTimestamp( + "RECEIVED_TIMESTAMP") != null) { + activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs)); + responseId = rs.getInt("OP_RES_ID"); + } + } + + } catch (SQLException e) { + throw new OperationManagementDAOException( + "Error occurred while getting the operation details from " + "the database.", e); + } catch (ClassNotFoundException e) { + throw new OperationManagementDAOException( + "Error occurred while converting the operation response to string.", e); + } catch (IOException e) { + throw new OperationManagementDAOException( + "IO exception occurred while converting the operations responses.", e); + } finally { + OperationManagementDAOUtil.cleanupResources(stmt, rs); + } + return activities; + } + public Activity getActivityByDevice(int operationId, int deviceId) throws OperationManagementDAOException { PreparedStatement stmt = null; @@ -482,7 +609,7 @@ public class GenericOperationDAOImpl implements OperationDAO { rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); } - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -512,7 +639,7 @@ public class GenericOperationDAOImpl implements OperationDAO { activityStatus.setUpdatedTimestamp(new java.util.Date( rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); } - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -523,7 +650,7 @@ public class GenericOperationDAOImpl implements OperationDAO { } if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID")) { - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -669,7 +796,7 @@ public class GenericOperationDAOImpl implements OperationDAO { rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); } - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -699,7 +826,7 @@ public class GenericOperationDAOImpl implements OperationDAO { activityStatus.setUpdatedTimestamp(new java.util.Date( rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); } - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -710,7 +837,7 @@ public class GenericOperationDAOImpl implements OperationDAO { } if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID")) { - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java index f935cab57a..a197769c26 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java @@ -77,6 +77,139 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { return isUpdated; } + @Override + public List getActivityList(List activityIds) throws OperationManagementDAOException { + PreparedStatement stmt = null; + ResultSet rs = null; + Activity activity; + List activities = new ArrayList<>(); + + try { + Connection conn = OperationManagementDAOFactory.getConnection(); + + String sql1 = "SELECT eom.ENROLMENT_ID, eom.OPERATION_ID, eom.ID AS EOM_MAPPING_ID, " + + "dor.ID AS OP_RES_ID, de.DEVICE_ID, d.DEVICE_IDENTIFICATION, d.DEVICE_TYPE_ID, " + + "dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, " + + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, " + + "dor.OPERATION_RESPONSE, dor.RECEIVED_TIMESTAMP FROM " + + "DM_ENROLMENT_OP_MAPPING eom INNER JOIN DM_OPERATION op " + + "ON op.ID=eom.OPERATION_ID INNER JOIN DM_ENROLMENT de " + + "ON de.ID=eom.ENROLMENT_ID INNER JOIN DM_DEVICE d ON d.ID=de.DEVICE_ID \n" + + "INNER JOIN DM_DEVICE_TYPE dt ON dt.ID=d.DEVICE_TYPE_ID\n" + + "LEFT JOIN DM_DEVICE_OPERATION_RESPONSE dor ON dor.ENROLMENT_ID=de.id \n" + + "AND dor.OPERATION_ID = eom.OPERATION_ID WHERE eom.OPERATION_ID " + "IN ("; + + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < activityIds.size(); i++) { + builder.append("?,"); + } + sql1 += builder.deleteCharAt(builder.length() - 1).toString() + ") AND de.TENANT_ID = ?"; + stmt = conn.prepareStatement(sql1); + int i; + for (i = 0; i < activityIds.size(); i++) { + stmt.setInt(i + 1, activityIds.get(i)); + } + stmt.setInt(i + 1, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); + + rs = stmt.executeQuery(); + + int operationId = 0; + int enrolmentId = 0; + int responseId = 0; + ActivityStatus activityStatus = new ActivityStatus(); + while (rs.next()) { + activity = new Activity(); + + if (operationId != rs.getInt("OPERATION_ID")) { + activities.add(activity); + List statusList = new ArrayList<>(); + activityStatus = new ActivityStatus(); + + operationId = rs.getInt("OPERATION_ID"); + enrolmentId = rs.getInt("ENROLMENT_ID"); + + activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); + activity.setCreatedTimeStamp( + new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); + activity.setCode(rs.getString("OPERATION_CODE")); + + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); + deviceIdentifier.setType(rs.getString("DEVICE_TYPE_NAME")); + + activityStatus.setDeviceIdentifier(deviceIdentifier); + + activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS"))); + + List operationResponses = new ArrayList<>(); + if (rs.getInt("UPDATED_TIMESTAMP") != 0) { + activityStatus.setUpdatedTimestamp( + new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); + + } + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { + operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); + responseId = rs.getInt("OP_RES_ID"); + } + activityStatus.setResponses(operationResponses); + statusList.add(activityStatus); + activity.setActivityStatus(statusList); + activity.setActivityId(OperationDAOUtil.getActivityId(rs.getInt("OPERATION_ID"))); + } + + if (operationId == rs.getInt("OPERATION_ID") && enrolmentId != rs.getInt("ENROLMENT_ID")) { + activityStatus = new ActivityStatus(); + + activity.setType(Activity.Type.valueOf(rs.getString("OPERATION_TYPE"))); + activity.setCreatedTimeStamp( + new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString()); + activity.setCode(rs.getString("OPERATION_CODE")); + + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(rs.getString("DEVICE_IDENTIFICATION")); + deviceIdentifier.setType(rs.getString("DEVICE_TYPE_NAME")); + activityStatus.setDeviceIdentifier(deviceIdentifier); + + activityStatus.setStatus(ActivityStatus.Status.valueOf(rs.getString("STATUS"))); + + List operationResponses = new ArrayList<>(); + if (rs.getInt("UPDATED_TIMESTAMP") != 0) { + activityStatus.setUpdatedTimestamp( + new java.util.Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); + } + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { + operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); + responseId = rs.getInt("OP_RES_ID"); + } + activityStatus.setResponses(operationResponses); + activity.getActivityStatus().add(activityStatus); + + enrolmentId = rs.getInt("ENROLMENT_ID"); + } + + if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID") && rs.getTimestamp( + "RECEIVED_TIMESTAMP") != null) { + activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs)); + responseId = rs.getInt("OP_RES_ID"); + } + } + + } catch (SQLException e) { + throw new OperationManagementDAOException( + "Error occurred while getting the operation details from " + "the database.", e); + } catch (ClassNotFoundException e) { + throw new OperationManagementDAOException( + "Error occurred while converting the operation response to string.", e); + } catch (IOException e) { + throw new OperationManagementDAOException( + "IO exception occurred while converting the operations responses.", e); + } finally { + OperationManagementDAOUtil.cleanupResources(stmt, rs); + } + return activities; + } + + @Override public List getActivitiesUpdatedAfter(long timestamp, int limit, @@ -176,7 +309,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); } - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -206,7 +339,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { activityStatus.setUpdatedTimestamp(new java.util.Date( rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); } - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { operationResponses.add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -217,7 +350,7 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { } if (rs.getInt("OP_RES_ID") != 0 && responseId != rs.getInt("OP_RES_ID")) { - if (rs.getTimestamp("RECEIVED_TIMESTAMP") != (null)) { + if (rs.getTimestamp("RECEIVED_TIMESTAMP") != null) { activityStatus.getResponses().add(OperationDAOUtil.getOperationResponse(rs)); responseId = rs.getInt("OP_RES_ID"); } @@ -235,4 +368,14 @@ public class MySQLOperationDAOImpl extends GenericOperationDAOImpl { } return activities; } + + private Integer[] getIntArrayOfActivityIds(List activityIds) { + Integer[] arr = new Integer[activityIds.size()]; + int x = 0; + for (Integer activityId : activityIds) { + arr[x] = activityId; + x++; + } + return arr; + } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java index 35f6a6d6eb..6a8a5b75c1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java @@ -120,8 +120,9 @@ public class PermissionUtils { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new PermissionManagementException("Error occurred while parsing file, while converting " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index ee45f88f0b..fd69c1b209 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -523,6 +523,8 @@ public interface DeviceManagementProviderService { List getAvailableDeviceTypes() throws DeviceManagementException; + List getPolicyMonitoringEnableDeviceTypes() throws DeviceManagementException; + boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException; boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException; @@ -565,6 +567,8 @@ public interface DeviceManagementProviderService { Activity getOperationByActivityId(String activity) throws OperationManagementException; + List getOperationByActivityIds(List idList) throws OperationManagementException; + Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId) throws OperationManagementException; List getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 97431004a6..cf3ef11ec5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; @@ -92,6 +93,7 @@ import org.wso2.carbon.user.api.UserStoreException; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.Enumeration; import java.util.HashMap; @@ -105,6 +107,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv PluginInitializationListener { private static Log log = LogFactory.getLog(DeviceManagementProviderServiceImpl.class); + private static final String OPERATION_RESPONSE_EVENT_STREAM_DEFINITION = "org.wso2.iot.OperationResponseStream"; private DeviceDAO deviceDAO; private DeviceDetailsDAO deviceInfoDAO; private DeviceTypeDAO deviceTypeDAO; @@ -1184,6 +1187,29 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return deviceTypesResponse; } + @Override + public List getPolicyMonitoringEnableDeviceTypes() throws DeviceManagementException { + + List deviceTypes = this.getAvailableDeviceTypes(); + List deviceTypesToMonitor = new ArrayList<>(); + int tenantId = this.getTenantId(); + Map registeredTypes = + pluginRepository.getAllDeviceManagementServices(tenantId); + + List services = new ArrayList<>(registeredTypes.values()); + for (DeviceManagementService deviceType : services) { + if (deviceType != null && deviceType.getGeneralConfig() != null && + deviceType.getGeneralConfig().isPolicyMonitoringEnabled()) { + for (String type : deviceTypes) { + if (type.equalsIgnoreCase(deviceType.getType())) { + deviceTypesToMonitor.add(type); + } + } + } + } + return deviceTypesToMonitor; + } + @Override public boolean updateDeviceInfo(DeviceIdentifier deviceId, Device device) throws DeviceManagementException { if (deviceId == null || device == null) { @@ -1431,6 +1457,34 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv public void updateOperation(DeviceIdentifier deviceId, Operation operation) throws OperationManagementException { pluginRepository.getOperationManager(deviceId.getType(), this.getTenantId()) .updateOperation(deviceId, operation); + try { + if (DeviceManagerUtil.isPublishOperationResponseEnabled()) { + List permittedOperations = DeviceManagerUtil.getEnabledOperationsForResponsePublish(); + if (permittedOperations.contains(operation.getCode()) + || permittedOperations.contains("*")) { + Object[] metaData = {deviceId.getId(), deviceId.getType()}; + Object[] payload = new Object[]{ + Calendar.getInstance().getTimeInMillis(), + operation.getId(), + operation.getCode(), + operation.getType() != null ? operation.getType().toString() : null, + operation.getStatus() != null ? operation.getStatus().toString() : null, + operation.getOperationResponse() + }; + DeviceManagerUtil.getEventPublisherService().publishEvent( + OPERATION_RESPONSE_EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload + ); + } + } + } catch (DeviceManagementException e) { + String msg = "Error occurred while reading configs."; + log.error(msg, e); + throw new OperationManagementException(msg, e); + } catch (DataPublisherConfigurationException e) { + String msg = "Error occurred while publishing event."; + log.error(msg, e); + throw new OperationManagementException(msg, e); + } } @Override @@ -1480,6 +1534,11 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return DeviceManagementDataHolder.getInstance().getOperationManager().getOperationByActivityId(activity); } + @Override + public List getOperationByActivityIds(List idList) throws OperationManagementException{ + return DeviceManagementDataHolder.getInstance().getOperationManager().getOperationByActivityIds(idList); + } + public Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId) throws OperationManagementException { return DeviceManagementDataHolder.getInstance().getOperationManager().getOperationByActivityIdAndDevice(activity, deviceId); } @@ -1491,13 +1550,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } @Override - public List getFilteredActivities(String operationCode, int limit, int offset) throws OperationManagementException{ + public List getFilteredActivities(String operationCode, int limit, int offset) throws OperationManagementException { limit = DeviceManagerUtil.validateActivityListPageSize(limit); return DeviceManagementDataHolder.getInstance().getOperationManager().getFilteredActivities(operationCode, limit, offset); } @Override - public int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementException{ + public int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementException { return DeviceManagementDataHolder.getInstance().getOperationManager().getTotalCountOfFilteredActivities(operationCode); } @@ -2581,7 +2640,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } try { DeviceManagementDAOFactory.openConnection(); - return deviceDAO.findGeoClusters(southWest,northEast,geohashLength,this.getTenantId()); + return deviceDAO.findGeoClusters(southWest, northEast, geohashLength, this.getTenantId()); } catch (DeviceManagementDAOException e) { String msg = "Error occurred while retrieving the geo clusters."; log.error(msg, e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 87b6e70ac7..44d8814fcd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -31,7 +31,6 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.GroupPaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.TransactionManagementException; -import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; @@ -84,8 +83,9 @@ public final class DeviceManagerUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new DeviceManagementException("Error occurred while parsing file, while converting " + @@ -416,11 +416,22 @@ public final class DeviceManagerUtil { return limit; } - public static boolean isOperationAnalyticsEnabled() throws DeviceManagementException { + public static boolean isPublishLocationResponseEnabled() throws DeviceManagementException { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + return deviceManagementConfig.getOperationAnalyticsConfiguration().isPublishLocationResponseEnabled(); + } else { + throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + + public static boolean isPublishDeviceInfoResponseEnabled() throws DeviceManagementException { DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). getDeviceManagementConfig(); if (deviceManagementConfig != null) { - return deviceManagementConfig.getOperationAnalyticsConfiguration().getIsEnabled(); + return deviceManagementConfig.getOperationAnalyticsConfiguration().isPublishDeviceInfoResponseEnabled(); } else { throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + "cdm-config.xml file."); @@ -431,11 +442,23 @@ public final class DeviceManagerUtil { DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). getDeviceManagementConfig(); if (deviceManagementConfig != null) { - return isOperationAnalyticsEnabled() - && deviceManagementConfig.getOperationAnalyticsConfiguration().getPublishOperationResponse(); + return deviceManagementConfig.getOperationAnalyticsConfiguration() + .getOperationResponseConfigurations().isEnabled(); } else { throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); + "cdm-config.xml file."); + } + } + + public static List getEnabledOperationsForResponsePublish() throws DeviceManagementException { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + return deviceManagementConfig.getOperationAnalyticsConfiguration() + .getOperationResponseConfigurations().getOperations(); + } else { + throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java index f83100b442..29ebe9c493 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.core; import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; +import org.wso2.carbon.device.mgt.common.general.GeneralConfig; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -108,4 +109,9 @@ public class TestDeviceManagementService implements DeviceManagementService { public DeviceStatusTaskPluginConfig getDeviceStatusTaskPluginConfig() { return null; } + + @Override + public GeneralConfig getGeneralConfig() { + return null; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java index 6ee4c3af37..0ce5541596 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java @@ -104,8 +104,10 @@ public class OperationManagementTests extends BaseDeviceManagementTest { @Test public void addCommandOperation() throws DeviceManagementException, OperationManagementException, - InvalidDeviceException { - this.commandActivity = this.operationMgtService.addOperation( + InvalidDeviceException { + NotificationStrategy notificationStrategy = new TestNotificationStrategy(true); + OperationManager operationManager = new OperationManagerImpl(DEVICE_TYPE, notificationStrategy); + this.commandActivity = operationManager.addOperation( getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE), this.deviceIds); validateOperationResponse(this.commandActivity, ActivityStatus.Status.PENDING); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/TestNotificationStrategy.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/TestNotificationStrategy.java index c10fc0372f..3f71a4d4ce 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/TestNotificationStrategy.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/TestNotificationStrategy.java @@ -26,6 +26,12 @@ import java.util.HashMap; public class TestNotificationStrategy implements NotificationStrategy { private PushNotificationConfig pushNotificationConfig; + private boolean setToThrowException = false; + + public TestNotificationStrategy(boolean setToThrowException){ + this.setToThrowException = setToThrowException; + this.pushNotificationConfig = new PushNotificationConfig("TEST", true, new HashMap<>()); + } public TestNotificationStrategy(){ this.pushNotificationConfig = new PushNotificationConfig("TEST", true, new HashMap<>()); @@ -38,7 +44,9 @@ public class TestNotificationStrategy implements NotificationStrategy { @Override public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException { - + if (setToThrowException) { + throw new PushNotificationExecutionFailedException("Generated exception"); + } } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index fa199542e5..731f2ade9c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -46,6 +46,11 @@ admin admin + + https://localhost:9443 + admin + admin + org.wso2.carbon.policy.mgt true @@ -88,10 +93,60 @@ false 86400 + + + + jdbc/DM_ARCHIVAL_DS + + + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivalTask + + 0 0 0 1/1 * ? * + + 30 + 1000 + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivedDataDeletionTask + + 0 0 3 1/1 * ? * + + 365 + + + + + false + - false - false + false + false + + false + + + + + * + + + + + true + wss://localhost:9443 + 2 + 100 + 20 + 15 + 640 + BYOD,COPE diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/config/operation/cdm-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/config/operation/cdm-config.xml index 64b646890b..b425b57b9d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/config/operation/cdm-config.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/config/operation/cdm-config.xml @@ -46,6 +46,11 @@ admin admin + + https://localhost:9443 + admin + admin + org.wso2.carbon.policy.mgt true @@ -88,10 +93,60 @@ false 86400 + + + + jdbc/DM_ARCHIVAL_DS + + + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivalTask + + 0 0 0 1/1 * ? * + + 30 + 1000 + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivedDataDeletionTask + + 0 0 3 1/1 * ? * + + 365 + + + - false - false + false + + false + false + + false + + + + + * + + + + + + true + wss://localhost:9443 + 2 + 100 + 20 + 15 + 640 + BYOD,COPE diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 72564f7cb1..8ae320eeea 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml @@ -167,6 +167,7 @@ javax.sql, javax.xml, javax.xml.bind.annotation, + javax.xml.stream, javax.xml.parsers;resolution:=optional, org.apache.commons.lang, org.osgi.service.component, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java index 83f6481401..0972cb07a0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java @@ -50,6 +50,9 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; import java.io.File; import java.io.StringReader; import java.io.StringWriter; @@ -235,11 +238,16 @@ public class DeviceTypeManager implements DeviceManager { try { resource = DeviceTypeUtils.getRegistryResource(deviceType); if (resource != null) { + XMLInputFactory factory = XMLInputFactory.newFactory(); + factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); + factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); + XMLStreamReader reader = factory.createXMLStreamReader( + new StringReader(new String((byte[]) resource.getContent(), Charset + .forName(DeviceTypePluginConstants.CHARSET_UTF8)))); + JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class); Unmarshaller unmarshaller = context.createUnmarshaller(); - return (PlatformConfiguration) unmarshaller.unmarshal( - new StringReader(new String((byte[]) resource.getContent(), Charset. - forName(DeviceTypePluginConstants.CHARSET_UTF8)))); + return (PlatformConfiguration) unmarshaller.unmarshal(reader); } else if (defaultPlatformConfiguration != null) { return defaultPlatformConfiguration; } @@ -247,7 +255,7 @@ public class DeviceTypeManager implements DeviceManager { } catch (DeviceTypeMgtPluginException e) { throw new DeviceManagementException( "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); - } catch (JAXBException e) { + } catch (JAXBException | XMLStreamException e) { throw new DeviceManagementException( "Error occurred while parsing the " + deviceType + " configuration : " + e.getMessage(), e); } catch (RegistryException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java index 9ff760b4c9..48f011f8db 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java @@ -30,6 +30,7 @@ import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.general.GeneralConfig; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -69,6 +70,7 @@ public class DeviceTypeManagerService implements DeviceManagementService { private InitialOperationConfig initialOperationConfig; private PullNotificationSubscriber pullNotificationSubscriber; private DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig; + private GeneralConfig generalConfig; public DeviceTypeManagerService(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier, DeviceTypeConfiguration deviceTypeConfiguration) { @@ -84,6 +86,7 @@ public class DeviceTypeManagerService implements DeviceManagementService { this.setDeviceStatusTaskPluginConfig(deviceTypeConfiguration.getDeviceStatusTaskConfiguration()); this.setPolicyMonitoringManager(deviceTypeConfiguration.getPolicyMonitoring()); this.setPullNotificationSubscriber(deviceTypeConfiguration.getPullNotificationSubscriberConfig()); + this.setGeneralConfig(deviceTypeConfiguration); } @Override @@ -92,7 +95,7 @@ public class DeviceTypeManagerService implements DeviceManagementService { } @Override - public OperationMonitoringTaskConfig getOperationMonitoringConfig(){ + public OperationMonitoringTaskConfig getOperationMonitoringConfig() { return operationMonitoringConfigs; } @@ -193,6 +196,11 @@ public class DeviceTypeManagerService implements DeviceManagementService { return deviceStatusTaskPluginConfig; } + @Override + public GeneralConfig getGeneralConfig() { + return generalConfig; + } + private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) { if (deviceTypeConfiguration.getProvisioningConfig() != null) { boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants(); @@ -264,4 +272,12 @@ public class DeviceTypeManagerService implements DeviceManagementService { } } } + + + public void setGeneralConfig(DeviceTypeConfiguration deviceTypeConfiguration) { + this.generalConfig = new GeneralConfig(); + if (deviceTypeConfiguration.getPolicyMonitoring() != null) { + this.generalConfig.setPolicyMonitoringEnabled(deviceTypeConfiguration.getPolicyMonitoring().isEnabled()); + } + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java index cb45a1b212..30cb5b255a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java @@ -33,7 +33,7 @@ public class InitialOperationConfig { return operations; } - public void setOperationsll(List operations) { + public void setOperations(List operations) { this.operations = operations; } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java index 56ab67d7bf..49bbb9ad1e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java @@ -141,6 +141,7 @@ public class DeviceTypeUtils { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java index b512a2965d..e957bfd0db 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java @@ -33,6 +33,7 @@ import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.general.GeneralConfig; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -76,6 +77,7 @@ public class DeviceTypeManagerServiceTest { private Method populatePushNotificationConfig; private Method setPolicyMonitoringManager; private Method setPullNotificationSubscriber; + private Method setGeneralConfig; @BeforeClass public void setup() throws NoSuchMethodException, SAXException, JAXBException, ParserConfigurationException, @@ -102,10 +104,19 @@ public class DeviceTypeManagerServiceTest { .getDeclaredMethod("setPullNotificationSubscriber", PullNotificationSubscriberConfig.class); setPullNotificationSubscriber.setAccessible(true); + setGeneralConfig = DeviceTypeManagerService.class + .getDeclaredMethod("setGeneralConfig", DeviceTypeConfiguration.class); + setGeneralConfig.setAccessible(true); + Field deviceStatusTaskPluginConfig = DeviceTypeManagerService.class .getDeclaredField("deviceStatusTaskPluginConfig"); deviceStatusTaskPluginConfig.setAccessible(true); + + Field generalConfig = DeviceTypeManagerService.class + .getDeclaredField("generalConfig"); + generalConfig.setAccessible(true); + Field operationMonitoringConfigs = DeviceTypeManagerService.class .getDeclaredField("operationMonitoringConfigs"); operationMonitoringConfigs.setAccessible(true); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java index 8a2634d0f8..fa7eb0126c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java @@ -87,7 +87,7 @@ public class Utils { throws DeviceTypeConfigurationException, ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); - + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml index eb12e9ccb3..5b1ed2d468 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml @@ -30,6 +30,7 @@ + true diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 6d4b38ee76..929c3a07e1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json index a81f661c99..93c0fef2e1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json @@ -33,6 +33,8 @@ "identityProviderUrl" : "https://%iot.keymanager.host%:%iot.keymanager.https.port%/samlsso", "acs": "https://%iot.manager.host%:%iot.manager.https.port%/devicemgt/uuf/sso/acs", "identityAlias": "wso2carbon", + "defaultNameIDPolicy": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", + "isPassive":false, "responseSigningEnabled" : true, "validateAssertionValidityPeriod": true, "validateAudienceRestriction": true, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index ef6cf7357f..16be67eb43 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -73,7 +73,7 @@ deviceModule = function () { } var userName = carbonUser.username + "@" + carbonUser.domain; var locationHistory = []; - var geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled; + var geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.enabled; if (geoServicesEnabled) { try { var fromDate = new Date(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js index 31400687bc..ed736c01c6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js @@ -19,45 +19,45 @@ /* ======================================================================== * datatables_extended function * ======================================================================== */ -$.fn.datatables_extended = function(settings){ +$.fn.datatables_extended = function (settings) { var elem = $(this); // EMM related function if (InitiateViewOption) { - $(document).on('click','.viewEnabledIcon',InitiateViewOption); + $(document).on('click', '.viewEnabledIcon', InitiateViewOption); } //--- End of EMM related codes /* * Work around for accessing settings params inside datatable functions */ - if(settings != null && settings.sorting != null && settings.sorting != undefined && settings.sorting){ + if (settings != null && settings.sorting != null && settings.sorting != undefined && settings.sorting) { elem.addClass('sorting-enabled'); - }else{ + } else { elem.addClass('sorting-disabled'); } $(elem).DataTable( - $.extend({},{ + $.extend({}, { bSortCellsTop: true, responsive: false, autoWidth: false, - dom:'<"dataTablesTop"' + - 'f' + - '<"dataTables_toolbar">' + - '>' + - 'rt' + - '<"dataTablesBottom"' + - 'lip' + - '>', + dom: '<"dataTablesTop"' + + 'f' + + '<"dataTables_toolbar">' + + '>' + + 'rt' + + '<"dataTablesBottom"' + + 'lip' + + '>', language: { searchPlaceholder: 'Search ...', search: '' }, - initComplete: function(){ + initComplete: function () { - this.api().columns().every(function(){ + this.api().columns().every(function () { var column = this; var filterColumn = $('.filter-row th', elem); @@ -74,18 +74,18 @@ $.fn.datatables_extended = function(settings){ ); column - //.search(val ? '^' + val + '$' : '', true, false) + //.search(val ? '^' + val + '$' : '', true, false) .search(val ? val : '', true, false) .draw(); - if (filterColumn.eq(column.index()).hasClass('data-platform')){ - if(val == null || val == undefined || val == ""){ + if (filterColumn.eq(column.index()).hasClass('data-platform')) { + if (val == null || val == undefined || val == "") { $("#operation-bar").hide(); - $( "#operation-guide" ).show(); - $( "#operation-bar" ).addClass("hidden"); - }else{ - $( "#operation-guide" ).hide(); - $( "#operation-bar" ).removeClass("hidden"); + $("#operation-guide").show(); + $("#operation-bar").addClass("hidden"); + } else { + $("#operation-guide").hide(); + $("#operation-bar").removeClass("hidden"); $("#operation-bar").show(); //TODO: Enable after adding iot operations bar //loadOperationBar(val); @@ -117,11 +117,12 @@ $.fn.datatables_extended = function(settings){ } else if (filterColumn.eq(column.index()).hasClass('text-filter')) { var title = filterColumn.eq(column.index()).attr('data-for'); - $(filterColumn.eq(column.index()).empty()).html(''); + $(filterColumn.eq(column.index()).empty()).html(''); filterColumn.eq(column.index()).find('input').on('keyup change', function () { column.search($(this).val()).draw(); - if($('.dataTables_empty').length > 0) { + if ($('.dataTables_empty').length > 0) { $('.bulk-action-row').addClass("hidden"); } else { $('.bulk-action-row').removeClass("hidden"); @@ -141,34 +142,36 @@ $.fn.datatables_extended = function(settings){ * create sorting dropdown menu for list table advance operations */ var table = this; - if(table.hasClass('sorting-enabled')){ - var dropdownmenu = $(''); + if (table.hasClass('sorting-enabled')) { + var dropdownmenu = $(''); $('.sort-row th', elem).each(function () { if (!$(this).hasClass('no-sort')) { - dropdownmenu.append('
  • ' + $(this).html() + '
  • '); + dropdownmenu.append('
  • ' + $(this).html() + '
  • '); } }); } - function getAdvanceToolBar(){ + function getAdvanceToolBar() { if (!table.hasClass('no-toolbar')) { if (table.hasClass('sorting-enabled')) { return '' + '
  • ' + + '
  • ' + + '
  • ' + + '
  • ' + + '
  • ' + dropdownmenu[0].outerHTML + '
  • ' + + '' } else { return '' + '
  • ' + + '
  • ' + + '
  • ' + + '
  • ' + + '' } - }else{ + } else { return ''; } } @@ -184,22 +187,22 @@ $.fn.datatables_extended = function(settings){ /** * sorting dropdown menu select function */ - $('.dataTables_wrapper .sort-list li a').click(function() { + $('.dataTables_wrapper .sort-list li a').click(function () { $(this).closest('li').siblings('li').find('a').removeClass('sorting_asc').removeClass('sorting_desc'); var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); if (!($(this).hasClass('sorting_asc')) && !($(this).hasClass('sorting_desc'))) { $(this).addClass('sorting_asc'); - thisTable.fnSort( [ [$(this).attr('data-column'),'asc'] ] ); + thisTable.fnSort([[$(this).attr('data-column'), 'asc']]); } - else if($(this).hasClass('sorting_asc')) { + else if ($(this).hasClass('sorting_asc')) { $(this).switchClass('sorting_asc', 'sorting_desc'); - thisTable.fnSort( [ [$(this).attr('data-column'),'desc'] ] ); + thisTable.fnSort([[$(this).attr('data-column'), 'desc']]); } - else if($(this).hasClass('sorting_desc')) { + else if ($(this).hasClass('sorting_desc')) { $(this).switchClass('sorting_desc', 'sorting_asc'); - thisTable.fnSort( [ [$(this).attr('data-column'),'asc'] ] ); + thisTable.fnSort([[$(this).attr('data-column'), 'asc']]); } }); @@ -216,44 +219,44 @@ $.fn.datatables_extended = function(settings){ $(button).addClass("active").html('Cancel'); $(button).parent().next().children("button").removeClass("disabled"); // EMM related code - $(document).off('click','.viewEnabledIcon'); + $(document).off('click', '.viewEnabledIcon'); //--- End of EMM related codes - } else if ($(button).html() == 'Cancel'){ + } else if ($(button).html() == 'Cancel') { $('.bulk-action-row').addClass('hidden'); thisTable.removeClass("table-selectable"); $(button).addClass("active").html('Select'); $(button).parent().next().children().addClass("disabled"); // EMM related function - $(document).on('click','.viewEnabledIcon',InitiateViewOption); + $(document).on('click', '.viewEnabledIcon', InitiateViewOption); //--- End of EMM related codes } }); /** * select/deselect all rows function */ - $('.dataTables_wrapper [data-click-event=toggle-selected]').click(function() { + $('.dataTables_wrapper [data-click-event=toggle-selected]').click(function () { var button = this, thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); - if(!$(button).hasClass('disabled')){ - if($(button).html() == 'Select All') { - thisTable.api().rows().every(function () { - $(this.node()).addClass(rowSelectedClass); - $(button).html('Deselect All'); - }); - } - else if($(button).html() == 'Deselect All') { - thisTable.api().rows().every(function () { - $(this.node()).removeClass(rowSelectedClass); - $(button).html('Select All'); - }); - } + if ($(button).html() == 'Select All') { + $(button).html('Deselect All'); + $('.bulk-action-row').removeClass('hidden'); + thisTable.api().rows().every(function () { + $(this.node()).addClass(rowSelectedClass); + }); + } + else if ($(button).html() == 'Deselect All') { + $('.bulk-action-row').addClass('hidden'); + $(button).html('Select All'); + thisTable.api().rows().every(function () { + $(this.node()).removeClass(rowSelectedClass); + }); } }); /** * on row click select/deselect row function */ - $('body').on('click', '[data-type=selectable]', function(){ + $('body').on('click', '[data-type=selectable]', function () { var rowSelectedClass = 'DTTT_selected selected'; $(this).toggleClass(rowSelectedClass); if ($('.table-selectable .DTTT_selected').length > 0) { @@ -265,8 +268,9 @@ $.fn.datatables_extended = function(settings){ thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); thisTable.api().rows().every(function () { - if(!$(this.node()).hasClass(rowSelectedClass)){ - $(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').html('Select All'); + if (!$(this.node()).hasClass(rowSelectedClass)) { + $(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]'). + html('Select All'); } }); }); @@ -275,8 +279,8 @@ $.fn.datatables_extended = function(settings){ * list table list/grid view toggle function */ var toggleButton = $('[data-click-event=toggle-list-view]'); - toggleButton.click(function(){ - if($(this).attr('data-view') == 'grid') { + toggleButton.click(function () { + if ($(this).attr('data-view') == 'grid') { $(this).closest('.dataTables_wrapper').find('.dataTable').addClass('grid-view'); //$(this).closest('li').hide(); //$(this).closest('li').siblings().show(); @@ -288,7 +292,7 @@ $.fn.datatables_extended = function(settings){ } }); } - },settings) + }, settings) ); }; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js index c79bd99516..836bef71cb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js @@ -50,12 +50,12 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter var deviceType; var ownership; - var searching = true; - if (options) { - if (typeof options.searching !== 'undefined') { - searching = options.searching; - } - } + var searching = true; + if (options) { + if (typeof options.searching !== 'undefined') { + searching = options.searching; + } + } //--- End of EMM related codes @@ -190,7 +190,8 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter }); } else if (filterColumn.eq(column.index()).hasClass('text-filter')) { var title = filterColumn.eq(column.index()).attr('data-for'); - $(filterColumn.eq(column.index()).empty()).html(''); + $(filterColumn.eq(column.index()).empty()).html(''); //noinspection SpellCheckingInspection filterColumn.eq(column.index()).find('input').on('keyup', function () { @@ -211,10 +212,12 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter */ var table = this; if (table.hasClass('sorting-enabled')) { - var dropdownmenu = $(''); + var dropdownmenu = $(''); $('.sort-row th', elem).each(function () { if (!$(this).hasClass('no-sort')) { - dropdownmenu.append('
  • ' + $(this).html() + '
  • '); + dropdownmenu.append('
  • ' + $(this).html() + '
  • '); } }); } @@ -303,15 +306,17 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); if (!$(button).hasClass('disabled')) { if ($(button).html() == 'Select All') { + $(button).html('Deselect All'); + $('.bulk-action-row').removeClass('hidden'); thisTable.api().rows().every(function () { $(this.node()).addClass(rowSelectedClass); - $(button).html('Deselect All'); }); } else if ($(button).html() == 'Deselect All') { + $('.bulk-action-row').addClass('hidden'); + $(button).html('Select All'); thisTable.api().rows().every(function () { $(this.node()).removeClass(rowSelectedClass); - $(button).html('Select All'); }); } } @@ -333,7 +338,8 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter thisTable.api().rows().every(function () { if (!$(this.node()).hasClass(rowSelectedClass)) { - $(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').html('Select All'); + $(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]'). + html('Select All'); } }); }); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs index 49f4e02bad..151a91e9fd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs @@ -576,8 +576,8 @@
    - - + + Name of the selected area(e.g. colombo)
    @@ -589,9 +589,8 @@
    -
    @@ -607,8 +606,8 @@
    - - + + Name of the selected area(e.g. colombo)
    @@ -620,9 +619,8 @@
    -
    @@ -639,8 +637,8 @@
    - - + + Name of the selected area(e.g. colombo) @@ -658,9 +656,8 @@
    -
    @@ -676,8 +673,8 @@
    - - + + Name of the selected area(e.g. colombo)
    @@ -689,9 +686,8 @@
    -
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js index 4094fc89dc..1fcfd20d1c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js @@ -60,6 +60,6 @@ function onRequest(context) { } else { viewModel.lastLocation = stringify({}); } - viewModel.geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled; + viewModel.geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.enabled; return viewModel; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js index 8457e973e5..5996dbcac3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js @@ -271,8 +271,8 @@ function createPopup(layer,id) { return; } - popupTemplate.find('#exportGeoJson').attr('leaflet_id', layer._leaflet_id); - popupTemplate.find('#editGeoJson').attr('leaflet_id', layer._leaflet_id); + popupTemplate.find('.exportGeoJson').attr('leaflet_id', layer._leaflet_id); + popupTemplate.find('.editGeoJson').attr('leaflet_id', layer._leaflet_id); layer.bindPopup(popupTemplate.html(), {closeOnClick: false, closeButton: false}).openPopup(); // transparent the layer .leaflet-popup-content-wrapper diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js index 04a94dd62f..e5894ceee1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js @@ -233,7 +233,7 @@ function setWithinAlert(leafletId) { * (look in get_alerts for .replace() method) * */ var selectedAreaGeoJson = JSON.stringify(map._layers[leafletId].toGeoJSON().geometry).replace(/"/g, "'"); - var areaName = $("#areaName").val(); + var areaName = $("#withinAlertAreaName").val(); var queryName = areaName; @@ -292,7 +292,7 @@ function setExitAlert(leafletId) { * (look in get_alerts for .replace() method) * */ var selectedAreaGeoJson = JSON.stringify(map._layers[leafletId].toGeoJSON().geometry).replace(/"/g, "'"); - var areaName = $("#areaName").val(); + var areaName = $("#exitAlertAreaName").val(); var queryName = areaName; @@ -357,7 +357,7 @@ function setStationeryAlert(leafletId) { var selectedProcessedAreaGeoJson = JSON.stringify(selectedAreaGeoJson).replace(/"/g, "'"); - var stationeryName = $("#areaName").val(); + var stationeryName = $("#stationaryAlertAreaName").val(); var queryName = stationeryName; var fluctuationRadius = $("#fRadius").val(); var time = $("#time").val(); @@ -477,7 +477,7 @@ function setTrafficAlert(leafletId) { var selectedProcessedAreaGeoJson = JSON.stringify(selectedAreaGeoJson).replace(/"/g, "'"); - var areaName = $("#areaName").val(); + var areaName = $("#trafficAlertAreaName").val(); var queryName = areaName; //var time = $("#time").val(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js index 8a4e0677f1..02ab4a66dd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js @@ -63,6 +63,9 @@ var constants = { APP_CONF_AUTH_MODULE_SSO: "sso", APP_CONF_AUTH_MODULE_SSO_ENABLED: "enabled", APP_CONF_AUTH_MODULE_SSO_ISSUER: "issuer", + APP_CONF_AUTH_MODULE_SSO_ACS: "acs", + APP_CONF_AUTH_MODULE_SSO_IS_PASSIVE: "isPassive", + APP_CONF_AUTH_MODULE_SSO_DEFAULT_NAME_ID_POLICY: "defaultNameIDPolicy", APP_CONF_AUTH_MODULE_SSO_RESPONSE_SIGNING_ENABLED: "responseSigningEnabled", APP_CONF_AUTH_MODULE_SSO_KEY_STORE_NAME: "keyStoreName", APP_CONF_AUTH_MODULE_SSO_KEY_STORE_PASSWORD: "keyStorePassword", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js index fad0b27b99..838d2bd8fb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js @@ -271,7 +271,9 @@ var module = {}; } function getSsoLoginRequestParams() { + var ssoClient = require("sso").client; var ssoConfigs = getSsoConfigurations(); + var carbon = require('carbon'); // Identity Provider URL var identityProviderUrl = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_IDENTITY_PROVIDER_URL]; if (!identityProviderUrl || (identityProviderUrl.length == 0)) { @@ -284,6 +286,13 @@ var module = {}; } // Issuer var issuer = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_ISSUER]; + var nameIDPolicy = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_DEFAULT_NAME_ID_POLICY]; + var signingEnabled = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_RESPONSE_SIGNING_ENABLED]; + var identityProviderUrl = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_IDENTITY_PROVIDER_URL]; + var isPassive = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_IS_PASSIVE]; + var acs = ssoConfigs[constants.APP_CONF_AUTH_MODULE_SSO_ACS]; + var superTenant = carbon.server.superTenant; + if (!issuer || (issuer.length == 0)) { var msg = "Issuer is not given in SSO configurations in Auth module configurations in " + "application configuration file '" + constants.FILE_APP_CONF + "'."; @@ -294,7 +303,12 @@ var module = {}; // SAML authentication request var encodedSAMLAuthRequest; try { - encodedSAMLAuthRequest = (require("sso")).client.getEncodedSAMLAuthRequest(issuer); + if (signingEnabled) { + encodedSAMLAuthRequest = ssoClient.getEncodedSignedSAMLAuthRequest(issuer, + identityProviderUrl, acs, isPassive, superTenant.tenantId, superTenant.domain, nameIDPolicy); + } else { + encodedSAMLAuthRequest = ssoClient.getEncodedSAMLAuthRequest(issuer); + } } catch (e) { log.error("Cannot create SAML login authorization token with issuer '" + issuer + "'."); log.error(e.message, e); @@ -529,7 +543,7 @@ var module = {}; response.sendError(500, msg); return; } - + /** * @type {{sessionId: string, loggedInUser: string, sessionIndex: string, samlToken: * string}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index e237521c45..faa164f3aa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml index f222a87170..e92219a3c3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index 311dd44a06..b9070a0df2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -70,7 +70,7 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { @PathParam("deviceType") String deviceType, @QueryParam("from") long from, @QueryParam("to") long to) { try { - if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) { + if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { return Response.status(Response.Status.BAD_REQUEST.getStatusCode()) .entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build(); } diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index e10ac2435b..68647a3ff3 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml index 1e48fbb15d..73c4ecbc6e 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/EmailSenderUtil.java b/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/EmailSenderUtil.java index 6c34c05805..cd915629fa 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/EmailSenderUtil.java +++ b/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/EmailSenderUtil.java @@ -31,8 +31,9 @@ public class EmailSenderUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new EmailSenderConfigurationFailedException("Error occurred while parsing file, while converting " + diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index 2e673aea3f..0436bce47c 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 04fcac9b9e..b31c5ddb99 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt identity-extensions - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - OAuth Extensions http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index b3973a05bb..b5058078b8 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -21,7 +21,7 @@ identity-extensions org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT 4.0.0 diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index 2b223d7e4b..828acad371 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/test/resources/carbon-home/repository/conf/cdm-config.xml index 9d3e282807..731f2ade9c 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -93,10 +93,51 @@ false 86400 + + + + jdbc/DM_ARCHIVAL_DS + + + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivalTask + + 0 0 0 1/1 * ? * + + 30 + 1000 + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivedDataDeletionTask + + 0 0 3 1/1 * ? * + + 365 + + + - false - false + false + + false + false + + false + + + + + * + + + + true wss://localhost:9443 diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 2975791f20..19e060ac42 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index f1d5082fbf..2e9cad3cdb 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index 3b6b1ea303..a30e850a35 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index e30e91082d..aa7b607886 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index 3f70faea72..d69032b1f0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index 9be3c7eaf5..e8b68c17e6 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java index 11e69580e0..946f1c49a6 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java @@ -209,7 +209,12 @@ public class PolicyManagerServiceImpl implements PolicyManagerService { List complianceFeatures = monitoringManager.checkPolicyCompliance(deviceIdentifier, response); - return !(complianceFeatures == null || complianceFeatures.isEmpty()); + if(complianceFeatures == null || complianceFeatures.isEmpty()) { + return true; + } else { + return false; + } + } @Override diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/MonitoringDAOImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/MonitoringDAOImpl.java index edc064b6d0..779232bfee 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/MonitoringDAOImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/MonitoringDAOImpl.java @@ -242,6 +242,7 @@ public class MonitoringDAOImpl implements MonitoringDAO { PreparedStatement stmt = null; ResultSet resultSet = null; NonComplianceData complianceData = new NonComplianceData(); + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index 447db27d7d..2ccbe94778 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -20,6 +20,7 @@ package org.wso2.carbon.policy.mgt.core.mgt.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; @@ -92,19 +93,21 @@ public class MonitoringManagerImpl implements MonitoringManager { PolicyManagementDAOFactory.openConnection(); NonComplianceData cmd = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId()); complianceData = monitoringService.checkPolicyCompliance(deviceIdentifier, - policy, deviceResponse); + policy, deviceResponse); + if (cmd != null) { + complianceData.setId(cmd.getId()); + complianceData.setPolicy(policy); + complianceFeatures = complianceData.getComplianceFeatures(); + complianceData.setDeviceId(device.getId()); + complianceData.setPolicyId(policy.getId()); + } - complianceData.setId(cmd.getId()); - complianceData.setPolicy(policy); - complianceFeatures = complianceData.getComplianceFeatures(); - complianceData.setDeviceId(device.getId()); - complianceData.setPolicyId(policy.getId()); } catch (SQLException e) { throw new PolicyComplianceException("Error occurred while opening a data source connection", e); } catch (MonitoringDAOException e) { throw new PolicyComplianceException( "Unable to add the none compliance features to database for device " + - deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e); + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e); } finally { PolicyManagementDAOFactory.closeConnection(); } @@ -115,7 +118,7 @@ public class MonitoringManagerImpl implements MonitoringManager { try { PolicyManagementDAOFactory.beginTransaction(); monitoringDAO.setDeviceAsNoneCompliance(device.getId(), device.getEnrolmentInfo().getId(), - policy.getId()); + policy.getId()); if (log.isDebugEnabled()) { log.debug("Compliance status primary key " + complianceData.getId()); } @@ -181,19 +184,19 @@ public class MonitoringManagerImpl implements MonitoringManager { device = service.getDevice(deviceIdentifier, false); } catch (DeviceManagementException e) { throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() + - " - " + deviceIdentifier.getType(), e); + " - " + deviceIdentifier.getType(), e); } try { PolicyManagementDAOFactory.openConnection(); NonComplianceData complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo() - .getId()); - if (complianceData == null || !complianceData.isStatus()) { + .getId()); + if (complianceData != null && !complianceData.isStatus()) { return false; } } catch (MonitoringDAOException e) { throw new PolicyComplianceException("Unable to retrieve compliance status for " + deviceIdentifier.getId() + - " - " + deviceIdentifier.getType(), e); + " - " + deviceIdentifier.getType(), e); } catch (SQLException e) { throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e); } finally { @@ -204,7 +207,7 @@ public class MonitoringManagerImpl implements MonitoringManager { @Override public NonComplianceData getDevicePolicyCompliance(DeviceIdentifier deviceIdentifier) throws - PolicyComplianceException { + PolicyComplianceException { NonComplianceData complianceData; try { PolicyManagementDAOFactory.openConnection(); @@ -218,11 +221,11 @@ public class MonitoringManagerImpl implements MonitoringManager { } catch (DeviceManagementException e) { throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() + - " - " + deviceIdentifier.getType(), e); + " - " + deviceIdentifier.getType(), e); } catch (MonitoringDAOException e) { throw new PolicyComplianceException("Unable to retrieve compliance data for " + deviceIdentifier.getId() + - " - " + deviceIdentifier.getType(), e); + " - " + deviceIdentifier.getType(), e); } catch (SQLException e) { throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e); } finally { @@ -288,10 +291,10 @@ public class MonitoringManagerImpl implements MonitoringManager { if (complianceData.getAttempts() == 0) { deviceIdsToAddOperation.put(complianceData.getDeviceId(), - deviceIds.get(complianceData.getDeviceId())); + deviceIds.get(complianceData.getDeviceId())); } else { deviceIdsWithExistingOperation.put(complianceData.getDeviceId(), - deviceIds.get(complianceData.getDeviceId())); + deviceIds.get(complianceData.getDeviceId())); } } } @@ -315,7 +318,7 @@ public class MonitoringManagerImpl implements MonitoringManager { log.debug("These devices are in the system for the first time"); for (PolicyDeviceWrapper wrapper : firstTimeDevices) { log.debug("First time device primary key : " + wrapper.getDeviceId() + " & policy id " + - wrapper.getPolicyId()); + wrapper.getPolicyId()); } } @@ -358,11 +361,11 @@ public class MonitoringManagerImpl implements MonitoringManager { List deviceTypes = new ArrayList<>(); try { - //when shutdown, it sets DeviceManagementService to null, therefore need to have a null check - if (PolicyManagementDataHolder.getInstance().getDeviceManagementService() != null) { - deviceTypes = - PolicyManagementDataHolder.getInstance().getDeviceManagementService().getAvailableDeviceTypes(); - } + //when shutdown, it sets DeviceManagementService to null, therefore need to have a null check + if (PolicyManagementDataHolder.getInstance().getDeviceManagementService() != null) { + deviceTypes = + PolicyManagementDataHolder.getInstance().getDeviceManagementService().getPolicyMonitoringEnableDeviceTypes(); + } } catch (DeviceManagementException e) { throw new PolicyComplianceException("Error occurred while getting the device types.", e); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java index 80358fa86c..67a53f2d30 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagerUtil.java @@ -62,8 +62,9 @@ public class PolicyManagerUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new PolicyManagementException("Error occurred while parsing file, while converting " + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java index bf24d0e536..0f17393128 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -46,6 +46,8 @@ import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.enforcement.DelegationTask; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; +import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager; +import org.wso2.carbon.policy.mgt.core.mgt.impl.MonitoringManagerImpl; import org.wso2.carbon.policy.mgt.core.mock.TypeXDeviceManagementService; import org.wso2.carbon.policy.mgt.core.task.MonitoringTask; import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService; @@ -232,7 +234,7 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { } @Test(dependsOnMethods = "applyPolicy") - public void checkCompliance() throws PolicyComplianceException { + public void checkCompliance() throws PolicyComplianceException, DeviceManagementException { new MonitoringTask().execute(); List complianceFeatures = new ArrayList<>(); @@ -246,6 +248,15 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { complianceFeature.setMessage("Test message"); complianceFeature.setCompliance(true); complianceFeatures.add(complianceFeature); + + Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + getDevice(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), false); + List deviceList = new ArrayList<>(); + deviceList.add(device); + + MonitoringManager manager = new MonitoringManagerImpl(); + manager.addMonitoringOperation(deviceList); + policyManagerService.checkCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), complianceFeatures); boolean deviceCompliance = policyManagerService.isCompliant(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); @@ -253,7 +264,7 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { } @Test(dependsOnMethods = "checkCompliance") - public void checkNonCompliance() throws PolicyComplianceException { + public void checkNonCompliance() throws PolicyComplianceException, DeviceManagementException { new MonitoringTask().execute(); List complianceFeatures = new ArrayList<>(); @@ -267,6 +278,15 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { complianceFeature.setMessage("Test message"); complianceFeature.setCompliance(false); complianceFeatures.add(complianceFeature); + + Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + getDevice(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), false); + List deviceList = new ArrayList<>(); + deviceList.add(device); + + MonitoringManager manager = new MonitoringManagerImpl(); + manager.addMonitoringOperation(deviceList); + policyManagerService.checkCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), complianceFeatures); boolean deviceCompliance = policyManagerService.isCompliant(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); Assert.assertFalse(deviceCompliance, "Policy was compliant even though the response was not compliant"); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java index 012bfd7b6b..0f76246da6 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/mock/TypeXDeviceManagementService.java @@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.common.MonitoringOperation; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; +import org.wso2.carbon.device.mgt.common.general.GeneralConfig; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -96,4 +97,9 @@ public class TypeXDeviceManagementService implements DeviceManagementService { public DeviceStatusTaskPluginConfig getDeviceStatusTaskPluginConfig() { return null; } + + @Override + public GeneralConfig getGeneralConfig() { + return null; + } } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index c84ae10bba..3755d4daf0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -25,41 +25,128 @@ - - 8 - 100 - 20 - 1000 - + + 1000 + 60000 + 60000 + true + + org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.FCMBasedPushNotificationProvider + + org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider + org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider + org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider + + + + false + https://localhost:9443 admin admin + + https://localhost:9443 + admin + admin + - org.wso2.carbon.policy.mgt - true - 60000 - 5 - 8 - 20 - + org.wso2.carbon.policy.mgt + true + 60000 + 5 + 8 + 20 + + + Simple true - + + + 20 + 20 + 20 + 20 + 20 + 20 + + true + true - 300 + 600 + + 10000 - - 100 - 2000 - 10 - false - + + true + 86400 + + + + + jdbc/DM_ARCHIVAL_DS + + + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivalTask + + 0 0 0 1/1 * ? * + + 30 + 1000 + + false + org.wso2.carbon.device.mgt.core.task.impl.ArchivedDataDeletionTask + + 0 0 3 1/1 * ? * + + 365 + + + + + false + + + false + false + + false + + + + + * + + + + + + true + wss://localhost:9443 + 2 + 100 + 20 + 15 + 640 + + BYOD,COPE diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 7bcf17ad50..c323aeb639 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Policy Management Component http://wso2.org diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 4b4e504f15..57cdef62c9 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -21,7 +21,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 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 08a516e8d1..72ec6325f6 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 @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java index 73e809fdd3..f3e0a4fe88 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/AuthenticationFrameworkUtil.java @@ -55,8 +55,9 @@ public class AuthenticationFrameworkUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { throw new AuthenticatorFrameworkException("Error occurred while parsing file, while converting " + diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/test/resources/carbon-home/repository/conf/cdm-config.xml index ea0f23c08e..aa02b0612a 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -46,6 +46,11 @@ admin admin + + https://localhost:9443 + admin + admin + org.wso2.carbon.policy.mgt true @@ -88,11 +93,6 @@ false 86400 - - false - false - - BYOD,COPE @@ -112,11 +112,41 @@ org.wso2.carbon.device.mgt.core.task.impl.ArchivedDataDeletionTask 0 0 3 1/1 * ? * - 365 + + false + + + false + false + + false + + + + + * + + + + + + true + wss://localhost:9443 + 2 + 100 + 20 + 15 + 640 + + BYOD,COPE diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index c6bce78933..457274816b 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index 99fa31000f..cb16fe8712 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - API Management Application Extension Feature http://wso2.org This feature contains an implementation of a api application registration, which takes care of subscription diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index 54f30ffaa0..4ac22f2ebe 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Management - APIM handler Server Feature http://wso2.org This feature contains the handler for the api authentications diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml index 493286c36e..c680f92cc3 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - APIM Integration Client Feature http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml index b9738af0f6..068f31313b 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - API Management Webapp Publisher Feature http://wso2.org This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 84f537d967..5e16e83037 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - API Management Extensions Feature http://wso2.org diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index ec7151e87e..9edcf00c04 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index 58181394ee..dda6758f99 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index 509ca2e0b1..e8bcff3e18 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Certificate Management Server Feature http://wso2.org This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index c487aca814..9ec1d2e5d5 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Certificate Management Feature http://wso2.org diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index 08bb789344..490b7fc2ab 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Type Deployer Feature http://wso2.org WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index c5323954e5..08c609eb36 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - FCM Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index ce2054ab1a..57dff0a8d1 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 657de19697..afa56939c3 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 096fe22c70..c781174074 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - XMPP Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 32b6724710..38da3be98e 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml index 090fb81864..b5edb021ad 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains bundles related to device analytics data publisher diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index c29518e494..b694f0952e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml index f617021074..46456257a1 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml index e17b5c5839..3755d4daf0 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml @@ -118,9 +118,24 @@ + + false + - false - false + false + false + + false + + + + + * + + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 32486cade5..bbbacd91c2 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,14 +4,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Management Extensions Feature http://wso2.org This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index cbfd1e5716..8cf6d46c2e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 70aba0be49..e0408718b7 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index 3085af6e6a..811f7e5abd 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 53efcc6305..4606e8b379 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index bfd0bc0180..0e1a6d6530 100644 --- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt email-sender-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Email Sender Feature http://wso2.org This feature contains the core bundles required for email sender related functionality diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml index e218f0cfda..fc4164e27b 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Email Sender Feature http://wso2.org diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index 9aa0ea126c..f9978873ce 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt jwt-client-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - JWT Client Feature http://wso2.org This feature contains jwt client implementation from which we can get a access token using the jwt diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 32139a3295..c685fc68ea 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - JWT Client Extension Feature http://wso2.org diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index 5b6ea83d8d..707e0d96a2 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Mgt OAuth Extensions Feature http://wso2.org This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index 875b31fe01..753169505a 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Device Management OAuth Extensions Feature http://wso2.org diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index 0c3c48248a..3180d5bae9 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Policy Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 0049283f49..2f190d41cf 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Policy Management Feature http://wso2.org diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index 0cb1f7297f..4cec77aeba 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Webapp Authenticator Framework Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 0b413c71ad..5c155b1a68 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 315139d284..9b4ba963f8 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1911,7 +1911,7 @@ 1.2.11.wso2v10 - 3.0.206-SNAPSHOT + 3.0.217-SNAPSHOT 4.4.8