Java Code Examples for com.sun.jmx.snmp.SnmpStatusException#snmpRspWrongValue()
The following examples show how to use
com.sun.jmx.snmp.SnmpStatusException#snmpRspWrongValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JvmClassLoadingImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmClassesVerboseLevel" variable. */ public void checkJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException { // // Add your own checking policy. // if (JvmClassesVerboseLevelVerbose.equals(x)) return; if (JvmClassesVerboseLevelSilent.equals(x)) return; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 2
Source File: SnmpGenericObjectServer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 3
Source File: SnmpGenericObjectServer.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 4
Source File: JvmMemPoolEntryImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static EnumJvmMemPoolType jvmMemPoolType(MemoryType type) throws SnmpStatusException { if (type.equals(MemoryType.HEAP)) return EnumJvmMemPoolTypeHeap; else if (type.equals(MemoryType.NON_HEAP)) return EnumJvmMemPoolTypeNonHeap; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 5
Source File: JvmClassLoadingImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmClassesVerboseLevel" variable. */ public void setJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException { final boolean verbose; if (JvmClassesVerboseLevelVerbose.equals(x)) verbose=true; else if (JvmClassesVerboseLevelSilent.equals(x)) verbose=false; // Should never happen, this case is handled by // checkJvmClassesVerboseLevel(); else throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); getClassLoadingMXBean().setVerbose(verbose); }
Example 6
Source File: JvmClassLoadingImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmClassesVerboseLevel" variable. */ public void setJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException { final boolean verbose; if (JvmClassesVerboseLevelVerbose.equals(x)) verbose=true; else if (JvmClassesVerboseLevelSilent.equals(x)) verbose=false; // Should never happen, this case is handled by // checkJvmClassesVerboseLevel(); else throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); getClassLoadingMXBean().setVerbose(verbose); }
Example 7
Source File: JvmMemPoolEntryImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static EnumJvmMemPoolType jvmMemPoolType(MemoryType type) throws SnmpStatusException { if (type.equals(MemoryType.HEAP)) return EnumJvmMemPoolTypeHeap; else if (type.equals(MemoryType.NON_HEAP)) return EnumJvmMemPoolTypeNonHeap; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 8
Source File: JvmClassLoadingMeta.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Check the value of a scalar variable */ public void check(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int) var) { case 4: if (x instanceof SnmpInt) { try { node.checkJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } break; case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); } }
Example 9
Source File: SnmpGenericObjectServer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 10
Source File: JvmMemPoolEntryImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static EnumJvmMemPoolType jvmMemPoolType(MemoryType type) throws SnmpStatusException { if (type.equals(MemoryType.HEAP)) return EnumJvmMemPoolTypeHeap; else if (type.equals(MemoryType.NON_HEAP)) return EnumJvmMemPoolTypeNonHeap; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 11
Source File: JvmClassLoadingMeta.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Set the value of a scalar variable */ public SnmpValue set(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int)var) { case 4: if (x instanceof SnmpInt) { try { node.setJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } return new SnmpInt(node.getJvmClassesVerboseLevel()); } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: break; } throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); }
Example 12
Source File: JvmClassLoadingImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmClassesVerboseLevel" variable. */ public void checkJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException { // // Add your own checking policy. // if (JvmClassesVerboseLevelVerbose.equals(x)) return; if (JvmClassesVerboseLevelSilent.equals(x)) return; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 13
Source File: JvmClassLoadingMeta.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Check the value of a scalar variable */ public void check(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int) var) { case 4: if (x instanceof SnmpInt) { try { node.checkJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } break; case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); } }
Example 14
Source File: JvmClassLoadingMeta.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Set the value of a scalar variable */ public SnmpValue set(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int)var) { case 4: if (x instanceof SnmpInt) { try { node.setJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } return new SnmpInt(node.getJvmClassesVerboseLevel()); } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: break; } throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); }
Example 15
Source File: SnmpGenericObjectServer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the value of an SNMP variable. * * <p><b><i> * You should never need to use this method directly. * </i></b></p> * * @param meta The impacted metadata object * @param name The ObjectName of the impacted MBean * @param x The new requested SnmpValue * @param id The OID arc identifying the variable we're trying to set. * @param data User contextual data allocated through the * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory} * * @return The new value of the variable after the operation. * * @exception SnmpStatusException whenever an SNMP exception must be * raised. Raising an exception will abort the request. <br> * Exceptions should never be raised directly, but only by means of * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name, SnmpValue x, long id, Object data) throws SnmpStatusException { final String attname = meta.getAttributeName(id); final Object attvalue= meta.buildAttributeValue(id,x); final Attribute att = new Attribute(attname,attvalue); Object result = null; try { server.setAttribute(name,att); result = server.getAttribute(name,attname); } catch(InvalidAttributeValueException iv) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } catch (InstanceNotFoundException f) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (ReflectionException r) { throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentName); } catch (MBeanException m) { Exception t = m.getTargetException(); if (t instanceof SnmpStatusException) throw (SnmpStatusException) t; throw new SnmpStatusException(SnmpStatusException.noAccess); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } return meta.buildSnmpValue(id,result); }
Example 16
Source File: JvmClassLoadingMeta.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Check the value of a scalar variable */ public void check(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int) var) { case 4: if (x instanceof SnmpInt) { try { node.checkJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } break; case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); } }
Example 17
Source File: JvmClassLoadingMeta.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the value of a scalar variable */ public SnmpValue set(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int)var) { case 4: if (x instanceof SnmpInt) { try { node.setJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } return new SnmpInt(node.getJvmClassesVerboseLevel()); } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: break; } throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); }
Example 18
Source File: JvmMemPoolEntryImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public static EnumJvmMemPoolType jvmMemPoolType(MemoryType type) throws SnmpStatusException { if (type.equals(MemoryType.HEAP)) return EnumJvmMemPoolTypeHeap; else if (type.equals(MemoryType.NON_HEAP)) return EnumJvmMemPoolTypeNonHeap; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 19
Source File: JvmClassLoadingImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmClassesVerboseLevel" variable. */ public void checkJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException { // // Add your own checking policy. // if (JvmClassesVerboseLevelVerbose.equals(x)) return; if (JvmClassesVerboseLevelSilent.equals(x)) return; throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); }
Example 20
Source File: JvmClassLoadingMeta.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Set the value of a scalar variable */ public SnmpValue set(SnmpValue x, long var, Object data) throws SnmpStatusException { switch((int)var) { case 4: if (x instanceof SnmpInt) { try { node.setJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger())); } catch(IllegalArgumentException e) { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue); } return new SnmpInt(node.getJvmClassesVerboseLevel()); } else { throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType); } case 3: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 2: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); case 1: throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); default: break; } throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable); }