Fixing API config initialization issues

revert-dabc3590
prabathabey 10 years ago
parent 717fa6dea8
commit aa7d4e4eba

@ -16,6 +16,7 @@
package org.wso2.carbon.device.mgt.mobile.config; package org.wso2.carbon.device.mgt.mobile.config;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.List; import java.util.List;
@ -24,12 +25,13 @@ public class APIPublisherConfig {
private List<APIConfig> apis; private List<APIConfig> apis;
@XmlElement(name = "APIs") @XmlElementWrapper(name = "APIs", nillable = false, required = true)
public List<APIConfig> getApis() { @XmlElement(name = "API", nillable = false)
public List<APIConfig> getAPIs() {
return apis; return apis;
} }
public void setApis(List<APIConfig> apis) { public void setAPIs(List<APIConfig> apis) {
this.apis = apis; this.apis = apis;
} }

@ -133,7 +133,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
private void initAPIConfigs() throws DeviceManagementException { private void initAPIConfigs() throws DeviceManagementException {
List<APIConfig> apiConfigs = List<APIConfig> apiConfigs =
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
getApiPublisherConfig().getApis(); getApiPublisherConfig().getAPIs();
for (APIConfig apiConfig : apiConfigs) { for (APIConfig apiConfig : apiConfigs) {
try { try {
APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner()); APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner());
@ -148,7 +148,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
private void publishAPIs() throws DeviceManagementException { private void publishAPIs() throws DeviceManagementException {
List<APIConfig> apiConfigs = List<APIConfig> apiConfigs =
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
getApiPublisherConfig().getApis(); getApiPublisherConfig().getAPIs();
for (APIConfig apiConfig : apiConfigs) { for (APIConfig apiConfig : apiConfigs) {
DeviceManagementAPIPublisherUtil.publishAPI(apiConfig); DeviceManagementAPIPublisherUtil.publishAPI(apiConfig);
} }
@ -157,7 +157,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
private void removeAPIs() throws DeviceManagementException { private void removeAPIs() throws DeviceManagementException {
List<APIConfig> apiConfigs = List<APIConfig> apiConfigs =
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
getApiPublisherConfig().getApis(); getApiPublisherConfig().getAPIs();
for (APIConfig apiConfig : apiConfigs) { for (APIConfig apiConfig : apiConfigs) {
DeviceManagementAPIPublisherUtil.removeAPI(apiConfig); DeviceManagementAPIPublisherUtil.removeAPI(apiConfig);
} }

@ -25,6 +25,7 @@
</ManagementRepository> </ManagementRepository>
<APIPublisher> <APIPublisher>
<APIs>
<API> <API>
<Name>enrollment</Name> <Name>enrollment</Name>
<Provider>admin</Provider> <Provider>admin</Provider>
@ -33,5 +34,6 @@
<Endpoint>http://localhost:9763/</Endpoint> <Endpoint>http://localhost:9763/</Endpoint>
<Transports>http,https</Transports> <Transports>http,https</Transports>
</API> </API>
</APIs>
</APIPublisher> </APIPublisher>
</MobileDeviceMgtConfiguration> </MobileDeviceMgtConfiguration>

Loading…
Cancel
Save