From 95f72f77f1a86f8f7e92b8cceafd63b40374dcbb Mon Sep 17 00:00:00 2001 From: harshanL Date: Mon, 15 Dec 2014 20:20:11 +0530 Subject: [PATCH 1/3] Commented MobileActivator jndi lookup code --- .../MobileDeviceManagementBundleActivator.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java index 67cf1873af..54c0c9f229 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java @@ -43,12 +43,12 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator { public void start(BundleContext bundleContext) throws Exception { try { //Initialize Mobile Device Management datasource - MobileDeviceConfigurationManager.getInstance().initConfig(); - MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() - .getMobileDeviceManagementConfig(); - MobileDataSourceConfig - dsConfig = config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); - MobileDeviceManagementDAOFactory.init(dsConfig); +// MobileDeviceConfigurationManager.getInstance().initConfig(); +// MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() +// .getMobileDeviceManagementConfig(); +// MobileDataSourceConfig +// dsConfig = config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); +// MobileDeviceManagementDAOFactory.init(dsConfig); /* If -Dsetup option enabled then create device management database schema */ String setupOption = System.getProperty("setup"); @@ -58,7 +58,7 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator { "-Dsetup is enabled. Mobile Device management repository schema initialization is about " + "to begin"); } - setupMobileDeviceManagementSchema(dsConfig); + setupMobileDeviceManagementSchema(null); } if (log.isDebugEnabled()) { From a69fc9dc4cf6a1e2a03e7241a611d29a99692a06 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Mon, 15 Dec 2014 20:52:38 +0530 Subject: [PATCH 2/3] Fixing issues spotted as a result of the bundle getting activated before the datasources used underneath are registered in JNDI --- .../mgt/mobile/impl/DataSourceListener.java | 22 +++++++ .../impl/dao/MobileDeviceDAOFactory.java | 61 +++++++++++++++++++ .../util/MobileDeviceManagementDAOUtil.java | 7 +++ ...MobileDeviceManagementBundleActivator.java | 48 ++++++++++++--- 4 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/DataSourceListener.java create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/DataSourceListener.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/DataSourceListener.java new file mode 100644 index 0000000000..61c881745f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/DataSourceListener.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed 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.mobile.impl; + +public interface DataSourceListener { + + void notifyObserver(); + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java new file mode 100644 index 0000000000..0de3bd431c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed 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.mobile.impl.dao; + +import org.wso2.carbon.device.mgt.mobile.impl.DataSourceListener; +import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceDAOImpl; +import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceModelImpl; +import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceVendorDAOImpl; +import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileOSVersionDAOImpl; +import org.wso2.carbon.device.mgt.mobile.impl.dao.util.MobileDeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementBundleActivator; + +import javax.sql.DataSource; + +public class MobileDeviceDAOFactory implements DataSourceListener { + + private DataSource dataSource; + + public MobileDeviceDAOFactory() { + MobileDeviceManagementBundleActivator.registerDataSourceListener(this); + } + + @Override + public void notifyObserver() { + this.dataSource = MobileDeviceManagementDAOUtil.resolveDataSource(); + } + + private DataSource getDataSource() { + return dataSource; + } + + public static MobileDeviceDAO getMobileDeviceDAO() { + return new MobileDeviceDAOImpl(); + } + + public static MobileDeviceModelDAO getMobileDeviceModelDAO() { + return new MobileDeviceModelImpl(); + } + + public static MobileDeviceVendorDAO getMobileDeviceVendorDAO() { + return new MobileDeviceVendorDAOImpl(); + } + + public static MobileOSVersionDAO getMobileOSVersionDAO() { + return new MobileOSVersionDAOImpl(); + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java index 453a3918d0..efb4ceff0d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java @@ -16,8 +16,15 @@ package org.wso2.carbon.device.mgt.mobile.impl.dao.util; +import javax.sql.DataSource; + /** * Utility method required by MobileDeviceManagement DAO classes. */ public class MobileDeviceManagementDAOUtil { + + public static DataSource resolveDataSource() { + return null; + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java index e614119492..e8dc1c1ac4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java @@ -18,20 +18,26 @@ package org.wso2.carbon.device.mgt.mobile.impl.internal; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; +import org.osgi.framework.*; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; +import org.wso2.carbon.device.mgt.mobile.impl.DataSourceListener; import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService; +import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceDAOFactory; import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; -public class MobileDeviceManagementBundleActivator implements BundleActivator { +import java.util.ArrayList; +import java.util.List; - private static final Log log = LogFactory.getLog(MobileDeviceManagementBundleActivator.class); - private ServiceRegistration androidServiceRegRef; - private ServiceRegistration iOSServiceRegRef; - private ServiceRegistration windowsServiceRegRef; +public class MobileDeviceManagementBundleActivator implements BundleActivator, BundleListener { + + private ServiceRegistration androidServiceRegRef; + private ServiceRegistration iOSServiceRegRef; + private ServiceRegistration windowsServiceRegRef; + private static List dataSourceListeners = new ArrayList(); + + private static final Log log = LogFactory.getLog(MobileDeviceManagementBundleActivator.class); + private static final String SYMBOLIC_NAME_DATA_SOURCE_COMPONENT = "org.wso2.carbon.ndatasource.core"; @Override public void start(BundleContext bundleContext) throws Exception { @@ -39,6 +45,11 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator { if (log.isDebugEnabled()) { log.debug("Activating Mobile Device Management Service bundle"); } + bundleContext.addBundleListener(this); + + MobileDeviceDAOFactory daoFactory = new MobileDeviceDAOFactory(); + //TODO Register this dao to an appropriate config file + androidServiceRegRef = bundleContext.registerService(DeviceManagerService.class.getName(), new AndroidDeviceManagerService(), null); @@ -64,6 +75,27 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator { androidServiceRegRef.unregister(); iOSServiceRegRef.unregister(); windowsServiceRegRef.unregister(); + + bundleContext.removeBundleListener(this); + } + + @Override + public void bundleChanged(BundleEvent bundleEvent) { + int eventType = bundleEvent.getType(); + String bundleSymbolicName = bundleEvent.getBundle().getSymbolicName(); + if (SYMBOLIC_NAME_DATA_SOURCE_COMPONENT.equals(bundleSymbolicName) && eventType == BundleEvent.STARTED) { + for (DataSourceListener listener : this.getDataSourceListeners()) { + listener.notifyObserver(); + } + } + } + + public static void registerDataSourceListener(DataSourceListener listener) { + dataSourceListeners.add(listener); + } + + private List getDataSourceListeners() { + return dataSourceListeners; } } From 674735d9db8506ed291cde9ff83b3aaec1710789 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Mon, 15 Dec 2014 21:06:51 +0530 Subject: [PATCH 3/3] code cleanup --- .../impl/dao/MobileDeviceDAOFactory.java | 18 ++- .../util/MobileDeviceManagementDAOUtil.java | 9 +- ...MobileDeviceManagementBundleActivator.java | 111 +++++------------- 3 files changed, 38 insertions(+), 100 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java index 0de3bd431c..fabb81d8d3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/MobileDeviceDAOFactory.java @@ -17,7 +17,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.dao; import org.wso2.carbon.device.mgt.mobile.impl.DataSourceListener; import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceDAOImpl; -import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceModelImpl; +import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceModelDAOImpl; import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceVendorDAOImpl; import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileOSVersionDAOImpl; import org.wso2.carbon.device.mgt.mobile.impl.dao.util.MobileDeviceManagementDAOUtil; @@ -27,7 +27,7 @@ import javax.sql.DataSource; public class MobileDeviceDAOFactory implements DataSourceListener { - private DataSource dataSource; + private static DataSource dataSource; public MobileDeviceDAOFactory() { MobileDeviceManagementBundleActivator.registerDataSourceListener(this); @@ -35,27 +35,23 @@ public class MobileDeviceDAOFactory implements DataSourceListener { @Override public void notifyObserver() { - this.dataSource = MobileDeviceManagementDAOUtil.resolveDataSource(); - } - - private DataSource getDataSource() { - return dataSource; + dataSource = MobileDeviceManagementDAOUtil.resolveDataSource(); } public static MobileDeviceDAO getMobileDeviceDAO() { - return new MobileDeviceDAOImpl(); + return new MobileDeviceDAOImpl(dataSource); } public static MobileDeviceModelDAO getMobileDeviceModelDAO() { - return new MobileDeviceModelImpl(); + return new MobileDeviceModelDAOImpl(dataSource); } public static MobileDeviceVendorDAO getMobileDeviceVendorDAO() { - return new MobileDeviceVendorDAOImpl(); + return new MobileDeviceVendorDAOImpl(dataSource); } public static MobileOSVersionDAO getMobileOSVersionDAO() { - return new MobileOSVersionDAOImpl(); + return new MobileOSVersionDAOImpl(dataSource); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java index 571dc62420..bc210f8ffa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDeviceManagementDAOUtil.java @@ -16,9 +16,9 @@ package org.wso2.carbon.device.mgt.mobile.impl.dao.util; -<<<<<<< HEAD + import javax.sql.DataSource; -======= + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.Device; @@ -32,19 +32,16 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Hashtable; ->>>>>>> 95f72f77f1a86f8f7e92b8cceafd63b40374dcbb /** * Utility method required by MobileDeviceManagement DAO classes. */ public class MobileDeviceManagementDAOUtil { -<<<<<<< HEAD public static DataSource resolveDataSource() { return null; } -======= private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOUtil.class); public static void cleanupResources(Connection conn, PreparedStatement stmt, ResultSet rs) { @@ -89,5 +86,5 @@ public class MobileDeviceManagementDAOUtil { MobileDevice mobileDeviceBO = new MobileDevice(); return mobileDeviceBO; } ->>>>>>> 95f72f77f1a86f8f7e92b8cceafd63b40374dcbb + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java index 01819c626a..9d3e08cadd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java @@ -16,27 +16,15 @@ package org.wso2.carbon.device.mgt.mobile.impl.internal; -import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; -<<<<<<< HEAD +import org.apache.commons.logging.LogFactory; import org.osgi.framework.*; -======= -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; import org.wso2.carbon.device.mgt.common.DeviceManagementException; ->>>>>>> 95f72f77f1a86f8f7e92b8cceafd63b40374dcbb import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.DataSourceListener; import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService; -<<<<<<< HEAD -import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceDAOFactory; -======= -import org.wso2.carbon.device.mgt.mobile.impl.config.MobileDeviceConfigurationManager; -import org.wso2.carbon.device.mgt.mobile.impl.config.MobileDeviceManagementConfig; import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig; -import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOFactory; ->>>>>>> 95f72f77f1a86f8f7e92b8cceafd63b40374dcbb +import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceDAOFactory; import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.util.MobileDeviceManagementSchemaInitializer; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; @@ -54,7 +42,6 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B private static final Log log = LogFactory.getLog(MobileDeviceManagementBundleActivator.class); private static final String SYMBOLIC_NAME_DATA_SOURCE_COMPONENT = "org.wso2.carbon.ndatasource.core"; -<<<<<<< HEAD @Override public void start(BundleContext bundleContext) throws Exception { try { @@ -63,6 +50,17 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B } bundleContext.addBundleListener(this); + /* If -Dsetup option enabled then create device management database schema */ + String setupOption = System.getProperty("setup"); + if (setupOption != null) { + if (log.isDebugEnabled()) { + log.debug( + "-Dsetup is enabled. Mobile Device management repository schema initialization is about " + + "to begin"); + } + setupMobileDeviceManagementSchema(null); + } + MobileDeviceDAOFactory daoFactory = new MobileDeviceDAOFactory(); //TODO Register this dao to an appropriate config file @@ -113,73 +111,20 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B private List getDataSourceListeners() { return dataSourceListeners; } -======= - @Override - public void start(BundleContext bundleContext) throws Exception { - try { - //Initialize Mobile Device Management datasource -// MobileDeviceConfigurationManager.getInstance().initConfig(); -// MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() -// .getMobileDeviceManagementConfig(); -// MobileDataSourceConfig -// dsConfig = config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); -// MobileDeviceManagementDAOFactory.init(dsConfig); - - /* If -Dsetup option enabled then create device management database schema */ - String setupOption = System.getProperty("setup"); - if (setupOption != null) { - if (log.isDebugEnabled()) { - log.debug( - "-Dsetup is enabled. Mobile Device management repository schema initialization is about " + - "to begin"); - } - setupMobileDeviceManagementSchema(null); - } - - if (log.isDebugEnabled()) { - log.debug("Activating Mobile Device Management Service bundle"); - } - androidServiceRegRef = - bundleContext.registerService(DeviceManagerService.class.getName(), - new AndroidDeviceManagerService(), null); - iOSServiceRegRef = - bundleContext.registerService(DeviceManagerService.class.getName(), - new IOSDeviceManagerService(), null); - windowsServiceRegRef = - bundleContext.registerService(DeviceManagerService.class.getName(), - new WindowsDeviceManagerService(), null); - if (log.isDebugEnabled()) { - log.debug("Mobile Device Management Service bundle is activated"); - } - } catch (Throwable e) { - log.error("Error occurred while activating Mobile Device Management Service Component", - e); - } - } - - private void setupMobileDeviceManagementSchema(MobileDataSourceConfig config) throws - DeviceManagementException { - MobileDeviceManagementSchemaInitializer initializer = - new MobileDeviceManagementSchemaInitializer(config); - log.info("Initializing mobile device management repository database schema"); - try { - initializer.createRegistryDatabase(); - } catch (Exception e) { - throw new DeviceManagementException( - "Error occurred while initializing Mobile Device Management " + - "database schema", e); - } - } - - @Override - public void stop(BundleContext bundleContext) throws Exception { - if (log.isDebugEnabled()) { - log.debug("Deactivating Mobile Device Management Service"); - } - androidServiceRegRef.unregister(); - iOSServiceRegRef.unregister(); - windowsServiceRegRef.unregister(); - } ->>>>>>> 95f72f77f1a86f8f7e92b8cceafd63b40374dcbb + + private void setupMobileDeviceManagementSchema(MobileDataSourceConfig config) throws + DeviceManagementException { + MobileDeviceManagementSchemaInitializer initializer = + new MobileDeviceManagementSchemaInitializer(config); + log.info("Initializing mobile device management repository database schema"); + try { + //initializer.createRegistryDatabase(); + } catch (Exception e) { + throw new DeviceManagementException( + "Error occurred while initializing Mobile Device Management " + + "database schema", e); + } + } + }