• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VersionConstraints类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.wso2.balana.VersionConstraints的典型用法代码示例。如果您正苦于以下问题:Java VersionConstraints类的具体用法?Java VersionConstraints怎么用?Java VersionConstraints使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

VersionConstraints类属于org.wso2.balana包,在下文中一共展示了VersionConstraints类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPolicy

点赞 3

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
@Override
public AbstractPolicy getPolicy(URI identifier, int type, VersionConstraints constraints) {

    AbstractPolicy policy = policyCollection.get(identifier);

    if (policy != null) {
        // we found a valid version, so see if it's the right kind,
        // and if it is then we return it
        if (type == PolicyReference.POLICY_REFERENCE) {
            if (policy instanceof Policy) {
                return policy;
            }
        } else {
            if (policy instanceof PolicySet) {
                return policy;
            }
        }
    }

    return null;
}
 

开发者ID:wso2,
项目名称:carbon-identity-framework,
代码行数:22,
代码来源:SimplePolicyCollection.java

示例2: getPolicy

点赞 3

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
@Override
public AbstractPolicy getPolicy(URI identifier, int type, VersionConstraints constraints) {

    AbstractPolicy policy = policyCollection.get(identifier);

    if (policy != null) {
        // we found a valid version, so see if it's the right kind,
        // and if it is then we return it
        if (type == PolicyReference.POLICY_REFERENCE) {
            if (policy instanceof Policy)
                return policy;
        } else {
            if (policy instanceof PolicySet)
                return policy;
        }
    }

    return null;
}
 

开发者ID:wso2-attic,
项目名称:carbon-identity,
代码行数:20,
代码来源:SimplePolicyCollection.java

示例3: findPolicy

点赞 3

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
@Override
public PolicyFinderResult findPolicy(URI idReference, int type, VersionConstraints constraints, PolicyMetaData parentMetaData) {

    AbstractPolicy policy = policies.get(idReference);
    if (policy != null) {
        if (type == PolicyReference.POLICY_REFERENCE) {
            if (policy instanceof Policy) {
                return new PolicyFinderResult(policy);
            }
        } else {
            if (policy instanceof PolicySet) {
                return new PolicyFinderResult(policy);
            }
        }
    }

    // if there was an error loading the policy, return the error
    ArrayList<String> code = new ArrayList<String>();
    code.add(Status.STATUS_PROCESSING_ERROR);
    Status status = new Status(code, "couldn't load referenced policy");
    log.info("No policy found, code=" + code);
    return new PolicyFinderResult(status);
}
 

开发者ID:telefonicaid,
项目名称:fiware-keypass,
代码行数:24,
代码来源:InMemoryPolicyFinderModule.java

示例4: findPolicy

点赞 3

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
@Override
public PolicyFinderResult findPolicy(URI idReference, int type, VersionConstraints constraints, 
                                     PolicyMetaData parentMetaData) {

    AbstractPolicy policy = policies.get(idReference);
    if(policy != null){
        if (type == PolicyReference.POLICY_REFERENCE) {
            if (policy instanceof Policy){
                return new PolicyFinderResult(policy);
            }
        } else {
            if (policy instanceof PolicySet){
                return new PolicyFinderResult(policy);
            }
        }
    }

    // if there was an error loading the policy, return the error
    ArrayList<String> code = new ArrayList<String>();
    code.add(Status.STATUS_PROCESSING_ERROR);
    Status status = new Status(code,
                               "couldn't load referenced policy");
    return new PolicyFinderResult(status);
}
 

开发者ID:wso2,
项目名称:balana,
代码行数:25,
代码来源:FileBasedPolicyFinderModule.java

示例5: findPolicy

点赞 2

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
public PolicyFinderResult findPolicy(URI idReference, int type, VersionConstraints constraints,
                                     PolicyMetaData parentMetaData) {

    // clear all current policies
    policies.getPolicies().clear();

    AbstractPolicy policy = null;

    try {
        AbstractPolicy policyFromStore = policyReader.readPolicy(idReference.toString(),
                this.policyFinder);

        if (policyFromStore != null) {
            if (type == PolicyReference.POLICY_REFERENCE) {
                if (policyFromStore instanceof Policy) {
                    policy = policyFromStore;
                    policies.addPolicy(policy);
                }
            } else {
                if (policyFromStore instanceof PolicySet) {
                    policy = policyFromStore;
                    policies.addPolicy(policy);
                }
            }
        }
    } catch (EntitlementException e) {
        // ignore and just log the error.
        log.error(e);
    }

    if (policy == null) {
        return new PolicyFinderResult();
    } else {
        return new PolicyFinderResult(policy);
    }
}
 

开发者ID:wso2,
项目名称:carbon-identity-framework,
代码行数:37,
代码来源:PAPPolicyFinder.java

示例6: getPolicy

点赞 2

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
/**
 * Attempts to retrieve a policy based on the given identifier and other constraints. If there
 * are multiple versions of the identified policy that meet the version constraints, then the
 * most recent version is returned.
 *
 * @param identifier
 * @param type
 * @param constraints
 * @return
 */
public AbstractPolicy getPolicy(URI identifier, int type, VersionConstraints constraints) {

    TreeSet<AbstractPolicy> set = policies.get(identifier.toString());

    // if we don't know about this identifier then there's nothing to do
    if (set == null)
        return null;

    // walk through the set starting with the most recent version, looking
    // for a match until we exhaust all known versions
    Iterator<AbstractPolicy> it = set.iterator();
    while (it.hasNext()) {
        AbstractPolicy policy = (AbstractPolicy) (it.next());
        if (constraints.meetsConstraint(policy.getVersion())) {
            // we found a valid version, so see if it's the right kind,
            // and if it is then we return it
            if (type == PolicyReference.POLICY_REFERENCE) {
                if (policy instanceof Policy)
                    return policy;
            } else {
                if (policy instanceof PolicySet)
                    return policy;
            }
        }
    }

    // we didn't find a match
    return null;
}
 

开发者ID:wso2,
项目名称:carbon-identity-framework,
代码行数:40,
代码来源:DefaultPolicyCollection.java

示例7: findPolicy

点赞 2

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
@Override
public PolicyFinderResult findPolicy(URI idReference, int type, VersionConstraints constraints,
                                     PolicyMetaData parentMetaData) {

    AbstractPolicy policy = policyReferenceCache.get(idReference);

    if (policy == null) {
        if (this.finderModules != null) {
            for (PolicyFinderModule finderModule : this.finderModules) {
                String policyString = finderModule.getReferencedPolicy(idReference.toString());
                if (policyString != null) {
                    policy = policyReader.getPolicy(policyString);
                    if (policy != null) {
                        policyReferenceCache.put(idReference, policy);
                        break;
                    }
                }
            }
        }
    }

    if (policy != null) {
        // we found a valid version, so see if it's the right kind,
        // and if it is then we return it
        if (type == PolicyReference.POLICY_REFERENCE) {
            if (policy instanceof Policy) {
                return new PolicyFinderResult(policy);
            }
        } else {
            if (policy instanceof PolicySet) {
                return new PolicyFinderResult(policy);
            }
        }
    }

    return new PolicyFinderResult();
}
 

开发者ID:wso2,
项目名称:carbon-identity-framework,
代码行数:38,
代码来源:CarbonPolicyFinder.java

示例8: getPolicy

点赞 1

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
/**
 * returns policy by identifier type and version
 *
 * @param identifier  policy identifier
 * @param type        policy type whether policy or policy set
 * @param constraints policy version constraints
 * @return policy as AbstractPolicy object of Balana
 */
public AbstractPolicy getPolicy(URI identifier, int type, VersionConstraints constraints);
 

开发者ID:wso2,
项目名称:carbon-identity-framework,
代码行数:10,
代码来源:PolicyCollection.java

示例9: findPolicy

点赞 1

import org.wso2.balana.VersionConstraints; //导入依赖的package包/类
/**
 * Tries to find one and only one matching policy given the idReference If more than one policy
 * is found, this is an error and must be reported as such. If no policies are found, then an
 * empty result must be returned. By default this method returns an empty result. This method
 * should never return null.
 * 
 * @param idReference an identifier specifying some policy
 * @param type type of reference (policy or policySet) as identified by the fields in
 *            <code>PolicyReference</code>
 * @param constraints any optional constraints on the version of the referenced policy (this
 *            will never be null, but it may impose no constraints, and in fact will never
 *            impose constraints when used from a pre-2.0 XACML policy)
 * @param parentMetaData the meta-data from the parent policy, which provides XACML version,
 *            factories, etc.
 * 
 * @return the result of looking for a matching policy
 */
public PolicyFinderResult findPolicy(URI idReference, int type, VersionConstraints constraints,
        PolicyMetaData parentMetaData) {
    return new PolicyFinderResult();
}
 

开发者ID:FTSRG,
项目名称:mondo-collab-framework,
代码行数:22,
代码来源:PolicyFinderModule.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)