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 4285877af1..90517191cc 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 2.0.76-SNAPSHOT + 3.0.3-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 9b52dda0c5..ccfe4cd600 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 - 2.0.76-SNAPSHOT + 3.0.3-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 39c3daf0c2..f8ec9560d5 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 - 2.0.76-SNAPSHOT + 3.0.3-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 759d69049d..171fb528a3 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 2.0.76-SNAPSHOT + 3.0.3-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 d3c8ad3a9f..e7d239a1ee 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 @@ -44,6 +44,8 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Contains util methods for synapse gateway authentication handler @@ -62,21 +64,47 @@ public class Utils { public static IOTServerConfiguration initConfig() { try { - String IOTServerAPIConfigurationPath = - CarbonUtils.getCarbonConfigDirPath() + File.separator + IOT_APIS_CONFIG_FILE; + String IOTServerAPIConfigurationPath = CarbonUtils.getCarbonConfigDirPath() + File.separator + + IOT_APIS_CONFIG_FILE; File file = new File(IOTServerAPIConfigurationPath); Document doc = Utils.convertToDocument(file); JAXBContext fileContext = JAXBContext.newInstance(IOTServerConfiguration.class); Unmarshaller unmarshaller = fileContext.createUnmarshaller(); - return (IOTServerConfiguration) unmarshaller.unmarshal(doc); + IOTServerConfiguration iotServerConfiguration = (IOTServerConfiguration) unmarshaller.unmarshal( + doc); + iotServerConfiguration.setHostname(replaceProperties(iotServerConfiguration.getHostname())); + iotServerConfiguration.setVerificationEndpoint( + replaceProperties(iotServerConfiguration.getVerificationEndpoint())); + iotServerConfiguration.setDynamicClientRegistrationEndpoint( + replaceProperties(iotServerConfiguration.getDynamicClientRegistrationEndpoint())); + iotServerConfiguration.setOauthTokenEndpoint( + replaceProperties(iotServerConfiguration.getOauthTokenEndpoint())); + return iotServerConfiguration; } catch (JAXBException | APIMCertificateMGTException e) { log.error("Error occurred while initializing Data Source config", e); return null; } } + /** + * This method gets the values from system variables and sets to xml. + */ + public static String replaceProperties(String text) { + String regex = "\\$\\{(.*?)\\}"; + Pattern pattern = Pattern.compile(regex); + Matcher matchPattern = pattern.matcher(text); + while (matchPattern.find()) { + String sysPropertyName = matchPattern.group(1); + String sysPropertyValue = System.getProperty(sysPropertyName); + if (sysPropertyValue != null && !sysPropertyName.isEmpty()) { + text = text.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue); + } + } + return text; + } + /** * This class build the iot-api-config.xml file. * @param file 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 6048ec35ca..ffbc34518c 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 2.0.76-SNAPSHOT + 3.0.3-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.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 4ddc75a315..0f07b7a0d2 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 2.0.76-SNAPSHOT + 3.0.3-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 aca277cb82..5e5f6d3d24 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index d5fe61013e..b84c21dd71 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 2.0.76-SNAPSHOT + 3.0.3-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 057ad4355e..4712b41734 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 - 2.0.76-SNAPSHOT + 3.0.3-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 1306bcba04..0d9c19c6dc 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 - 2.0.76-SNAPSHOT + 3.0.3-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 fa5cca6ec8..202c8ced25 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 614d09c7d4..ec4a9b1330 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 2.0.76-SNAPSHOT + 3.0.3-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 8645560e59..18de0fecde 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml index 414bcaa8dd..a4a89876ae 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml @@ -125,4 +125,28 @@ + + + DEVICE_INFO + APPLICATION_LIST + DEVICE_LOCATION + + + + + + false + 300 + 600 + 300 + \ No newline at end of file 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 10fef13da7..9f7e55c47c 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 - 2.0.76-SNAPSHOT + 3.0.3-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 94e0c0df38..efca80f3cc 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 - 2.0.76-SNAPSHOT + 3.0.3-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 173665a10e..c5b7cb64c4 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index f4e05b2354..4bd1e4133e 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index cef640a4cb..4ad0c103c8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.76-SNAPSHOT + 3.0.3-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 a3994c8642..23dacf6433 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 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 db3519da3a..b870980e9f 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 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 ac67362445..4e35677ceb 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java index 5b0e234218..f37e7e1d25 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java @@ -73,4 +73,4 @@ public class DeviceIdentifier implements Serializable{ ", type='" + type + '\'' + '}'; } -} +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManager.java index 060865c726..31b1aea61e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManager.java @@ -37,8 +37,9 @@ public interface DeviceManager { /** * Method to save platform specific Configuration. - * + * @param configuration - A Platform configuration object which needs to save * @return Returns the status of the operation + * @throws DeviceManagementException If something goes wrong while saving the configuration. */ boolean saveConfiguration(PlatformConfiguration configuration) throws DeviceManagementException; @@ -46,6 +47,7 @@ public interface DeviceManager { * Method to get platform specific Configuration. * * @return Returns the platform specific tenant configurations + * @throws DeviceManagementException If something goes wrong while fetching the configuration. */ PlatformConfiguration getConfiguration() throws DeviceManagementException; @@ -53,6 +55,7 @@ public interface DeviceManager { * Method to enrolling a particular device of type mobile, IoT, etc within CDM. * * @param device Metadata corresponding to the device being enrolled + * @return A boolean indicating the status of the operation. * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ boolean enrollDevice(Device device) throws DeviceManagementException; @@ -61,6 +64,7 @@ public interface DeviceManager { * Method to modify the metadata corresponding to device enrollment. * * @param device Modified device enrollment related metadata + * @return A boolean indicating the status of the operation. * @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a * device */ @@ -70,6 +74,7 @@ public interface DeviceManager { * Method to disenroll a particular device from CDM. * * @param deviceId Fully qualified device identifier + * @return A boolean indicating the status of the operation. * @throws DeviceManagementException If some unusual behaviour is observed while disenrolling a device */ boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException; @@ -100,6 +105,7 @@ public interface DeviceManager { * * @param deviceId Fully qualified device identifier * @param status Indicates whether the device is active + * @return A boolean indicating the status of the operation. * @throws DeviceManagementException If some unusual behaviour is observed while updating the active status * of the device */ @@ -127,6 +133,7 @@ public interface DeviceManager { * * @param deviceIdentifier identifier to identify the device * @param device Updated device information related data + * @return A boolean indicating the status of the operation. * @throws DeviceManagementException If some unusual behaviour is observed while updating the device info */ boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException; @@ -136,6 +143,7 @@ public interface DeviceManager { * * @param deviceId Fully qualified device identifier * @param ownershipType Type of ownership + * @return A boolean indicating the status of the operation. * @throws DeviceManagementException If some unusual behaviour is observed while setting the ownership * of the device */ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ApplicationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ApplicationManager.java index e9da177cdd..36224b08d4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ApplicationManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ApplicationManager.java @@ -39,7 +39,7 @@ public interface ApplicationManager { * @param pageNumber Page number of the list. * @param size Number of items in one page. * @return The list of applications belongs to a domain. - * @throws ApplicationManagementException + * @throws ApplicationManagementException If something goes wrong */ Application[] getApplications(String domain, int pageNumber, int size) @@ -52,6 +52,7 @@ public interface ApplicationManager { * @param deviceId Device id of the device that the status belongs to. * @param application Application details of the app being updated. * @param status Installed/Uninstalled + * @throws ApplicationManagementException If something goes wrong */ void updateApplicationStatus(DeviceIdentifier deviceId, Application application, String status) throws ApplicationManagementException; @@ -62,6 +63,7 @@ public interface ApplicationManager { * @param deviceId Device id of the device that the status belongs to. * @param application Application details of the app being searched. * @return Status of the application on the device. + * @throws ApplicationManagementException If something goes wrong */ String getApplicationStatus(DeviceIdentifier deviceId, Application application) throws ApplicationManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/authorization/DeviceAccessAuthorizationService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/authorization/DeviceAccessAuthorizationService.java index 18706fe7de..9ff3eb119b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/authorization/DeviceAccessAuthorizationService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/authorization/DeviceAccessAuthorizationService.java @@ -55,8 +55,8 @@ public interface DeviceAccessAuthorizationService { * DeviceIdentifier list. * * @param deviceIdentifiers - List of DeviceIdentifiers to be checked for authorization. - * @return DeviceAuthorizationResult - Authorization result including the list of authorized devices & unauthorized - * devices. + * @return DeviceAuthorizationResult - Authorization result object including the list of authorized devices and + * unauthorized devices. * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. */ DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers) throws @@ -68,8 +68,8 @@ public interface DeviceAccessAuthorizationService { * * @param deviceIdentifiers - List of DeviceIdentifiers to be checked for authorization. * @param groupPermissions - Group Permissions - * @return DeviceAuthorizationResult - Authorization result including the list of authorized devices & unauthorized - * devices. + * @return DeviceAuthorizationResult - Authorization result object including the list of authorized devices and + * unauthorized devices. * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. */ DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers, String[] groupPermissions) @@ -95,8 +95,8 @@ public interface DeviceAccessAuthorizationService { * @param deviceIdentifiers - List of DeviceIdentifiers to be checked for authorization. * @param username - User name * @param groupPermissions - Group Permissions - * @return DeviceAuthorizationResult - Authorization result including the list of authorized devices & unauthorized - * devices. + * @return DeviceAuthorizationResult - Authorization result object including the list of authorized devices and + * unauthorized devices. * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. */ DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers, String username, @@ -129,8 +129,8 @@ public interface DeviceAccessAuthorizationService { * * @param deviceIdentifiers - List of DeviceIdentifiers to be checked for authorization. * @param username - Username of the user to be checked for authorization. - * @return DeviceAuthorizationResult - Authorization result including the list of authorized devices & unauthorized - * devices. + * @return DeviceAuthorizationResult - Authorization result object including the list of authorized devices and + * unauthorized devices. * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. */ DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers, String username) throws diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/PlatformConfigurationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/PlatformConfigurationManagementService.java index 39484a378f..758c1fc495 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/PlatformConfigurationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/PlatformConfigurationManagementService.java @@ -28,6 +28,7 @@ public interface PlatformConfigurationManagementService { * * @param platformConfiguration Operation to be added. * @param resourcePath Registry resource path. + * @return A boolean indicating the status of the operation. * @throws org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException If some unusual behaviour is observed while adding the * configuration. */ @@ -38,6 +39,7 @@ public interface PlatformConfigurationManagementService { * Method to retrieve the list of general tenant configurations. * * @param resourcePath Registry resource path. + * @return Platform Configuration object. * @throws org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException If some unusual behaviour is observed while fetching the * operation list. */ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/NotificationManagementService.java index cbf26cc4cf..d2a0cfcf6d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/NotificationManagementService.java @@ -32,6 +32,7 @@ public interface NotificationManagementService { /** * Method to add a notification to the database. * + * @param deviceId - DeviceIdentifier of the device * @param notification - Notification to be added to database. * @return boolean status of the operation. * @throws NotificationManagementException @@ -66,7 +67,7 @@ public interface NotificationManagementService { * Method to fetch all the notifications in the database. * * @return List of all Notifications in the database. - * @throws NotificationManagementException + * @throws NotificationManagementException if something goes wrong while fetching the Notifications. * */ List getAllNotifications() throws NotificationManagementException; 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 ce548628b9..45db0d3eff 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 @@ -17,11 +17,14 @@ */ package org.wso2.carbon.device.mgt.common.operation.mgt; -import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.InvalidDeviceException; +import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; import java.util.List; -import java.util.Map; /** * This represents the Device Operation management functionality which should be implemented by @@ -34,8 +37,9 @@ public interface OperationManager { * * @param operation Operation to be added * @param devices List of DeviceIdentifiers to execute the operation + * @return Activity object corresponds to the added operation. * @throws OperationManagementException If some unusual behaviour is observed while adding the operation - * InvalidDeviceException If addOperation request contains Invalid DeviceIdentifiers. + * @throws InvalidDeviceException If addOperation request contains Invalid DeviceIdentifiers. */ Activity addOperation(Operation operation, List devices) throws OperationManagementException, InvalidDeviceException; @@ -43,7 +47,8 @@ public interface OperationManager { /** * Method to retrieve the list of all operations to a device. * - * @param deviceId + * @param deviceId - Device Identifier of the device + * @return A List of operations applied to the given device-id. * @throws OperationManagementException If some unusual behaviour is observed while fetching the * operation list. */ @@ -64,6 +69,7 @@ public interface OperationManager { * Method to retrieve the list of available operations to a device. * * @param deviceId DeviceIdentifier of the device + * @return A List of pending operations. * @throws OperationManagementException If some unusual behaviour is observed while fetching the * operation list. */ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/permission/mgt/PermissionManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/permission/mgt/PermissionManagerService.java index 5a31013663..68b81a9de4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/permission/mgt/PermissionManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/permission/mgt/PermissionManagerService.java @@ -27,19 +27,20 @@ import java.util.Properties; public interface PermissionManagerService { /** + * Adds a permission. * * @param permission - Permission to be added - * @throws PermissionManagementException If some unusual behaviour is observed while adding the - * permission. + * @return A boolean indicating the status of the operation. + * @throws PermissionManagementException If some unusual behaviour is observed while adding the permission. */ boolean addPermission(Permission permission) throws PermissionManagementException; /** + * Fetches a given permission. * * @param properties - Properties of the permission to be fetched. * @return The matched Permission object. - * @throws PermissionManagementException If some unusual behaviour is observed while fetching the - * permission. + * @throws PermissionManagementException If some unusual behaviour is observed while fetching the permission. */ Permission getPermission(Properties properties) throws PermissionManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java index c1f7e37da7..f18a5f5e7c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/push/notification/NotificationStrategy.java @@ -32,8 +32,8 @@ public interface NotificationStrategy { void undeploy(); /** - * Provides push notification configuration - * + * Provides push notification configuration. + * @return PushNotificationConfig for this NotificationStrategy */ PushNotificationConfig getConfig(); 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 a28a5969a7..7cc234efec 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java index 15df1e4435..af07800f3d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java @@ -22,6 +22,9 @@ import org.wso2.carbon.device.mgt.core.operation.mgt.PolicyOperation; public final class DeviceManagementConstants { + public static final String DM_CACHE_MANAGER = "DM_CACHE_MANAGER"; + public static final String DEVICE_CACHE = "DEVICE_CACHE"; + public static final class Common { private Common() { throw new AssertionError(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 756f09e32a..bf078a7b56 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -21,14 +21,22 @@ package org.wso2.carbon.device.mgt.core.app.mgt; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.InvalidDeviceException; +import org.wso2.carbon.device.mgt.common.TransactionManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; -import org.wso2.carbon.device.mgt.core.dao.*; +import org.wso2.carbon.device.mgt.core.dao.ApplicationDAO; +import org.wso2.carbon.device.mgt.core.dao.ApplicationMappingDAO; +import org.wso2.carbon.device.mgt.core.dao.DeviceDAO; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import java.sql.SQLException; @@ -190,10 +198,9 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem List applications) throws ApplicationManagementException { List installedAppList = getApplicationListForDevice(deviceIdentifier); try { + Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier, + false); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceManagementDAOFactory.beginTransaction(); - Device device = deviceDAO.getDevice(deviceIdentifier, tenantId); - if (log.isDebugEnabled()) { log.debug("Device:" + device.getId() + ":identifier:" + deviceIdentifier.getId()); } @@ -212,6 +219,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem appIdsToRemove.add(installedApp.getId()); } } + DeviceManagementDAOFactory.beginTransaction(); applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId); Application installedApp; List applicationIds = new ArrayList<>(); @@ -247,6 +255,8 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem throw new ApplicationManagementException("Error occurred saving application list to the device", e); } catch (TransactionManagementException e) { throw new ApplicationManagementException("Error occurred while initializing transaction", e); + } catch (DeviceManagementException e) { + throw new ApplicationManagementException("Error occurred obtaining the device object.", e); } finally { DeviceManagementDAOFactory.closeConnection(); } @@ -255,27 +265,31 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem @Override public List getApplicationListForDevice( DeviceIdentifier deviceId) throws ApplicationManagementException { - Device device; + Device device = null; try { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - DeviceManagementDAOFactory.openConnection(); - device = deviceDAO.getDevice(deviceId, tenantId); - if (device == null) { - if (log.isDebugEnabled()) { - log.debug("No device is found upon the device identifier '" + deviceId.getId() + - "' and type '" + deviceId.getType() + "'. Therefore returning null"); - } - return null; + device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, + false); + } catch (DeviceManagementException e) { + throw new ApplicationManagementException("Error occurred while fetching the device of '" + + deviceId.getType() + "' carrying the identifier'" + deviceId.getId(), e); + } + if (device == null) { + if (log.isDebugEnabled()) { + log.debug("No device is found upon the device identifier '" + deviceId.getId() + + "' and type '" + deviceId.getType() + "'. Therefore returning null"); } + return null; + } + try { + DeviceManagementDAOFactory.openConnection(); return applicationDAO.getInstalledApplications(device.getId()); } catch (DeviceManagementDAOException e) { throw new ApplicationManagementException("Error occurred while fetching the Application List of '" + deviceId.getType() + "' device carrying the identifier'" + deviceId.getId(), e); } catch (SQLException e) { throw new ApplicationManagementException("Error occurred while opening a connection to the data source", e); - } finally { + } finally { DeviceManagementDAOFactory.closeConnection(); } } - -} +} \ 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/cache/DeviceCacheKey.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/DeviceCacheKey.java new file mode 100644 index 0000000000..79f3d7507c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/DeviceCacheKey.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 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.cache; + +import java.util.Objects; + +/** + * This represents a Key object used in DeviceCache. + */ +public class DeviceCacheKey { + + private String deviceId; + private String deviceType; + private int tenantId; + private volatile int hashCode; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (!DeviceCacheKey.class.isAssignableFrom(obj.getClass())) { + return false; + } + final DeviceCacheKey other = (DeviceCacheKey) obj; + String thisId = this.deviceId + "-" + this.deviceType + "_" + this.tenantId; + String otherId = other.deviceId + "-" + other.deviceType + "_" + other.tenantId; + if (!thisId.equals(otherId)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + if (hashCode == 0) { + hashCode = Objects.hash(deviceId, deviceType, tenantId); + } + return hashCode; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/DeviceCacheManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/DeviceCacheManager.java new file mode 100644 index 0000000000..9a3d3ee3f4 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/DeviceCacheManager.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017, 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.cache; + +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.Device; + +import java.util.List; + +/** + * This defines the contract to be implemented by DeviceCacheManager which holds the necessary functionalities to + * manage a cache of Device objects. + */ +public interface DeviceCacheManager { + + /** + * Adds a given device object to the device-cache. + * @param deviceIdentifier - DeviceIdentifier of the device to be added. + * @param device - Device object to be added. + * @param tenantId - Owning tenant of the device. + * + */ + void addDeviceToCache(DeviceIdentifier deviceIdentifier, Device device, int tenantId); + + /** + * Removes a device object from device-cache. + * @param deviceIdentifier - DeviceIdentifier of the device to be removed. + * @param tenantId - Owning tenant of the device. + * + */ + void removeDeviceFromCache(DeviceIdentifier deviceIdentifier, int tenantId); + + /** + * Removes a list of devices from device-cache. + * @param deviceList - List of Cache-Keys of the device objects to be removed. + * + */ + void removeDevicesFromCache(List deviceList); + + /** + * Updates a given device object in the device-cache. + * @param deviceIdentifier - DeviceIdentifier of the device to be updated. + * @param device - Device object to be updated. + * @param tenantId - Owning tenant of the device. + * + */ + void updateDeviceInCache(DeviceIdentifier deviceIdentifier, Device device, int tenantId); + + /** + * Fetches a device object from device-cache. + * @param deviceIdentifier - DeviceIdentifier of the device to be fetched. + * @param tenantId - Owning tenant of the device. + * @return Device object + * + */ + Device getDeviceFromCache(DeviceIdentifier deviceIdentifier, int tenantId); +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java new file mode 100644 index 0000000000..6759ef7e5b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2017, 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.cache.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.core.cache.DeviceCacheKey; +import org.wso2.carbon.device.mgt.core.cache.DeviceCacheManager; +import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; + +import javax.cache.Cache; +import java.util.List; + +/** + * Implementation of DeviceCacheManager. + */ +public class DeviceCacheManagerImpl implements DeviceCacheManager { + + private static final Log log = LogFactory.getLog(DeviceCacheManagerImpl.class); + + private static DeviceCacheManagerImpl deviceCacheManager; + + private DeviceCacheManagerImpl() { + } + + public static DeviceCacheManagerImpl getInstance() { + if (deviceCacheManager == null) { + synchronized (DeviceCacheManagerImpl.class) { + if (deviceCacheManager == null) { + deviceCacheManager = new DeviceCacheManagerImpl(); + } + } + } + return deviceCacheManager; + } + + @Override + public void addDeviceToCache(DeviceIdentifier deviceIdentifier, Device device, int tenantId) { + Cache lCache = DeviceManagerUtil.getDeviceCache(); + DeviceCacheKey cacheKey = getCacheKey(deviceIdentifier, tenantId); + if (lCache.containsKey(cacheKey)) { + this.updateDeviceInCache(deviceIdentifier, device, tenantId); + } else { + lCache.put(cacheKey, device); + } + } + + @Override + public void removeDeviceFromCache(DeviceIdentifier deviceIdentifier, int tenantId) { + Cache lCache = DeviceManagerUtil.getDeviceCache(); + DeviceCacheKey cacheKey = getCacheKey(deviceIdentifier, tenantId); + if (lCache.containsKey(cacheKey)) { + lCache.remove(cacheKey); + } + } + + @Override + public void removeDevicesFromCache(List deviceList) { + Cache lCache = DeviceManagerUtil.getDeviceCache(); + for (DeviceCacheKey cacheKey : deviceList) { + if (lCache.containsKey(cacheKey)) { + lCache.remove(cacheKey); + } + } + } + + @Override + public void updateDeviceInCache(DeviceIdentifier deviceIdentifier, Device device, int tenantId) { + Cache lCache = DeviceManagerUtil.getDeviceCache(); + DeviceCacheKey cacheKey = getCacheKey(deviceIdentifier, tenantId); + if (lCache.containsKey(cacheKey)) { + lCache.replace(cacheKey, device); + } + } + + @Override + public Device getDeviceFromCache(DeviceIdentifier deviceIdentifier, int tenantId) { + Cache lCache = DeviceManagerUtil.getDeviceCache(); + return lCache.get(getCacheKey(deviceIdentifier, tenantId)); + } + + + private DeviceCacheKey getCacheKey(DeviceIdentifier deviceIdentifier, int tenantId) { + DeviceCacheKey deviceCacheKey = new DeviceCacheKey(); + deviceCacheKey.setDeviceId(deviceIdentifier.getId()); + deviceCacheKey.setDeviceType(deviceIdentifier.getType()); + deviceCacheKey.setTenantId(tenantId); + return deviceCacheKey; + } +} \ 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/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 170b861027..842b6bd967 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 @@ -18,6 +18,7 @@ package org.wso2.carbon.device.mgt.core.config; import org.wso2.carbon.device.mgt.core.config.geo.location.GeoLocationConfiguration; +import org.wso2.carbon.device.mgt.core.config.cache.DeviceCacheConfiguration; import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations; import org.wso2.carbon.device.mgt.core.config.pagination.PaginationConfiguration; import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration; @@ -26,9 +27,7 @@ import org.wso2.carbon.device.mgt.core.config.status.task.DeviceStatusTaskConfig import org.wso2.carbon.device.mgt.core.config.task.TaskConfiguration; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; /** * Represents Device Mgt configuration. @@ -44,9 +43,9 @@ public final class DeviceManagementConfig { private PaginationConfiguration paginationConfiguration; private PushNotificationConfiguration pushNotificationConfiguration; private DeviceStatusTaskConfig deviceStatusTaskConfig; + private DeviceCacheConfiguration deviceCacheConfiguration; private GeoLocationConfiguration geoLocationConfiguration; - @XmlElement(name = "ManagementRepository", required = true) public DeviceManagementConfigRepository getDeviceManagementConfigRepository() { return deviceManagementConfigRepository; @@ -111,6 +110,15 @@ public final class DeviceManagementConfig { this.deviceStatusTaskConfig = deviceStatusTaskConfig; } + @XmlElement(name = "DeviceCacheConfiguration", required = true) + public DeviceCacheConfiguration getDeviceCacheConfiguration() { + return deviceCacheConfiguration; + } + + public void setDeviceCacheConfiguration(DeviceCacheConfiguration deviceCacheConfiguration) { + this.deviceCacheConfiguration = deviceCacheConfiguration; + } + @XmlElement(name = "GeoLocationConfiguration", required = true) public GeoLocationConfiguration getGeoLocationConfiguration() { return geoLocationConfiguration; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/cache/DeviceCacheConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/cache/DeviceCacheConfiguration.java new file mode 100644 index 0000000000..34a813fbcf --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/cache/DeviceCacheConfiguration.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017, 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.cache; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "DeviceCacheConfiguration") +public class DeviceCacheConfiguration { + + private boolean isEnabled; + private int expiryTime; + + @XmlElement(name = "Enable", required = true) + public boolean isEnabled() { + return isEnabled; + } + + public void setEnabled(boolean enabled) { + isEnabled = enabled; + } + + @XmlElement(name = "ExpiryTime", required = true) + public int getExpiryTime() { + return expiryTime; + } + + public void setExpiryTime(int expiryTime) { + this.expiryTime = expiryTime; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java index 1eb39fc502..14ac17dd95 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java @@ -158,7 +158,7 @@ public interface DeviceDAO { HashMap getDevice(DeviceIdentifier deviceIdentifier) throws DeviceManagementDAOException; /** - * This method is used to retrieve a device of a given id. + * This method is used to retrieve a device of a given tenant id. * * @param deviceId device id. * @param tenantId tenant id. diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java index db8167d282..c42bb8acf8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -57,6 +57,7 @@ import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImpl; import org.wso2.carbon.device.mgt.core.task.DeviceTaskManagerService; import org.wso2.carbon.device.mgt.core.util.DeviceManagementSchemaInitializer; +import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.email.sender.core.service.EmailSenderService; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; @@ -152,6 +153,8 @@ public class DeviceManagementServiceComponent { GroupManagementDAOFactory.init(dsConfig); NotificationManagementDAOFactory.init(dsConfig); OperationManagementDAOFactory.init(dsConfig); + /*Initialize the device cache*/ + DeviceManagerUtil.initializeDeviceCache(); /* Initialize Operation Manager */ this.initOperationsManager(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java index 88883a4e26..90867dbc3d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EntityDoesNotExistException; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; @@ -30,8 +31,8 @@ import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; import org.wso2.carbon.device.mgt.core.dao.DeviceDAO; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationDAO; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil; @@ -65,7 +66,7 @@ public class NotificationManagementServiceImpl implements NotificationManagement int notificationId; int tenantId = NotificationDAOUtil.getTenantId(); - Device device = this.getDevice(deviceId, tenantId); + Device device = this.getDevice(deviceId); if (device == null) { throw new EntityDoesNotExistException("No device is found with type '" + deviceId.getType() + "' and id '" + deviceId.getId() + "'"); @@ -87,19 +88,13 @@ public class NotificationManagementServiceImpl implements NotificationManagement return true; } - private Device getDevice(DeviceIdentifier deviceId, int tenantId) throws NotificationManagementException { + private Device getDevice(DeviceIdentifier deviceId) throws NotificationManagementException { Device device; try { - DeviceManagementDAOFactory.openConnection(); - device = deviceDAO.getDevice(deviceId, tenantId); - } catch (SQLException e) { - throw new NotificationManagementException("Error occurred while opening a connection to" + - " the data source", e); - } catch (DeviceManagementDAOException e) { - throw new NotificationManagementException("Error occurred while retriving device data for " + + device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, false); + } catch (DeviceManagementException e) { + throw new NotificationManagementException("Error occurred while retrieving device data for " + " adding notification", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); } return device; } 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 7219440c91..dc096eb130 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 @@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.MonitoringOperation; @@ -293,19 +294,11 @@ public class OperationManagerImpl implements OperationManager { } private Device getDevice(DeviceIdentifier deviceId) throws OperationManagementException { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { - DeviceManagementDAOFactory.openConnection(); - return deviceDAO.getDevice(deviceId, tenantId); - } catch (SQLException e) { - throw new OperationManagementException("Error occurred while opening a connection the data " + - "source", e); - } catch (DeviceManagementDAOException e) { - OperationManagementDAOFactory.rollbackTransaction(); + return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, false); + } catch (DeviceManagementException e) { throw new OperationManagementException( - "Error occurred while retrieving device info", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); + "Error occurred while retrieving device info.", e); } } 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/SQLServerOperationDAOImpl.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/SQLServerOperationDAOImpl.java index 60015a9095..cbc5817381 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/SQLServerOperationDAOImpl.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/SQLServerOperationDAOImpl.java @@ -284,7 +284,8 @@ public class SQLServerOperationDAOImpl extends GenericOperationDAOImpl { stmt = conn.prepareStatement(sql); stmt.setString(1, opStatus.toString()); stmt.setString(2, pushNotificationStatus.toString()); - stmt.setInt(3, limit); + stmt.setInt(3, 0); + stmt.setInt(4, limit); rs = stmt.executeQuery(); while (rs.next()) { int tenantID = rs.getInt("TENANT_ID"); 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 12b873a228..6543f4bda9 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 @@ -57,6 +57,7 @@ import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; +import org.wso2.carbon.device.mgt.core.cache.impl.DeviceCacheManagerImpl; import org.wso2.carbon.device.mgt.core.dao.ApplicationDAO; import org.wso2.carbon.device.mgt.core.dao.DeviceDAO; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; @@ -282,8 +283,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv boolean status = deviceManager.modifyEnrollment(device); try { int tenantId = this.getTenantId(); + Device currentDevice = this.getDevice(deviceIdentifier, false); DeviceManagementDAOFactory.beginTransaction(); - Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId); device.setId(currentDevice.getId()); if (device.getEnrolmentInfo().getId() == 0) { device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId()); @@ -294,6 +295,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv deviceDAO.updateDevice(device, tenantId); enrollmentDAO.updateEnrollment(device.getEnrolmentInfo()); DeviceManagementDAOFactory.commitTransaction(); + this.removeDeviceFromCache(deviceIdentifier); } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); throw new DeviceManagementException("Error occurred while modifying the device " + @@ -333,30 +335,33 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } return false; } - try { - int tenantId = this.getTenantId(); - DeviceManagementDAOFactory.beginTransaction(); - Device device = deviceDAO.getDevice(deviceId, tenantId); - if (device == null) { - if (log.isDebugEnabled()) { - log.debug("Device not found for id '" + deviceId.getId() + "'"); - } - return false; + int tenantId = this.getTenantId(); + + Device device = this.getDevice(deviceId, false); + if (device == null) { + if (log.isDebugEnabled()) { + log.debug("Device not found for id '" + deviceId.getId() + "'"); } + return false; + } - if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) { - if (log.isDebugEnabled()) { - log.debug("Device has already disenrolled : " + deviceId.getId() + "'"); - } - return false; + if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) { + if (log.isDebugEnabled()) { + log.debug("Device has already disenrolled : " + deviceId.getId() + "'"); } + return true; + } + + try { device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime()); device.getEnrolmentInfo().setStatus(EnrolmentInfo.Status.REMOVED); + DeviceManagementDAOFactory.beginTransaction(); enrollmentDAO.updateEnrollment(device.getId(), device.getEnrolmentInfo(), tenantId); deviceDAO.updateDevice(device, tenantId); DeviceManagementDAOFactory.commitTransaction(); + this.removeDeviceFromCache(deviceId); } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); throw new DeviceManagementException("Error occurred while dis-enrolling '" + deviceId.getType() + @@ -371,19 +376,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { - try { - DeviceManagementDAOFactory.openConnection(); - Device device = deviceDAO.getDevice(deviceId, this.getTenantId()); - if (device != null) { - return true; - } - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while obtaining the enrollment information device for" + - "id '" + deviceId.getId() + "'", e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); + Device device = this.getDevice(deviceId, false); + if (device != null) { + return true; } return false; } @@ -582,25 +577,29 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public Device getDevice(DeviceIdentifier deviceId, boolean requireDeviceInfo) throws DeviceManagementException { - Device device; - try { - DeviceManagementDAOFactory.openConnection(); - device = deviceDAO.getDevice(deviceId, this.getTenantId()); - if (device == null) { - String msg = "No device is found upon the type '" + deviceId.getType() + "' and id '" + - deviceId.getId() + "'"; - if (log.isDebugEnabled()) { - log.debug(msg); + int tenantId = this.getTenantId(); + Device device = this.getDeviceFromCache(deviceId); + if (device == null) { + try { + DeviceManagementDAOFactory.openConnection(); + device = deviceDAO.getDevice(deviceId, tenantId); + if (device == null) { + String msg = "No device is found upon the type '" + deviceId.getType() + "' and id '" + + deviceId.getId() + "'"; + if (log.isDebugEnabled()) { + log.debug(msg); + } + return null; } - return null; + this.addDeviceToCache(deviceId, device); + } catch (DeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while obtaining the device for id " + + "'" + deviceId.getId() + "'", e); + } catch (SQLException e) { + throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); } - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while obtaining the device for id " + - "'" + deviceId.getId() + "'", e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); } if (requireDeviceInfo) { device = this.getAllDeviceInfo(device); @@ -690,25 +689,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public Device getDeviceWithTypeProperties(DeviceIdentifier deviceId) throws DeviceManagementException { - Device device; - try { - DeviceManagementDAOFactory.openConnection(); - device = deviceDAO.getDevice(deviceId, this.getTenantId()); - if (device == null) { - if (log.isDebugEnabled()) { - log.debug("No device is found upon the type '" + deviceId.getType() + "' and id '" + - deviceId.getId() + "'"); - } - return null; - } - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while obtaining the device for id " + - "'" + deviceId.getId() + "'", e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } + Device device = this.getDevice(deviceId, false); DeviceManager deviceManager = this.getDeviceManager(device.getType()); if (deviceManager == null) { @@ -883,14 +864,15 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv EnrolmentInfo.Status status) throws DeviceManagementException { try { boolean success = false; - DeviceManagementDAOFactory.beginTransaction(); int tenantId = this.getTenantId(); - Device device = deviceDAO.getDevice(deviceId, tenantId); + Device device = this.getDevice(deviceId, false); EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo(); + DeviceManagementDAOFactory.beginTransaction(); if (enrolmentInfo != null) { success = enrollmentDAO.setStatus(enrolmentInfo.getId(), currentOwner, status, tenantId); } DeviceManagementDAOFactory.commitTransaction(); + this.removeDeviceFromCache(deviceId); return success; } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); @@ -899,7 +881,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv throw new DeviceManagementException("Error occurred while initiating transaction", e); } finally { DeviceManagementDAOFactory.closeConnection(); - } } @@ -1210,7 +1191,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return this.getAllDevicesOfRole(role, true); } - //TODO FIX THIS @Override public List getAllDevicesOfRole(String role, boolean requireDeviceInfo) throws DeviceManagementException { List devices = new ArrayList<>(); @@ -1433,19 +1413,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public boolean isEnrolled(DeviceIdentifier deviceId, String user) throws DeviceManagementException { - try { - DeviceManagementDAOFactory.openConnection(); - Device device = deviceDAO.getDevice(deviceId, this.getTenantId()); - if (device != null && device.getEnrolmentInfo().getOwner().equals(user)) { - return true; - } - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while obtaining the enrollment information device for" + - "id '" + deviceId.getId() + "' and user : " + user, e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); + Device device = this.getDevice(deviceId, false); + if (device != null && device.getEnrolmentInfo() != null && device.getEnrolmentInfo().getOwner().equals(user)) { + return true; } return false; } @@ -1726,4 +1696,16 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } return device; } + + private Device getDeviceFromCache(DeviceIdentifier deviceIdentifier) { + return DeviceCacheManagerImpl.getInstance().getDeviceFromCache(deviceIdentifier, this.getTenantId()); + } + + private void addDeviceToCache(DeviceIdentifier deviceIdentifier, Device device) { + DeviceCacheManagerImpl.getInstance().addDeviceToCache(deviceIdentifier, device, this.getTenantId()); + } + + private void removeDeviceFromCache(DeviceIdentifier deviceIdentifier) { + DeviceCacheManagerImpl.getInstance().removeDeviceFromCache(deviceIdentifier, this.getTenantId()); + } } \ 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/status/task/impl/DeviceStatusMonitoringTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java index 6bc51da2ba..101e549c63 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.core.status.task.impl; import com.google.gson.Gson; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.TransactionManagementException; @@ -66,8 +67,10 @@ public class DeviceStatusMonitoringTask implements Task { public void execute() { List operationEnrolmentMappings = null; List enrolmentInfoTobeUpdated = new ArrayList<>(); + List identifiers = new ArrayList<>(); Map lastActivities = null; EnrolmentInfo enrolmentInfo; + DeviceIdentifier deviceIdentifier; try { operationEnrolmentMappings = this.getOperationEnrolmentMappings(); if (operationEnrolmentMappings != null && operationEnrolmentMappings.size() > 0) { @@ -87,12 +90,19 @@ public class DeviceStatusMonitoringTask implements Task { enrolmentInfo.setId(mapping.getEnrolmentId()); enrolmentInfo.setStatus(newStatus); enrolmentInfoTobeUpdated.add(enrolmentInfo); + + deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(mapping.getDeviceId()); + deviceIdentifier.setId(mapping.getDeviceType()); + identifiers.add(deviceIdentifier); } } if (enrolmentInfoTobeUpdated.size() > 0) { try { this.updateDeviceStatus(enrolmentInfoTobeUpdated); + //Remove updated entries from cache + //DeviceCacheManagerImpl.getInstance().removeDevicesFromCache(identifiers); } catch (DeviceStatusTaskException e) { log.error("Error occurred while updating non-responsive device-status of devices of type '" + deviceType + "'",e); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java index 83850b3182..ebcd3d5886 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java @@ -92,13 +92,19 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager { operations = this.getValidOperationNames(); //list operations for each device type devices = deviceManagementProviderService.getAllDevices(deviceType, false);//list devices for each type if (!devices.isEmpty()) { - for (String str : operations) { - CommandOperation operation = new CommandOperation(); - operation.setEnabled(true); - operation.setType(Operation.Type.COMMAND); - operation.setCode(str); - deviceManagementProviderService.addOperation(deviceType, operation, - DeviceManagerUtil.getValidDeviceIdentifiers(devices)); + if (operations != null) { + for (String str : operations) { + CommandOperation operation = new CommandOperation(); + operation.setEnabled(true); + operation.setType(Operation.Type.COMMAND); + operation.setCode(str); + deviceManagementProviderService.addOperation(deviceType, operation, + DeviceManagerUtil.getValidDeviceIdentifiers(devices)); + } + } else { + if (log.isDebugEnabled()) { + log.debug("No operations are available."); + } } } else { if (log.isDebugEnabled()) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java index d23939f866..b8119222db 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java @@ -53,7 +53,6 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService { log.info("Task adding for " + deviceType); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - try { TaskService taskService = DeviceManagementDataHolder.getInstance().getTaskService(); taskService.registerTaskType(TASK_TYPE); 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 665ffff1c4..ee972ef5bf 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 @@ -33,6 +33,8 @@ import org.wso2.carbon.device.mgt.common.TransactionManagementException; 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; +import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.core.cache.DeviceCacheKey; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; @@ -51,6 +53,10 @@ import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.ConfigurationContextService; import org.wso2.carbon.utils.NetworkUtils; +import javax.cache.Cache; +import javax.cache.CacheConfiguration; +import javax.cache.CacheManager; +import javax.cache.Caching; import javax.sql.DataSource; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; @@ -62,12 +68,15 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; public final class DeviceManagerUtil { private static final Log log = LogFactory.getLog(DeviceManagerUtil.class); + private static boolean isDeviceCacheInistialized = false; + public static Document convertToDocument(File file) throws DeviceManagementException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); @@ -455,6 +464,10 @@ public final class DeviceManagerUtil { return true; } + private static CacheManager getCacheManager() { + return Caching.getCacheManagerFactory().getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER); + } + public static EventsPublisherService getEventPublisherService() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); EventsPublisherService eventsPublisherService = @@ -466,4 +479,53 @@ public final class DeviceManagerUtil { } return eventsPublisherService; } -} + + public static void initializeDeviceCache() { + DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); + int deviceCacheExpiry = config.getDeviceCacheConfiguration().getExpiryTime(); + CacheManager manager = getCacheManager(); + if (config.getDeviceCacheConfiguration().isEnabled()) { + if(!isDeviceCacheInistialized) { + isDeviceCacheInistialized = true; + if (manager != null) { + if (deviceCacheExpiry > 0) { + manager.createCacheBuilder(DeviceManagementConstants.DEVICE_CACHE). + setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, + deviceCacheExpiry)).setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration. + Duration(TimeUnit.SECONDS, deviceCacheExpiry)).setStoreByValue(true).build(); + } else { + manager.getCache(DeviceManagementConstants.DEVICE_CACHE); + } + } else { + if (deviceCacheExpiry > 0) { + Caching.getCacheManager(). + createCacheBuilder(DeviceManagementConstants.DEVICE_CACHE). + setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, + deviceCacheExpiry)).setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration. + Duration(TimeUnit.SECONDS, deviceCacheExpiry)).setStoreByValue(true).build(); + } else { + Caching.getCacheManager().getCache(DeviceManagementConstants.DEVICE_CACHE); + } + } + } + } + } + + public static Cache getDeviceCache() { + DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); + CacheManager manager = getCacheManager(); + Cache deviceCache = null; + if (config.getDeviceCacheConfiguration().isEnabled()) { + if(!isDeviceCacheInistialized) { + initializeDeviceCache(); + } + if (manager != null) { + deviceCache = manager.getCache(DeviceManagementConstants.DEVICE_CACHE); + } else { + deviceCache = Caching.getCacheManager(DeviceManagementConstants.DM_CACHE_MANAGER). + getCache(DeviceManagementConstants.DEVICE_CACHE); + } + } + return deviceCache; + } +} \ No newline at end of file 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 1da40b739f..07902affff 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 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 c215d8ef41..773de8d732 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js index 1461688397..75ab86ebb8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js @@ -428,7 +428,7 @@ $(document).ready(function () { $("#right-sidebar").on("click", ".new-notification", function () { var notificationId = $(this).data("id"); var redirectUrl = $(this).data("url"); - var markAsReadNotificationsAPI = "/mdm-admin/notifications/" + notificationId + "/CHECKED"; + var markAsReadNotificationsAPI = "/api/device-mgt/v1.0/notifications/" + notificationId + "/mark-checked"; var messageSideBar = ".sidebar-messages"; invokerUtil.put( 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 b822573de2..4614d6b870 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 9fd5fe9627..9b15b97627 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-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 0cf7911768..3f903f1589 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/internal/EmailSenderServiceComponent.java b/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/internal/EmailSenderServiceComponent.java index 8747ca6e19..b45798a0c1 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/internal/EmailSenderServiceComponent.java +++ b/components/email-sender/org.wso2.carbon.email.sender.core/src/main/java/org/wso2/carbon/email/sender/core/internal/EmailSenderServiceComponent.java @@ -28,7 +28,8 @@ import org.wso2.carbon.utils.Axis2ConfigurationContextObserver; import org.wso2.carbon.utils.ConfigurationContextService; /** - * @scr.component name="org.wso2.carbon.email.sender.EmailSenderServiceComponent" immediate="true" + * @scr.component name="org.wso2.carbon.email.sender.emailsendereervicecomponent" + * immediate="true" * @scr.reference name="registry.service" * interface="org.wso2.carbon.registry.core.service.RegistryService" * cardinality="1..1" diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index dd2836fc3a..d192478902 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml index 8c6c708008..b019bdaf64 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml index 5d4450ec88..246616ebd2 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml index a40f323841..9693a1a5b1 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT bundle WSO2 Carbon - Dynamic client registration service WSO2 Carbon - Dynamic Client Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml index 4274d4b3e0..38f10e930d 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.web.app.registration - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT bundle WSO2 Carbon - Dynamic client web app registration WSO2 Carbon - Dynamic Client Web-app Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml index 0734eb6c5f..3c3d87a1a9 100644 --- a/components/identity-extensions/dynamic-client-registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT pom WSO2 Carbon - Dynamic client registration http://wso2.org 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 53a49fb364..64067ab408 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,22 +22,18 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT bundle WSO2 Carbon - OAuth Extensions http://wso2.org - - org.wso2.carbon.devicemgt - org.wso2.carbon.identity.authenticator.backend.oauth - commons-codec.wso2 commons-codec @@ -91,7 +87,6 @@ org.wso2.carbon.device.mgt.oauth.extensions.* - org.wso2.carbon.identity.authenticator.backend.oauth.*, org.wso2.carbon.identity.oauth2.grant.jwt;version="${carbon.identity.jwt.grant.version.range}", org.apache.commons.lang, org.apache.commons.logging, diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java index 40d87a17ec..090a6f0f1b 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java @@ -22,12 +22,11 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; +import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.LocalOAuthValidator; +import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; import org.wso2.carbon.identity.application.common.model.ServiceProvider; -import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuth2TokenValidator; -import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationResponse; -import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidatorFactory; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.dto.OAuth2AccessTokenReqDTO; import org.wso2.carbon.identity.oauth2.internal.OAuth2ServiceComponentHolder; @@ -47,12 +46,12 @@ public class AccessTokenGrantHandler extends AbstractAuthorizationGrantHandler { private static Log log = LogFactory.getLog(AccessTokenGrantHandler.class); private static final String TENANT_DOMAIN_KEY = "tenantDomain"; - private OAuth2TokenValidator tokenValidator; + private LocalOAuthValidator tokenValidator; public static final String TOKEN_GRANT_PARAM = "admin_access_token"; public AccessTokenGrantHandler() { try { - tokenValidator = OAuthValidatorFactory.getValidator(); + tokenValidator = new LocalOAuthValidator(); } catch (IllegalArgumentException e) { log.error("Failed to initialise Authenticator", e); } diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/LocalOAuthValidator.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/LocalOAuthValidator.java new file mode 100755 index 0000000000..dd7872da35 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/LocalOAuthValidator.java @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator; + +import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.internal.OAuthAuthenticatorDataHolder; +import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO; +import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; + +import java.rmi.RemoteException; + +/** + * Handles the authentication using the inbuilt IS features. + */ +public class LocalOAuthValidator { + private static final String BEARER_TOKEN_TYPE = "bearer"; + + /** + * This method gets a string accessToken and validates it and generate the OAuth2ClientApplicationDTO + * containing the validity and user details if valid. + * + * @param token which need to be validated. + * @return OAuthValidationResponse with the validated results. + */ + public OAuthValidationResponse validateToken(String token) throws RemoteException{ + OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO(); + OAuth2TokenValidationRequestDTO.OAuth2AccessToken accessToken = + validationRequest.new OAuth2AccessToken(); + accessToken.setTokenType(BEARER_TOKEN_TYPE); + accessToken.setIdentifier(token); + validationRequest.setAccessToken(accessToken); + OAuth2TokenValidationResponseDTO tokenValidationResponse = OAuthAuthenticatorDataHolder.getInstance(). + getOAuth2TokenValidationService().findOAuthConsumerIfTokenIsValid(validationRequest).getAccessTokenValidationResponse(); + boolean isValid = tokenValidationResponse.isValid(); + String userName = null; + String tenantDomain = null; + if (isValid) { + userName = MultitenantUtils.getTenantAwareUsername( + tokenValidationResponse.getAuthorizedUser()); + tenantDomain = + MultitenantUtils.getTenantDomain(tokenValidationResponse.getAuthorizedUser()); + } + return new OAuthValidationResponse(userName, tenantDomain, isValid); + } +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/OAuthValidationResponse.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/OAuthValidationResponse.java new file mode 100755 index 0000000000..75042177fb --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/OAuthValidationResponse.java @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator; + +/** + * This class holds the authenticated user information after the OAuth2 token is validated. + */ +@SuppressWarnings("unused") +public class OAuthValidationResponse { + + private String userName; + private String tenantDomain; + private boolean isValid; + + public OAuthValidationResponse(String userName, String tenantDomain, boolean isValid) { + this.userName = userName; + this.tenantDomain = tenantDomain; + this.isValid = isValid; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getTenantDomain() { + return tenantDomain; + } + + public void setTenantDomain(String tenantDomain) { + this.tenantDomain = tenantDomain; + } + + public boolean isValid() { + return isValid; + } + + public void setIsValid(boolean isValid) { + this.isValid = isValid; + } +} \ No newline at end of file diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorDataHolder.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorDataHolder.java new file mode 100644 index 0000000000..85b32c04c5 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorDataHolder.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * you may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.internal; + +import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; + +/** + * DataHolder of Backend OAuth Authenticator component. + */ +public class OAuthAuthenticatorDataHolder { + + private OAuth2TokenValidationService oAuth2TokenValidationService; + + private static OAuthAuthenticatorDataHolder thisInstance = new OAuthAuthenticatorDataHolder(); + + private OAuthAuthenticatorDataHolder() {} + + public static OAuthAuthenticatorDataHolder getInstance() { + return thisInstance; + } + + public OAuth2TokenValidationService getOAuth2TokenValidationService() { + if (oAuth2TokenValidationService == null) { + throw new IllegalStateException("OAuth2TokenValidation service is not initialized properly"); + } + return oAuth2TokenValidationService; + } + + public void setOAuth2TokenValidationService( + OAuth2TokenValidationService oAuth2TokenValidationService) { + this.oAuth2TokenValidationService = oAuth2TokenValidationService; + } +} \ No newline at end of file diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java new file mode 100755 index 0000000000..63407083b7 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; + +/** + * @scr.component name="org.wso2.carbon.device.mgt.oauth.extensions.authenticator" immediate="true" + * @scr.reference name="identity.oauth2.validation.service" + * interface="org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService" + * cardinality="1..1" + * policy="dynamic" + * bind="setOAuth2ValidationService" + * unbind="unsetOAuth2ValidationService" + */ +public class OAuthAuthenticatorServiceComponent { + + private static final Log log = LogFactory.getLog(OAuthAuthenticatorServiceComponent.class); + + @SuppressWarnings("unused") + protected void activate(ComponentContext componentContext) { + if (log.isDebugEnabled()) { + log.debug("Starting Backend OAuthAuthenticator Framework Bundle"); + } + } + + @SuppressWarnings("unused") + protected void deactivate(ComponentContext componentContext) { + //do nothing + } + + /** + * Sets OAuth2TokenValidation Service. + * + * @param tokenValidationService An instance of OAuth2TokenValidationService. + */ + @SuppressWarnings("unused") + protected void setOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { + if (log.isDebugEnabled()) { + log.debug("Setting OAuth2TokenValidationService Service"); + } + OAuthAuthenticatorDataHolder.getInstance().setOAuth2TokenValidationService(tokenValidationService); + } + + /** + * Unsets OAuth2TokenValidation Service. + * + * @param tokenValidationService An instance of OAuth2TokenValidationService + */ + @SuppressWarnings("unused") + protected void unsetOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { + if (log.isDebugEnabled()) { + log.debug("Unsetting OAuth2TokenValidationService Service"); + } + OAuthAuthenticatorDataHolder.getInstance().setOAuth2TokenValidationService(null); + } +} \ No newline at end of file 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 115d5b3409..2aa613ae56 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 - 2.0.76-SNAPSHOT + 3.0.3-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 cf1952b664..20ab758a29 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 9941cdb6f0..dc5364318e 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-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 5d35deba5f..5ddfffc568 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 2.0.76-SNAPSHOT + 3.0.3-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 3a922ee52e..810f3ff8a4 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 2.0.76-SNAPSHOT + 3.0.3-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 d2e4ad79e7..594518862b 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 2.0.76-SNAPSHOT + 3.0.3-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 c5e142775b..33e3f3f7c8 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 2.0.76-SNAPSHOT + 3.0.3-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 457d2ad373..29bad98efe 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 2.0.76-SNAPSHOT + 3.0.3-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/impl/PolicyInformationPointImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyInformationPointImpl.java index da1146f780..6dd0ebbc5a 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyInformationPointImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyInformationPointImpl.java @@ -72,7 +72,7 @@ public class PolicyInformationPointImpl implements PolicyInformationPoint { GroupManagementProviderService groupManagementProviderService = new GroupManagementProviderServiceImpl(); try { - device = deviceManagementService.getDevice(deviceIdentifier); + device = deviceManagementService.getDevice(deviceIdentifier, false); if (device != null) { pipDevice.setDevice(device); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index 5307c5f29f..37a3e148fc 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -190,7 +190,7 @@ public class PolicyManagerImpl implements PolicyManager { policy.setProfileId(profileId); Timestamp currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime()); policy.getProfile().setUpdatedDate(currentTimestamp); - + policy.setPriorityId(previousPolicy.getPriorityId()); policyDAO.updatePolicy(policy); profileDAO.updateProfile(policy.getProfile()); 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 98be922a1c..0cd1564505 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 @@ -24,27 +24,35 @@ jdbc/DM_DS - - 8 - 100 - 20 - 1000 - - - https://localhost:9443 - admin - admin - - - org.wso2.carbon.policy.mgt - true - 60000 - 5 - 8 - 20 - - Simple - + + 8 + 100 + 20 + 1000 + + + https://localhost:9443 + admin + admin + + + org.wso2.carbon.policy.mgt + true + 60000 + 5 + 8 + 20 + + Simple + + + + true + + + true + 300 + diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index cead84d591..9eff98ef2f 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT pom WSO2 Carbon - Policy Management Component http://wso2.org 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 26053e142c..489c683afc 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 101c769980..ab514fa928 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.76-SNAPSHOT + 3.0.3-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 8a7f9312f6..9e4a23a758 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 d3d3ec21ef..d8a9d5a3bb 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 eb9273ba98..3269843001 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 2.0.76-SNAPSHOT + 3.0.3-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 76107bd680..046eec1f43 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 047a7fb61f..30f60294b5 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.76-SNAPSHOT + 3.0.3-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 48f723a20c..e0f3f97515 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 - 2.0.76-SNAPSHOT + 3.0.3-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 fc0d804e6b..bd17b75dd4 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 - 2.0.76-SNAPSHOT + 3.0.3-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 360aa56d59..ef813e0137 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 0defaaf173..5cc12fe47a 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.76-SNAPSHOT + 3.0.3-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 76079286d2..868d8315bd 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 0018023f5b..a499a4fb23 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index ef05209c55..1f6d333a2e 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 365a5706bc..e7d46a48d9 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 33a9dfa1fd..0be04110a8 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml index 47a6f4b0dc..742196382e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml @@ -3,13 +3,13 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.dashboard.feature - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT pom WSO2 Carbon - Device Management Dashboard Analytics Feature WSO2 Carbon - Device Management Dashboard Analytics Feature 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 a586ca8b68..b88b261961 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 2a7feada7c..d9c391b9a7 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 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 86c1c157f8..b4ee62f260 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 a8473649b6..941321cff4 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 - 2.0.76-SNAPSHOT + 3.0.3-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 2934b5112f..f29782d609 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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.server.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml index 44abdad940..ef37f6205d 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml @@ -54,10 +54,6 @@ Simple - - - - 20 @@ -66,9 +62,18 @@ 20 20 + true + + + true + 600 + true 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 1adfc72b46..e116f6aa2f 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index e90b06de1e..c6b2410619 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml index c500eeb026..6e452cd647 100644 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml +++ b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration.server.feature pom - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT WSO2 Carbon - Dynamic Client Registration Server Feature http://wso2.org This feature contains dynamic client registration features diff --git a/features/dynamic-client-registration/pom.xml b/features/dynamic-client-registration/pom.xml index 4c27706912..2f16496def 100644 --- a/features/dynamic-client-registration/pom.xml +++ b/features/dynamic-client-registration/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org 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 598c37dd75..2e57ffbf7b 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 ebaf636fed..ca80318fbf 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 2.0.76-SNAPSHOT + 3.0.3-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 5322162e89..1049305018 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 08e09e9f8a..992127d8a7 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT pom WSO2 Carbon - Dynamic Client Registration 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 ec74f0c236..cdd462c88c 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 3dbfb527cf..e4a95c0046 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.76-SNAPSHOT + 3.0.3-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 47d91c966c..b558de39d5 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 1749f169a0..d86101a294 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.76-SNAPSHOT + 3.0.3-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 d9bed043a2..a2a6fa8637 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 2.0.76-SNAPSHOT + 3.0.3-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 510b2fff47..96859e05f6 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 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index a6c7fd524e..918951df81 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1828,7 +1828,7 @@ 1.2.11.wso2v10 - 2.0.76-SNAPSHOT + 3.0.3-SNAPSHOT 4.4.8 @@ -1955,6 +1955,7 @@ 1.9 (1.9,2.0] 3.12.1.GA + true