jdk/src/share/classes/java/security/cert/PolicyNode.java
changeset 18551 882a3948c6e6
parent 5506 202f599c92aa
equal deleted inserted replaced
18550:6d0f51c99930 18551:882a3948c6e6
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    39  * <i>n</i>, where <i>n</i> is the length of the certification
    39  * <i>n</i>, where <i>n</i> is the length of the certification
    40  * path that has been validated.
    40  * path that has been validated.
    41  *
    41  *
    42  * <p>Most applications will not need to examine the valid policy tree.
    42  * <p>Most applications will not need to examine the valid policy tree.
    43  * They can achieve their policy processing goals by setting the
    43  * They can achieve their policy processing goals by setting the
    44  * policy-related parameters in <code>PKIXParameters</code>. However,
    44  * policy-related parameters in {@code PKIXParameters}. However,
    45  * the valid policy tree is available for more sophisticated applications,
    45  * the valid policy tree is available for more sophisticated applications,
    46  * especially those that process policy qualifiers.
    46  * especially those that process policy qualifiers.
    47  *
    47  *
    48  * <p>{@link PKIXCertPathValidatorResult#getPolicyTree()
    48  * <p>{@link PKIXCertPathValidatorResult#getPolicyTree()
    49  * PKIXCertPathValidatorResult.getPolicyTree} returns the root node of the
    49  * PKIXCertPathValidatorResult.getPolicyTree} returns the root node of the
    50  * valid policy tree. The tree can be traversed using the
    50  * valid policy tree. The tree can be traversed using the
    51  * {@link #getChildren getChildren} and {@link #getParent getParent} methods.
    51  * {@link #getChildren getChildren} and {@link #getParent getParent} methods.
    52  * Data about a particular node can be retrieved using other methods of
    52  * Data about a particular node can be retrieved using other methods of
    53  * <code>PolicyNode</code>.
    53  * {@code PolicyNode}.
    54  *
    54  *
    55  * <p><b>Concurrent Access</b>
    55  * <p><b>Concurrent Access</b>
    56  * <p>All <code>PolicyNode</code> objects must be immutable and
    56  * <p>All {@code PolicyNode} objects must be immutable and
    57  * thread-safe. Multiple threads may concurrently invoke the methods defined
    57  * thread-safe. Multiple threads may concurrently invoke the methods defined
    58  * in this class on a single <code>PolicyNode</code> object (or more than one)
    58  * in this class on a single {@code PolicyNode} object (or more than one)
    59  * with no ill effects. This stipulation applies to all public fields and
    59  * with no ill effects. This stipulation applies to all public fields and
    60  * methods of this class and any added or overridden by subclasses.
    60  * methods of this class and any added or overridden by subclasses.
    61  *
    61  *
    62  * @since       1.4
    62  * @since       1.4
    63  * @author      Sean Mullan
    63  * @author      Sean Mullan
    64  */
    64  */
    65 public interface PolicyNode {
    65 public interface PolicyNode {
    66 
    66 
    67     /**
    67     /**
    68      * Returns the parent of this node, or <code>null</code> if this is the
    68      * Returns the parent of this node, or {@code null} if this is the
    69      * root node.
    69      * root node.
    70      *
    70      *
    71      * @return the parent of this node, or <code>null</code> if this is the
    71      * @return the parent of this node, or {@code null} if this is the
    72      * root node
    72      * root node
    73      */
    73      */
    74     PolicyNode getParent();
    74     PolicyNode getParent();
    75 
    75 
    76     /**
    76     /**
    77      * Returns an iterator over the children of this node. Any attempts to
    77      * Returns an iterator over the children of this node. Any attempts to
    78      * modify the children of this node through the
    78      * modify the children of this node through the
    79      * <code>Iterator</code>'s remove method must throw an
    79      * {@code Iterator}'s remove method must throw an
    80      * <code>UnsupportedOperationException</code>.
    80      * {@code UnsupportedOperationException}.
    81      *
    81      *
    82      * @return an iterator over the children of this node
    82      * @return an iterator over the children of this node
    83      */
    83      */
    84     Iterator<? extends PolicyNode> getChildren();
    84     Iterator<? extends PolicyNode> getChildren();
    85 
    85 
    92     int getDepth();
    92     int getDepth();
    93 
    93 
    94     /**
    94     /**
    95      * Returns the valid policy represented by this node.
    95      * Returns the valid policy represented by this node.
    96      *
    96      *
    97      * @return the <code>String</code> OID of the valid policy
    97      * @return the {@code String} OID of the valid policy
    98      * represented by this node. For the root node, this method always returns
    98      * represented by this node. For the root node, this method always returns
    99      * the special anyPolicy OID: "2.5.29.32.0".
    99      * the special anyPolicy OID: "2.5.29.32.0".
   100      */
   100      */
   101     String getValidPolicy();
   101     String getValidPolicy();
   102 
   102 
   103     /**
   103     /**
   104      * Returns the set of policy qualifiers associated with the
   104      * Returns the set of policy qualifiers associated with the
   105      * valid policy represented by this node.
   105      * valid policy represented by this node.
   106      *
   106      *
   107      * @return an immutable <code>Set</code> of
   107      * @return an immutable {@code Set} of
   108      * <code>PolicyQualifierInfo</code>s. For the root node, this
   108      * {@code PolicyQualifierInfo}s. For the root node, this
   109      * is always an empty <code>Set</code>.
   109      * is always an empty {@code Set}.
   110      */
   110      */
   111     Set<? extends PolicyQualifierInfo> getPolicyQualifiers();
   111     Set<? extends PolicyQualifierInfo> getPolicyQualifiers();
   112 
   112 
   113     /**
   113     /**
   114      * Returns the set of expected policies that would satisfy this
   114      * Returns the set of expected policies that would satisfy this
   115      * node's valid policy in the next certificate to be processed.
   115      * node's valid policy in the next certificate to be processed.
   116      *
   116      *
   117      * @return an immutable <code>Set</code> of expected policy
   117      * @return an immutable {@code Set} of expected policy
   118      * <code>String</code> OIDs. For the root node, this method
   118      * {@code String} OIDs. For the root node, this method
   119      * always returns a <code>Set</code> with one element, the
   119      * always returns a {@code Set} with one element, the
   120      * special anyPolicy OID: "2.5.29.32.0".
   120      * special anyPolicy OID: "2.5.29.32.0".
   121      */
   121      */
   122     Set<String> getExpectedPolicies();
   122     Set<String> getExpectedPolicies();
   123 
   123 
   124     /**
   124     /**
   125      * Returns the criticality indicator of the certificate policy extension
   125      * Returns the criticality indicator of the certificate policy extension
   126      * in the most recently processed certificate.
   126      * in the most recently processed certificate.
   127      *
   127      *
   128      * @return <code>true</code> if extension marked critical,
   128      * @return {@code true} if extension marked critical,
   129      * <code>false</code> otherwise. For the root node, <code>false</code>
   129      * {@code false} otherwise. For the root node, {@code false}
   130      * is always returned.
   130      * is always returned.
   131      */
   131      */
   132     boolean isCritical();
   132     boolean isCritical();
   133 }
   133 }