797N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 553N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 513N/A * A permission for Smart Card operations. A CardPermission consists of the 0N/A * name of the card terminal the permission applies to and a set of actions 0N/A * that are valid for that terminal. 0N/A * <p>A CardPermission with a name of <code>*</code> applies to all 0N/A * card terminals. The actions string is a comma separated list of the actions 0N/A * listed below, or <code>*</code> to signify "all actions." 0N/A * <p>Individual actions are: 0N/A * <dd>connect to a card using 0N/A * {@linkplain CardTerminal#connect CardTerminal.connect()} 0N/A * <dd>reset the card using {@linkplain Card#disconnect Card.disconnect(true)} 0N/A * <dd>establish exclusive access to a card using 0N/A * {@linkplain Card#beginExclusive} and {@linkplain Card#endExclusive * <dd>transmit a control command using * {@linkplain Card#transmitControlCommand Card.transmitControlCommand()} * <dd>obtain the basic logical channel using * {@linkplain Card#getBasicChannel} * <dd>open a new logical channel using * {@linkplain Card#openLogicalChannel} * @author Andreas Sterbenz * @author JSR 268 Expert Group private final static int A_RESET =
0x10;
// sum of all the actions above private final static int A_ALL =
0x3f;
private transient int mask;
* Constructs a new CardPermission with the specified actions. * <code>terminalName</code> is the name of a CardTerminal or <code>*</code> * if this permission applies to all terminals. <code>actions</code> * contains a comma-separated list of the individual actions * or <code>*</code> to signify all actions. For more information, * see the documentation at the top of this {@linkplain CardPermission * @param terminalName the name of the card terminal, or <code>*</code> * @param actions the action string (or null if the set of permitted * @throws NullPointerException if terminalName is null * @throws IllegalArgumentException if actions is an invalid actions // try exact matches for simple actions first * Returns the canonical string representation of the actions. * It is <code>*</code> to signify all actions defined by this class or * the string concatenation of the comma-separated, * lexicographically sorted list of individual actions. * @return the canonical string representation of the actions. * Checks if this CardPermission object implies the specified permission. * That is the case, if and only if * <li><p><code>permission</code> is an instance of CardPermission,</p> * <li><p><code>permission</code>'s actions are a proper subset of this * object's actions, and</p> * <li><p>this object's <code>getName()</code> method is either * <code>*</code> or equal to <code>permission</code>'s <code>name</code>. * @param permission the permission to check against * @return true if and only if this CardPermission object implies the * Compares the specified object with this CardPermission for equality. * This CardPermission is equal to another Object <code>object</code>, if * <li><p><code>object</code> is an instance of CardPermission,</p> * <li><p><code>this.getName()</code> is equal to * <code>((CardPermission)object).getName()</code>, and</p> * <li><p><code>this.getActions()</code> is equal to * <code>((CardPermission)object).getActions()</code>.</p> * @param obj the object to be compared for equality with this CardPermission * @return true if and only if the specified object is equal to this * Returns the hash code value for this CardPermission object. * @return the hash code value for this CardPermission object. // Write out the actions. The superclass takes care of the name. // Call getActions to make sure actions field is initialized // Read in the actions, then restore the mask.