KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > relation > RoleStatus


1 /*
2  * @(#)RoleStatus.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.management.relation;
9
10 /**
11  * This class describes the various problems which can be encountered when
12  * accessing a role.
13  *
14  * @since 1.5
15  */

16 public class RoleStatus {
17
18     //
19
// Possible problems
20
//
21

22     /**
23      * Problem type when trying to access an unknown role.
24      */

25     public static final int NO_ROLE_WITH_NAME = 1;
26     /**
27      * Problem type when trying to read a non-readable attribute.
28      */

29     public static final int ROLE_NOT_READABLE = 2;
30     /**
31      * Problem type when trying to update a non-writable attribute.
32      */

33     public static final int ROLE_NOT_WRITABLE = 3;
34     /**
35      * Problem type when trying to set a role value with less ObjectNames than
36      * the minimum expected cardinality.
37      */

38     public static final int LESS_THAN_MIN_ROLE_DEGREE = 4;
39     /**
40      * Problem type when trying to set a role value with more ObjectNames than
41      * the maximum expected cardinality.
42      */

43     public static final int MORE_THAN_MAX_ROLE_DEGREE = 5;
44     /**
45      * Problem type when trying to set a role value including the ObjectName of
46      * a MBean not of the class expected for that role.
47      */

48     public static final int REF_MBEAN_OF_INCORRECT_CLASS = 6;
49     /**
50      * Problem type when trying to set a role value including the ObjectName of
51      * a MBean not registered in the MBean Server.
52      */

53     public static final int REF_MBEAN_NOT_REGISTERED = 7;
54
55     /**
56      * Returns true if given value corresponds to a known role status, false
57      * otherwise.
58      *
59      * @param theRoleStatus a status code.
60      *
61      * @return true if this value is a known role status.
62      */

63     public static boolean isRoleStatus(int theRoleStatus) {
64     if (theRoleStatus != NO_ROLE_WITH_NAME &&
65         theRoleStatus != ROLE_NOT_READABLE &&
66         theRoleStatus != ROLE_NOT_WRITABLE &&
67         theRoleStatus != LESS_THAN_MIN_ROLE_DEGREE &&
68         theRoleStatus != MORE_THAN_MAX_ROLE_DEGREE &&
69         theRoleStatus != REF_MBEAN_OF_INCORRECT_CLASS &&
70         theRoleStatus != REF_MBEAN_NOT_REGISTERED) {
71         return false;
72     }
73     return true;
74     }
75 }
76
Popular Tags