/** * <p>create</p> * * @param resourceType a {@link org.opennms.netmgt.collectd.ResourceType} object. * @param collectionName a {@link java.lang.String} object. * @param mibObj a {@link org.opennms.netmgt.config.datacollection.MibObject} object. * @param groupType a {@link org.opennms.netmgt.collection.api.AttributeGroupType} object. * @return a {@link org.opennms.netmgt.collectd.SnmpAttributeType} object. */ public static SnmpAttributeType create(ResourceType resourceType, String collectionName, MibObject mibObj, AttributeGroupType groupType) { if (NumericAttributeType.supportsType(mibObj.getType())) { return new NumericAttributeType(resourceType, collectionName, mibObj, groupType); } if (StringAttributeType.supportsType(mibObj.getType())) { return new StringAttributeType(resourceType, collectionName, mibObj, groupType); } if (HexStringAttributeType.supportsType(mibObj.getType())) { return new HexStringAttributeType(resourceType, collectionName, mibObj, groupType); } throw new IllegalArgumentException("No support exists for AttributeType '" + mibObj.getType() + "' for MIB object: "+ mibObj); }
/** * <p>Constructor for NumericAttributeType.</p> * * @param resourceType a {@link org.opennms.netmgt.collectd.ResourceType} object. * @param collectionName a {@link java.lang.String} object. * @param mibObj a {@link org.opennms.netmgt.config.datacollection.MibObject} object. * @param groupType a {@link org.opennms.netmgt.collection.api.AttributeGroupType} object. */ public NumericAttributeType(ResourceType resourceType, String collectionName, MibObject mibObj, AttributeGroupType groupType) { super(resourceType, collectionName, mibObj, groupType); if (mibObj.getType().toLowerCase().startsWith("counter")) { m_type = AttributeType.COUNTER; } else { m_type = AttributeType.GAUGE; } // Assign the data source object identifier and instance LOG.debug("buildDataSourceList: ds_name: {} ds_oid: {}.{}", getName(), getOid(), getInstance()); }