jdk/src/share/classes/java/security/IdentityScope.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 4983 91e752cf5bb1
permissions -rw-r--r--
Initial load
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
 * Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.security;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <p>This class represents a scope for identities. It is an Identity
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * itself, and therefore has a name and can have a scope. It can also
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * optionally have a public key and associated certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <p>An IdentityScope can contain Identity objects of all kinds, including
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Signers. All types of Identity objects can be retrieved, added, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * removed using the same methods. Note that it is possible, and in fact
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * expected, that different types of identity scopes will
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * apply different policies for their various operations on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * various types of Identities.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <p>There is a one-to-one mapping between keys and identities, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * there can only be one copy of one key per scope. For example, suppose
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <b>Acme Software, Inc</b> is a software publisher known to a user.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * Suppose it is an Identity, that is, it has a public key, and a set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * associated certificates. It is named in the scope using the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * "Acme Software". No other named Identity in the scope has the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * public  key. Of course, none has the same name as well.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @see Identity
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @see Signer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @see Principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @see Key
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @author Benjamin Renaud
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @deprecated This class is no longer used. Its functionality has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * replaced by <code>java.security.KeyStore</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <code>java.security.cert</code> package, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * <code>java.security.Principal</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
@Deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
public abstract
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
class IdentityScope extends Identity {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    private static final long serialVersionUID = -2337346281189773310L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /* The system's scope */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private static IdentityScope scope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    // initialize the system scope
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static void initializeSystemScope() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        String classname = AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                new PrivilegedAction<String>() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            public String run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                return Security.getProperty("system.scope");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        if (classname == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                Class.forName(classname);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            } catch (ClassNotFoundException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                //Security.error("unable to establish a system scope from " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                //             classname);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * This constructor is used for serialization only and should not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * be used by subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    protected IdentityScope() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        this("restoring...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * Constructs a new identity scope with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @param name the scope name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public IdentityScope(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Constructs a new identity scope with the specified name and scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @param name the scope name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @param scope the scope for the new identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @exception KeyManagementException if there is already an identity
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * with the same name in the scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    public IdentityScope(String name, IdentityScope scope)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    throws KeyManagementException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        super(name, scope);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * Returns the system's identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @return the system's identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @see #setSystemScope
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public static IdentityScope getSystemScope() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        if (scope == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            initializeSystemScope();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        return scope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * Sets the system's identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * <p>First, if there is a security manager, its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * <code>checkSecurityAccess</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * method is called with <code>"setSystemScope"</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * as its argument to see if it's ok to set the identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @param scope the scope to set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * @exception  SecurityException  if a security manager exists and its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * <code>checkSecurityAccess</code> method doesn't allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * setting the identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @see #getSystemScope
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @see SecurityManager#checkSecurityAccess
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    protected static void setSystemScope(IdentityScope scope) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        check("setSystemScope");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        IdentityScope.scope = scope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * Returns the number of identities within this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @return the number of identities within this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public abstract int size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Returns the identity in this scope with the specified name (if any).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @param name the name of the identity to be retrieved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @return the identity named <code>name</code>, or null if there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * no identities named <code>name</code> in this scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public abstract Identity getIdentity(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Retrieves the identity whose name is the same as that of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * specified principal. (Note: Identity implements Principal.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * @param principal the principal corresponding to the identity
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * to be retrieved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @return the identity whose name is the same as that of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * principal, or null if there are no identities of the same name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * in this scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public Identity getIdentity(Principal principal) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return getIdentity(principal.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * Retrieves the identity with the specified public key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @param key the public key for the identity to be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @return the identity with the given key, or null if there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * no identities in this scope with that key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public abstract Identity getIdentity(PublicKey key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * Adds an identity to this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @param identity the identity to be added.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @exception KeyManagementException if the identity is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * valid, a name conflict occurs, another identity has the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * public key as the identity being added, or another exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * occurs. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    public abstract void addIdentity(Identity identity)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    throws KeyManagementException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * Removes an identity from this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @param identity the identity to be removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @exception KeyManagementException if the identity is missing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * or another exception occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public abstract void removeIdentity(Identity identity)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    throws KeyManagementException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Returns an enumeration of all identities in this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @return an enumeration of all identities in this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    public abstract Enumeration<Identity> identities();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * Returns a string representation of this identity scope, including
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * its name, its scope name, and the number of identities in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @return a string representation of this identity scope.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        return super.toString() + "[" + size() + "]";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    private static void check(String directive) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        SecurityManager security = System.getSecurityManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        if (security != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            security.checkSecurityAccess(directive);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}