--- old/src/jdk.snmp/share/classes/com/sun/jmx/snmp/EnumRowStatus.java 2014-10-15 14:04:25.000000000 +0200 +++ /dev/null 2014-10-15 14:04:25.000000000 +0200 @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.snmp; - -import java.io.Serializable; -import java.util.Hashtable; - - -/** - * This class is an internal class which is used to represent RowStatus - * codes as defined in RFC 2579. - * - * It defines an additional code, unspecified, which is - * implementation specific, and is used to identify - * unspecified actions (when for instance the RowStatus variable - * is not present in the varbind list) or uninitialized values. - * - * mibgen does not generate objects of this class but any variable - * using the RowStatus textual convention can be converted into an - * object of this class thanks to the - * EnumRowStatus(Enumerated valueIndex) constructor. - * - *

This API is a Sun Microsystems internal API and is subject - * to change without notice.

- **/ - -public class EnumRowStatus extends Enumerated implements Serializable { - private static final long serialVersionUID = 8966519271130162420L; - - /** - * This value is SNMP Runtime implementation specific, and is used to identify - * unspecified actions (when for instance the RowStatus variable - * is not present in the varbind list) or uninitialized values. - */ - public final static int unspecified = 0; - - /** - * This value corresponds to the active RowStatus, as defined in - * RFC 2579 from SMIv2: - * - */ - public final static int active = 1; - - /** - * This value corresponds to the notInService RowStatus, as - * defined in RFC 2579 from SMIv2: - * - **/ - public final static int notInService = 2; - - /** - * This value corresponds to the notReady RowStatus, as defined - * in RFC 2579 from SMIv2: - * - */ - public final static int notReady = 3; - - /** - * This value corresponds to the createAndGo RowStatus, - * as defined in RFC 2579 from SMIv2: - * - */ - public final static int createAndGo = 4; - - /** - * This value corresponds to the createAndWait RowStatus, - * as defined in RFC 2579 from SMIv2: - * - */ - public final static int createAndWait = 5; - - /** - * This value corresponds to the destroy RowStatus, as defined in - * RFC 2579 from SMIv2: - * - */ - public final static int destroy = 6; - - /** - * Build an EnumRowStatus from an int. - * @param valueIndex should be either 0 (unspecified), or one of - * the values defined in RFC 2579. - * @exception IllegalArgumentException if the given - * valueIndex is not valid. - **/ - public EnumRowStatus(int valueIndex) - throws IllegalArgumentException { - super(valueIndex); - } - - /** - * Build an EnumRowStatus from an Enumerated. - * @param valueIndex should be either 0 (unspecified), or one of - * the values defined in RFC 2579. - * @exception IllegalArgumentException if the given - * valueIndex is not valid. - **/ - public EnumRowStatus(Enumerated valueIndex) - throws IllegalArgumentException { - this(valueIndex.intValue()); - } - - /** - * Build an EnumRowStatus from a long. - * @param valueIndex should be either 0 (unspecified), or one of - * the values defined in RFC 2579. - * @exception IllegalArgumentException if the given - * valueIndex is not valid. - **/ - public EnumRowStatus(long valueIndex) - throws IllegalArgumentException { - this((int)valueIndex); - } - - /** - * Build an EnumRowStatus from an Integer. - * @param valueIndex should be either 0 (unspecified), or one of - * the values defined in RFC 2579. - * @exception IllegalArgumentException if the given - * valueIndex is not valid. - **/ - public EnumRowStatus(Integer valueIndex) - throws IllegalArgumentException { - super(valueIndex); - } - - /** - * Build an EnumRowStatus from a Long. - * @param valueIndex should be either 0 (unspecified), or one of - * the values defined in RFC 2579. - * @exception IllegalArgumentException if the given - * valueIndex is not valid. - **/ - public EnumRowStatus(Long valueIndex) - throws IllegalArgumentException { - this(valueIndex.longValue()); - } - - /** - * Build an EnumRowStatus with unspecified value. - **/ - public EnumRowStatus() - throws IllegalArgumentException { - this(unspecified); - } - - /** - * Build an EnumRowStatus from a String. - * @param x should be either "unspecified", or one of - * the values defined in RFC 2579 ("active", "notReady", etc...) - * @exception IllegalArgumentException if the given String - * x is not valid. - **/ - public EnumRowStatus(String x) - throws IllegalArgumentException { - super(x); - } - - /** - * Build an EnumRowStatus from an SnmpInt. - * @param valueIndex should be either 0 (unspecified), or one of - * the values defined in RFC 2579. - * @exception IllegalArgumentException if the given - * valueIndex is not valid. - **/ - public EnumRowStatus(SnmpInt valueIndex) - throws IllegalArgumentException { - this(valueIndex.intValue()); - } - - /** - * Build an SnmpValue from this object. - * - * @exception IllegalArgumentException if this object holds an - * unspecified value. - * @return an SnmpInt containing this object value. - **/ - public SnmpInt toSnmpValue() - throws IllegalArgumentException { - if (value == unspecified) - throw new - IllegalArgumentException("`unspecified' is not a valid SNMP value."); - return new SnmpInt(value); - } - - /** - * Check that the given value is valid. - * - * Valid values are: - * - * - **/ - static public boolean isValidValue(int value) { - if (value < 0) return false; - if (value > 6) return false; - return true; - } - - // Documented in Enumerated - // - @Override - protected Hashtable getIntTable() { - return EnumRowStatus.getRSIntTable(); - } - - // Documented in Enumerated - // - @Override - protected Hashtable getStringTable() { - return EnumRowStatus.getRSStringTable(); - } - - static Hashtable getRSIntTable() { - return intTable ; - } - - static Hashtable getRSStringTable() { - return stringTable ; - } - - // Initialize the mapping tables. - // - final static Hashtable intTable = new Hashtable<>(); - final static Hashtable stringTable = new Hashtable<>(); - static { - intTable.put(0, "unspecified"); - intTable.put(3, "notReady"); - intTable.put(6, "destroy"); - intTable.put(2, "notInService"); - intTable.put(5, "createAndWait"); - intTable.put(1, "active"); - intTable.put(4, "createAndGo"); - stringTable.put("unspecified", 0); - stringTable.put("notReady", 3); - stringTable.put("destroy", 6); - stringTable.put("notInService", 2); - stringTable.put("createAndWait", 5); - stringTable.put("active", 1); - stringTable.put("createAndGo", 4); - } - - -}