Examples of InstallTask


Examples of com.sun.grid.installer.task.InstallTask

                    try {
                        if (h.isQmasterHost() && h.getInstallTimeout() < 360000) {
                            //Qmaster installation can wait up to 5mins to qmaster to startup
                            h.setInstallTimeout(Util.DEF_INSTALL_TIMEOUT + 300000);
                        }
                        singleThreadPool.execute(new InstallTask(h, this, variablesCopy, localizedMessages));
                    } catch (RejectedExecutionException e) {
                        setHostState(h, State.CANCELED);
                    }
                } else if (h.isFirstTask()) {
                    //This is a first execd/shadowd task and there were no other BDB or qmaster components
                    //Need to create a first task that will add all hosts as admin hosts
                    Properties vars = new Properties();
                    vars.putAll(idata.getVariables());
                    vars.put(VAR_ALL_ADMIN_HOSTS, Util.listToString(possibleAdminHosts));
                    vars.setProperty(VAR_ALL_CSPHOSTS, "");
                    vars.setProperty(VAR_ALL_COPYUSERS, "");
                    //Only for CSP mode
                    if (vars.getProperty("add.product.mode").equalsIgnoreCase("csp")) {
                        List<String> cspList = allHosts;
                        String allHostsButCurrent = "";
                        String allUsers = "";
                        // Construct a reverse odered list so the local host will be the last one
                        for (int i = cspList.size() - 1; i >= 0; i--) {
                                allHostsButCurrent += cspList.get(i).trim() + " ";
                                allUsers += allConnectUsers.get(i).trim() + " ";
                            }
                        vars.setProperty(VAR_ALL_CSPHOSTS, allHostsButCurrent.trim());
                        vars.setProperty(VAR_ALL_COPYUSERS, allUsers.trim());
                    } else if (vars.getProperty(VAR_SGE_JMX).equalsIgnoreCase("true") && vars.getProperty(VAR_JMX_SSL).equalsIgnoreCase("true")) {
                        //Copy certs to all shadow hosts (need the keystores to be able to start JMX thread)
                        String allHostsButCurrent = "";
                        String allUsers = "";
                        // Construct a reverse odered list so the local host will be the last one
                        for (int i = allShadowHosts.size() - 1; i >= 0; i--) {
                                allHostsButCurrent += allShadowHosts.get(i).trim() + " ";
                                allUsers += allShadowConnectUsers.get(i).trim() + " ";
                            }
                        vars.setProperty(VAR_ALL_CSPHOSTS, allHostsButCurrent.trim());
                        vars.setProperty(VAR_ALL_COPYUSERS, allUsers.trim());
                    }
                    vars.put(VAR_FIRST_TASK, "true");
                    wait = true;

                    try {
                        //And execute the first task in the singleThreadPool
                        singleThreadPool.execute(new InstallTask(h, this, vars, localizedMessages));
                    } catch (RejectedExecutionException e) {
                        setHostState(h, State.CANCELED);
                    }
                } else {
                    try {
                        //Only execd get installed in parallel
                        threadPool.execute(new InstallTask(h, this, variablesCopy, localizedMessages));
                    } catch (RejectedExecutionException e) {
                        setHostState(h, State.CANCELED);
                    }
                }

                started++;
                //In case the task is a BDB or qmaster host, we have to wait for sucessful finish!
                while (wait) {
                    if (singleThreadPool.getCompletedTaskCount() >= completed + 1 && !singleThreadPool.isTerminated()) {
                        wait = false;
                        //If bdb, qmaster, prereq tasks fail => it's over!
                        if (h.getState() != Host.State.SUCCESS) {
                            for (Host host : installList) {
                                setHostLog(host, "FAILED: " + MessageFormat.format(localizedMessages.getProperty("msg.previous.dependent.install.failed"), h.getComponentString()));
                                setHostState(host, State.FAILED_DEPENDENT_ON_PREVIOUS);
                            }
                            observer.setTaskCount(-1);
                            return;
                        }
                        completed++;
                    } else if (singleThreadPool.isTerminated()){
                        //There is not guarantee that the currently executing task will be interrupted. It may also finish as SUCCESS or FAILED!
                        for (Host host : installList) {
                            setHostLog(host, "CANCELED: " + MessageFormat.format(localizedMessages.getProperty("msg.install.canceled"), ""));
                            setHostState(host, State.CANCELED);
                        }
                        observer.setTaskCount(-1);
                        return;
                    } else {
                        try {
                            Thread.sleep(200);
                        } catch (InterruptedException ex) {
                        }
                    }
                }
            }
        } catch (Exception e) {
            Debug.error(e);
        } finally {
            //Wait until all tasks have finished
            while (threadPool.getCompletedTaskCount() + singleThreadPool.getCompletedTaskCount() < started && !(threadPool.isTerminated() && singleThreadPool.isTerminated())) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException ex) {
                }
            }
            //Execute final task to setup correct submit and remove invalid admin hosts silently on local host
            Properties vars = new Properties();
            if (lastTaskHost == null) {
                Debug.error("lastTaskHost not set!");
                throw new IllegalArgumentException("lastTaskHost not set!");
            } else if (lastTaskHost.getState() != Host.State.FAILED_DEPENDENT_ON_PREVIOUS) {
                //Run the last task only if we have the lastTaskHost and we are not in FAILED_DEPENDENT_ON_PREVIOUS state
                vars.putAll(idata.getVariables());
                vars.put(VAR_ALL_ADMIN_HOSTS, Util.listToString(adminHosts));
                vars.put(VAR_ALL_HOSTS, Util.listToString(allHosts));
                vars.put(VAR_ALL_SUBMIT_HOSTS, Util.listToString(submitHosts));
                vars.put(VAR_LAST_TASK, "true");
                //And execute the last task in the singleThreadPool
                try {
                    singleThreadPool.execute(new InstallTask(lastTaskHost, this, vars, localizedMessages));
                } catch (RejectedExecutionException e) {
                    setHostState(lastTaskHost, State.CANCELED);
                }
                started++;
                //Wait until it's finished
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

        Set<String> profileIds = options.getProfiles();
        String versionId = options.getVersion();
        List<Profile> profiles = Profiles.getProfiles(fabricService, profileIds, versionId);
        String layout = configObject.getOverlayFolder();
        String[] postUnpackRemoveFiles = configObject.getPostUnpackRemoveFiles();
        InstallTask answer = createCommonPostInstal(options, environmentVariables, layout);
        if (postUnpackRemoveFiles != null && postUnpackRemoveFiles.length > 0) {
            answer = CompositeTask.combine(answer, new RemoveFilesTask(postUnpackRemoveFiles));
        }

        if (!configObject.isInternalAgent()) {
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

    protected InstallTask createCommonPostInstal(CreateChildContainerOptions options, Map<String, String> environmentVariables, String layout) {
        Set<String> profileIds = options.getProfiles();
        String versionId = options.getVersion();
        List<Profile> profiles = Profiles.getProfiles(fabricService, profileIds, versionId);
        InstallTask answer = null;
        if (layout != null) {
            Map<String, String> configuration = ProcessUtils.getProcessLayout(fabricService, profiles, layout);
            if (configuration != null && !configuration.isEmpty()) {
                Map variables = Profiles.getOverlayConfiguration(fabricService, profileIds, versionId, Constants.TEMPLATE_VARIABLES_PID);
                if (variables == null) {
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

            if (ChildContainers.isJavaContainer(fabricService, options)) {
                LOG.debug("Java container detected - installing jar. Configuration: ", options);
                JavaContainerConfig javaConfig = createJavaContainerConfig(options);
                InstallOptions parameters = createJavaInstallOptions(container, metadata, options, javaConfig, environmentVariables);
                String layout = javaConfig.getOverlayFolder();
                InstallTask postInstall = createCommonPostInstal(options, environmentVariables, layout);
                Objects.notNull(parameters, "JavaInstall parameters");
                installation = procManager.installJar(parameters, postInstall);
            } else {
                LOG.debug("Process container detected - installing process. Configuration: ", options);
                InstallOptions parameters = createProcessInstallOptions(container, metadata, options, processConfig, environmentVariables);
                InstallTask postInstall = createProcessPostInstall(container, options, processConfig, environmentVariables);
                Objects.notNull(parameters, "process parameters");
                installation = procManager.install(parameters, postInstall);
            }
        } catch (Exception e) {
            handleException("Creating container " + containerId, e);
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

        Profile processProfile = getProcessProfile(requirements, true);
        Profile deployProcessProfile = getProcessProfile(requirements, false);
        Map<String, String> configuration = ProcessUtils.getProcessLayout(fabricService, processProfile, requirements.getLayout());

        //DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabricService, executorService);
        InstallTask applyConfiguration = new ApplyConfigurationTask(configuration, installOptions.getProperties());
        List<Profile> profiles = new ArrayList<Profile>();
        profiles.add(deployProcessProfile);
        Map<String, File> javaArtifacts = JavaContainers.getJavaContainerArtifactsFiles(fabricService, profiles, executorService);
        String versionId = Profiles.versionId(fabricService.getCurrentContainer().getVersion());
        List<String> profileIds = Profiles.profileIds(profiles);
        Map<String, String> contextPathConfiguration = Profiles.getOverlayConfiguration(fabricService, profileIds, versionId, Constants.WEB_CONTEXT_PATHS_PID);
        InstallTask applyProfile = new InstallDeploymentsTask(javaArtifacts, contextPathConfiguration);
        InstallTask compositeTask = new CompositeTask(applyConfiguration, applyProfile);
        Installation installation = processManager.install(installOptions, compositeTask);
        if (installation != null) {
            installation.getController().start();
        }
        return installation;
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

                .mainClass(mainClass)
                .controllerUrl(getControllerURL())
                .build();

        // allow a post install step to be specified - e.g. specifying jars/wars?
        InstallTask postInstall = null;

        Installation install = getContainerProcessManager().installJar(options, postInstall);
        ShellUtils.storeFabricCredentials(session, jmxUser, jmxPassword);
        System.out.println("Installed process " + install.getId() + " to " + install.getInstallDir());
    }
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

                .extractCmd(getExtract(extractCmd))
                .controllerUrl(getControllerURL())
                .build();

        // allow a post install step to be specified - e.g. specifying jars/wars?
        InstallTask postInstall = null;

        Installation install = getContainerProcessManager().install(options, postInstall);
        ShellUtils.storeFabricCredentials(session, jmxUser, jmxPassword);
        System.out.println("Installed process " + install.getId() + " to " + install.getInstallDir());
    }
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

        return installations.get(id);
    }

    @Override
    public Installation install(final InstallOptions options, final InstallTask postInstall) throws Exception {
        @SuppressWarnings("serial")
        InstallTask installTask = new InstallTask() {
            @Override
            public void install(InstallContext installContext, ProcessConfig config, String id, File installDir) throws Exception {
                config.setName(options.getName());
                File archive = getDownloadStrategy(options).downloadContent(options.getUrl(), installDir);
                if (archive == null) {
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

        substituteEnvironmentVariableExpressions(options.getEnvironment(), options.getEnvironment());
    }

    @Override
    public Installation installJar(final InstallOptions parameters, final InstallTask postInstall) throws Exception {
        @SuppressWarnings("serial")
        InstallTask installTask = new InstallTask() {
            @Override
            public void install(InstallContext installContext, ProcessConfig config, String id, File installDir) throws Exception {
                config.setName(parameters.getName());
                // lets untar the process launcher
                String resourceName = "process-launcher.tar.gz";
View Full Code Here

Examples of io.fabric8.process.manager.InstallTask

    }

    private Installation installProcess(String pid, InstallOptions options, Map<String, String> env) throws ConfigurationException {
        try {
            // allow bundles / features which could be specified
            InstallTask postInstall = null;

            // TODO add support for jar install parameters
            Installation installation = processManager.install(options, postInstall);

            // add environment variables from properties
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.