本文整理了Java中org.wso2.carbon.registry.api.Resource.getContent
方法的一些代码示例,展示了Resource.getContent
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getContent
方法的具体详情如下:
包路径:org.wso2.carbon.registry.api.Resource
类名称:Resource
方法名:getContent
暂无
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement.common
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);
代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.entitlement.common
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);
代码示例来源:origin: wso2/carbon-identity-framework
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);
代码示例来源:origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl
@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);
}
}
代码示例来源:origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl
@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);
}
}
代码示例来源:origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel
/**
* 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);
}
}
内容来源于网络,如有侵权,请联系作者删除!