jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/SingleCertificateResolver.java
author mullan
Mon, 26 Sep 2011 17:20:45 -0700
changeset 10694 cf59e2badd14
parent 1337 e8d6cef36199
child 18780 f47b920867e7
permissions -rw-r--r--
7088502: Security libraries don't build with javac -Werror Summary: Changes to files in src/share/classes/com/sun/org/apache/xml/internal/security and its subpackages to remove warnings Reviewed-by: mullan Contributed-by: kurchi.subhra.hazra@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * Copyright  1999-2004 The Apache Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *  Licensed under the Apache License, Version 2.0 (the "License");
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *  you may not use this file except in compliance with the License.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *  You may obtain a copy of the License at
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *  Unless required by applicable law or agreed to in writing, software
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *  distributed under the License is distributed on an "AS IS" BASIS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 *  See the License for the specific language governing permissions and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *  limitations under the License.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xml.internal.security.keys.storage.implementations;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
import java.security.cert.X509Certificate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
import java.util.Iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolverSpi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * This {@link StorageResolverSpi} makes a single {@link X509Certificate}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * available to the {@link com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
    33
 * @author $Author: mullan $
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
public class SingleCertificateResolver extends StorageResolverSpi {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
   /** Field _certificate */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
   X509Certificate _certificate = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
   /** Field _iterator */
10694
cf59e2badd14 7088502: Security libraries don't build with javac -Werror
mullan
parents: 1337
diff changeset
    41
   Iterator<X509Certificate> _iterator = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    * @param x509cert the single {@link X509Certificate}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
   public SingleCertificateResolver(X509Certificate x509cert) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
      this._certificate = x509cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
      this._iterator = new InternalIterator(this._certificate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
   /** @inheritDoc */
10694
cf59e2badd14 7088502: Security libraries don't build with javac -Werror
mullan
parents: 1337
diff changeset
    54
   public Iterator<X509Certificate> getIterator() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
      return this._iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    * Class InternalIterator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    *
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
    61
    * @author $Author: mullan $
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
    62
    * @version $Revision: 1.5 $
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    */
10694
cf59e2badd14 7088502: Security libraries don't build with javac -Werror
mullan
parents: 1337
diff changeset
    64
   static class InternalIterator implements Iterator<X509Certificate> {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
      /** Field _alreadyReturned */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
      boolean _alreadyReturned = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
      /** Field _certificate */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
      X509Certificate _certificate = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
      /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
       * Constructor InternalIterator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
       * @param x509cert
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
      public InternalIterator(X509Certificate x509cert) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         this._certificate = x509cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      /** @inheritDoc */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
      public boolean hasNext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
         return (!this._alreadyReturned);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
      /** @inheritDoc */
10694
cf59e2badd14 7088502: Security libraries don't build with javac -Werror
mullan
parents: 1337
diff changeset
    87
      public X509Certificate next() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
         this._alreadyReturned = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
         return this._certificate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
      /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
       * Method remove
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
      public void remove() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
         throw new UnsupportedOperationException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            "Can't remove keys from KeyStore");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
}