Examples of PolicyStore


Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

        PolicyFinder policyFinder = null;
        Set<PolicyFinderModule> policyModules = null;
        // Setup the PolicyFinder that the EntitlementEngine will use
        policyFinder = new PolicyFinder();

        registryModule = new RegistryBasedPolicyFinder(new PolicyStoreReader(new PolicyStore(
                registry)), tenantId);

        policyModules = new HashSet<PolicyFinderModule>();
        // Add all policy finders - we only have RegistryBasedPolicyFinder
        policyModules.add(registryModule);
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

        AbstractPolicy policyObj;
        EntitlementEngine entitlementEngine = EntitlementEngine
                .getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());
        policyObj = PolicyReader.getInstance(null, null).getPolicy(policy.getPolicy());
        if (policyObj != null) {
            policyAdmin = new PolicyAdmin(new PolicyStore(getGovernanceUserRegistry()));
            policy.setPolicyId(policyObj.getId().toASCIIString());
            // All the policies wont be active at the time been added.
            policy.setActive(policy.isActive());
            if (getPolicy(policy.getPolicyId()) != null) {
                throw new IdentityException(
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

    public PaginatedPolicySetDTO getAllPolicies(String policyTypeFilter, String policySearchString,
                                                int pageNumber) throws IdentityException {
        PolicyStoreReader policyReader;
        List<PolicyDTO>  policyDTOList = new ArrayList<PolicyDTO>();
        EntitlementEngine.getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());       
        policyReader = new PolicyStoreReader(new PolicyStore(getGovernanceUserRegistry()));
        PolicyDTO[] policyDTOs = policyReader.readAllPolicyDTOs();

        for (PolicyDTO policyDTO : policyDTOs){
            // Filter out services based on service type
            if (!policyTypeFilter.equals("ALL") && !policyTypeFilter.equals(policyDTO.getPolicyType())) {
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

            policy.setPolicy(EntitlementServiceComponent.getTemplatePolicy());
            policy.setPolicyId(policyId);
            return policy;
        }

        policyReader = new PolicyStoreReader(new PolicyStore(getGovernanceUserRegistry()));
        return policyReader.readPolicyDTO(policyId);
    }
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

     */
    public void removePolicy(PolicyDTO policy) throws IdentityException {
        PolicyAdmin policyAdmin;
        EntitlementEngine entitlementEngine = EntitlementEngine
                .getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());
        policyAdmin = new PolicyAdmin(new PolicyStore(getGovernanceUserRegistry()));
        policyAdmin.removePolicy(policy);
        // Reload the policies to the memory.
        entitlementEngine.getRegistryModule().init(null);
    }
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

        AbstractPolicy policyObj;
        EntitlementEngine entitlementEngine = EntitlementEngine
                .getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());
        policyObj = PolicyReader.getInstance(null, null).getPolicy(policy.getPolicy());
        if (policyObj != null) {
            policyAdmin = new PolicyAdmin(new PolicyStore(getGovernanceUserRegistry()));
            policy.setPolicyId(policyObj.getId().toASCIIString());
            policyAdmin.addOrUpdatePolicy(policy);
            // Reload the policies to the memory.
            entitlementEngine.getRegistryModule().init(null);
        } else {
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

     *             throws when registry error occurs
     */

    public String[] getEntitlementPolicyDataFromRegistry(String resourceName)
            throws IdentityException {
        PolicyStore policyStoreAdmin;
        List<String> entitlementPolicyResources = new ArrayList<String>();
        Resource resource;
        InputStream inputStream = null;
        BufferedReader bufferedReader = null;
        try {
            policyStoreAdmin = new PolicyStore(EntitlementServiceComponent.getRegistryService().
                    getGovernanceSystemRegistry());
            resource = policyStoreAdmin.getEntitlementPolicyResources(resourceName);
            inputStream = resource.getContentStream();
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
            String stringLine;
            while ((stringLine = bufferedReader.readLine()) != null) {
                entitlementPolicyResources.add(stringLine.trim());
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

     */
    public String[] getAllPolicyIds() throws IdentityException {
        List<String> policyIds = new ArrayList<String>();
        PolicyStoreReader policyReader;
        EntitlementEngine.getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());        
        policyReader = new PolicyStoreReader(new PolicyStore(getGovernanceUserRegistry()));

        for(PolicyDTO policyDTO : policyReader.readAllPolicyDTOs()){
            policyIds.add(policyDTO.getPolicyId());                   
        }
        return policyIds.toArray(new String[policyIds.size()]);
View Full Code Here

Examples of org.wso2.carbon.identity.entitlement.policy.PolicyStore

     * Set policy combining algorithm globally
     * @param policyCombiningAlgorithm   policy combining algorithm as a String
     * @throws IdentityException throws
     */
    public void setGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws IdentityException {
        PolicyStore policyStore;
        EntitlementEngine entitlementEngine = EntitlementEngine
                .getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());
        policyStore = new PolicyStore(getGovernanceUserRegistry());
        policyStore.addPolicyCombiningAlgorithm(policyCombiningAlgorithm);
        entitlementEngine.getRegistryModule().init(null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.