public static Resource getRegistryResource(String path) throws MobileDeviceMgtPluginException { try { if (MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)) { return MobileDeviceManagementUtil.getConfigurationRegistry().get(path); } return null; } catch (RegistryException e) { throw new MobileDeviceMgtPluginException( "Error in retrieving registry resource : " + e.getMessage(), e); } }
public static boolean putRegistryResource(String path, Resource resource) throws MobileDeviceMgtPluginException { boolean status; try { MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction(); MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource); MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction(); status = true; } catch (RegistryException e) { throw new MobileDeviceMgtPluginException( "Error occurred while persisting registry resource : " + e.getMessage(), e); } return status; }
public static boolean createRegistryCollection(String path) throws MobileDeviceMgtPluginException { try { if (!MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)) { Resource resource = MobileDeviceManagementUtil.getConfigurationRegistry().newCollection(); MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction(); MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource); MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction(); } return true; } catch (MobileDeviceMgtPluginException e) { throw new MobileDeviceMgtPluginException( "Error occurred while creating a registry collection : " + e.getMessage(), e); } catch (RegistryException e) { throw new MobileDeviceMgtPluginException( "Error occurred while creating a registry collection : " + e.getMessage(), e); } }