139 * <li>addNotificationListener</li>
140 * <li>getAttribute</li>
141 * <li>getClassLoader</li>
142 * <li>getClassLoaderFor</li>
143 * <li>getClassLoaderRepository</li>
144 * <li>getDomains</li>
145 * <li>getMBeanInfo</li>
146 * <li>getObjectInstance</li>
147 * <li>instantiate</li>
148 * <li>invoke</li>
149 * <li>isInstanceOf</li>
150 * <li>queryMBeans</li>
151 * <li>queryNames</li>
152 * <li>registerMBean</li>
153 * <li>removeNotificationListener</li>
154 * <li>setAttribute</li>
155 * <li>unregisterMBean</li>
156 * </ul>
157 *
158 * <p>In a comma-separated list of actions, spaces are allowed before
159 * and after each action.</p>
160 *
161 * @since 1.5
162 */
163 public class MBeanPermission extends Permission {
164
165 private static final long serialVersionUID = -2416928705275160661L;
166
167 /**
168 * Actions list.
169 */
170 private static final int AddNotificationListener = 0x00001;
171 private static final int GetAttribute = 0x00002;
172 private static final int GetClassLoader = 0x00004;
173 private static final int GetClassLoaderFor = 0x00008;
174 private static final int GetClassLoaderRepository = 0x00010;
175 private static final int GetDomains = 0x00020;
176 private static final int GetMBeanInfo = 0x00040;
177 private static final int GetObjectInstance = 0x00080;
178 private static final int Instantiate = 0x00100;
179 private static final int Invoke = 0x00200;
1112 // bottom is implied
1113 } else if (this.objectName == null) {
1114 // bottom implies nothing but itself
1115 return false;
1116 } else if (!this.objectName.apply(that.objectName)) {
1117 /* ObjectName.apply returns false if that.objectName is a
1118 wildcard so we also allow equals for that case. This
1119 never happens during real permission checks, but means
1120 the implies relation is reflexive. */
1121 if (!this.objectName.equals(that.objectName))
1122 return false;
1123 }
1124
1125 return true;
1126 }
1127
1128 /**
1129 * Checks two MBeanPermission objects for equality. Checks
1130 * that <i>obj</i> is an MBeanPermission, and has the same
1131 * name and actions as this object.
1132 * <P>
1133 * @param obj the object we are testing for equality with this object.
1134 * @return true if obj is an MBeanPermission, and has the
1135 * same name and actions as this MBeanPermission object.
1136 */
1137 public boolean equals(Object obj) {
1138 if (obj == this)
1139 return true;
1140
1141 if (! (obj instanceof MBeanPermission))
1142 return false;
1143
1144 MBeanPermission that = (MBeanPermission) obj;
1145
1146 return (this.mask == that.mask) &&
1147 (this.getName().equals(that.getName()));
1148 }
1149
1150 /**
1151 * Deserialize this object based on its name and actions.
1152 */
|
139 * <li>addNotificationListener</li>
140 * <li>getAttribute</li>
141 * <li>getClassLoader</li>
142 * <li>getClassLoaderFor</li>
143 * <li>getClassLoaderRepository</li>
144 * <li>getDomains</li>
145 * <li>getMBeanInfo</li>
146 * <li>getObjectInstance</li>
147 * <li>instantiate</li>
148 * <li>invoke</li>
149 * <li>isInstanceOf</li>
150 * <li>queryMBeans</li>
151 * <li>queryNames</li>
152 * <li>registerMBean</li>
153 * <li>removeNotificationListener</li>
154 * <li>setAttribute</li>
155 * <li>unregisterMBean</li>
156 * </ul>
157 *
158 * <p>In a comma-separated list of actions, spaces are allowed before
159 * and after each action.
160 *
161 * @since 1.5
162 */
163 public class MBeanPermission extends Permission {
164
165 private static final long serialVersionUID = -2416928705275160661L;
166
167 /**
168 * Actions list.
169 */
170 private static final int AddNotificationListener = 0x00001;
171 private static final int GetAttribute = 0x00002;
172 private static final int GetClassLoader = 0x00004;
173 private static final int GetClassLoaderFor = 0x00008;
174 private static final int GetClassLoaderRepository = 0x00010;
175 private static final int GetDomains = 0x00020;
176 private static final int GetMBeanInfo = 0x00040;
177 private static final int GetObjectInstance = 0x00080;
178 private static final int Instantiate = 0x00100;
179 private static final int Invoke = 0x00200;
1112 // bottom is implied
1113 } else if (this.objectName == null) {
1114 // bottom implies nothing but itself
1115 return false;
1116 } else if (!this.objectName.apply(that.objectName)) {
1117 /* ObjectName.apply returns false if that.objectName is a
1118 wildcard so we also allow equals for that case. This
1119 never happens during real permission checks, but means
1120 the implies relation is reflexive. */
1121 if (!this.objectName.equals(that.objectName))
1122 return false;
1123 }
1124
1125 return true;
1126 }
1127
1128 /**
1129 * Checks two MBeanPermission objects for equality. Checks
1130 * that <i>obj</i> is an MBeanPermission, and has the same
1131 * name and actions as this object.
1132 *
1133 * @param obj the object we are testing for equality with this object.
1134 * @return true if obj is an MBeanPermission, and has the
1135 * same name and actions as this MBeanPermission object.
1136 */
1137 public boolean equals(Object obj) {
1138 if (obj == this)
1139 return true;
1140
1141 if (! (obj instanceof MBeanPermission))
1142 return false;
1143
1144 MBeanPermission that = (MBeanPermission) obj;
1145
1146 return (this.mask == that.mask) &&
1147 (this.getName().equals(that.getName()));
1148 }
1149
1150 /**
1151 * Deserialize this object based on its name and actions.
1152 */
|