Exemplo n.º 1
0
    RequisitionInterface getInterfaceForNode(final String foreignId, final String ipAddress) {
      flush();

      final Requisition req = getActiveRequisition(false);
      final RequisitionNode node = req == null ? null : req.getNode(foreignId);
      return node == null ? null : node.getInterface(ipAddress);
    }
Exemplo n.º 2
0
 void updateInterface(
     final String foreignId, final String ipAddress, final MultivaluedMapImpl params) {
   final String foreignSource = m_foreignSource;
   LOG.debug(
       "updateInterface: Updating interface {} on node {}/{}",
       ipAddress,
       foreignSource,
       foreignId);
   if (params.isEmpty()) return;
   final Requisition req = getActiveRequisition(false);
   if (req != null) {
     final RequisitionNode node = req.getNode(foreignId);
     if (node != null) {
       final RequisitionInterface iface = node.getInterface(ipAddress);
       if (iface != null) {
         req.updateDateStamp();
         RestUtils.setBeanProperties(iface, params);
         save(req);
         LOG.debug(
             "updateInterface: Interface {} on node {}/{} updated",
             ipAddress,
             foreignSource,
             foreignId);
       }
     }
   }
 }
Exemplo n.º 3
0
    RequisitionMonitoredService getServiceForInterface(
        final String foreignId, final String ipAddress, final String service) {
      flush();

      final Requisition req = getActiveRequisition(false);
      final RequisitionNode node = req == null ? null : req.getNode(foreignId);
      final RequisitionInterface iface = node == null ? null : node.getInterface(ipAddress);

      return iface == null ? null : iface.getMonitoredService(service);
    }
Exemplo n.º 4
0
 void addOrReplaceService(
     final String foreignId, final String ipAddress, final RequisitionMonitoredService service) {
   final Requisition req = getActiveRequisition(true);
   if (req != null) {
     final RequisitionNode node = req.getNode(foreignId);
     if (node != null) {
       final RequisitionInterface iface = node.getInterface(ipAddress);
       if (iface != null) {
         req.updateDateStamp();
         iface.putMonitoredService(service);
         save(req);
       }
     }
   }
 }
Exemplo n.º 5
0
 void deleteInterfaceService(
     final String foreignId, final String ipAddress, final String service) {
   LOG.debug(
       "deleteInterfaceService: Deleting service {} from interface {} on node {}/{}",
       service,
       ipAddress,
       getForeignSource(),
       foreignId);
   final Requisition req = getActiveRequisition(false);
   if (req != null) {
     final RequisitionNode node = req.getNode(foreignId);
     if (node != null) {
       final RequisitionInterface iface = node.getInterface(ipAddress);
       if (iface != null) {
         req.updateDateStamp();
         iface.deleteMonitoredService(service);
         save(req);
       }
     }
   }
 }