Package org.glite.authz.pap.common.xacml.impl

Examples of org.glite.authz.pap.common.xacml.impl.PolicyTypeString


            XMLObject xmlObjectDOM = unmarshaller.unmarshall(element);

            if (xmlObjectDOM instanceof PolicyType) {

                xmlObject = new PolicyTypeString((PolicyType) xmlObjectDOM);
                xmlObject.releaseDOM();

            } else if (xmlObjectDOM instanceof PolicySetType) {

                xmlObject = new PolicySetTypeString((PolicySetType) xmlObjectDOM);
View Full Code Here


            if (fileName.startsWith(FileSystemRepositoryManager.POLICY_FILENAME_PREFIX)) {

                String policyId = getPolicyIdFromFileName(fileName);

                PolicyTypeString policy = papCache.get(policyId);

                if (policy == null) {
                    try {
                        policy = new PolicyTypeString(policyId, policyHelper.readFromFileAsString(file));
                    } catch (Throwable e) {
                        throw new RepositoryException(e);
                    }
                    papCache.put(policyId, policy);
                }
                policyList.add(new PolicyTypeString(policyId, policy.getPolicyString()));

                if (policy.isDOMLoaded()) {
                    log.warn("DOM not released for Policy id=" + policyId);
                }
            }
        }
        return policyList;
View Full Code Here

     */
    public synchronized PolicyType getById(String papId, String policyId) {

        Map<String, PolicyTypeString> papCache = getPapCache(papId);

        PolicyTypeString policy = papCache.get(policyId);

        if (policy == null) {

            File policyFile = new File(getPolicyFileAbsolutePath(papId, policyId));

            if (!policyFile.exists()) {
                if (papCache.size() == 0) {
                    cache.remove(papId);
                }
                throw new NotFoundException(policyNotFoundExceptionMsg(policyId));
            }

            try {
                policy = new PolicyTypeString(policyId, policyHelper.readFromFileAsString(policyFile));
            } catch (Throwable e) {
                throw new RepositoryException(e);
            }

            papCache.put(policyId, policy);
        }

        if (policy.isDOMLoaded()) {
            log.warn("DOM not released for id=" + policyId);
        }
        return new PolicyTypeString(policyId, policy.getPolicyString());
    }
View Full Code Here

    /**
     * {@Inherited}
     */
    public synchronized void store(String papId, PolicyType policy) {

        PolicyTypeString policyTypeString = TypeStringUtils.cloneAsPolicyTypeString(policy);

        TypeStringUtils.releaseUnneededMemory(policy);

        File papDir = new File(FileSystemRepositoryManager.getPAPDirAbsolutePath(papId));

        if (!papDir.exists()) {
            throw new NotFoundException(papDirNotFoundExceptionMsg(papDir.getAbsolutePath()));
        }

        String policyId = policyTypeString.getPolicyId();

        File policyFile = new File(getPolicyFileAbsolutePath(papId, policyId));

        if (policyFile.exists()) {
            throw new AlreadyExistsException("Already exists: policyId=" + policyId);
View Full Code Here

    /**
     * {@Inherited}
     */
    public synchronized void update(String papId, String version, PolicyType newPolicy) {

        PolicyTypeString newPolicyTypeString = TypeStringUtils.cloneAsPolicyTypeString(newPolicy);

        TypeStringUtils.releaseUnneededMemory(newPolicy);

        String policyId = newPolicyTypeString.getPolicyId();

        File policyFile = new File(getPolicyFileAbsolutePath(papId, policyId));
        if (!policyFile.exists()) {
            throw new NotFoundException(policyNotFoundExceptionMsg(policyId));
        }

        Map<String, PolicyTypeString> papCache = getPapCache(papId);

        PolicyTypeString oldPolicy = papCache.get(policyId);

        if (oldPolicy == null) {
            try {
                oldPolicy = new PolicyTypeString(policyHelper.buildFromFile(policyFile));
            } catch (Throwable e) {
                throw new RepositoryException(e);
            }
        }

        if (!(oldPolicy.getVersion().equals(version))) {
            throw new InvalidVersionException(String.format("Attempting to update the wrong version of PolicyId=\"%s\" (requestedVersion=\"%s\", repositoryVersion=\"%s\")",
                                                            policyId,
                                                            version,
                                                            oldPolicy.getVersion()));
        }

        TypeStringUtils.releaseUnneededMemory(oldPolicy);

        PolicyHelper.toFile(policyFile, newPolicyTypeString);
View Full Code Here

                    for (PolicySetType policySet : policyStatement.getPolicySets()) {
                        responseList.add(new PolicySetTypeString(policySet));
                    }
                    for (PolicyType policy : policyStatement.getPolicies()) {
                        responseList.add(new PolicyTypeString(policy));
                    }
                }
            }
        }
        return responseList;
View Full Code Here

    try {

        MessageElement messageElement = context.getCurElement();
        String element = messageElement.getAsString();
       
        PolicyTypeString object = new PolicyTypeString(element);

        setValue(object);
    }

    catch (Exception exception) {
View Full Code Here

     */
    private void setPolicyType() {

        releaseDOM();

        policy = new PolicyTypeString(PolicyHelper.build(policyId, PolicyHelper.RULE_COMBALG_FIRST_APPLICABLE));

        if (description != null) {
            policy.setDescription(DescriptionTypeHelper.build(description));
        }

View Full Code Here

TOP

Related Classes of org.glite.authz.pap.common.xacml.impl.PolicyTypeString

Copyright © 2018 www.massapicom. 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.