@Override public void persistConfig(String policyEditorType, String xmlConfig) throws PolicyEditorException { super.persistConfig(policyEditorType, xmlConfig); Registry registry = CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_GOVERNANCE); try { Resource resource = registry.newResource(); resource.setContent(xmlConfig); String path = null; if (EntitlementConstants.PolicyEditor.BASIC.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.STANDARD.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_STANDARD_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.RBAC.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_RBAC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.SET.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_SET_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else { //default path = EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } registry.put(path, resource); } catch (RegistryException e) { throw new PolicyEditorException("Error while persisting policy editor config"); } }
@Override public void persistConfig(String policyEditorType, String xmlConfig) throws PolicyEditorException { super.persistConfig(policyEditorType, xmlConfig); Registry registry = CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_GOVERNANCE); try { Resource resource = registry.newResource(); resource.setContent(xmlConfig); String path = null; if (EntitlementConstants.PolicyEditor.BASIC.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.STANDARD.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_STANDARD_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.RBAC.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_RBAC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.SET.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_SET_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else { //default path = EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } registry.put(path, resource); } catch (RegistryException e) { throw new PolicyEditorException("Error while persisting policy editor config"); } }
@Override public void persistConfig(String policyEditorType, String xmlConfig) throws PolicyEditorException { super.persistConfig(policyEditorType, xmlConfig); Registry registry = CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_GOVERNANCE); try { Resource resource = registry.newResource(); resource.setContent(xmlConfig); String path = null; if (EntitlementConstants.PolicyEditor.BASIC.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.STANDARD.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_STANDARD_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.RBAC.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_RBAC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else if (EntitlementConstants.PolicyEditor.SET.equals(policyEditorType)) { path = EntitlementConstants.ENTITLEMENT_POLICY_SET_EDITOR_CONFIG_FILE_REGISTRY_PATH; } else { //default path = EntitlementConstants.ENTITLEMENT_POLICY_BASIC_EDITOR_CONFIG_FILE_REGISTRY_PATH; } registry.put(path, resource); } catch (RegistryException e) { throw new PolicyEditorException("Error while persisting policy editor config"); } }
/** * Helper method * * @param verificationCode verificationCode as String * @param subscriberIds Array of subscriberIds */ private void persistVerificationCode(String verificationCode, String[] subscriberIds) { Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); try { org.wso2.carbon.registry.api.Resource resource = registry.newResource(); resource.setProperty("subscriberIds", Arrays.asList(subscriberIds)); resource.setProperty("policyIds", Arrays.asList(policyIds)); resource.setProperty("action", action); resource.setProperty("version", version); resource.setProperty("order", Integer.toString(order)); registry.put(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER_VERIFICATION + verificationCode, resource); } catch (org.wso2.carbon.registry.api.RegistryException e) { log.error("Error while persisting verification code", e); } }
/** * Helper method * * @param verificationCode verificationCode as String * @param subscriberIds Array of subscriberIds */ private void persistVerificationCode(String verificationCode, String[] subscriberIds) { Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); try { org.wso2.carbon.registry.api.Resource resource = registry.newResource(); resource.setProperty("subscriberIds", Arrays.asList(subscriberIds)); resource.setProperty("policyIds", Arrays.asList(policyIds)); resource.setProperty("action", action); resource.setProperty("version", version); resource.setProperty("order", Integer.toString(order)); registry.put(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER_VERIFICATION + verificationCode, resource); } catch (org.wso2.carbon.registry.api.RegistryException e) { log.error("Error while persisting verification code", e); } }
/** * Helper method * * @param verificationCode verificationCode as String * @param subscriberIds Array of subscriberIds */ private void persistVerificationCode(String verificationCode, String[] subscriberIds) { Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); try { org.wso2.carbon.registry.api.Resource resource = registry.newResource(); resource.setProperty("subscriberIds", Arrays.asList(subscriberIds)); resource.setProperty("policyIds", Arrays.asList(policyIds)); resource.setProperty("action", action); resource.setProperty("version", version); resource.setProperty("order", Integer.toString(order)); registry.put(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER_VERIFICATION + verificationCode, resource); } catch (org.wso2.carbon.registry.api.RegistryException e) { log.error("Error while persisting verification code", e); } }
Resource permissionNode = tenantGovReg.newResource(); permissionNode.setProperty("name", permission.getValue()); tenantGovReg.put(permissinPath, permissionNode);
Resource permissionNode = tenantGovReg.newResource(); permissionNode.setProperty("name", permission.getValue()); tenantGovReg.put(permissinPath, permissionNode);