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

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


                if (XACMLPolicyStatementType.TYPE_LOCAL_NAME.equals(statementLocalName)) {

                    XACMLPolicyStatementType policyStatement = (XACMLPolicyStatementType) statement;

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


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

                String policySetId = getPolicySetIdFromFileName(fileName);

                PolicySetTypeString policySet = papCache.get(policySetId);

                if (policySet == null) {
                    try {
                        policySet = new PolicySetTypeString(policySetId,
                                                            policySetHelper.readFromFileAsString(file));
                        log.debug("getAll(): PolicySet retrieved from file: id=" + policySetId);
                    } catch (Throwable e) {
                        throw new RepositoryException(e);
                    }

                    papCache.put(policySetId, policySet);
                } else {
                    log.debug("getAll(): PolicySet retrieved from cache: id=" + policySetId);
                }

                policySetList.add(new PolicySetTypeString(policySetId, policySet.getPolicySetString()));

                if (policySet.isDOMLoaded()) {
                    log.warn("getAll(): DOM not released for PolicySet id=" + policySetId);
                }
            }
        }
        return policySetList;
View Full Code Here

     */
    public synchronized PolicySetType getById(String papId, String policySetId) {

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

        PolicySetTypeString policySet = papCache.get(policySetId);

        File policySetFile = new File(getPolicySetAbsolutePath(papId, policySetId));
        if (policySet == null) {

            if (!policySetFile.exists()) {
                if (papCache.size() == 0) {
                    cache.remove(papId);
                }
                throw new NotFoundException(policySetNotFoundExceptionMsg(policySetId));
            }

            try {
                policySet = new PolicySetTypeString(policySetId,
                                                    policySetHelper.readFromFileAsString(policySetFile));
            } catch (Throwable e) {
                throw new RepositoryException(e);
            }

            papCache.put(policySetId, policySet);
            log.debug("getById(): PolicySet retrieved from file: id=" + policySetId);

        } else {
            log.debug("getById(): PolicySet retrieved from cache: id=" + policySetId);
        }

        if (policySet.isDOMLoaded()) {
            log.warn("getById(): DOM not released for PolicySet id=" + policySetId);
        }

        return new PolicySetTypeString(policySetId, policySet.getPolicySetString());
    }
View Full Code Here

    /**
     * {@Inherited}
     */
    public synchronized void store(String papId, PolicySetType policySet) {

        PolicySetTypeString policySetTypeString = TypeStringUtils.cloneAsPolicySetTypeString(policySet);

        TypeStringUtils.releaseUnneededMemory(policySet);

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

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

        String policySetId = policySetTypeString.getPolicySetId();

        File policySetFile = new File(getPolicySetAbsolutePath(papId, policySetId));
        if (policySetFile.exists()) {
            throw new AlreadyExistsException("Already exists: policySetId=" + policySetId);
        }
View Full Code Here

        if (!policySetFile.exists()) {
            throw new NotFoundException(policySetNotFoundExceptionMsg(policySetId));
        }

        Map<String, PolicySetTypeString> papCache = getPapCache(papId);
        PolicySetTypeString oldPolicySetString = papCache.get(policySetId);

        if (oldPolicySetString == null) {
            try {
                oldPolicySetString = new PolicySetTypeString(policySetHelper.buildFromFile(policySetFile));
                log.debug("update(): PolicySet retrieved from file: id=" + policySetId);
            } catch (Throwable e) {
                throw new RepositoryException(e);
            }
        } else {
            log.debug("update(): PolicySet retrieved from cache: id=" + policySetId);
        }

        String repositoryVersion = oldPolicySetString.getVersion();
        TypeStringUtils.releaseUnneededMemory(oldPolicySetString);

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

        PolicySetHelper.toFile(policySetFile, newPolicySet);

        PolicySetTypeString newPolicySetTypeString = TypeStringUtils.cloneAsPolicySetTypeString(newPolicySet);

        papCache.put(policySetId, newPolicySetTypeString);
    }
View Full Code Here

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

            } else if (xmlObjectDOM instanceof PolicySetType) {

                xmlObject = new PolicySetTypeString((PolicySetType) xmlObjectDOM);
                xmlObject.releaseDOM();

            } else {

                xmlObject = xmlObjectDOM;
View Full Code Here

        }
        return sb.toString();
    }

    private PolicySetTypeString buildXACMLNoReferences() {
        PolicySetTypeString policySet = new PolicySetTypeString(PolicySetHelper.build(policySetId,
                                                                                      PolicySetHelper.COMB_ALG_FIRST_APPLICABLE,
                                                                                      targetWizard.getXACML(),
                                                                                      null));
        if (description != null) {
            policySet.setDescription(DescriptionTypeHelper.build(description));
        }

        policySet.setVersion(version);

        return policySet;
    }
View Full Code Here

        try {

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

            PolicySetTypeString object = new PolicySetTypeString(element);

            setValue(object);
           
        } catch (Exception exception) {
            throw new SAXException("Error deserializing " + " : " + exception.getClass() + " : " + exception.getMessage());
View Full Code Here

TOP

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

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.