Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_STANDARD_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.STANDARD, configString); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_RBAC_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.RBAC, configString); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_SET_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.SET, configString);
Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_STANDARD_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.STANDARD, configString); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_RBAC_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.RBAC, configString); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_SET_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.SET, configString);
Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_STANDARD_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.STANDARD, configString); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_RBAC_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.RBAC, configString); Resource resource = registry. get(EntitlementConstants.ENTITLEMENT_POLICY_SET_EDITOR_CONFIG_FILE_REGISTRY_PATH); if (resource != null && resource.getContent() != null) { configString = new String((byte[]) resource.getContent(), Charset.forName("UTF-8")); config.put(EntitlementConstants.PolicyEditor.SET, configString);
@Override public TenantConfiguration getConfiguration() throws DeviceManagementException { Resource resource; try { String androidRegPath = MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants. MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath); if (resource != null) { 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 null; } catch (MobileDeviceMgtPluginException e) { throw new DeviceManagementException( "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); } catch (JAXBException e) { throw new DeviceManagementException( "Error occurred while parsing the Android configuration : " + e.getMessage(), e); } catch (RegistryException e) { throw new DeviceManagementException( "Error occurred while retrieving the Registry resource of Android Configuration : " + e.getMessage(), e); } }
@Override public TenantConfiguration getConfiguration() throws DeviceManagementException { Resource resource; try { String windowsTenantRegistryPath = MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants. MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath); if (resource != null) { 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 null; } catch (MobileDeviceMgtPluginException e) { throw new DeviceManagementException( "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); } catch (JAXBException e) { throw new DeviceManagementException( "Error occurred while parsing the Windows configuration : " + e.getMessage(), e); } catch (RegistryException e) { throw new DeviceManagementException( "Error occurred while retrieving the Registry resource of Windows configuration : " + e.getMessage(), e); } }
/** * Load Analytics profile from given registry and registry path. * * @param analyticsServerProfile AnalyticsServerProfile instance * @param registry Registry space where file is located * @param location Registry path of the profile file */ private void loadAnalyticsProfileFromRegistry(AnalyticsServerProfile analyticsServerProfile, Registry registry, String location) { try { if (registry.resourceExists(location)) { Resource resource = registry.get(location); String resourceContent = new String((byte[]) resource.getContent()); parseAnalyticsProfile(resourceContent, analyticsServerProfile); } else { String errMsg = "The resource: " + location + " does not exist."; handleError(errMsg); } } catch (RegistryException e) { String errMsg = "Error occurred while reading the resource from registry: " + location + " to build the Analytics server profile: " + profileLocation; handleError(errMsg, e); } }