From 1c13180e568efb2b3ff464cffb79cc29f761c06d Mon Sep 17 00:00:00 2001 From: manoj Date: Thu, 26 Mar 2015 17:22:24 +0530 Subject: [PATCH] Create pluin level databases --- .../pom.xml | 2 +- .../AbstractMobileOperationManager.java | 4 +-- .../MobileDeviceConfigurationManager.java | 3 -- .../MobileDeviceManagementRepository.java | 16 ++++++--- .../datasource/MobileDataSourceConfig.java | 3 +- .../MobileDataSourceConfigurations.java | 17 +++++---- .../impl/windows/WindowsDeviceManager.java | 8 ++--- .../malformed-mobile-config-no-api-config.xml | 35 +++++++++---------- .../src/main/resources/conf/mobile-config.xml | 1 - 9 files changed, 45 insertions(+), 44 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml index d3d4069a4..e6974c919 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml @@ -60,7 +60,7 @@ javax.xml.bind.*, javax.naming, javax.sql, - javax.xml.bind.annotation, + javax.xml.bind.annotation.*, javax.xml.parsers, org.w3c.dom, org.wso2.carbon.core, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java index 5a63eef8b..1b369bb16 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java @@ -33,8 +33,8 @@ public abstract class AbstractMobileOperationManager implements OperationManager } @Override - public boolean addOperation(Operation operation, - List devices) throws OperationManagementException { + public boolean addOperation(Operation operation, List devices) throws + OperationManagementException { return true; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java index 755e71f90..07123434d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java @@ -75,8 +75,5 @@ public class MobileDeviceConfigurationManager { return currentMobileDeviceConfig; } - public MobileDataSourceConfig getMobileDataSourceConfig() { - return currentMobileDeviceConfig.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java index 1d7b6560c..88369dd84 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java @@ -18,13 +18,13 @@ package org.wso2.carbon.device.mgt.mobile.config; -import org.wso2.carbon.device.mgt.mobile.common.PluginTypeEnum; import org.wso2.carbon.device.mgt.mobile.config.datasource.DataSourceConfigAdapter; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import java.util.List; import java.util.Map; /** @@ -34,12 +34,13 @@ import java.util.Map; public class MobileDeviceManagementRepository { private Map mobileDataSourceConfigMap; + private List mobileDataSourceConfigs; - public MobileDataSourceConfig getMobileDataSourceConfig(PluginTypeEnum type) { - return mobileDataSourceConfigMap.get(type.toString()); - } + public MobileDataSourceConfig getMobileDataSourceConfig(String provider) { + return mobileDataSourceConfigMap.get(provider); + } - @XmlElement(name="DataSourceConfigurations") + @XmlElement(name = "DataSourceConfigurations") @XmlJavaTypeAdapter(DataSourceConfigAdapter.class) public Map getMobileDataSourceConfigMap() { return mobileDataSourceConfigMap; @@ -48,4 +49,9 @@ public class MobileDeviceManagementRepository { public void setMobileDataSourceConfigMap(Map mobileDataSourceConfigMap) { this.mobileDataSourceConfigMap = mobileDataSourceConfigMap; } + + public List getMobileDataSourceConfigs() { + return (List) mobileDataSourceConfigMap.values(); + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java index 99fa93fe8..869aaf12e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java @@ -25,7 +25,8 @@ import javax.xml.bind.annotation.XmlRootElement; /** * Class for holding data source configuration in mobile-config.xml at parsing with JAXB. */ -@XmlRootElement(name = "DataSourceConfiguration") public class MobileDataSourceConfig { +@XmlRootElement(name = "DataSourceConfiguration") +public class MobileDataSourceConfig { private JNDILookupDefinition jndiLookupDefinition; private String type; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java index 7c4afa9a4..17e80f5bf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java @@ -1,9 +1,3 @@ -package org.wso2.carbon.device.mgt.mobile.config.datasource; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - /* * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * @@ -21,10 +15,19 @@ import java.util.List; * specific language governing permissions and limitations * under the License. */ +package org.wso2.carbon.device.mgt.mobile.config.datasource; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + @XmlRootElement(name = "DataSourceConfigurations") +@XmlAccessorType(XmlAccessType.FIELD) public class MobileDataSourceConfigurations { - @XmlElement(name = "DataSourceConfigurations", nillable = true) + @XmlElement(name = "DataSourceConfiguration", nillable = true) private List mobileDataSourceConfigs; public List getMobileDataSourceConfigs() { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java index 920d61296..054e1eab8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java @@ -34,17 +34,13 @@ import java.util.List; */ public class WindowsDeviceManager implements DeviceManager { -<<<<<<< HEAD:components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java - private static final Log log = LogFactory.getLog(WindowsDeviceManagerService.class); - private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory; + private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory; - public WindowsDeviceManagerService() { + public WindowsDeviceManager() { mobileDeviceManagementDAOFactory = new MobileDeviceManagementDAOFactory(DeviceManagementConstants .MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); } -======= private static final Log log = LogFactory.getLog(WindowsDeviceManager.class); ->>>>>>> 2c5cc4c28de5586b7450887d02c49a4c9973b40a:components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java @Override public String getProviderType() { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml index 69f2044ec..3fad2eceb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml @@ -19,24 +19,23 @@ - - - jdbc/MobileDM_DS - - + + + + jdbc/MobileIOSDM_DS + + + + + jdbc/MobileAndroidDM_DS + + + + + jdbc/MobileWindowsDM_DS + + + - - - - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - 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 e0f632213..9daf68724 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 @@ -19,7 +19,6 @@ -