/**
  * handleReloadConfigEvent
  *
  * @param event a {@link org.opennms.netmgt.xml.event.Event} object.
  */
 @EventHandler(uei = EventConstants.RELOAD_DAEMON_CONFIG_UEI)
 public void handleReloadConfigEvent(final Event event) {
   if (isReloadConfigEventTarget(event)) {
     EventBuilder ebldr = null;
     LogUtils.debugf(this, "Reloading the SNMP asset adapter configuration");
     try {
       m_config.update();
       ebldr =
           new EventBuilder(
               EventConstants.RELOAD_DAEMON_CONFIG_SUCCESSFUL_UEI, "Provisiond." + NAME);
       ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "Provisiond." + NAME);
     } catch (Throwable e) {
       LogUtils.infof(this, e, "Unable to reload SNMP asset adapter configuration");
       ebldr =
           new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI, "Provisiond." + NAME);
       ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "Provisiond." + NAME);
       ebldr.addParam(EventConstants.PARM_REASON, e.getLocalizedMessage().substring(1, 128));
     }
     if (ebldr != null) {
       getEventForwarder().sendNow(ebldr.getEvent());
     }
   }
 }
  /**
   * doUpdate
   *
   * @param nodeId a int.
   * @param retry a boolean.
   * @throws org.opennms.netmgt.provision.ProvisioningAdapterException if any.
   */
  @Override
  public void doUpdateNode(final int nodeId) throws ProvisioningAdapterException {
    log().debug("doUpdate: updating nodeid: " + nodeId);

    final OnmsNode node = m_nodeDao.get(nodeId);
    Assert.notNull(node, "doUpdate: failed to return node for given nodeId:" + nodeId);

    final InetAddress ipaddress =
        m_template.execute(
            new TransactionCallback<InetAddress>() {
              public InetAddress doInTransaction(final TransactionStatus arg0) {
                return getIpForNode(node);
              }
            });

    final SnmpAgentConfig agentConfig = m_snmpConfigDao.getAgentConfig(ipaddress);

    final OnmsAssetRecord asset = node.getAssetRecord();
    m_config.getReadLock().lock();
    try {
      for (AssetField field : m_config.getAssetFieldsForAddress(ipaddress, node.getSysObjectId())) {
        try {
          String value =
              fetchSnmpAssetString(agentConfig, field.getMibObjs(), field.getFormatString());
          if (log().isDebugEnabled()) {
            log()
                .debug(
                    "doUpdate: Setting asset field \"" + field.getName() + "\" to value: " + value);
          }
          // Use Spring bean-accessor classes to set the field value
          BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(asset);
          try {
            wrapper.setPropertyValue(field.getName(), value);
          } catch (BeansException e) {
            log()
                .warn(
                    "doUpdate: Could not set property \""
                        + field.getName()
                        + "\" on asset object: "
                        + e.getMessage(),
                    e);
          }
        } catch (MissingFormatArgumentException e) {
          // This exception is thrown if the SNMP operation fails or an incorrect number of
          // parameters is returned by the agent or because of a misconfiguration.
          log()
              .warn(
                  "doUpdate: Could not set value for asset field \""
                      + field.getName()
                      + "\": "
                      + e.getMessage(),
                  e);
        }
      }
    } finally {
      m_config.getReadLock().unlock();
    }
    node.setAssetRecord(asset);
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
  }