/**
   * syncProbe() Called during incremental discovery Rediscover and parse the load balancing virtual
   * server object that is represented by the given VirtualApplication object
   *
   * @param objects List of existing VirtualApplication objects to be rediscovered
   */
  private void syncProbe(EList<Object> objects) {
    if (!FeaturesManager.vmtMANAGER.isLoadBalancerEnabled()) {
      logger.error("Operations Manager is not licensed for Load Balancer targets");
      return;
    }
    if (!objects.isEmpty() && initProbe() != null) {
      if (logPrefix == "") logPrefix = target.getNameOrAddress() + " : ";
      for (Object object : objects) {
        if (!(object instanceof VirtualApplication)) continue;
        // Get all the lbv servers from NetScaler appliance
        VirtualApplication vApp = (VirtualApplication) object;
        DiscoveryExtension discExt = vApp.getDiscoveryExtension();
        if (logger.isDebugEnabled())
          logger.debug(logPrefix + " rediscovering virtual application " + vApp.toVMTString());

        if (discExt instanceof NetScalerVirtualAppDiscExt) { // lbvserver
          lbvserver server = NetScalerUtil.getLbvServer(session, vApp.getName(), target, logPrefix);
          if (server != null) parseServer(server);
          else exceptions = true;
        } else if (discExt instanceof NetScalerGslbVirtualAppDiscExt) { // gslb vserver
          gslbvserver gslb =
              NetScalerUtil.getGslbvServer(session, vApp.getName(), target, logPrefix);
          if (gslb != null) parseGslbServer(gslb);
          else exceptions = true;
        }
      }
      // If no exceptions clear previous occurrences of DISCOVERY notifications
      if (!exceptions) target.clearNotifications(NotificationCategory.DISCOVERY);
    }
  }
  /**
   * Set up properties for the given virtual application object representing a NetScaler loading
   * balance. and its discovery extension. Create the GslbServiceAgent to capture the lbvserver and
   * app services that are configured on this target and are bound to the specified GSLB. Also
   * create the transaction commodity sold by the vApp.
   *
   * @param gslb VirtualApplication for the load balancing server
   * @param specificTarget NetScaler appliance target
   * @param vServerExt NetScalerGslbVirtualAppDiscExt Discovery extension for the virtual
   *     application
   * @param localName gslb server name to be set as local name in the discovery extension
   * @param vAppUuid UUID created for the virtual application
   * @param vAppType load balancing service protocol
   * @param classname static string "gslbvserver" to set as class name in the discovery extension
   * @param lbvServers list of lbvservers configured on the gslb on this target
   * @return modified vApp object
   */
  private VirtualApplication createGslbVirtualApplication(
      VirtualApplication gslb,
      VMTTarget specificTarget,
      NetScalerGslbVirtualAppDiscExt vServerExt,
      String localName,
      String vAppUuid,
      String vAppType,
      String classname,
      List<String> lbvServers) {
    // set properties in the virtual app and the discovery extension
    // and create the transaction commodity sold
    gslb =
        createVirtualApplication(
            gslb,
            specificTarget,
            vServerExt,
            localName, // service name as the local name
            "", // there is no IP and port associated with the GSLB
            0, // there is no port for the GSLB service
            vAppUuid, // uuid for the gslb vapp containing its service name only
            vAppType, // service type
            NetScalerUtil.GSLB_VSERVER // class name for the poller
            );

    // agent to represent this service on this target
    String agentName =
        NetScalerUtil.GSLB_AGENT_PREFIX + gslb.getName() + "-" + target.getNameOrAddress();
    GslbServiceAgent lbAgent =
        (GslbServiceAgent)
            createObject(MediationPackage.eINSTANCE.getGslbServiceAgent(), agentName);
    lbAgent.setDisplayName(gslb.getName() + "-" + target.getNameOrAddress());
    // discovery extension for the agent
    NetScalerGslbServiceAgentDiscExt agentDiscExt =
        (NetScalerGslbServiceAgentDiscExt)
            lbAgent.createExtension(
                DiscoveryExtensionsPackage.eINSTANCE.getNetScalerGslbServiceAgentDiscExt());
    // we set the GSLB server name as the local name
    setExtProps(
        agentDiscExt,
        specificTarget,
        NetScalerUtil.LB_VSERVER, // class name attribute in the extension used during polling
        agentName, // display name attribute in the extension
        localName, // local name attribute
        localName, // id attribute
        logPrefix);

    // attach to the vApp
    gslb.getAgents().add(lbAgent);
    agentDiscExt.getLbvServers().addAll(lbvServers);
    if (logger.isDebugEnabled())
      logger.debug(
          logPrefix
              + gslb.toVMTString()
              + " : create glsb agent on target "
              + target.getNameOrAddress());

    return gslb;
  }