Package com.webobjects.monitor._private

Examples of com.webobjects.monitor._private.MSiteConfig


    checkPassword();
    MApplication application = (MApplication) routeObjectForKey("name");
    // Old code. The if statement replaces this code along with the addInstanceOnAllHostsAction() method. kib 20110622
    //    addInstance(application, (MHost)routeObjectForKey("host"), false);
    if (request().stringFormValueForKey("host") != null) {
      MHost mHost = siteConfig().hostWithName(request().stringFormValueForKey("host"));
      addInstance(application, mHost, false);
    } else
      addInstance(application, null, true);
    return response(application, ERXKeyFilter.filterWithNone());
  }
View Full Code Here


        WOResponse[] responses = sendQueryToWotaskds("HOST", hostArray);

        NSMutableArray errorArray = new NSMutableArray();
        NSDictionary responseDict = null;
        for (int i = 0; i < responses.length; i++) {
            MHost aHost = siteConfig().hostArray().objectAtIndex(i);

            if ((responses[i] == null) || (responses[i].content() == null)) {
                responseDict = emptyResponse;
            } else {
                try {
                    responseDict = (NSDictionary) new _JavaMonitorDecoder().decodeRootObject(responses[i].content());
                } catch (WOXMLException wxe) {
                    NSLog.err.appendln("MonitorComponent pageWithName(HostsPage) Error decoding response: "
                            + responses[i].contentString());
                    responseDict = responseParsingFailed;
                }
            }
            getGlobalErrorFromResponse(responseDict, errorArray);

            NSDictionary queryResponse = (NSDictionary) responseDict.valueForKey("queryWotaskdResponse");
            if (queryResponse != null) {
                NSDictionary hostResponse = (NSDictionary) queryResponse.valueForKey("hostResponse");
                aHost._setHostInfo(hostResponse);
                aHost.isAvailable = true;
            } else {
                aHost.isAvailable = false;
            }
        } // for
View Full Code Here

                    }

                    if ((nullOrError == null) && (siteConfig().hostWithAddress(anAddress) == null)) {
                        if (hostMeetsMinimumVersion(anAddress)) {

                            MHost host = new MHost(siteConfig(), newHostName, hostTypeSelection.toUpperCase());

                            // To avoid overwriting hosts
                            NSArray tempHostArray = new NSArray(siteConfig().hostArray());
                            siteConfig().addHost_M(host);
View Full Code Here

        return HostsPage.create(context());
    }

    public WOComponent removeHostClicked() {

        final MHost host = currentHost;

        return ConfirmationPage.create(context(), new ConfirmationPage.Delegate() {

            public WOComponent cancel() {
                return HostsPage.create(context());
            }

            public WOComponent confirm() {
                handler().startWriting();
                try {
                    siteConfig().removeHost_M(host);
                    NSMutableArray tempHostArray = new NSMutableArray(siteConfig().hostArray());
                    tempHostArray.addObject(host);

                    handler().sendRemoveHostToWotaskds(host, tempHostArray);
                } finally {
                    handler().endWriting();
                }
                return HostsPage.create(context());
            }

            public String explaination() {
                return "Selecting 'Yes' will shutdown any running instances of this host, and remove those instance configurations.";
            }

            public int pageType() {
                return HOST_PAGE;
            }

            public String question() {
                return "Are you sure you want to delete the host <I>" + host.name() + "</I>?";
            }

        });
    }
View Full Code Here

        NSMutableArray<MInstance> runningInstances = new NSMutableArray<MInstance>();
        NSMutableSet<MHost> activeHosts = new NSMutableSet<MHost>();
        NSMutableDictionary<MHost, NSMutableArray<MInstance>> inactiveInstancesByHost = new NSMutableDictionary<MHost, NSMutableArray<MInstance>>();
        NSMutableDictionary<MHost, NSMutableArray<MInstance>> activeInstancesByHost = new NSMutableDictionary<MHost, NSMutableArray<MInstance>>();
        for (MInstance instance : instances) {
            MHost host = instance.host();
            if (instance.isRunning_M()) {
                runningInstances.addObject(instance);
                activeHosts.addObject(host);
                NSMutableArray<MInstance> currentInstances = activeInstancesByHost.objectForKey(host);
                if (currentInstances == null) {
                    currentInstances = new NSMutableArray<MInstance>();
                    activeInstancesByHost.setObjectForKey(currentInstances, host);
                }
                currentInstances.addObject(instance);
            } else {
                NSMutableArray<MInstance> currentInstances = inactiveInstancesByHost.objectForKey(host);
                if (currentInstances == null) {
                    currentInstances = new NSMutableArray<MInstance>();
                    inactiveInstancesByHost.setObjectForKey(currentInstances, host);
                }
                currentInstances.addObject(instance);
            }
        }
       
        if (inactiveInstancesByHost.isEmpty()) {
          addObjectsFromArrayIfAbsentToErrorMessageArray(
              new NSArray<String>("You must have at least one inactive instance to perform a graceful bounce."));
          return;
        }
       
        int numToStartPerHost = 1;
        if (activeHosts.count() > 0) {
            numToStartPerHost = (int) (runningInstances.count() / activeHosts.count() * .1);
        }
        if (numToStartPerHost < 1) {
            numToStartPerHost = 1;
        }
        boolean useScheduling = true;

        for (MInstance instance : runningInstances) {
            useScheduling &= instance.schedulingEnabled() != null && instance.schedulingEnabled().booleanValue();
        }

        NSMutableArray<MInstance> startingInstances = new NSMutableArray<MInstance>();
        for (int i = 0; i < numToStartPerHost; i++) {
            for (MHost host : activeHosts) {
                NSArray<MInstance> inactiveInstances = inactiveInstancesByHost.objectForKey(host);
                if (inactiveInstances != null && inactiveInstances.count() >= i) {
                    MInstance instance = inactiveInstances.objectAtIndex(i);
                    log("Starting inactive instance " + instance.displayName() + " on host " + host.addressAsString());
                    startingInstances.addObject(instance);
                } else {
                    log("Not enough inactive instances on host: " + host.addressAsString());
                }
            }
        }
        for (MInstance instance : startingInstances) {
            if (useScheduling) {
View Full Code Here

        NSArray<MInstance> instances = application().instanceArray().immutableClone();
        NSMutableArray<MInstance> runningInstances = new NSMutableArray<MInstance>();
        NSMutableSet<MHost> activeHosts = new NSMutableSet<MHost>();
        for (MInstance instance : instances) {
            MHost host = instance.host();
            if (instance.isRunning_M()) {
                runningInstances.addObject(instance);
                activeHosts.addObject(host);
            }
        }
View Full Code Here

    }

    public WOComponent saveMoving() {
        handler().startReading();
        try {
            MHost mhost;
            NSArray hosts = siteConfig().hostArray();
            for (Enumeration enumeration = hosts.objectEnumerator(); enumeration.hasMoreElements(); ) {
                mhost = (MHost) enumeration.nextElement();
                handler().sendOverwriteToWotaskd(mhost);
            }
View Full Code Here

  }

  public WOComponent configureHostClicked() {
    handler().startWriting();
    try {
      MHost host = myHost();

      if ((_hostTypeSelection != null) && (!(_hostTypeSelection.toUpperCase().equals(host.osType())))) {
        host.setOsType(_hostTypeSelection.toUpperCase());
        handler().sendUpdateHostToWotaskds(host, siteConfig().hostArray());
      }
    } finally {
      handler().endWriting();
    }
View Full Code Here

    }

    public String outputDiff() {
        MInstance myInstance = myInstance();
        MApplication myApplication = myInstance.application();
        MHost myHost = myInstance.host();
        String appOutputPath = null;

        if (myHost.osType().equals("UNIX")) {
            appOutputPath = myInstance.generateOutputPath(myApplication.unixOutputPath());
        } else if (myHost.osType().equals("WINDOWS")) {
            appOutputPath = myInstance.generateOutputPath(myApplication.winOutputPath());
        } else if (myHost.osType().equals("MACOSX")) {
            appOutputPath = myInstance.generateOutputPath(myApplication.macOutputPath());
        }

        if (!safeEquals(myInstance.outputPath(), appOutputPath)) {
            return _diffString;
View Full Code Here

    return HostConfigurePage.create(context(), myHost());
  }

  public WOComponent syncHostClicked() {
    MHost host = myHost();
    siteConfig().hostErrorArray.addObjectIfAbsent(host);
    handler().sendUpdateHostToWotaskds(host, new NSArray(host));

    return HostConfigurePage.create(context(), myHost());
  }
View Full Code Here

TOP

Related Classes of com.webobjects.monitor._private.MSiteConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.