APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.provider.certpath

pack-priv final Class PolicyNodeImpl

extends Object
implements PolicyNode
Class Inheritance
All Implemented Interfaces
java.security.cert.PolicyNode
Imports
java.util.*, java.security.cert.*, sun.security.util.KnownOIDs

Implements the PolicyNode interface.

This class provides an implementation of the PolicyNode interface, and is used internally to build and search Policy Trees. While the implementation is mutable during construction, it is immutable before returning to a client and no mutable public or protected methods are exposed by this implementation, as per the contract of PolicyNode.

Authors
Seth Proctor, Sean Mullan
Since
1.4

Field Summary

Modifier and TypeField and Description
private static final String
ANY_POLICY

Use to specify the special policy "Any Policy"

private boolean
private final HashSet<PolicyNodeImpl>
private final boolean
private final int
private final HashSet<String>
private boolean
private final PolicyNodeImpl
private final HashSet<PolicyQualifierInfo>
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
PolicyNodeImpl(PolicyNodeImpl
the PolicyNode above this in the tree, or null if this node is the tree's root node
parent
,
String
a String representing this node's valid policy OID
validPolicy
,
Set<PolicyQualifierInfo>
the Set of qualifiers for this policy
qualifierSet
,
boolean
a boolean representing whether the extension is critical
criticalityIndicator
,
Set<String>
a Set of expected policies
expectedPolicySet
,
boolean
a boolean indicating whether this node was generated by a policy mapping
generatedByPolicyMapping
)

Constructor which takes a PolicyNodeImpl representing the parent in the Policy Tree to this node.

pack-priv
PolicyNodeImpl(PolicyNodeImpl
a PolicyNode that's the new parent of the node, or null if this is the root node
parent
,
PolicyNodeImpl
a PolicyNode containing the policy data to copy
node
)

Alternate constructor which makes a new node with the policy data in an existing PolicyNodeImpl.

Method Summary

Modifier and TypeMethod and Description
private void
addChild(PolicyNodeImpl
new PolicyNodeImpl child node
child
)

Private method sets a child node.

pack-priv void
addExpectedPolicy(String
a String representing an expected policy.
expectedPolicy
)

Adds an expectedPolicy to the expected policy set.

pack-priv String
asString()

Prints out some data on this node.

pack-priv PolicyNodeImpl

Returns:

a copy of the tree
copyTree
()

Returns a copy of the tree, without copying the policy-related data, rooted at the node on which this was called.

private PolicyNodeImpl
pack-priv void
deleteChild(PolicyNode
the child node to be deleted
childNode
)

Deletes the specified child node of this node, if it exists.

public Iterator<PolicyNodeImpl>
getChildren()

Implements java.security.cert.PolicyNode.getChildren.

Returns an iterator over the children of this node.

public int
getDepth()

Implements java.security.cert.PolicyNode.getDepth.

Returns the depth of this node in the valid policy tree.

public Set<String>
getExpectedPolicies()

Implements java.security.cert.PolicyNode.getExpectedPolicies.

Returns the set of expected policies that would satisfy this node's valid policy in the next certificate to be processed.

public PolicyNode
getParent()

Implements java.security.cert.PolicyNode.getParent.

Returns the parent of this node, or null if this is the root node.

pack-priv Set<PolicyNodeImpl>

Returns:

a Set of all nodes at the specified depth
getPolicyNodes
(int
an int representing the depth of the desired nodes
depth
)

Returns all nodes at the specified depth in the tree.

private void
getPolicyNodes(int depth, Set<PolicyNodeImpl> set)

Add all nodes at depth to set and return the Set.

pack-priv Set<PolicyNodeImpl>

Returns:

a Set of matched PolicyNodes
getPolicyNodesExpected
(int
an int representing the desired depth
depth
,
String
a String encoding the valid OID to match
expectedOID
,
boolean
a boolean indicating whether an expected_policy_set containing ANY_POLICY should be considered a match
matchAny
)

Finds all nodes at the specified depth whose expected_policy_set contains the specified expected OID (if matchAny is false) or the special OID "any value" (if matchAny is true).

private Set<PolicyNodeImpl>
getPolicyNodesExpectedHelper(int depth, String expectedOID, boolean matchAny)

pack-priv Set<PolicyNodeImpl>

Returns:

a Set of matched PolicyNodes
getPolicyNodesValid
(int
an int representing the desired depth
depth
,
String
a String encoding the valid OID to match
validOID
)

Finds all nodes at the specified depth that contains the specified valid OID

public Set<PolicyQualifierInfo>
getPolicyQualifiers()

Implements java.security.cert.PolicyNode.getPolicyQualifiers.

Returns the set of policy qualifiers associated with the valid policy represented by this node.

public String
getValidPolicy()

Implements java.security.cert.PolicyNode.getValidPolicy.

Returns the valid policy represented by this node.

public boolean
isCritical()

Implements java.security.cert.PolicyNode.isCritical.

Returns the criticality indicator of the certificate policy extension in the most recently processed certificate.

pack-priv boolean
private static String
pack-priv void
prune(int
an int representing the desired minimum depth of all paths
depth
)

Removes all paths which don't reach the specified depth.

pack-priv void
setImmutable()

Sets the immutability flag of this node and all of its children to true.

public String

Returns:

a String describing the contents of the Policy Node
toString
()

Overrides java.lang.Object.toString.

Return a printable representation of the PolicyNode.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ANY_POLICYback to summary
private static final String ANY_POLICY

Use to specify the special policy "Any Policy"

isImmutableback to summary
private boolean isImmutable
mChildrenback to summary
private final HashSet<PolicyNodeImpl> mChildren
mCriticalityIndicatorback to summary
private final boolean mCriticalityIndicator
mDepthback to summary
private final int mDepth
mExpectedPolicySetback to summary
private final HashSet<String> mExpectedPolicySet
mOriginalExpectedPolicySetback to summary
private boolean mOriginalExpectedPolicySet
mParentback to summary
private final PolicyNodeImpl mParent
mQualifierSetback to summary
private final HashSet<PolicyQualifierInfo> mQualifierSet
mValidPolicyback to summary
private final String mValidPolicy

Constructor Detail

PolicyNodeImplback to summary
pack-priv PolicyNodeImpl(PolicyNodeImpl parent, String validPolicy, Set<PolicyQualifierInfo> qualifierSet, boolean criticalityIndicator, Set<String> expectedPolicySet, boolean generatedByPolicyMapping)

Constructor which takes a PolicyNodeImpl representing the parent in the Policy Tree to this node. If null, this is the root of the tree. The constructor also takes the associated data for this node, as found in the certificate. It also takes a boolean argument specifying whether this node is being created as a result of policy mapping.

Parameters
parent:PolicyNodeImpl

the PolicyNode above this in the tree, or null if this node is the tree's root node

validPolicy:String

a String representing this node's valid policy OID

qualifierSet:Set<PolicyQualifierInfo>

the Set of qualifiers for this policy

criticalityIndicator:boolean

a boolean representing whether the extension is critical

expectedPolicySet:Set<String>

a Set of expected policies

generatedByPolicyMapping:boolean

a boolean indicating whether this node was generated by a policy mapping

PolicyNodeImplback to summary
pack-priv PolicyNodeImpl(PolicyNodeImpl parent, PolicyNodeImpl node)

Alternate constructor which makes a new node with the policy data in an existing PolicyNodeImpl.

Parameters
parent:PolicyNodeImpl

a PolicyNode that's the new parent of the node, or null if this is the root node

node:PolicyNodeImpl

a PolicyNode containing the policy data to copy

Method Detail

addChildback to summary
private void addChild(PolicyNodeImpl child)

Private method sets a child node. This is called from the child's constructor.

Parameters
child:PolicyNodeImpl

new PolicyNodeImpl child node

addExpectedPolicyback to summary
pack-priv void addExpectedPolicy(String expectedPolicy)

Adds an expectedPolicy to the expected policy set. If this is the original expected policy set initialized by the constructor, then the expected policy set is cleared before the expected policy is added.

Parameters
expectedPolicy:String

a String representing an expected policy.

asStringback to summary
pack-priv String asString()

Prints out some data on this node.

copyTreeback to summary
pack-priv PolicyNodeImpl copyTree()

Returns a copy of the tree, without copying the policy-related data, rooted at the node on which this was called.

Returns:PolicyNodeImpl

a copy of the tree

copyTreeback to summary
private PolicyNodeImpl copyTree(PolicyNodeImpl parent)
deleteChildback to summary
pack-priv void deleteChild(PolicyNode childNode)

Deletes the specified child node of this node, if it exists.

Parameters
childNode:PolicyNode

the child node to be deleted

getChildrenback to summary
public Iterator<PolicyNodeImpl> getChildren()

Implements java.security.cert.PolicyNode.getChildren.

Doc from java.security.cert.PolicyNode.getChildren.

Returns an iterator over the children of this node. Any attempts to modify the children of this node through the Iterator's remove method must throw an UnsupportedOperationException.

Annotations
@Override
getDepthback to summary
public int getDepth()

Implements java.security.cert.PolicyNode.getDepth.

Doc from java.security.cert.PolicyNode.getDepth.

Returns the depth of this node in the valid policy tree.

Annotations
@Override
getExpectedPoliciesback to summary
public Set<String> getExpectedPolicies()

Implements java.security.cert.PolicyNode.getExpectedPolicies.

Doc from java.security.cert.PolicyNode.getExpectedPolicies.

Returns the set of expected policies that would satisfy this node's valid policy in the next certificate to be processed.

Annotations
@Override
getParentback to summary
public PolicyNode getParent()

Implements java.security.cert.PolicyNode.getParent.

Doc from java.security.cert.PolicyNode.getParent.

Returns the parent of this node, or null if this is the root node.

Annotations
@Override
getPolicyNodesback to summary
pack-priv Set<PolicyNodeImpl> getPolicyNodes(int depth)

Returns all nodes at the specified depth in the tree.

Parameters
depth:int

an int representing the depth of the desired nodes

Returns:Set<PolicyNodeImpl>

a Set of all nodes at the specified depth

getPolicyNodesback to summary
private void getPolicyNodes(int depth, Set<PolicyNodeImpl> set)

Add all nodes at depth to set and return the Set. Internal recursion helper.

getPolicyNodesExpectedback to summary
pack-priv Set<PolicyNodeImpl> getPolicyNodesExpected(int depth, String expectedOID, boolean matchAny)

Finds all nodes at the specified depth whose expected_policy_set contains the specified expected OID (if matchAny is false) or the special OID "any value" (if matchAny is true).

Parameters
depth:int

an int representing the desired depth

expectedOID:String

a String encoding the valid OID to match

matchAny:boolean

a boolean indicating whether an expected_policy_set containing ANY_POLICY should be considered a match

Returns:Set<PolicyNodeImpl>

a Set of matched PolicyNodes

getPolicyNodesExpectedHelperback to summary
private Set<PolicyNodeImpl> getPolicyNodesExpectedHelper(int depth, String expectedOID, boolean matchAny)
getPolicyNodesValidback to summary
pack-priv Set<PolicyNodeImpl> getPolicyNodesValid(int depth, String validOID)

Finds all nodes at the specified depth that contains the specified valid OID

Parameters
depth:int

an int representing the desired depth

validOID:String

a String encoding the valid OID to match

Returns:Set<PolicyNodeImpl>

a Set of matched PolicyNodes

getPolicyQualifiersback to summary
public Set<PolicyQualifierInfo> getPolicyQualifiers()

Implements java.security.cert.PolicyNode.getPolicyQualifiers.

Doc from java.security.cert.PolicyNode.getPolicyQualifiers.

Returns the set of policy qualifiers associated with the valid policy represented by this node.

Annotations
@Override
getValidPolicyback to summary
public String getValidPolicy()

Implements java.security.cert.PolicyNode.getValidPolicy.

Doc from java.security.cert.PolicyNode.getValidPolicy.

Returns the valid policy represented by this node.

Annotations
@Override
isCriticalback to summary
public boolean isCritical()

Implements java.security.cert.PolicyNode.isCritical.

Doc from java.security.cert.PolicyNode.isCritical.

Returns the criticality indicator of the certificate policy extension in the most recently processed certificate.

Annotations
@Override
isImmutableback to summary
pack-priv boolean isImmutable()
policyToStringback to summary
private static String policyToString(String oid)
pruneback to summary
pack-priv void prune(int depth)

Removes all paths which don't reach the specified depth.

Parameters
depth:int

an int representing the desired minimum depth of all paths

setImmutableback to summary
pack-priv void setImmutable()

Sets the immutability flag of this node and all of its children to true.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Return a printable representation of the PolicyNode. Starting at the node on which this method is called, it recurses through the tree and prints out each node.

Returns:String

a String describing the contents of the Policy Node

Annotations
@Override