From aa7d4e4eba03139dfae13a606bf9b8b768026d9c Mon Sep 17 00:00:00 2001 From: prabathabey Date: Mon, 12 Jan 2015 00:11:03 +0530 Subject: [PATCH] Fixing API config initialization issues --- .../mgt/mobile/config/APIPublisherConfig.java | 8 +++++--- .../MobileDeviceManagementBundleActivator.java | 6 +++--- .../src/main/resources/conf/mobile-config.xml | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/APIPublisherConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/APIPublisherConfig.java index 27454d10c9..faeaa2474b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/APIPublisherConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/APIPublisherConfig.java @@ -16,6 +16,7 @@ package org.wso2.carbon.device.mgt.mobile.config; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import java.util.List; @@ -24,12 +25,13 @@ public class APIPublisherConfig { private List apis; - @XmlElement(name = "APIs") - public List getApis() { + @XmlElementWrapper(name = "APIs", nillable = false, required = true) + @XmlElement(name = "API", nillable = false) + public List getAPIs() { return apis; } - public void setApis(List apis) { + public void setAPIs(List apis) { this.apis = apis; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java index e6eed7b771..2d1fb04ad2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java @@ -133,7 +133,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B private void initAPIConfigs() throws DeviceManagementException { List apiConfigs = MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). - getApiPublisherConfig().getApis(); + getApiPublisherConfig().getAPIs(); for (APIConfig apiConfig : apiConfigs) { try { APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner()); @@ -148,7 +148,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B private void publishAPIs() throws DeviceManagementException { List apiConfigs = MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). - getApiPublisherConfig().getApis(); + getApiPublisherConfig().getAPIs(); for (APIConfig apiConfig : apiConfigs) { DeviceManagementAPIPublisherUtil.publishAPI(apiConfig); } @@ -157,7 +157,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B private void removeAPIs() throws DeviceManagementException { List apiConfigs = MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). - getApiPublisherConfig().getApis(); + getApiPublisherConfig().getAPIs(); for (APIConfig apiConfig : apiConfigs) { DeviceManagementAPIPublisherUtil.removeAPI(apiConfig); } diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml index 73ca222435..bac7bdd5c8 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml @@ -25,13 +25,15 @@ - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - + + + enrollment + admin + enrollment + 1.0.0 + http://localhost:9763/ + http,https + +