@Override public PrimaryType unmarshal(final String typeCode) throws Exception { return typeCode == null? null : PrimaryType.get(typeCode); }
public static List<PrimaryType> getAllTypes() { final List<PrimaryType> types = new ArrayList<>(); for (final char c : s_order) { types.add(PrimaryType.get(c)); } return types; }
public static PrimaryType get(final String code) { if (code == null) { return NOT_ELIGIBLE; } final String codeText = code.trim(); if (codeText.length() < 1) { return NOT_ELIGIBLE; } else if (codeText.length() > 1) { throw new IllegalArgumentException("Cannot convert string '"+codeText+"' to a collType"); } else { return get(codeText.charAt(0)); } }
/** {@inheritDoc} */ @Override public void setAsText(final String text) throws IllegalArgumentException { super.setValue(PrimaryType.get(text)); }
public InterfaceBuilder setIsSnmpPrimary(final String isSnmpPrimary) { m_iface.setIsSnmpPrimary(PrimaryType.get(isSnmpPrimary)); return this; }
/** {@inheritDoc} */ public void foundInterface(final String ipAddr, final Object descr, final InterfaceSnmpPrimaryType snmpPrimary, final boolean managed, final int status) { if ("".equals(ipAddr)) { log().error("Found interface on node "+m_node.getLabel()+" with an empty ipaddr! Ignoring!"); // create a bogus OnmsIpInterface and set it to current to services we run across get ignored as well m_currentInterface = new OnmsIpInterface(); return; } m_currentInterface = new OnmsIpInterface(ipAddr, m_node); m_currentInterface.setIsManaged(status == 3 ? "U" : "M"); m_currentInterface.setIsSnmpPrimary(PrimaryType.get(snmpPrimary.toString())); //m_currentInterface.setIpStatus(status == 3 ? new Integer(3) : new Integer(1)); if (InterfaceSnmpPrimaryType.P.equals(snmpPrimary)) { final InetAddress addr = InetAddressUtils.addr(ipAddr); if (addr == null) { LogUtils.errorf(this, "Unable to resolve address of snmpPrimary interface for node %s", m_node.getLabel()); } m_collector = new IfSnmpCollector(addr); } //FIXME: verify this doesn't conflict with constructor. The constructor already adds this //interface to the node. m_node.addIpInterface(m_currentInterface); }