src/java.management/share/classes/javax/management/MBeanPermission.java
author rriggs
Fri, 07 Dec 2018 11:51:17 -0500
changeset 52902 e3398b2e1ab0
parent 47216 71c04702a3d5
permissions -rw-r--r--
8214971: Replace use of string.equals("") with isEmpty() Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
44858
7183899b064b 8179415: Update java.management and java.management.rmi to be HTML-5 friendly
ksrini
parents: 27957
diff changeset
     2
 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
    23
 * questions.
2
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 javax.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.security.Permission;
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>Permission controlling access to MBeanServer operations.  If a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * security manager has been set using {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * System#setSecurityManager}, most operations on the MBean Server
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * require that the caller's permissions imply an MBeanPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * appropriate for the operation.  This is described in detail in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * documentation for the {@link MBeanServer} interface.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>As with other {@link Permission} objects, an MBeanPermission can
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * represent either a permission that you <em>have</em> or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * permission that you <em>need</em>.  When a sensitive operation is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * being checked for permission, an MBeanPermission is constructed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * representing the permission you need.  The operation is only
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    45
 * allowed if the permissions you have {@linkplain #implies imply} the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * permission you need.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
    48
 * <p>An MBeanPermission contains four items of information:</p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <li><p>The <em>action</em>.  For a permission you need,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * this is one of the actions in the list <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * href="#action-list">below</a>.  For a permission you have, this is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * a comma-separated list of those actions, or <code>*</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * representing all actions.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <p>The action is returned by {@link #getActions()}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * <li><p>The <em>class name</em>.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * <p>For a permission you need, this is the class name of an MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * you are accessing, as returned by {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * MBeanServer#getMBeanInfo(ObjectName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * MBeanServer.getMBeanInfo(name)}.{@link MBeanInfo#getClassName()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * getClassName()}.  Certain operations do not reference a class name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * in which case the class name is null.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * <p>For a permission you have, this is either empty or a <em>class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * name pattern</em>.  A class name pattern is a string following the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * Java conventions for dot-separated class names.  It may end with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * "<code>.*</code>" meaning that the permission grants access to any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * class that begins with the string preceding "<code>.*</code>".  For
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * instance, "<code>javax.management.*</code>" grants access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * <code>javax.management.MBeanServerDelegate</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * <code>javax.management.timer.Timer</code>, among other classes.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <p>A class name pattern can also be empty or the single character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * "<code>*</code>", both of which grant access to any class.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * <li><p>The <em>member</em>.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * <p>For a permission you need, this is the name of the attribute or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * operation you are accessing.  For operations that do not reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * an attribute or operation, the member is null.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * <p>For a permission you have, this is either the name of an attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * or operation you can access, or it is empty or the single character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * "<code>*</code>", both of which grant access to any member.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    91
 * <li id="MBeanName"><p>The <em>object name</em>.</p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * <p>For a permission you need, this is the {@link ObjectName} of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * MBean you are accessing.  For operations that do not reference a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * single MBean, it is null.  It is never an object name pattern.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * <p>For a permission you have, this is the {@link ObjectName} of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * MBean or MBeans you can access.  It may be an object name pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * to grant access to all MBeans whose names match the pattern.  It
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * may also be empty, which grants access to all MBeans whatever their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * name.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * <p>If you have an MBeanPermission, it allows operations only if all
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   106
 * four of the items match.</p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   108
 * <p>The class name, member, and object name can be written together
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   109
 * as a single string, which is the <em>name</em> of this permission.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * The name of the permission is the string returned by {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * Permission#getName() getName()}.  The format of the string is:</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * <blockquote>
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   114
 * <code>className#member[objectName]</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * <p>The object name is written using the usual syntax for {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * ObjectName}.  It may contain any legal characters, including
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * <code>]</code>.  It is terminated by a <code>]</code> character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * that is the last character in the string.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   122
 * <p>One or more of the <code>className</code>, <code>member</code>,
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   123
 * or <code>objectName</code> may be omitted.  If the
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   124
 * <code>member</code> is omitted, the <code>#</code> may be too (but
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * does not have to be).  If the <code>objectName</code> is omitted,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * the <code>[]</code> may be too (but does not have to be).  It is
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   127
 * not legal to omit all three items, that is to have a <em>name</em>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * that is the empty string.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   130
 * <p>One or more of the <code>className</code>, <code>member</code>,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * or <code>objectName</code> may be the character "<code>-</code>",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * which is equivalent to a null value.  A null value is implied by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * any value (including another null value) but does not imply any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * other value.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *
44858
7183899b064b 8179415: Update java.management and java.management.rmi to be HTML-5 friendly
ksrini
parents: 27957
diff changeset
   136
 * <p><a id="action-list">The possible actions are these:</a></p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * <li>addNotificationListener</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * <li>getAttribute</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * <li>getClassLoader</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * <li>getClassLoaderFor</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * <li>getClassLoaderRepository</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * <li>getDomains</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * <li>getMBeanInfo</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * <li>getObjectInstance</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * <li>instantiate</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * <li>invoke</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * <li>isInstanceOf</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * <li>queryMBeans</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * <li>queryNames</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * <li>registerMBean</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * <li>removeNotificationListener</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * <li>setAttribute</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * <li>unregisterMBean</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * <p>In a comma-separated list of actions, spaces are allowed before
24368
2b4801b94265 8038795: Tidy warnings cleanup for javax.management
yan
parents: 5506
diff changeset
   159
 * and after each action.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
public class MBeanPermission extends Permission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    private static final long serialVersionUID = -2416928705275160661L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * Actions list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    private static final int AddNotificationListener    = 0x00001;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    private static final int GetAttribute               = 0x00002;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    private static final int GetClassLoader             = 0x00004;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    private static final int GetClassLoaderFor          = 0x00008;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    private static final int GetClassLoaderRepository   = 0x00010;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    private static final int GetDomains                 = 0x00020;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    private static final int GetMBeanInfo               = 0x00040;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    private static final int GetObjectInstance          = 0x00080;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    private static final int Instantiate                = 0x00100;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    private static final int Invoke                     = 0x00200;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    private static final int IsInstanceOf               = 0x00400;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    private static final int QueryMBeans                = 0x00800;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    private static final int QueryNames                 = 0x01000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    private static final int RegisterMBean              = 0x02000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    private static final int RemoveNotificationListener = 0x04000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    private static final int SetAttribute               = 0x08000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    private static final int UnregisterMBean            = 0x10000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * No actions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    private static final int NONE = 0x00000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * All actions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    private static final int ALL =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        AddNotificationListener    |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        GetAttribute               |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        GetClassLoader             |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        GetClassLoaderFor          |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        GetClassLoaderRepository   |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        GetDomains                 |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        GetMBeanInfo               |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        GetObjectInstance          |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        Instantiate                |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        Invoke                     |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        IsInstanceOf               |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        QueryMBeans                |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        QueryNames                 |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        RegisterMBean              |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        RemoveNotificationListener |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        SetAttribute               |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        UnregisterMBean;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * The actions string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    private String actions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * The actions mask.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    private transient int mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * The classname prefix that must match.  If null, is implied by any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * classNamePrefix but does not imply any non-null classNamePrefix.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    private transient String classNamePrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * True if classNamePrefix must match exactly.  Otherwise, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * className being matched must start with classNamePrefix.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    private transient boolean classNameExactMatch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * The member that must match.  If null, is implied by any member
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * but does not imply any non-null member.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    private transient String member;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * The objectName that must match.  If null, is implied by any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * objectName but does not imply any non-null objectName.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    private transient ObjectName objectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * Parse <code>actions</code> parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    private void parseActions() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        int mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        if (actions == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            throw new IllegalArgumentException("MBeanPermission: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                                               "actions can't be null");
52902
e3398b2e1ab0 8214971: Replace use of string.equals("") with isEmpty()
rriggs
parents: 47216
diff changeset
   259
        if (actions.isEmpty())
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            throw new IllegalArgumentException("MBeanPermission: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                                               "actions can't be empty");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        mask = getMask(actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        if ((mask & ALL) != mask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            throw new IllegalArgumentException("Invalid actions mask");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        if (mask == NONE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            throw new IllegalArgumentException("Invalid actions mask");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        this.mask = mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * Parse <code>name</code> parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    private void parseName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        String name = getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        if (name == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            throw new IllegalArgumentException("MBeanPermission name " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                                               "cannot be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
52902
e3398b2e1ab0 8214971: Replace use of string.equals("") with isEmpty()
rriggs
parents: 47216
diff changeset
   282
        if (name.isEmpty())
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            throw new IllegalArgumentException("MBeanPermission name " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                                               "cannot be empty");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        /* The name looks like "class#member[objectname]".  We subtract
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
           elements from the right as we parse, so after parsing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
           objectname we have "class#member" and after parsing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
           member we have "class".  Each element is optional.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        // Parse ObjectName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
24685
215fa91e1b4c 8044461: Cleanup new Boolean and single character strings
rriggs
parents: 24368
diff changeset
   293
        int openingBracket = name.indexOf('[');
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        if (openingBracket == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            // If "[on]" missing then ObjectName("*:*")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            objectName = ObjectName.WILDCARD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            if (!name.endsWith("]")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                throw new IllegalArgumentException("MBeanPermission: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                                                   "The ObjectName in the " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                                                   "target name must be " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                                                   "included in square " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                                                   "brackets");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                // Create ObjectName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                    // If "[]" then ObjectName("*:*")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                    //
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   311
                    String on = name.substring(openingBracket + 1,
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   312
                                               name.length() - 1);
52902
e3398b2e1ab0 8214971: Replace use of string.equals("") with isEmpty()
rriggs
parents: 47216
diff changeset
   313
                    if (on.isEmpty())
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                        objectName = ObjectName.WILDCARD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                    else if (on.equals("-"))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                        objectName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                        objectName = new ObjectName(on);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                } catch (MalformedObjectNameException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                    throw new IllegalArgumentException("MBeanPermission: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                                                       "The target name does " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                                                       "not specify a valid " +
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   323
                                                       "ObjectName", e);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   327
            name = name.substring(0, openingBracket);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        // Parse member
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
24685
215fa91e1b4c 8044461: Cleanup new Boolean and single character strings
rriggs
parents: 24368
diff changeset
   332
        int poundSign = name.indexOf('#');
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        if (poundSign == -1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            setMember("*");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
            String memberName = name.substring(poundSign + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            setMember(memberName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            name = name.substring(0, poundSign);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        // Parse className
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        setClassName(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * Assign fields based on className, member, and objectName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     */
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   351
    private void initName(String className, String member,
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   352
                          ObjectName objectName) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        setClassName(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        setMember(member);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        this.objectName = objectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    private void setClassName(String className) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        if (className == null || className.equals("-")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
            classNamePrefix = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            classNameExactMatch = false;
52902
e3398b2e1ab0 8214971: Replace use of string.equals("") with isEmpty()
rriggs
parents: 47216
diff changeset
   362
        } else if (className.isEmpty() || className.equals("*")) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            classNamePrefix = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            classNameExactMatch = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        } else if (className.endsWith(".*")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            // Note that we include the "." in the required prefix
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            classNamePrefix = className.substring(0, className.length() - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            classNameExactMatch = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            classNamePrefix = className;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            classNameExactMatch = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    private void setMember(String member) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        if (member == null || member.equals("-"))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
            this.member = null;
52902
e3398b2e1ab0 8214971: Replace use of string.equals("") with isEmpty()
rriggs
parents: 47216
diff changeset
   378
        else if (member.isEmpty())
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            this.member = "*";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            this.member = member;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * <p>Create a new MBeanPermission object with the specified target name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * and actions.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * <p>The target name is of the form
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   389
     * "<code>className#member[objectName]</code>" where each part is
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   390
     * optional.  It must not be empty or null.</p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * <p>The actions parameter contains a comma-separated list of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * desired actions granted on the target name.  It must not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * empty or null.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     *
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   396
     * @param name the triplet "className#member[objectName]".
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @param actions the action string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @exception IllegalArgumentException if the <code>name</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * <code>actions</code> is invalid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    public MBeanPermission(String name, String actions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        parseName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        this.actions = actions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        parseActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * <p>Create a new MBeanPermission object with the specified target name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * (class name, member, object name) and actions.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * <p>The class name, member and object name parameters define a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * target name of the form
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * "<code>className#member[objectName]</code>" where each part is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * optional.  This will be the result of {@link #getName()} on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * resultant MBeanPermission.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * <p>The actions parameter contains a comma-separated list of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * desired actions granted on the target name.  It must not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * empty or null.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @param className the class name to which this permission applies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * May be null or <code>"-"</code>, which represents a class name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * that is implied by any class name but does not imply any other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * class name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * @param member the member to which this permission applies.  May
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * be null or <code>"-"</code>, which represents a member that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * implied by any member but does not imply any other member.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * @param objectName the object name to which this permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * applies.  May be null, which represents an object name that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * implied by any object name but does not imply any other object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * @param actions the action string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    public MBeanPermission(String className,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                           String member,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                           ObjectName objectName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                           String actions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   443
        super(makeName(className, member, objectName));
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   444
        initName(className, member, objectName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        this.actions = actions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        parseActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   450
    private static String makeName(String className, String member,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                                   ObjectName objectName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        final StringBuilder name = new StringBuilder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        if (className == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            className = "-";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        name.append(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        if (member == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            member = "-";
27957
24b4e6082f19 8055723: Replace concat String to append in StringBuilder parameters (dev)
weijun
parents: 25859
diff changeset
   458
        name.append('#').append(member);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        if (objectName == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            name.append("[-]");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        else
27957
24b4e6082f19 8055723: Replace concat String to append in StringBuilder parameters (dev)
weijun
parents: 25859
diff changeset
   462
            name.append('[').append(objectName.getCanonicalName()).append(']');
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        /* In the interests of legibility for Permission.toString(), we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
           transform the empty string into "*".  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        if (name.length() == 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            return "*";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            return name.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * Returns the "canonical string representation" of the actions. That is,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * this method always returns present actions in alphabetical order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * @return the canonical string representation of the actions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
    public String getActions() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        if (actions == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
            actions = getActions(this.mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        return actions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * Returns the "canonical string representation"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * of the actions from the mask.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    private static String getActions(int mask) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        final StringBuilder sb = new StringBuilder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        boolean comma = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        if ((mask & AddNotificationListener) == AddNotificationListener) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
            comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            sb.append("addNotificationListener");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        if ((mask & GetAttribute) == GetAttribute) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            sb.append("getAttribute");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        if ((mask & GetClassLoader) == GetClassLoader) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            sb.append("getClassLoader");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        if ((mask & GetClassLoaderFor) == GetClassLoaderFor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
            sb.append("getClassLoaderFor");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        if ((mask & GetClassLoaderRepository) == GetClassLoaderRepository) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
            sb.append("getClassLoaderRepository");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        if ((mask & GetDomains) == GetDomains) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            sb.append("getDomains");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        if ((mask & GetMBeanInfo) == GetMBeanInfo) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
            sb.append("getMBeanInfo");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        if ((mask & GetObjectInstance) == GetObjectInstance) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
            sb.append("getObjectInstance");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        if ((mask & Instantiate) == Instantiate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
            sb.append("instantiate");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        if ((mask & Invoke) == Invoke) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
            sb.append("invoke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        if ((mask & IsInstanceOf) == IsInstanceOf) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
            sb.append("isInstanceOf");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
        if ((mask & QueryMBeans) == QueryMBeans) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
            sb.append("queryMBeans");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
        if ((mask & QueryNames) == QueryNames) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
            sb.append("queryNames");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
        if ((mask & RegisterMBean) == RegisterMBean) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
            sb.append("registerMBean");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        if ((mask & RemoveNotificationListener) == RemoveNotificationListener) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
            sb.append("removeNotificationListener");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        if ((mask & SetAttribute) == SetAttribute) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
            sb.append("setAttribute");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        if ((mask & UnregisterMBean) == UnregisterMBean) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
            if (comma) sb.append(',');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
            else comma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
            sb.append("unregisterMBean");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
        return sb.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * Returns the hash code value for this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * @return a hash code value for this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
        return this.getName().hashCode() + this.getActions().hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * Converts an action String to an integer action mask.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * @param action the action string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * @return the action mask.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    private static int getMask(String action) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
         * BE CAREFUL HERE! PARSING ORDER IS IMPORTANT IN THIS ALGORITHM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
         * The 'string length' test must be performed for the lengthiest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
         * strings first.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
         * In this permission if the "unregisterMBean" string length test is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
         * performed after the "registerMBean" string length test the algorithm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
         * considers the 'unregisterMBean' action as being the 'registerMBean'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
         * action and a parsing error is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        int mask = NONE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        if (action == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
            return mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        if (action.equals("*")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
            return ALL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        char[] a = action.toCharArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
        int i = a.length - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        if (i < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
            return mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        while (i != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
            char c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
            // skip whitespace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
            while ((i!=-1) && ((c = a[i]) == ' ' ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
                               c == '\r' ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
                               c == '\n' ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
                               c == '\f' ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
                               c == '\t'))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
                i--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
            // check for the known strings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
            int matchlen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
            if (i >= 25 && /* removeNotificationListener */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
                (a[i-25] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
                (a[i-24] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
                (a[i-23] == 'm') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                (a[i-22] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                (a[i-21] == 'v') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
                (a[i-20] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                (a[i-19] == 'N') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                (a[i-18] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                (a[i-17] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
                (a[i-16] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                (a[i-15] == 'f') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
                (a[i-14] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                (a[i-13] == 'c') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
                (a[i-12] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                (a[i-11] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
                (a[i-10] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
                (a[i-9] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                (a[i-8] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                (a[i-7] == 'L') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                (a[i-6] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                (a[i-5] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                (a[i-4] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                (a[i-3] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                (a[i-2] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                (a[i-1] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
                (a[i] == 'r')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                matchlen = 26;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                mask |= RemoveNotificationListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
            } else if (i >= 23 && /* getClassLoaderRepository */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
                       (a[i-23] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
                       (a[i-22] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
                       (a[i-21] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
                       (a[i-20] == 'C') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
                       (a[i-19] == 'l') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
                       (a[i-18] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
                       (a[i-17] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
                       (a[i-16] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                       (a[i-15] == 'L') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
                       (a[i-14] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
                       (a[i-13] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                       (a[i-12] == 'd') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                       (a[i-11] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                       (a[i-10] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
                       (a[i-9] == 'R') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                       (a[i-8] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                       (a[i-7] == 'p') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                       (a[i-6] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
                       (a[i-5] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                       (a[i-4] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                       (a[i-3] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                       (a[i-2] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
                       (a[i-1] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
                       (a[i] == 'y')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
                matchlen = 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
                mask |= GetClassLoaderRepository;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
            } else if (i >= 22 && /* addNotificationListener */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
                       (a[i-22] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
                       (a[i-21] == 'd') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
                       (a[i-20] == 'd') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
                       (a[i-19] == 'N') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
                       (a[i-18] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
                       (a[i-17] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                       (a[i-16] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
                       (a[i-15] == 'f') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
                       (a[i-14] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                       (a[i-13] == 'c') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                       (a[i-12] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
                       (a[i-11] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
                       (a[i-10] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
                       (a[i-9] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
                       (a[i-8] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
                       (a[i-7] == 'L') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
                       (a[i-6] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
                       (a[i-5] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                       (a[i-4] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
                       (a[i-3] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                       (a[i-2] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
                       (a[i-1] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
                       (a[i] == 'r')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
                matchlen = 23;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
                mask |= AddNotificationListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
            } else if (i >= 16 && /* getClassLoaderFor */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
                       (a[i-16] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
                       (a[i-15] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
                       (a[i-14] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
                       (a[i-13] == 'C') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
                       (a[i-12] == 'l') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
                       (a[i-11] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
                       (a[i-10] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
                       (a[i-9] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
                       (a[i-8] == 'L') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
                       (a[i-7] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
                       (a[i-6] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
                       (a[i-5] == 'd') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
                       (a[i-4] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
                       (a[i-3] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
                       (a[i-2] == 'F') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                       (a[i-1] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
                       (a[i] == 'r')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
                matchlen = 17;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
                mask |= GetClassLoaderFor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
            } else if (i >= 16 && /* getObjectInstance */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
                       (a[i-16] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
                       (a[i-15] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                       (a[i-14] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
                       (a[i-13] == 'O') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                       (a[i-12] == 'b') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
                       (a[i-11] == 'j') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
                       (a[i-10] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
                       (a[i-9] == 'c') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
                       (a[i-8] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
                       (a[i-7] == 'I') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
                       (a[i-6] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                       (a[i-5] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
                       (a[i-4] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
                       (a[i-3] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
                       (a[i-2] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
                       (a[i-1] == 'c') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
                       (a[i] == 'e')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
                matchlen = 17;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
                mask |= GetObjectInstance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
            } else if (i >= 14 && /* unregisterMBean */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
                       (a[i-14] == 'u') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
                       (a[i-13] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
                       (a[i-12] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
                       (a[i-11] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
                       (a[i-10] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
                       (a[i-9] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
                       (a[i-8] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
                       (a[i-7] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
                       (a[i-6] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
                       (a[i-5] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
                       (a[i-4] == 'M') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
                       (a[i-3] == 'B') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
                       (a[i-2] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
                       (a[i-1] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
                       (a[i] == 'n')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
                matchlen = 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
                mask |= UnregisterMBean;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
            } else if (i >= 13 && /* getClassLoader */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
                       (a[i-13] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
                       (a[i-12] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
                       (a[i-11] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
                       (a[i-10] == 'C') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
                       (a[i-9] == 'l') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
                       (a[i-8] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
                       (a[i-7] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
                       (a[i-6] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
                       (a[i-5] == 'L') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
                       (a[i-4] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
                       (a[i-3] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
                       (a[i-2] == 'd') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
                       (a[i-1] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
                       (a[i] == 'r')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
                matchlen = 14;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
                mask |= GetClassLoader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
            } else if (i >= 12 && /* registerMBean */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
                       (a[i-12] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
                       (a[i-11] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
                       (a[i-10] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
                       (a[i-9] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
                       (a[i-8] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
                       (a[i-7] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
                       (a[i-6] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
                       (a[i-5] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
                       (a[i-4] == 'M') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
                       (a[i-3] == 'B') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
                       (a[i-2] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
                       (a[i-1] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
                       (a[i] == 'n')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
                matchlen = 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
                mask |= RegisterMBean;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
            } else if (i >= 11 && /* getAttribute */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
                       (a[i-11] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
                       (a[i-10] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
                       (a[i-9] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
                       (a[i-8] == 'A') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
                       (a[i-7] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
                       (a[i-6] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
                       (a[i-5] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
                       (a[i-4] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
                       (a[i-3] == 'b') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
                       (a[i-2] == 'u') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
                       (a[i-1] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
                       (a[i] == 'e')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
                matchlen = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
                mask |= GetAttribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
            } else if (i >= 11 && /* getMBeanInfo */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
                       (a[i-11] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
                       (a[i-10] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
                       (a[i-9] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
                       (a[i-8] == 'M') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
                       (a[i-7] == 'B') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
                       (a[i-6] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
                       (a[i-5] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
                       (a[i-4] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
                       (a[i-3] == 'I') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
                       (a[i-2] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
                       (a[i-1] == 'f') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
                       (a[i] == 'o')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
                matchlen = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
                mask |= GetMBeanInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
            } else if (i >= 11 && /* isInstanceOf */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
                       (a[i-11] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
                       (a[i-10] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
                       (a[i-9] == 'I') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
                       (a[i-8] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
                       (a[i-7] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
                       (a[i-6] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
                       (a[i-5] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
                       (a[i-4] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
                       (a[i-3] == 'c') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
                       (a[i-2] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
                       (a[i-1] == 'O') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
                       (a[i] == 'f')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
                matchlen = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
                mask |= IsInstanceOf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
            } else if (i >= 11 && /* setAttribute */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
                       (a[i-11] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
                       (a[i-10] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
                       (a[i-9] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                       (a[i-8] == 'A') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
                       (a[i-7] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
                       (a[i-6] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
                       (a[i-5] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
                       (a[i-4] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
                       (a[i-3] == 'b') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
                       (a[i-2] == 'u') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
                       (a[i-1] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
                       (a[i] == 'e')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
                matchlen = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
                mask |= SetAttribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
            } else if (i >= 10 && /* instantiate */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
                       (a[i-10] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
                       (a[i-9] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
                       (a[i-8] == 's') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
                       (a[i-7] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
                       (a[i-6] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
                       (a[i-5] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
                       (a[i-4] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
                       (a[i-3] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
                       (a[i-2] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
                       (a[i-1] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
                       (a[i] == 'e')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
                matchlen = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
                mask |= Instantiate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
            } else if (i >= 10 && /* queryMBeans */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
                       (a[i-10] == 'q') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
                       (a[i-9] == 'u') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
                       (a[i-8] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
                       (a[i-7] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
                       (a[i-6] == 'y') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
                       (a[i-5] == 'M') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
                       (a[i-4] == 'B') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
                       (a[i-3] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
                       (a[i-2] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
                       (a[i-1] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
                       (a[i] == 's')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
                matchlen = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
                mask |= QueryMBeans;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
            } else if (i >= 9 && /* getDomains */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
                       (a[i-9] == 'g') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
                       (a[i-8] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
                       (a[i-7] == 't') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
                       (a[i-6] == 'D') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
                       (a[i-5] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
                       (a[i-4] == 'm') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
                       (a[i-3] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
                       (a[i-2] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
                       (a[i-1] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
                       (a[i] == 's')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
                matchlen = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
                mask |= GetDomains;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
            } else if (i >= 9 && /* queryNames */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
                       (a[i-9] == 'q') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
                       (a[i-8] == 'u') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
                       (a[i-7] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
                       (a[i-6] == 'r') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
                       (a[i-5] == 'y') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
                       (a[i-4] == 'N') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
                       (a[i-3] == 'a') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
                       (a[i-2] == 'm') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
                       (a[i-1] == 'e') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
                       (a[i] == 's')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
                matchlen = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
                mask |= QueryNames;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
            } else if (i >= 5 && /* invoke */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
                       (a[i-5] == 'i') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
                       (a[i-4] == 'n') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
                       (a[i-3] == 'v') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
                       (a[i-2] == 'o') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
                       (a[i-1] == 'k') &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
                       (a[i] == 'e')) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
                matchlen = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
                mask |= Invoke;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
                // parse error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
                throw new IllegalArgumentException("Invalid permission: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
                                                   action);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
            // make sure we didn't just match the tail of a word
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
            // like "ackbarfaccept".  Also, skip to the comma.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
            boolean seencomma = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
            while (i >= matchlen && !seencomma) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
                switch(a[i-matchlen]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
                case ',':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
                    seencomma = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
                case ' ': case '\r': case '\n':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
                case '\f': case '\t':
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
                    throw new IllegalArgumentException("Invalid permission: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
                                                       action);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
                i--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
            // point i at the location of the comma minus one (or -1).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
            i -= matchlen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        return mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     * <p>Checks if this MBeanPermission object "implies" the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     * specified permission.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     * <p>More specifically, this method returns true if:</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     * <li> <i>p</i> is an instance of MBeanPermission; and</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * <li> <i>p</i> has a null className or <i>p</i>'s className
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * matches this object's className; and</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * <li> <i>p</i> has a null member or <i>p</i>'s member matches this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * object's member; and</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     * <li> <i>p</i> has a null object name or <i>p</i>'s
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     * object name matches this object's object name; and</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     * <li> <i>p</i>'s actions are a subset of this object's actions</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     * <p>If this object's className is "<code>*</code>", <i>p</i>'s
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     * className always matches it.  If it is "<code>a.*</code>", <i>p</i>'s
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
     * className matches it if it begins with "<code>a.</code>".</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
     * <p>If this object's member is "<code>*</code>", <i>p</i>'s
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * member always matches it.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * <p>If this object's objectName <i>n1</i> is an object name pattern,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     * <i>p</i>'s objectName <i>n2</i> matches it if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
     * {@link ObjectName#equals <i>n1</i>.equals(<i>n2</i>)} or if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
     * {@link ObjectName#apply <i>n1</i>.apply(<i>n2</i>)}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     * <p>A permission that includes the <code>queryMBeans</code> action
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
     * is considered to include <code>queryNames</code> as well.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     * @param p the permission to check against.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * @return true if the specified permission is implied by this object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     * false if not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
    public boolean implies(Permission p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
        if (!(p instanceof MBeanPermission))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        MBeanPermission that = (MBeanPermission) p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
        // Actions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
        // The actions in 'this' permission must be a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
        // superset of the actions in 'that' permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
        /* "queryMBeans" implies "queryNames" */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
        if ((this.mask & QueryMBeans) == QueryMBeans) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
            if (((this.mask | QueryNames) & that.mask) != that.mask) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
                //System.out.println("action [with QueryNames] does not imply");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
            if ((this.mask & that.mask) != that.mask) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
                //System.out.println("action does not imply");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
        // Target name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
        // The 'className' check is true iff:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
        // 1) the className in 'this' permission is omitted or "*", or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
        // 2) the className in 'that' permission is omitted or "*", or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
        // 3) the className in 'this' permission does pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
        //    matching with the className in 'that' permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
        // The 'member' check is true iff:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
        // 1) the member in 'this' permission is omitted or "*", or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
        // 2) the member in 'that' permission is omitted or "*", or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
        // 3) the member in 'this' permission equals the member in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
        //    'that' permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
        // The 'object name' check is true iff:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
        // 1) the object name in 'this' permission is omitted or "*:*", or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
        // 2) the object name in 'that' permission is omitted or "*:*", or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
        // 3) the object name in 'this' permission does pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
        //    matching with the object name in 'that' permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
        /* Check if this.className implies that.className.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
           If that.classNamePrefix is empty that means the className is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
           irrelevant for this permission check.  Otherwise, we do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
           expect that "that" contains a wildcard, since it is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
           needed permission.  So we assume that.classNameExactMatch.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
        if (that.classNamePrefix == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
            // bottom is implied
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
        } else if (this.classNamePrefix == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
            // bottom implies nothing but itself
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
        } else if (this.classNameExactMatch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
            if (!that.classNameExactMatch)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
                return false; // exact never implies wildcard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
            if (!that.classNamePrefix.equals(this.classNamePrefix))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
                return false; // exact match fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
            // prefix match, works even if "that" is also a wildcard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
            // e.g. a.* implies a.* and a.b.*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
            if (!that.classNamePrefix.startsWith(this.classNamePrefix))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
        /* Check if this.member implies that.member */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
        if (that.member == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
            // bottom is implied
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
        } else if (this.member == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
            // bottom implies nothing but itself
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
        } else if (this.member.equals("*")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
            // wildcard implies everything (including itself)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
        } else if (!this.member.equals(that.member)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
        /* Check if this.objectName implies that.objectName */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
        if (that.objectName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
            // bottom is implied
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
        } else if (this.objectName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
            // bottom implies nothing but itself
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
        } else if (!this.objectName.apply(that.objectName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
            /* ObjectName.apply returns false if that.objectName is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
               wildcard so we also allow equals for that case.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
               never happens during real permission checks, but means
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
               the implies relation is reflexive.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
            if (!this.objectName.equals(that.objectName))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
     * Checks two MBeanPermission objects for equality. Checks
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
     * that <i>obj</i> is an MBeanPermission, and has the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
     * name and actions as this object.
24368
2b4801b94265 8038795: Tidy warnings cleanup for javax.management
yan
parents: 5506
diff changeset
  1132
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
     * @param obj the object we are testing for equality with this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
     * @return true if obj is an MBeanPermission, and has the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
     * same name and actions as this MBeanPermission object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
        if (obj == this)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
        if (! (obj instanceof MBeanPermission))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
        MBeanPermission that = (MBeanPermission) obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
        return (this.mask == that.mask) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
            (this.getName().equals(that.getName()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     * Deserialize this object based on its name and actions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
    private void readObject(ObjectInputStream in)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
            throws IOException, ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
        in.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
        parseName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
        parseActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
}