Merge pull request #9 from hasuniea/master

refactored windows plugin enrollment
revert-dabc3590
Prabath Abeysekara 9 years ago
commit 7dc3f88b35

@ -4,7 +4,7 @@
* 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
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@ -18,19 +18,14 @@
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.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
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.windows.dao.WindowsDAOFactory;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import java.util.List;

@ -14,8 +14,8 @@
* 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.windows;
import org.apache.commons.logging.Log;
@ -43,6 +43,7 @@ import javax.xml.bind.Unmarshaller;
import java.io.StringReader;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
public class WindowsDeviceManager implements DeviceManager {
@ -101,19 +102,15 @@ public class WindowsDeviceManager implements DeviceManager {
public TenantConfiguration getConfiguration() throws DeviceManagementException {
Resource resource;
try {
String androidRegPath =
String windowsTenantRegistryPath =
MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
if(resource != null){
resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath);
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
return (TenantConfiguration) unmarshaller.unmarshal(
new StringReader(new String((byte[]) resource.getContent(), Charset
.forName(MobilePluginConstants.CHARSET_UTF8))));
}
return new TenantConfiguration();
} catch (MobileDeviceMgtPluginException e) {
throw new DeviceManagementException(
"Error occurred while retrieving the Registry instance : " + e.getMessage(), e);
@ -128,12 +125,42 @@ public class WindowsDeviceManager implements DeviceManager {
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
return true;
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
if (log.isDebugEnabled()) {
log.debug("Modifying the Windows device enrollment data");
}
WindowsDAOFactory.beginTransaction();
status = daoFactory.getMobileDeviceDAO().updateMobileDevice(mobileDevice);
WindowsDAOFactory.commitTransaction();
} catch (MobileDeviceManagementDAOException e) {
WindowsDAOFactory.rollbackTransaction();
throw new DeviceManagementException("Error while updating the enrollment of the Windows device : " +
device.getDeviceIdentifier(), e);
} finally {
WindowsDAOFactory.closeConnection();
}
return status;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
boolean status;
try {
if (log.isDebugEnabled()) {
log.debug("Dis-enrolling windows device : " + deviceId);
}
WindowsDAOFactory.beginTransaction();
status = daoFactory.getMobileDeviceDAO().deleteMobileDevice(deviceId.getId());
WindowsDAOFactory.commitTransaction();
} catch (MobileDeviceManagementDAOException e) {
WindowsDAOFactory.rollbackTransaction();
throw new DeviceManagementException("Error while removing the Windows device : " + deviceId.getId(), e);
} finally {
WindowsDAOFactory.closeConnection();
}
return status;
}
@Override
@ -153,12 +180,45 @@ public class WindowsDeviceManager implements DeviceManager {
}
public List<Device> getAllDevices() throws DeviceManagementException {
return null;
List<Device> devices = null;
try {
if (log.isDebugEnabled()) {
log.debug("Fetching the details of all Windows devices");
}
WindowsDAOFactory.openConnection();
List<MobileDevice> mobileDevices = daoFactory.getMobileDeviceDAO().getAllMobileDevices();
if (mobileDevices != null) {
devices = new ArrayList<>();
for (MobileDevice mobileDevice : mobileDevices) {
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
}
}
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while fetching all Windows devices", e);
} finally {
WindowsDAOFactory.closeConnection();
}
return devices;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return null;
Device device = null;
try {
if (log.isDebugEnabled()) {
log.debug("Getting the details of Windows device : '" + deviceId.getId() + "'");
}
WindowsDAOFactory.openConnection();
MobileDevice mobileDevice = daoFactory.getMobileDeviceDAO().
getMobileDevice(deviceId.getId());
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException(
"Error occurred while fetching the Windows device: '" + deviceId.getId() + "'", e);
} finally {
WindowsDAOFactory.closeConnection();
}
return device;
}
@Override
@ -199,10 +259,15 @@ public class WindowsDeviceManager implements DeviceManager {
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
WindowsDAOFactory.beginTransaction();
status = daoFactory.getMobileDeviceDAO().addMobileDevice(mobileDevice);
WindowsDAOFactory.commitTransaction();
} catch (MobileDeviceManagementDAOException e) {
WindowsDAOFactory.rollbackTransaction();
throw new DeviceManagementException("Error while enrolling the Windows device '" +
device.getDeviceIdentifier() + "'", e);
} finally {
WindowsDAOFactory.closeConnection();
}
return status;
}

@ -16,7 +16,6 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.wso2.carbon.device.mgt.common.Device;

@ -14,15 +14,15 @@
* 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.windows.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.windows.dao.impl.WindowsDeviceDAOImpl;
import javax.sql.DataSource;
import java.sql.Connection;
@ -36,13 +36,12 @@ public class WindowsDAOFactory extends MobileDeviceManagementDAOFactory
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
public WindowsDAOFactory() {
this.dataSource = getDataSourceMap().get(DeviceManagementConstants.MobileDeviceTypes
.MOBILE_DEVICE_TYPE_WINDOWS);
this.dataSource = getDataSourceMap().get(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
}
@Override
public MobileDeviceDAO getMobileDeviceDAO() {
return null;
return new WindowsDeviceDAOImpl();
}
@Override
@ -80,19 +79,32 @@ public class WindowsDAOFactory extends MobileDeviceManagementDAOFactory
}
}
public static void openConnection() throws MobileDeviceManagementDAOException {
if (currentConnection.get() == null) {
Connection conn;
try {
conn = dataSource.getConnection();
currentConnection.set(conn);
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException
("Error occurred while retrieving data source connection", e);
}
}
}
public static Connection getConnection() throws MobileDeviceManagementDAOException {
if (currentConnection.get() == null) {
try {
currentConnection.set(dataSource.getConnection());
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while retrieving data source connection",
e);
throw new MobileDeviceManagementDAOException
("Error occurred while retrieving data source connection", e);
}
}
return currentConnection.get();
}
public static void commitTransaction() throws MobileDeviceManagementDAOException {
public static void commitTransaction() {
try {
Connection conn = currentConnection.get();
if (conn != null) {
@ -104,14 +116,13 @@ public class WindowsDAOFactory extends MobileDeviceManagementDAOFactory
}
}
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while committing the transaction", e);
log.error("Error occurred while committing the transaction", e);
} finally {
closeConnection();
}
}
public static void closeConnection() throws MobileDeviceManagementDAOException {
public static void closeConnection() {
Connection con = currentConnection.get();
try {
con.close();
@ -121,7 +132,7 @@ public class WindowsDAOFactory extends MobileDeviceManagementDAOFactory
currentConnection.remove();
}
public static void rollbackTransaction() throws MobileDeviceManagementDAOException {
public static void rollbackTransaction() {
try {
Connection conn = currentConnection.get();
if (conn != null) {
@ -133,7 +144,7 @@ public class WindowsDAOFactory extends MobileDeviceManagementDAOFactory
}
}
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while rollback the transaction", e);
log.warn("Error occurred while roll-backing the transaction", e);
} finally {
closeConnection();
}

@ -0,0 +1,249 @@
/*
* 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.windows.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.windows.dao.WindowsDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.windows.util.WindowsPluginConstants;
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;
/**
* Implements MobileDeviceDAO for Windows Devices.
*/
public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
private static final Log log = LogFactory.getLog(WindowsDeviceDAOImpl.class);
@Override
public MobileDevice getMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
MobileDevice mobileDevice = null;
try {
conn = WindowsDAOFactory.getConnection();
String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, IMSI, " +
"OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, MAC_ADDRESS, OS_VERSION, DEVICE_NAME " +
"FROM WINDOWS_DEVICE WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId);
rs = stmt.executeQuery();
while (rs.next()) {
mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.MOBILE_DEVICE_ID));
mobileDevice.setVendor(rs.getString(WindowsPluginConstants.IMEI));
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI));
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION));
mobileDevice.setImei(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR));
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
Map<String, String> propertyMap = new HashMap<String, String>();
propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI));
propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO));
propertyMap.put(WindowsPluginConstants.DEVICE_NAME, rs.getString(WindowsPluginConstants.DEVICE_NAME));
mobileDevice.setDeviceProperties(propertyMap);
}
if (log.isDebugEnabled()) {
log.debug("All Windows device details have fetched from Windows database.");
}
return mobileDevice;
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while fetching all Windows device data", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
@Override
public boolean addMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn;
PreparedStatement stmt = null;
try {
conn = WindowsDAOFactory.getConnection();
String createDBQuery =
"INSERT INTO WINDOWS_DEVICE(MOBILE_DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, " +
"IMSI, OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, " +
"MAC_ADDRESS, DEVICE_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileDevice.getMobileDeviceId());
Map<String, String> properties = mobileDevice.getDeviceProperties();
stmt.setString(2, properties.get(WindowsPluginConstants.CHANNEL_URI));
stmt.setString(3, properties.get(WindowsPluginConstants.DEVICE_INFO));
stmt.setString(4, mobileDevice.getImei());
stmt.setString(5, mobileDevice.getImsi());
stmt.setString(6, mobileDevice.getOsVersion());
stmt.setString(7, mobileDevice.getModel());
stmt.setString(8, mobileDevice.getVendor());
stmt.setString(9, mobileDevice.getLatitude());
stmt.setString(10, mobileDevice.getLongitude());
stmt.setString(11, mobileDevice.getSerial());
stmt.setString(12, properties.get(WindowsPluginConstants.MAC_ADDRESS));
stmt.setString(13, properties.get(WindowsPluginConstants.DEVICE_NAME));
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Windows device " + mobileDevice.getMobileDeviceId() + " data has been" +
" added to the Windows database.");
}
}
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while adding the Windows device '" +
mobileDevice.getMobileDeviceId() + "' to the Windows db.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override
public boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = WindowsDAOFactory.getConnection();
String updateDBQuery =
"UPDATE WINDOWS_DEVICE SET CHANNEL_URI = ?, DEVICE_INFO = ?, IMEI = ?, IMSI = ?, " +
"OS_VERSION = ?, DEVICE_MODEL = ?, VENDOR = ?, LATITUDE = ?, LONGITUDE = ?, " +
"SERIAL = ?, MAC_ADDRESS = ?, DEVICE_NAME = ? WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
Map<String, String> properties = mobileDevice.getDeviceProperties();
stmt.setString(1, properties.get(WindowsPluginConstants.CHANNEL_URI));
stmt.setString(2, properties.get(WindowsPluginConstants.DEVICE_INFO));
stmt.setString(3, mobileDevice.getImei());
stmt.setString(4, mobileDevice.getImsi());
stmt.setString(5, mobileDevice.getOsVersion());
stmt.setString(6, mobileDevice.getModel());
stmt.setString(7, mobileDevice.getVendor());
stmt.setString(8, mobileDevice.getLatitude());
stmt.setString(9, mobileDevice.getLongitude());
stmt.setString(10, mobileDevice.getSerial());
stmt.setString(11, properties.get(WindowsPluginConstants.MAC_ADDRESS));
stmt.setString(12, properties.get(WindowsPluginConstants.DEVICE_NAME));
stmt.setString(13, mobileDevice.getMobileDeviceId());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Windows device " + mobileDevice.getMobileDeviceId() + " data has been" +
" modified.");
}
}
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while modifying the Windows device '" +
mobileDevice.getMobileDeviceId() + "' data.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override
public boolean deleteMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn;
PreparedStatement stmt = null;
try {
conn = WindowsDAOFactory.getConnection();
String deleteDBQuery = "DELETE FROM WINDOWS_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("Windows device " + mblDeviceId + " data has deleted" +
" from the windows database.");
}
}
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while deleting windows device '" +
mblDeviceId + "'", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override
public List<MobileDevice> getAllMobileDevices() throws MobileDeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
MobileDevice mobileDevice;
List<MobileDevice> mobileDevices = new ArrayList<MobileDevice>();
try {
conn = WindowsDAOFactory.getConnection();
String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, IMSI, " +
"OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, MAC_ADDRESS, OS_VERSION, DEVICE_NAME " +
"FROM WINDOWS_DEVICE";
stmt = conn.prepareStatement(selectDBQuery);
rs = stmt.executeQuery();
while (rs.next()) {
mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.MOBILE_DEVICE_ID));
mobileDevice.setVendor(rs.getString(WindowsPluginConstants.IMEI));
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI));
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION));
mobileDevice.setImei(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR));
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
Map<String, String> propertyMap = new HashMap<String, String>();
propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI));
propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO));
propertyMap.put(WindowsPluginConstants.DEVICE_NAME, rs.getString(WindowsPluginConstants.DEVICE_NAME));
mobileDevice.setDeviceProperties(propertyMap);
mobileDevices.add(mobileDevice);
}
if (log.isDebugEnabled()) {
log.debug("All Windows device details have fetched from Windows database.");
}
return mobileDevices;
} catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while fetching all Windows device data", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
}

@ -0,0 +1,41 @@
/*
* 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.windows.util;
/**
* Define constance used by Windows plugin.
*/
public class WindowsPluginConstants {
//properties related to database table WINDOWS_DEVICE
public static final String MOBILE_DEVICE_ID = "MOBILE_DEVICE_ID";
public static final String CHANNEL_URI = "CHANNEL_URI ";
public static final String DEVICE_INFO = "DEVICE_INFO";
public static final String IMEI = "IMEI";
public static final String IMSI = "IMSI";
public static final String OS_VERSION = "OS_VERSION";
public static final String DEVICE_MODEL = "DEVICE_MODEL";
public static final String VENDOR = "VENDOR";
public static final String LATITUDE = "LATITUDE";
public static final String LONGITUDE = "LONGITUDE";
public static final String SERIAL = "SERIAL";
public static final String MAC_ADDRESS = "MAC_ADDRESS";
public static final String DEVICE_NAME = "DEVICE_NAME";
}

@ -0,0 +1,35 @@
/*
* 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.windows.util;
import java.util.Map;
/**
* Contains utility methods used by Windows plugin.
*/
public class WindowsUtils {
public static String getDeviceProperty(Map<String, String> deviceProperties, String property) {
String deviceProperty = deviceProperties.get(property);
if (deviceProperty == null) {
return null;
}
return deviceProperty;
}
}
Loading…
Cancel
Save