public class DefaultPolicyCollection extends Object implements PolicyCollection
Constructor and Description |
---|
DefaultPolicyCollection(org.wso2.balana.combine.PolicyCombiningAlgorithm combiningAlg)
Creates a new
DefaultPolicyCollection that will return errors when multiple policies
match for a given request. |
DefaultPolicyCollection(org.wso2.balana.combine.PolicyCombiningAlgorithm combiningAlg,
int maxInMemoryPolicies)
Creates a new
DefaultPolicyCollection that will return errors when multiple policies
match for a given request. |
DefaultPolicyCollection(org.wso2.balana.combine.PolicyCombiningAlgorithm combiningAlg,
URI parentPolicyId)
Creates a new
DefaultPolicyCollection that will create a new top-level PolicySet when
multiple policies match for a given request. |
Modifier and Type | Method and Description |
---|---|
boolean |
addPolicy(org.wso2.balana.AbstractPolicy policy)
Adds a new policy to the collection, and uses the policy's identifier as the reference
identifier.
|
boolean |
addPolicy(org.wso2.balana.AbstractPolicy policy,
String identifier)
*Adds a new policy to the collection using the given identifier as the reference identifier.
|
boolean |
deletePolicy(String policyId) |
org.wso2.balana.AbstractPolicy |
getEffectivePolicy(ArrayList<org.wso2.balana.AbstractPolicy> policies)
Get Policy or Policy Set for given applicable policies
|
org.wso2.balana.AbstractPolicy |
getEffectivePolicy(org.wso2.balana.ctx.EvaluationCtx context)
Attempts to retrieve a policy based on the given context.
|
LinkedHashMap<String,TreeSet<org.wso2.balana.AbstractPolicy>> |
getPolicies()
get All policies
|
org.wso2.balana.AbstractPolicy |
getPolicy(String policyId)
Get Policy using policyId
|
org.wso2.balana.AbstractPolicy |
getPolicy(URI policyId)
Get Policy using policyId
|
org.wso2.balana.AbstractPolicy |
getPolicy(URI identifier,
int type,
org.wso2.balana.VersionConstraints constraints)
Attempts to retrieve a policy based on the given identifier and other constraints.
|
LinkedHashMap |
getPolicyMap() |
int |
hashCode() |
void |
init(Properties properties)
initializes policy finder collection
|
void |
setPolicyCombiningAlgorithm(org.wso2.balana.combine.PolicyCombiningAlgorithm algorithm)
sets global policy combining algorithm
|
void |
setPolicyMap(LinkedHashMap policyMap) |
public DefaultPolicyCollection(org.wso2.balana.combine.PolicyCombiningAlgorithm combiningAlg, int maxInMemoryPolicies)
DefaultPolicyCollection
that will return errors when multiple policies
match for a given request.combiningAlg
- Policy combining AlgorithmmaxInMemoryPolicies
- maximum no of policies that keeps in memorypublic DefaultPolicyCollection(org.wso2.balana.combine.PolicyCombiningAlgorithm combiningAlg)
DefaultPolicyCollection
that will return errors when multiple policies
match for a given request.combiningAlg
- Policy combining Algorithmpublic DefaultPolicyCollection(org.wso2.balana.combine.PolicyCombiningAlgorithm combiningAlg, URI parentPolicyId)
DefaultPolicyCollection
that will create a new top-level PolicySet when
multiple policies match for a given request.combiningAlg
- the algorithm to use in a new PolicySet when more than one policy appliesparentPolicyId
- the identifier to use for the new PolicySetpublic void init(Properties properties) throws Exception
PolicyCollection
init
in interface PolicyCollection
properties
- Properties, that need to initialize the moduleException
- throws when initialization is failedpublic boolean addPolicy(org.wso2.balana.AbstractPolicy policy)
addPolicy
in interface PolicyCollection
policy
- the policy to addpublic boolean addPolicy(org.wso2.balana.AbstractPolicy policy, String identifier)
policy
- identifier
- public org.wso2.balana.AbstractPolicy getEffectivePolicy(org.wso2.balana.ctx.EvaluationCtx context) throws EntitlementException
getEffectivePolicy
in interface PolicyCollection
context
- EntitlementException
public org.wso2.balana.AbstractPolicy getPolicy(URI policyId)
getPolicy
in interface PolicyCollection
policyId
- policyId as a URIpublic org.wso2.balana.AbstractPolicy getPolicy(String policyId)
policyId
- policyId as a Stringpublic LinkedHashMap<String,TreeSet<org.wso2.balana.AbstractPolicy>> getPolicies()
public org.wso2.balana.AbstractPolicy getEffectivePolicy(ArrayList<org.wso2.balana.AbstractPolicy> policies) throws EntitlementException
policies
- applicable policies as array listEntitlementException
- throws if no policy combiningAlg is definedpublic org.wso2.balana.AbstractPolicy getPolicy(URI identifier, int type, org.wso2.balana.VersionConstraints constraints)
getPolicy
in interface PolicyCollection
identifier
- type
- constraints
- public void setPolicyCombiningAlgorithm(org.wso2.balana.combine.PolicyCombiningAlgorithm algorithm)
PolicyCollection
setPolicyCombiningAlgorithm
in interface PolicyCollection
algorithm
- PolicyCombiningAlgorithm object of Balanapublic boolean deletePolicy(String policyId)
deletePolicy
in interface PolicyCollection
public LinkedHashMap getPolicyMap()
getPolicyMap
in interface PolicyCollection
public void setPolicyMap(LinkedHashMap policyMap)
setPolicyMap
in interface PolicyCollection
Copyright © 2016 WSO2. All rights reserved.