Merge branch 'master' of github.com:wso2/carbon-device-mgt-plugins

revert-dabc3590
Dulitha Wijewantha 10 years ago
commit cc26e2102d

@ -70,6 +70,7 @@
</Import-Package>
<Export-Package>
!org.wso2.carbon.device.mgt.mobile.internal,
!org.wso2.carbon.device.mgt.mobile.impl,
org.wso2.carbon.device.mgt.mobile.*,
</Export-Package>
</instructions>

@ -25,8 +25,6 @@ import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException;
import org.wso2.carbon.device.mgt.mobile.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.FeatureManagementDAOException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
@ -65,7 +63,7 @@ public abstract class MobileDeviceManagementDAOFactory implements MobileDeviceMa
* @param config Mobile data source configuration
* @return data source resolved from the data source definition
*/
protected static DataSource resolveDataSource(MobileDataSourceConfig config) {
public static DataSource resolveDataSource(MobileDataSourceConfig config) {
DataSource dataSource = null;
if (config == null) {
throw new RuntimeException("Device Management Repository data source configuration " +
@ -113,7 +111,7 @@ public abstract class MobileDeviceManagementDAOFactory implements MobileDeviceMa
private static void assertDataSourceInitialization() {
if (!isInitialized) {
throw new DataSourceNotAvailableException("Mobile device management metadata repository datasource " +
throw new DataSourceNotAvailableException("Mobile device management metadata repository data source " +
"is not initialized");
}
}
@ -180,7 +178,7 @@ public abstract class MobileDeviceManagementDAOFactory implements MobileDeviceMa
}
}
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while rollbacking the transaction", e);
throw new MobileDeviceManagementDAOException("Error occurred while rollback the transaction", e);
} finally {
closeConnection();
}

@ -21,7 +21,10 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
@ -34,7 +37,7 @@ import java.util.List;
/**
* This represents the Android implementation of DeviceManagerService.
*/
public class AndroidDeviceManager implements DeviceManager {
public class AndroidDeviceManager implements DeviceMgtService {
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
private static final Log log = LogFactory.getLog(AndroidDeviceManager.class);
@ -209,4 +212,9 @@ public class AndroidDeviceManager implements DeviceManager {
return devices;
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException {
}
}

@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.android.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.*;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl.AndroidDeviceDAOImpl;
@ -33,8 +34,9 @@ public class AndroidDAOFactory extends MobileDeviceManagementDAOFactory
private static final Log log = LogFactory.getLog(AndroidDAOFactory.class);
private static DataSource dataSource;
public static void init(MobileDataSourceConfig config) {
dataSource = resolveDataSource(config);
public static void init() {
dataSource = MobileDeviceManagementDAOFactory.getDataSource(DeviceManagementConstants.MobileDeviceTypes.
MOBILE_DEVICE_TYPE_ANDROID);
}
@Override

@ -46,8 +46,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
}
@Override
public boolean addFeature(MobileFeature mobileFeature) throws
MobileDeviceManagementDAOException {
public boolean addFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
boolean status = false;
Connection conn = null;
@ -73,8 +72,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
}
@Override
public boolean updateFeature(MobileFeature mobileFeature) throws
MobileDeviceManagementDAOException {
public boolean updateFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;

@ -1,164 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.ios;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.IOSDAOFactory;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import java.util.List;
/**
* This represents the iOS implementation of DeviceManagerService.
*/
public class IOSDeviceManager implements DeviceManager {
private static final Log log = LogFactory.getLog(IOSDeviceManager.class);
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
private IOSFeatureManager iosFeatureManager;
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS;
}
public IOSDeviceManager() {
mobileDeviceManagementDAOFactory = new IOSDAOFactory();
iosFeatureManager = new IOSFeatureManager();
}
@Override
public FeatureManager getFeatureManager() {
return iosFeatureManager;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while enrolling the iOS device : " +
device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
if (log.isDebugEnabled()) {
log.debug("Modifying the iOS device enrollment data");
}
status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.updateMobileDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the enrollment of the iOS device : " +
device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
boolean isEnrolled = false;
try {
if (log.isDebugEnabled()) {
log.debug("Checking the enrollment of iOS device : " + deviceId.getId());
}
MobileDevice mobileDevice =
mobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice(
deviceId.getId());
if (mobileDevice != null) {
isEnrolled = true;
}
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while checking the enrollment status of iOS device : " +
deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return isEnrolled;
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return true;
}
@Override
public List<Device> getAllDevices() throws DeviceManagementException {
return null;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
Device device;
try {
if (log.isDebugEnabled()) {
log.debug("Getting the details of iOS device : " + deviceId.getId());
}
MobileDevice mobileDevice = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().
getMobileDevice(deviceId.getId());
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while fetching the iOS device : " + deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return device;
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return true;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true;
}
}

@ -1,116 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.ios;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.IOSDAOFactory;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import java.util.ArrayList;
import java.util.List;
public class IOSFeatureManager implements FeatureManager {
private static final Log log = LogFactory.getLog(IOSFeatureManager.class);
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
private MobileFeatureDAO featureDAO;
public IOSFeatureManager() {
mobileDeviceManagementDAOFactory = new IOSDAOFactory();
this.featureDAO = mobileDeviceManagementDAOFactory.getMobileFeatureDao();
}
@Override
public boolean addFeature(Feature feature) throws DeviceManagementException {
try {
mobileDeviceManagementDAOFactory.beginTransaction();
MobileFeature mobileFeature = MobileDeviceManagementUtil.convertToMobileFeature(feature);
try {
featureDAO.addFeature(mobileFeature);
} catch (MobileDeviceManagementDAOException e) {
log.error("error in feature add ", e);
throw new DeviceManagementException("error in feature add", e);
}
mobileDeviceManagementDAOFactory.commitTransaction();
return true;
} catch (MobileDeviceManagementDAOException e) {
try {
mobileDeviceManagementDAOFactory.rollbackTransaction();
} catch (MobileDeviceManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e);
}
throw new DeviceManagementException("DB transaction error occurred while add the feature", e);
}
}
@Override
public Feature getFeature(String code) throws DeviceManagementException {
try {
MobileFeature mobileFeature = featureDAO.getFeatureByCode(code);
Feature feature = MobileDeviceManagementUtil.convertToFeature(mobileFeature);
return feature;
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the feature", e);
}
}
@Override
public List<Feature> getFeatures() throws DeviceManagementException {
List<Feature> featureList = new ArrayList<Feature>();
try {
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
}
return featureList;
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered " +
"for Android platform", e);
}
}
@Override
public boolean removeFeature(String name) throws DeviceManagementException {
try {
mobileDeviceManagementDAOFactory.beginTransaction();
featureDAO.deleteFeatureByCode(name);
mobileDeviceManagementDAOFactory.commitTransaction();
return true;
} catch (MobileDeviceManagementDAOException e) {
try {
mobileDeviceManagementDAOFactory.rollbackTransaction();
} catch (MobileDeviceManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e);
}
throw new DeviceManagementException("Error occurred while removing the feature", e);
}
}
}

@ -1,79 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.ios.dao;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
public class FeatureManagementDAOException extends MobileDeviceManagementDAOException {
private String message;
private static final long serialVersionUID = 2021891706072918865L;
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message and
* nested exception.
*
* @param message error message
* @param nestedException exception
*/
public FeatureManagementDAOException(String message, Exception nestedException) {
super(message, nestedException);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message
* and cause.
*
* @param message the detail message.
* @param cause the cause of this exception.
*/
public FeatureManagementDAOException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message.
*
* @param message the detail message.
*/
public FeatureManagementDAOException(String message) {
super(message);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified and cause.
*
* @param cause the cause of this exception.
*/
public FeatureManagementDAOException(Throwable cause) {
super(cause);
}
public String getMessage() {
return message;
}
public void setErrorMessage(String errorMessage) {
this.message = errorMessage;
}
}

@ -1,63 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.ios.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.*;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.impl.FeatureDAOImpl;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.impl.IOSDeviceDAOImpl;
public class IOSDAOFactory extends MobileDeviceManagementDAOFactory {
private static final Log log = LogFactory.getLog(IOSDAOFactory.class);
public static void init(MobileDataSourceConfig config) {
dataSource = resolveDataSource(config);
}
@Override
public MobileDeviceDAO getMobileDeviceDAO() {
return new IOSDeviceDAOImpl(dataSource);
}
@Override
public MobileOperationDAO getMobileOperationDAO() {
return null;
}
@Override
public MobileOperationPropertyDAO getMobileOperationPropertyDAO() {
return null;
}
@Override
public MobileDeviceOperationMappingDAO getMobileDeviceOperationDAO() {
return null;
}
@Override
public MobileFeatureDAO getMobileFeatureDao() {
return new FeatureDAOImpl();
}
public MobileFeaturePropertyDAO getFeaturePropertyDAO() {
return null;
}
}

@ -1,154 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.ios.dao.impl;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.FeatureManagementDAOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class FeatureDAOImpl implements MobileFeatureDAO {
public boolean addFeature(MobileFeature feature) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
boolean status = false;
try {
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
String sql = "INSERT INTO IOS_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(sql);
stmt.setString(1, feature.getCode());
stmt.setString(2, feature.getName());
stmt.setString(3, feature.getDescription());
stmt.executeUpdate();
status = true;
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
feature.getName() + "' into the metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override
public boolean updateFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException {
return false;
}
@Override
public boolean deleteFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException {
return false;
}
@Override
public boolean deleteFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
boolean status = false;
try {
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
String sql = "DELETE FROM IOS_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, mblFeatureCode);
stmt.execute();
status = true;
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
mblFeatureCode + "' into the metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override
public MobileFeature getFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException {
return null;
}
@Override
public MobileFeature getFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM IOS_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, mblFeatureCode);
rs = stmt.executeQuery();
MobileFeature feature = null;
if (rs.next()) {
feature = new MobileFeature();
feature.setId(rs.getInt("ID"));
feature.setCode(rs.getString("CODE"));
feature.setName(rs.getString("NAME"));
feature.setDescription(rs.getString("DESCRIPTION"));
}
return feature;
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while retrieving feature metadata '" +
mblFeatureCode + "' from the feature metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
@Override
public List<MobileFeature> getFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException {
return null;
}
@Override
public List<MobileFeature> getAllFeatures() throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
List<MobileFeature> features = new ArrayList<MobileFeature>();
try {
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM IOS_FEATURE";
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
MobileFeature feature = new MobileFeature();
feature.setId(rs.getInt("FEATURE_ID"));
feature.setCode(rs.getString("CODE"));
feature.setName(rs.getString("NAME"));
feature.setDescription(rs.getString("DESCRIPTION"));
features.add(feature);
}
return features;
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while retrieving all feature metadata from the " +
"feature metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
}

@ -1,339 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.ios.dao.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceDAO;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.impl.ios.util.IOSPluginConstants;
import org.wso2.carbon.device.mgt.mobile.impl.ios.util.IOSUtils;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class IOSDeviceDAOImpl implements MobileDeviceDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(IOSDeviceDAOImpl.class);
public IOSDeviceDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public MobileDevice getMobileDevice(String deviceID) throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileDevice mobileDevice = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, APNS_PUSH_TOKEN, MAGIC_TOKEN, MDM_TOKEN, UNLOCK_TOKEN, " +
"CHALLENGE_TOKEN, DEVICE_INFO, SERIAL, PRODUCT, MAC_ADDRESS, DEVICE_NAME, ICCID," +
"LATITUDE, LONGITUDE, IMEI, VERSION FROM IOS_DEVICE WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceID);
ResultSet resultSet = stmt.executeQuery();
if (resultSet.next()) {
mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(resultSet.getString(IOSPluginConstants.MOBILE_DEVICE_ID));
Map<String, String> tokenMap = new HashMap<String, String>();
tokenMap.put(IOSPluginConstants.APNS_PUSH_TOKEN,
resultSet.getString(IOSPluginConstants.APNS_PUSH_TOKEN));
tokenMap.put(IOSPluginConstants.MAGIC_TOKEN, resultSet.getString(IOSPluginConstants.MAGIC_TOKEN));
tokenMap.put(IOSPluginConstants.MDM_TOKEN, resultSet.getString(IOSPluginConstants.MDM_TOKEN));
tokenMap.put(IOSPluginConstants.UNLOCK_TOKEN, resultSet.getString(IOSPluginConstants.UNLOCK_TOKEN));
tokenMap.put(IOSPluginConstants.CHALLENGE_TOKEN,
resultSet.getString(IOSPluginConstants.CHALLENGE_TOKEN));
tokenMap.put(IOSPluginConstants.DEVICE_INFO, resultSet.getString(IOSPluginConstants.DEVICE_INFO));
tokenMap.put(IOSPluginConstants.SERIAL, resultSet.getString(IOSPluginConstants.SERIAL));
tokenMap.put(IOSPluginConstants.PRODUCT, resultSet.getString(IOSPluginConstants.PRODUCT));
tokenMap.put(IOSPluginConstants.MAC_ADDRESS, resultSet.getString(IOSPluginConstants.MAC_ADDRESS));
tokenMap.put(IOSPluginConstants.DEVICE_NAME, resultSet.getString(IOSPluginConstants.DEVICE_NAME));
tokenMap.put(IOSPluginConstants.ICCID, resultSet.getString(IOSPluginConstants.ICCID));
tokenMap.put(IOSPluginConstants.LATITUDE, resultSet.getString(IOSPluginConstants.LATITUDE));
tokenMap.put(IOSPluginConstants.LONGITUDE, resultSet.getString(IOSPluginConstants.LONGITUDE));
tokenMap.put(IOSPluginConstants.IMEI, resultSet.getString(IOSPluginConstants.IMEI));
tokenMap.put(IOSPluginConstants.VERSION, resultSet.getString(IOSPluginConstants.VERSION));
mobileDevice.setDeviceProperties(tokenMap);
if (log.isDebugEnabled()) {
log.debug("Mobile device " + deviceID + " data has been fetched from iOS database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while fetching mobile device '" + deviceID + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return mobileDevice;
}
public static final String IMEI = "IMEI";
public static final String VERSION = "VERSION";
public static final String MAC_ADDRESS = "MAC_ADDRESS";
public static final String ICCID = "ICCID";
@Override
public boolean addMobileDevice(MobileDevice mobileDevice)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO IOS_DEVICE(MOBILE_DEVICE_ID, APNS_PUSH_TOKEN, MAGIC_TOKEN, MDM_TOKEN, UNLOCK_TOKEN, " +
"CHALLENGE_TOKEN, DEVICE_INFO, SERIAL, PRODUCT, MAC_ADDRESS, DEVICE_NAME, ICCID, " +
"LATITUDE, LONGITUDE, IMEI, VERSION) VALUES " +
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileDevice.getMobileDeviceId());
if (mobileDevice.getDeviceProperties() == null) {
mobileDevice.setDeviceProperties(new HashMap<String, String>());
}
stmt.setString(2, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.APNS_PUSH_TOKEN));
stmt.setString(3, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.MAGIC_TOKEN));
stmt.setString(4, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.MDM_TOKEN));
stmt.setString(5, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.UNLOCK_TOKEN));
stmt.setString(6, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.CHALLENGE_TOKEN));
stmt.setString(7, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.DEVICE_INFO));
stmt.setString(8, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.SERIAL));
stmt.setString(9, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.PRODUCT));
stmt.setString(10, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.MAC_ADDRESS));
stmt.setString(11, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.DEVICE_NAME));
stmt.setString(12, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.ICCID));
stmt.setString(13, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.LATITUDE));
stmt.setString(14, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.LONGITUDE));
stmt.setString(15, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.IMEI));
stmt.setString(16, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.VERSION));
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Mobile device " + mobileDevice.getMobileDeviceId() + " data has been added" +
" to the iOS database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while adding the mobile device '" +
mobileDevice.getMobileDeviceId() + "' to the iOS db.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateMobileDevice(MobileDevice mobileDevice)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE IOS_DEVICE SET APNS_PUSH_TOKEN = ?, MAGIC_TOKEN = ?, MDM_TOKEN = ?, UNLOCK_TOKEN = ?, " +
"CHALLENGE_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, PRODUCT = ?, MAC_ADDRESS = ?, " +
"DEVICE_NAME = ?, ICCID = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, VERSION = ? " +
"WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.APNS_PUSH_TOKEN));
stmt.setString(2, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.MAGIC_TOKEN));
stmt.setString(3, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.MDM_TOKEN));
stmt.setString(4, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.UNLOCK_TOKEN));
stmt.setString(5, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.CHALLENGE_TOKEN));
stmt.setString(6, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.DEVICE_INFO));
stmt.setString(7, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.SERIAL));
stmt.setString(8, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.PRODUCT));
stmt.setString(9, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.MAC_ADDRESS));
stmt.setString(10, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.DEVICE_NAME));
stmt.setString(11, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.ICCID));
stmt.setString(12, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.LATITUDE));
stmt.setString(13, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.LONGITUDE));
stmt.setString(14, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.IMEI));
stmt.setString(15, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
IOSPluginConstants.VERSION));
stmt.setString(16, mobileDevice.getMobileDeviceId());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Mobile device " + mobileDevice.getMobileDeviceId() + " data has" +
" updated");
}
}
} catch (SQLException e) {
String msg = "Error occurred while updating the mobile device '" +
mobileDevice.getMobileDeviceId() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM IOS_DEVICE WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, mblDeviceId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Mobile device " + mblDeviceId + " data has deleted" +
" from the iOS database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while deleting mobile device " + mblDeviceId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public List<MobileDevice> getAllMobileDevices() throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
List<MobileDevice> mobileDevices = new ArrayList<MobileDevice>();
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, APNS_PUSH_TOKEN, MAGIC_TOKEN, MDM_TOKEN, UNLOCK_TOKEN, " +
"CHALLENGE_TOKEN, DEVICE_INFO, SERIAL, PRODUCT, MAC_ADDRESS, DEVICE_NAME, ICCID," +
"LATITUDE, LONGITUDE, IMEI, VERSION FROM IOS_DEVICE";
stmt = conn.prepareStatement(selectDBQuery);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
MobileDevice mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(resultSet.getString(IOSPluginConstants.MOBILE_DEVICE_ID));
Map<String, String> tokenMap = new HashMap<String, String>();
tokenMap.put(IOSPluginConstants.APNS_PUSH_TOKEN,
resultSet.getString(IOSPluginConstants.APNS_PUSH_TOKEN));
tokenMap.put(IOSPluginConstants.MAGIC_TOKEN, resultSet.getString(IOSPluginConstants.MAGIC_TOKEN));
tokenMap.put(IOSPluginConstants.MDM_TOKEN, resultSet.getString(IOSPluginConstants.MDM_TOKEN));
tokenMap.put(IOSPluginConstants.UNLOCK_TOKEN, resultSet.getString(IOSPluginConstants.UNLOCK_TOKEN));
tokenMap.put(IOSPluginConstants.CHALLENGE_TOKEN,
resultSet.getString(IOSPluginConstants.CHALLENGE_TOKEN));
tokenMap.put(IOSPluginConstants.DEVICE_INFO, resultSet.getString(IOSPluginConstants.DEVICE_INFO));
tokenMap.put(IOSPluginConstants.SERIAL, resultSet.getString(IOSPluginConstants.SERIAL));
tokenMap.put(IOSPluginConstants.PRODUCT, resultSet.getString(IOSPluginConstants.PRODUCT));
tokenMap.put(IOSPluginConstants.MAC_ADDRESS, resultSet.getString(IOSPluginConstants.MAC_ADDRESS));
tokenMap.put(IOSPluginConstants.DEVICE_NAME, resultSet.getString(IOSPluginConstants.DEVICE_NAME));
tokenMap.put(IOSPluginConstants.ICCID, resultSet.getString(IOSPluginConstants.ICCID));
tokenMap.put(IOSPluginConstants.LATITUDE, resultSet.getString(IOSPluginConstants.LATITUDE));
tokenMap.put(IOSPluginConstants.LONGITUDE, resultSet.getString(IOSPluginConstants.LONGITUDE));
tokenMap.put(IOSPluginConstants.IMEI, resultSet.getString(IOSPluginConstants.IMEI));
tokenMap.put(IOSPluginConstants.VERSION, resultSet.getString(IOSPluginConstants.VERSION));
mobileDevice.setDeviceProperties(tokenMap);
mobileDevices.add(mobileDevice);
}
if (log.isDebugEnabled()) {
log.debug("All Mobile device details have fetched from iOS database.");
}
return mobileDevices;
} catch (SQLException e) {
String msg = "Error occurred while fetching all mobile device data'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile device " +
"management metadata repository datasource";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,22 +0,0 @@
package org.wso2.carbon.device.mgt.mobile.impl.ios.util;
public class IOSPluginConstants {
public static final String MOBILE_DEVICE_ID = "MOBILE_DEVICE_ID";
public static final String APNS_PUSH_TOKEN = "APNS_PUSH_TOKEN";
public static final String MAGIC_TOKEN = "MAGIC_TOKEN";
public static final String MDM_TOKEN = "MDM_TOKEN";
public static final String UNLOCK_TOKEN = "UNLOCK_TOKEN";
public static final String CHALLENGE_TOKEN = "CHALLENGE_TOKEN";
public static final String DEVICE_INFO = "DEVICE_INFO";
public static final String SERIAL = "SERIAL";
public static final String PRODUCT = "PRODUCT";
public static final String DEVICE_NAME = "DEVICE_NAME";
public static final String LATITUDE = "LATITUDE";
public static final String LONGITUDE = "LONGITUDE";
public static final String IMEI = "IMEI";
public static final String VERSION = "VERSION";
public static final String MAC_ADDRESS = "MAC_ADDRESS";
public static final String ICCID = "ICCID";
}

@ -1,17 +0,0 @@
package org.wso2.carbon.device.mgt.mobile.impl.ios.util;
import java.util.Map;
public class IOSUtils {
public static String getDeviceProperty(Map<String, String> deviceProperties, String property) {
String deviceProperty = deviceProperties.get(property);
if (deviceProperty == null) {
return "";
}
return deviceProperty;
}
}

@ -21,7 +21,10 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
@ -33,7 +36,7 @@ import java.util.List;
/**
* This represents the Windows implementation of DeviceManagerService.
*/
public class WindowsDeviceManager implements DeviceManager {
public class WindowsDeviceManager implements DeviceMgtService {
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
@ -114,4 +117,9 @@ public class WindowsDeviceManager implements DeviceManager {
return status;
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException {
}
}

@ -28,7 +28,6 @@ import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManager;
import java.util.ArrayList;
@ -41,7 +40,6 @@ import java.util.Map;
public class MobileDeviceManagementBundleActivator implements BundleActivator, BundleListener {
private ServiceRegistration androidServiceRegRef;
private ServiceRegistration iOSServiceRegRef;
private ServiceRegistration windowsServiceRegRef;
private static List<DataSourceListener> dataSourceListeners =
@ -70,9 +68,6 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
androidServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(),
new AndroidDeviceManager(), null);
iOSServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(),
new IOSDeviceManager(), null);
windowsServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(),
new WindowsDeviceManager(), null);
@ -92,7 +87,6 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
}
try {
androidServiceRegRef.unregister();
iOSServiceRegRef.unregister();
windowsServiceRegRef.unregister();
bundleContext.removeBundleListener(this);

@ -24,7 +24,7 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException;
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager;
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
@ -33,8 +33,6 @@ import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.IOSDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManager;
import org.wso2.carbon.ndatasource.core.DataSourceService;
@ -59,7 +57,6 @@ public class MobileDeviceManagementServiceComponent {
private ServiceRegistration serverStartupObserverRef;
private ServiceRegistration androidServiceRegRef;
private ServiceRegistration iOSServiceRegRef;
private ServiceRegistration windowsServiceRegRef;
private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class);
@ -78,11 +75,9 @@ public class MobileDeviceManagementServiceComponent {
Map<String, MobileDataSourceConfig> dsConfigMap =
config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap();
MobileDeviceManagementDAOFactory.setMobileDataSourceConfigMap(dsConfigMap);
IOSDAOFactory.init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes.
MOBILE_DEVICE_TYPE_IOS));
AndroidDAOFactory
.init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes.
MOBILE_DEVICE_TYPE_ANDROID));
MobileDeviceManagementDAOFactory.init();
AndroidDAOFactory.init();
String setupOption = System.getProperty("setup");
if (setupOption != null) {
@ -92,8 +87,7 @@ public class MobileDeviceManagementServiceComponent {
"to begin");
}
try {
Map<String, DataSource> dataSourceMap = MobileDeviceManagementDAOFactory.
getDataSourceMap();
Map<String, DataSource> dataSourceMap = MobileDeviceManagementDAOFactory.getDataSourceMap();
for (DataSource dataSource : dataSourceMap.values()) {
MobileDeviceManagementDAOUtil
.setupMobileDeviceManagementSchema(dataSource);
@ -104,11 +98,9 @@ public class MobileDeviceManagementServiceComponent {
}
androidServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), new AndroidDeviceManager(), null);
iOSServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), new IOSDeviceManager(), null);
bundleContext.registerService(DeviceMgtService.class.getName(), new AndroidDeviceManager(), null);
windowsServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), new WindowsDeviceManager(), null);
bundleContext.registerService(DeviceMgtService.class.getName(), new WindowsDeviceManager(), null);
if (log.isDebugEnabled()) {
log.debug("Mobile Device Management Service Component has been successfully activated");
@ -126,9 +118,6 @@ public class MobileDeviceManagementServiceComponent {
if (androidServiceRegRef != null) {
androidServiceRegRef.unregister();
}
if (iOSServiceRegRef != null) {
iOSServiceRegRef.unregister();
}
if (windowsServiceRegRef != null) {
windowsServiceRegRef.unregister();
}

@ -20,11 +20,6 @@
<MobileDeviceMgtConfiguration>
<ManagementRepository>
<DataSourceConfigurations>
<DataSourceConfiguration type="ios">
<JndiLookupDefinition>
<Name>jdbc/MobileIOSDM_DS</Name>
</JndiLookupDefinition>
</DataSourceConfiguration>
<DataSourceConfiguration type="android">
<JndiLookupDefinition>
<Name>jdbc/MobileAndroidDM_DS</Name>

@ -64,4 +64,5 @@ VALUES
('VPN', 'VPN', 'VPN operation'),
('PER_APP_VPN', 'PER_APP_VPN', 'Per app VPN operation'),
('APP_TO_PER_APP_VPN_MAPPING', 'APP_TO_PER_APP_VPN_MAPPING', 'App to per app VPN mapping operation'),
('ENTERPRISE_WIPE', 'ENTERPRISE_WIPE', 'Enterprise wipe operation');
('ENTERPRISE_WIPE', 'ENTERPRISE_WIPE', 'Enterprise wipe operation'),
('APP_LOCK', 'APP_LOCK', 'App lock operation');

Loading…
Cancel
Save