本文整理汇总了Java中com.sun.jmx.snmp.SnmpStatusException.snmpRspWrongValue方法的典型用法代码示例。如果您正苦于以下问题:Java SnmpStatusException.snmpRspWrongValue方法的具体用法?Java SnmpStatusException.snmpRspWrongValue怎么用?Java SnmpStatusException.snmpRspWrongValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.snmp.SnmpStatusException
的用法示例。
在下文中一共展示了SnmpStatusException.snmpRspWrongValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: set
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
/**
* 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);
}
示例2: check
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
/**
* 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);
}
}
示例3: setJvmClassesVerboseLevel
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
/**
* 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);
}
示例4: checkJvmClassesVerboseLevel
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
/**
* 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);
}
示例5: jvmMemPoolType
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
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);
}
示例6: set
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
/**
* 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);
}