From ce1586a52c7a9af9a927a0548804d25b58f0f7b5 Mon Sep 17 00:00:00 2001 From: manoj Date: Sat, 7 Feb 2015 06:13:27 +0530 Subject: [PATCH 1/2] Add Default License configuration file --- .../src/main/resources/DefaultLicense.xml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/DefaultLicense.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/DefaultLicense.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/DefaultLicense.xml new file mode 100644 index 0000000000..2cea20f942 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/DefaultLicense.xml @@ -0,0 +1,50 @@ + + + + + + wso2 + android + 1.0.0 + 1.0.0 + 01-01-2014 + 31-12-2035 + + + + wso2 + ios + 1.0.0 + 1.0.0 + 01-01-2014 + 31-12-2035 + + + + wso2 + windows + 1.0.0 + 1.0.0 + 01-01-2014 + 31-12-2035 + + + \ No newline at end of file From 4b81d04320b2e66d6d43931f67b46cb61c735e1b Mon Sep 17 00:00:00 2001 From: manoj Date: Sat, 7 Feb 2015 06:14:20 +0530 Subject: [PATCH 2/2] License Managment refactor --- .../device/mgt/common/DeviceManagementConstants.java | 10 ---------- .../carbon/device/mgt/core/LicenseManagerImpl.java | 3 ++- .../internal/LicenseManagementServiceComponent.java | 3 +-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java index 5e63430d41..ebd264b36a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java @@ -59,21 +59,11 @@ public final class DeviceManagementConstants { public final static String LANGUAGE_CODE_ENGLISH_UK = "en-uk"; } - public static final class DefaultLicences { - - private DefaultLicences() { - throw new AssertionError(); - } - - public static final String DEFAULT_LICENSE_CONFIG_XML_NAME = "DefaultLicense.xml"; - } - public static final class LicenseProperties { private LicenseProperties() { throw new AssertionError(); } - public static final String OVERVIEW_PROVIDER = "overview_provider"; public static final String OVERVIEW_NAME = "overview_name"; public static final String OVERVIEW_LANGUAGE = "overview_language"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/LicenseManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/LicenseManagerImpl.java index 413e1fe12b..3252e2e98d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/LicenseManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/LicenseManagerImpl.java @@ -68,7 +68,8 @@ public class LicenseManagerImpl implements LicenseManager { try { GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry); - GenericArtifactManager artifactManager = new GenericArtifactManager(registry, "license"); + GenericArtifactManager artifactManager = new GenericArtifactManager(registry, + DeviceManagementConstants.LicenseProperties.LICENSE_REGISTRY_KEY); filteredArtifacts = artifactManager.findGenericArtifacts( new GenericArtifactFilter() { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/LicenseManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/LicenseManagementServiceComponent.java index 3fd0ad6acc..67d2b6a835 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/LicenseManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/LicenseManagementServiceComponent.java @@ -68,7 +68,7 @@ public class LicenseManagementServiceComponent { LicenseManager licenseManager = new LicenseManagerImpl(); LicenseManagementDataHolder.getInstance().setLicenseManager(licenseManager); - /* If -Dsetup option enabled then create creates default license management */ + /* If -Dsetup option enabled then create creates default license management */ String setupOption = System.getProperty( org.wso2.carbon.device.mgt.core.DeviceManagementConstants.Common.PROPERTY_SETUP); @@ -81,7 +81,6 @@ public class LicenseManagementServiceComponent { .getLicenseMgtConfig(); addDefaultLicenses(licenseManagementConfig); } - if (log.isDebugEnabled()) { log.debug("Registering OSGi service LicenseManagementService"); }