Esempio n. 1
0
  public static void createSiteConfig() {

    _siteConfig = MSiteConfig.unarchiveSiteConfig(false);
    if (_siteConfig == null) {
      NSLog.err.appendln("The Site Configuration could not be loaded from the local filesystem");
      System.exit(1);
    }

    for (Enumeration e = _siteConfig.hostArray().objectEnumerator(); e.hasMoreElements(); ) {
      _siteConfig.hostErrorArray.addObjectIfAbsent(e.nextElement());
    }
    if (_siteConfig.localHost() != null)
      _siteConfig.hostErrorArray.removeObject(_siteConfig.localHost());
  }
Esempio n. 2
0
  public void updateForPage(String aName) {
    // KH - we should probably set the instance information as we get the
    // responses, to avoid waiting, then doing it in serial! (not that it's
    // _that_ slow)
    MSiteConfig siteConfig = WOTaskdHandler.siteConfig();
    startReading();
    try {
      aName = ERXStringUtilities.lastPropertyKeyInKeyPath(aName);
      if (siteConfig.hostArray().count() != 0) {
        if (ApplicationsPage.class.getName().endsWith(aName)
            && (siteConfig.applicationArray().count() != 0)) {

          for (Enumeration e = siteConfig.applicationArray().objectEnumerator();
              e.hasMoreElements(); ) {
            MApplication anApp = (MApplication) e.nextElement();
            anApp.setRunningInstancesCount(0);
          }
          NSArray<MHost> hostArray = siteConfig.hostArray();
          getApplicationStatusForHosts(hostArray);
        } else if (AppDetailPage.class.getName().endsWith(aName)) {
          NSArray<MHost> hostArray = siteConfig.hostArray();

          getInstanceStatusForHosts(hostArray);
        } else if (HostsPage.class.getName().endsWith(aName)) {
          NSArray<MHost> hostArray = siteConfig.hostArray();

          getHostStatusForHosts(hostArray);
        }
      }
    } finally {
      endReading();
    }
  }
Esempio n. 3
0
  /* ******** Common Functionality ********* */
  private static NSMutableDictionary createUpdateRequestDictionary(
      MSiteConfig _Config,
      MHost _Host,
      MApplication _Application,
      NSArray _InstanceArray,
      String requestType) {
    NSMutableDictionary monitorRequest = new NSMutableDictionary(1);
    NSMutableDictionary updateWotaskd = new NSMutableDictionary(1);
    NSMutableDictionary requestTypeDict = new NSMutableDictionary();

    if (_Config != null) {
      NSDictionary site = new NSDictionary(_Config.values());
      requestTypeDict.takeValueForKey(site, "site");
    }
    if (_Host != null) {
      NSArray hostArray = new NSArray(_Host.values());
      requestTypeDict.takeValueForKey(hostArray, "hostArray");
    }
    if (_Application != null) {
      NSArray applicationArray = new NSArray(_Application.values());
      requestTypeDict.takeValueForKey(applicationArray, "applicationArray");
    }
    if (_InstanceArray != null) {
      int instanceCount = _InstanceArray.count();
      NSMutableArray instanceArray = new NSMutableArray(instanceCount);
      for (int i = 0; i < instanceCount; i++) {
        MInstance anInst = (MInstance) _InstanceArray.objectAtIndex(i);
        instanceArray.addObject(anInst.values());
      }
      requestTypeDict.takeValueForKey(instanceArray, "instanceArray");
    }

    updateWotaskd.takeValueForKey(requestTypeDict, requestType);
    monitorRequest.takeValueForKey(updateWotaskd, "updateWotaskd");

    return monitorRequest;
  }