当前位置: 首页>>代码示例>>Java>>正文


Java Variable.isException方法代码示例

本文整理汇总了Java中org.snmp4j.smi.Variable.isException方法的典型用法代码示例。如果您正苦于以下问题:Java Variable.isException方法的具体用法?Java Variable.isException怎么用?Java Variable.isException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.snmp4j.smi.Variable的用法示例。


在下文中一共展示了Variable.isException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAvailability

import org.snmp4j.smi.Variable; //导入方法依赖的package包/类
/**
 * Returns UP if able to obtain one of the defined measurement mib.
 */
@Override
public AvailabilityType getAvailability() {
    Set<MeasurementDefinition> mds = this.definitions;
    if (!mds.isEmpty()) {
        MeasurementDefinition md = mds.iterator().next();
        OID oid = index.getNameRecord(md.getName()).getOid0();
        try {
            Variable variable = snmp.get(oid);
            if (variable.isException())
                return DOWN;
        } catch (IOException e) {
            return DOWN;
        }
    }
    return UP;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:20,代码来源:MibComponent.java

示例2: getAvailability

import org.snmp4j.smi.Variable; //导入方法依赖的package包/类
/**
 * Returns DOWN if the table row no longer exists or can be read.
 */
@Override
public AvailabilityType getAvailability() {
    Set<MeasurementDefinition> mds = this.definitions;
    if (!mds.isEmpty()) {
        MeasurementDefinition md = mds.iterator().next();
        OID oid = oid(md.getName());
        try {
            Variable variable = snmp.get(oid);
            if (variable.isException())
                return DOWN;
        } catch (IOException e) {
            return DOWN;
        }
    }
    return UP;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:20,代码来源:MibTableComponent.java

示例3: getVariable

import org.snmp4j.smi.Variable; //导入方法依赖的package包/类
private Variable getVariable() throws SnmpException {
  Variable variable = delegate.getVariable();
  if (variable.isException()) {
    throw new SnmpException(String.format("%s %s: %s",
        getName(), getOid(), variable.toString()));
  }
  return variable;
}
 
开发者ID:soulwing,项目名称:tnm4j,代码行数:9,代码来源:Snmp4jVarbind.java

示例4: discoverResources

import org.snmp4j.smi.Variable; //导入方法依赖的package包/类
@Override
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<SnmpComponentHolder> rdc) throws Exception {

    Set<DiscoveredResourceDetails> drd = new HashSet<DiscoveredResourceDetails>();
    String rtName = rdc.getResourceType().getName();
    log.debug("discover " + rtName);

    Set<MeasurementDefinition> mds = rdc.getResourceType().getMetricDefinitions();
    List<OID> oids = new ArrayList<OID>();
    Configuration conf = rdc.getDefaultPluginConfiguration();
    MibIndex digest = MibComponent.index(conf);
    for (MeasurementDefinition md : mds) {
        OID oid = digest.getNameRecord(md.getName()).getOid0();
        oids.add(oid);
    }
    SnmpComponent snmp = rdc.getParentResourceComponent().getSnmpComponent();
    if (oids.size() > 3) {
        // don't discover entire OID list
        oids = oids.subList(0, 3);
    }
    Map<OID, Variable> map = snmp.get(oids);
    if (map.isEmpty()) {
        log.debug("could not discover " + rtName + "; map empty");
        return drd;
    }
    for (Variable v : map.values()) {
        if (v.isException()) {
            log.debug("could not discover " + rtName + "; variable was " + v);
            return drd;
        }
    }

    String version = null;
    DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
            rdc.getResourceType(), // ResourceType
            rtName, // won't run multiple instances (probably)
            rtName, // resource name
            version, // Version
            rtName, // unique name
            conf,
            null // process information
    );

    drd.add(detail);
    return drd;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:47,代码来源:MibDiscovery.java

示例5: checkForExceptions

import org.snmp4j.smi.Variable; //导入方法依赖的package包/类
/**
 * Check a variable for a syntax exception (noSuchInstance, noSuchObject,
 * endOfMibView).
 * 
 * @param variable
 *            variable to be checked
 * @throws SnmpSyntaxException
 *             if the syntax of this variable equals one of the following:
 *             <ul>
 *             <li>noSuchInstance</li>
 *             <li>noSuchObject</li>
 *             <li>endOfMibView</li> </li>
 */
public static void checkForExceptions(Variable variable)
		throws SnmpSyntaxException {
	if (variable.isException())
		throw new SnmpSyntaxException(variable);
}
 
开发者ID:ccascone,项目名称:JNetMan,代码行数:19,代码来源:SnmpSyntaxException.java


注:本文中的org.snmp4j.smi.Variable.isException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。