Examples of PapContainer


Examples of org.glite.authz.pap.papmanagement.PapContainer

    }

    @Override
    protected PolicySetType doExecute() {

        PapContainer psContainer = new PapContainer(ps);

        PolicySetType policySet = psContainer.getRootPolicySet();

        return policySet;
    }
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

    }
   
    @Override
    protected PolicySetType doExecute() {
     
        PapContainer papContainer = new PapContainer(ps);
       
        if (!papContainer.hasPolicySet(policySetId))
            throw new NotFoundException("PolicySet '" + policySetId + "' not found.");
       
        PolicySetType policySet = papContainer.getPolicySet(policySetId);
       
        return policySet;
       
    }
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

        if (pap.isRemote()) {
            throw new XACMLPolicyManagementServiceException("Forbidden operation for a remote PAP");
        }

        PapContainer papContainer = new PapContainer(pap);

        PolicySetType targetPolicySet = getTargetPolicySet(papContainer);

        if (targetPolicySet == null) {
            targetPolicySet = (new PolicySetWizard(resourceAttributeWizard)).getXACML();
        } else {
            updateOperationForPolicySet = true;
        }

        String policyId = null;

        PolicyWizard targetPolicyWizard;
        PolicyType candidatePolicy = getTargetPolicy(papContainer, targetPolicySet);

        if (candidatePolicy == null) {
            targetPolicyWizard = new PolicyWizard(actionAttributeWizard);
            targetPolicyWizard.setPrivate(!isPublic);
            policyId = targetPolicyWizard.getPolicyId();
            PolicySetHelper.addPolicyReference(targetPolicySet, 0, policyId);
        } else {
            targetPolicyWizard = new PolicyWizard(candidatePolicy);

            if (targetPolicyWizard.denyRuleForAttributeExists(banAttributeWizard)) {
                // ban policy already exists
                return null;
            }
            policyId = candidatePolicy.getPolicyId();
            updateOperationForPolicy = true;
            policySetNeedToBeSaved = false;
        }

        targetPolicyWizard.addRule(0, banAttributeWizard, EffectType.Deny);

        // Store the ban policy and the policy set in which it is contained
        // (only if needed)
        if (policySetNeedToBeSaved) {
            if (updateOperationForPolicySet) {
                String oldVersion = targetPolicySet.getVersion();
                PolicySetWizard.increaseVersion(targetPolicySet);
                papContainer.updatePolicySet(oldVersion, targetPolicySet);
            } else {
                papContainer.addPolicySet(0, targetPolicySet);
            }
        } else {
            TypeStringUtils.releaseUnneededMemory(targetPolicySet);
        }

        if (updateOperationForPolicy) {
            String oldVersion = targetPolicyWizard.getVersionString();
            targetPolicyWizard.increaseVersion();
            papContainer.updatePolicy(oldVersion, targetPolicyWizard.getXACML());
        } else {
            papContainer.storePolicy(targetPolicyWizard.getXACML());
        }

        targetPolicyWizard.releaseChildrenDOM();
        targetPolicyWizard.releaseDOM();
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

        }

        log.debug(String.format("Storing policies for PAP %s (id=%s)", pap.getAlias(), pap.getId()));

        PapManager papManager = PapManager.getInstance();
        PapContainer papContainer = papManager.getPapContainer(pap.getAlias());

        synchronized (storePoliciesLock) {

            papContainer.deleteAllPolicies();
            papContainer.deleteAllPolicySets();

            XACMLObject papRoot = papPolicies.get(0);

            if (papRoot instanceof PolicySetType) {

                ((PolicySetType) papRoot).setPolicySetId(papContainer.getPap().getId());

                for (XACMLObject xacmlObject : papPolicies) {

                    if (xacmlObject instanceof PolicySetType) {
                        PolicySetType policySet = (PolicySetType) xacmlObject;
                        papContainer.storePolicySet(policySet);

                        log.debug(String.format("Stored PolicySet \"%s\" into pap \"%s\"",
                                                policySet.getPolicySetId(),
                                                pap.getAlias()));
                    } else if (xacmlObject instanceof PolicyType) {

                        PolicyType policy = (PolicyType) xacmlObject;
                        papContainer.storePolicy(policy);

                        log.debug(String.format("Stored Policy \"%s\" into pap \"%s\"",
                                                policy.getPolicyId(),
                                                pap.getAlias()));
                    } else {
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

            throw new NotFoundException(String.format("Not found: papAlias=%s", papAlias));
        }

        String papId = iniConfiguration.getString(idKey(papAlias));

        PapContainer papContainer = new PapContainer(get(papAlias));

        papContainer.deleteAllPolicies();
        papContainer.deleteAllPolicySets();

        File papDir = new File(getPapDirAbsolutePath(papId));
        papDir.delete();

        removeFromINIConfiguration(papAlias);
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

        return new HasRemotePolicyOperation(ps, policyId);
    }

    @Override
    protected Boolean doExecute() {
        PapContainer localPAP = new PapContainer(ps);
        return localPAP.hasPolicy(policyId);
    }
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

    }

    @Override
    protected PolicyType doExecute() {

        PapContainer papContainer = new PapContainer(ps);

        if (!papContainer.hasPolicy(policyId)) {
            throw new NotFoundException("Policy '" + policyId + "' not found.");
        }

        PolicyType policy = papContainer.getPolicy(policyId);

        return policy;
    }
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

        if (pap.isRemote()) {
            throw new XACMLPolicyManagementServiceException("Forbidden operation for a remote PAP");
        }

        PapContainer papContainer = new PapContainer(pap);

        String policySetId = WizardUtils.generateId(null);

        policySet.setPolicySetId(policySetId);

        papContainer.addPolicySet(index, policySet);

        TypeStringUtils.releaseUnneededMemory(policySet);

        log.info(String.format("Added policy set (policyId=\"%s\")", policySetId));
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

        return new HasLocalPolicyOperation(ps, policyId);
    }

    @Override
    protected Boolean doExecute() {
        PapContainer localPAP = new PapContainer(ps);
        return localPAP.hasPolicy(policyId);
    }
View Full Code Here

Examples of org.glite.authz.pap.papmanagement.PapContainer

        if (pap.isRemote()) {
            throw new XACMLPolicyManagementServiceException("Forbidden operation for a remote PAP");
        }

        PapContainer papContainer = new PapContainer(pap);

        if (papContainer.getRootPolicySetId().equals(id)) {
            throw new RepositoryException("Invalid operation: cannot remove the local PAP root policy set");
        }

        if (papContainer.hasPolicy(id)) {
            papContainer.removePolicyAndReferences(id);
            return true;
        }

        if (papContainer.hasPolicySet(id)) {
            papContainer.removePolicySetAndReferences(id);
            return true;
        }

        removeRule(papContainer, id);
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.