4824N/A/*
4824N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
4824N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4824N/A *
4824N/A * This code is free software; you can redistribute it and/or modify it
4824N/A * under the terms of the GNU General Public License version 2 only, as
4824N/A * published by the Free Software Foundation. Oracle designates this
4824N/A * particular file as subject to the "Classpath" exception as provided
4824N/A * by Oracle in the LICENSE file that accompanied this code.
4824N/A *
4824N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4824N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4824N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4824N/A * version 2 for more details (a copy is included in the LICENSE file that
4824N/A * accompanied this code).
4824N/A *
4824N/A * You should have received a copy of the GNU General Public License version
4824N/A * 2 along with this work; if not, write to the Free Software Foundation,
4824N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4824N/A *
4824N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4824N/A * or visit www.oracle.com if you need additional information or have any
4824N/A * questions.
4824N/A */
4824N/A
4824N/Apackage javax.management.relation;
4824N/A
4824N/A/**
4824N/A * This class describes the various problems which can be encountered when
4824N/A * accessing a role.
4824N/A *
4824N/A * @since 1.5
4824N/A */
4824N/Apublic class RoleStatus {
4824N/A
4824N/A //
4824N/A // Possible problems
4824N/A //
4824N/A
4824N/A /**
4824N/A * Problem type when trying to access an unknown role.
4824N/A */
4824N/A public static final int NO_ROLE_WITH_NAME = 1;
4824N/A /**
4824N/A * Problem type when trying to read a non-readable attribute.
4824N/A */
4824N/A public static final int ROLE_NOT_READABLE = 2;
4824N/A /**
4824N/A * Problem type when trying to update a non-writable attribute.
4824N/A */
4824N/A public static final int ROLE_NOT_WRITABLE = 3;
4824N/A /**
4824N/A * Problem type when trying to set a role value with less ObjectNames than
4824N/A * the minimum expected cardinality.
4824N/A */
4824N/A public static final int LESS_THAN_MIN_ROLE_DEGREE = 4;
4824N/A /**
4824N/A * Problem type when trying to set a role value with more ObjectNames than
4824N/A * the maximum expected cardinality.
4824N/A */
4824N/A public static final int MORE_THAN_MAX_ROLE_DEGREE = 5;
4824N/A /**
4824N/A * Problem type when trying to set a role value including the ObjectName of
4824N/A * a MBean not of the class expected for that role.
4824N/A */
4824N/A public static final int REF_MBEAN_OF_INCORRECT_CLASS = 6;
4824N/A /**
4824N/A * Problem type when trying to set a role value including the ObjectName of
4824N/A * a MBean not registered in the MBean Server.
4824N/A */
4824N/A public static final int REF_MBEAN_NOT_REGISTERED = 7;
4824N/A
4824N/A /**
4824N/A * Returns true if given value corresponds to a known role status, false
4824N/A * otherwise.
4824N/A *
4824N/A * @param status a status code.
4824N/A *
4824N/A * @return true if this value is a known role status.
4824N/A */
4824N/A public static boolean isRoleStatus(int status) {
4824N/A if (status != NO_ROLE_WITH_NAME &&
4824N/A status != ROLE_NOT_READABLE &&
4824N/A status != ROLE_NOT_WRITABLE &&
4824N/A status != LESS_THAN_MIN_ROLE_DEGREE &&
4824N/A status != MORE_THAN_MAX_ROLE_DEGREE &&
4824N/A status != REF_MBEAN_OF_INCORRECT_CLASS &&
4824N/A status != REF_MBEAN_NOT_REGISTERED) {
4824N/A return false;
4824N/A }
4824N/A return true;
4824N/A }
4824N/A}
4824N/A