Package org.apache.geronimo.system.plugin

Examples of org.apache.geronimo.system.plugin.DownloadResults


        if (artifact != null) {
            pluginList.getPlugin().add(toPluginType(Artifact.create(artifact)));
        } else {
            addDependencies(pluginList);
        }
        DownloadResults downloadPoller = new DownloadResults();
        String targetServerPath = targetServerDirectory.getAbsolutePath();

        Kernel kernel = new BasicKernel("Assembly", bundleContext);
        PluginRepositoryList pluginRepoList = new PluginRepositoryDownloader(Collections.singletonMap(localRepo, (String[]) null), true);
        try {
            PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath, targetServerPath, installedPluginsList, servers, pluginRepoList, kernel, bundleContext);
            installer.install(pluginList, sourceRepo, true, null, null, downloadPoller);
            if (overrides != null) {
                for (Override override: this.overrides) {
                    AttributesType attributes = override.getOverrides(overridesDir);
                    installer.mergeOverrides(override.getServer(), attributes);
                }
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Could not use plugin installer bean", e);
        } finally {
            kernel.shutdown();           
            try {
                bundleContext.getBundle().stop();
            } catch (BundleException e) {
                // ignore
            }
        }
        getLog().info("Installed plugins: ");
        for (Artifact artifact: downloadPoller.getInstalledConfigIDs()) {
            getLog().info("    " + artifact);
        }
        getLog().info("Installed dependencies: ");
        for (Artifact artifact: downloadPoller.getDependenciesInstalled()) {
            getLog().info("    " + artifact);
        }
        if (downloadPoller.isFailed()) {
            throw new MojoExecutionException("Could not download all dependencies", downloadPoller.getFailure());
        }
    }
View Full Code Here


        String[] configId = request.getParameterValues("configId");
        String repo = request.getParameter("repository");
        String user = request.getParameter("repo-user");
        String pass = request.getParameter("repo-pass");
        int downloadKey = Integer.parseInt(request.getParameter("download-key"));
        DownloadResults results = pluginInstaller.checkOnInstall(downloadKey, true);

        List<InstallResults> dependencies = new ArrayList<InstallResults>();
        if (results != null) {
            if(results.isFailed()) {
                //TODO is this an appropriate way to explain failure?
                throw new PortletException("Unable to install configuration", results.getFailure());
            }
            for (Artifact uri: results.getDependenciesInstalled()) {
                dependencies.add(new InstallResults(uri.toString(), "installed"));
            }
            for (Artifact uri: results.getDependenciesPresent()) {
                dependencies.add(new InstallResults(uri.toString(), "already present"));
            }
        }
        request.getPortletSession(true).setAttribute("car.install.results", dependencies);
        response.setRenderParameter("configId", configId);
View Full Code Here

        PluginListType list = getServerPluginList(request, pluginInstaller);
        PluginListType installList = getPluginsFromIds(configIds, list);
       

        try {
            DownloadResults downloadResults = pluginInstaller.installPluginList("repository", relativeServerPath, installList);
            archiver.archive(relativeServerPath, "var/temp", new Artifact(groupId, artifactId, version, format));
        } catch (Exception e) {
            throw new PortletException("Could not assemble server", e);
        }
        return ASSEMBLY_CONFIRM_MODE+BEFORE_ACTION;
View Full Code Here

        PluginListType list = getRepoPluginList(request, pluginInstaller, repo);
        PluginListType installList = getPluginsFromIds(configIds, list);

        Object downloadKey = pluginInstaller.startInstall(installList, repo, false, user, pass);
        DownloadResults results = pluginInstaller.checkOnInstall(downloadKey);
        request.getPortletSession(true).setAttribute(DOWNLOAD_RESULTS_SESSION_KEY, results);
       
        response.setRenderParameter("configIds", configIds);
        response.setRenderParameter("repository", repo);
        response.setRenderParameter("downloadKey", downloadKey.toString());
View Full Code Here

            jpaNodeInfo = clusterContext.getNodeInfo(cluster, nodeInfo);
            clusterContext.close();
        }
        Map<String, DownloadResults> installedPluginLists = new HashMap<String, DownloadResults>();
        for (JpaPluginList pluginList : cluster.getPluginLists()) {
            DownloadResults downloadResults = installToNode(pluginList, jpaNodeInfo);
            installedPluginLists.put(pluginList.getName(), downloadResults);
        }
        return installedPluginLists;
    }
View Full Code Here

    }

    private Map<String, DownloadResults> installToCluster(JpaPluginList pluginList, JpaClusterInfo cluster) {
        Map<String, DownloadResults> installedNodes = new HashMap<String, DownloadResults>();
        for (JpaNodeInfo jpaNodeInfo : cluster.getJpaNodeInfos()) {
            DownloadResults downloadResults = installToNode(pluginList, jpaNodeInfo);
            installedNodes.put(jpaNodeInfo.getName(), downloadResults);
        }
        return installedNodes;
    }
View Full Code Here

            PluginInstaller pluginInstaller = jpaNodeInfo.getPluginInstaller();
            PluginListType pluginList = jpaPluginList.getPluginList();
            //TODO parameterize restrictToDefaultRepository
            return pluginInstaller.install(pluginList, defaultRepository, false, null, null);
        } catch (IOException e) {
            DownloadResults downloadResults = new DownloadResults();
            downloadResults.setFailure(e);
            return downloadResults;
        }
    }
View Full Code Here

    }

    private Map<String, DownloadResults> removeFromCluster(List<JpaPluginInstance> pluginList, JpaClusterInfo cluster) {
        Map<String, DownloadResults> installedNodes = new HashMap<String, DownloadResults>();
        for (JpaNodeInfo jpaNodeInfo : cluster.getJpaNodeInfos()) {
            DownloadResults downloadResults = removeFromNode(pluginList, jpaNodeInfo);
            installedNodes.put(jpaNodeInfo.getName(), downloadResults);
        }
        return installedNodes;
    }
View Full Code Here

        }
        return installedNodes;
    }

    private DownloadResults removeFromNode(List<JpaPluginInstance> pluginList, JpaNodeInfo jpaNodeInfo) {
        DownloadResults downloadResults = new DownloadResults();
        try {
            ConfigurationManager configurationManager = jpaNodeInfo.getConfigurationManager();
            for (JpaPluginInstance jpaPluginInstance: pluginList) {
                Artifact artifact = jpaPluginInstance.toArtifact();
                configurationManager.uninstallConfiguration(artifact);
                downloadResults.addRemovedConfigID(artifact);
            }
        } catch (IOException e) {
            downloadResults.setFailure(e);
        } catch (NoSuchConfigException e) {
            downloadResults.setFailure(e);
        } catch (LifecycleException e) {
            downloadResults.setFailure(e);
        }
        return downloadResults;
    }
View Full Code Here

    private void log(NodeInfo nodeInfo, Map<String, DownloadResults> results) {
        log.info("installing to node: " + nodeInfo.getName());
        for (Map.Entry<String, DownloadResults> entry: results.entrySet()) {
            log.info("installation results for plugin list: " + entry.getKey());
            DownloadResults downloadResults = entry.getValue();
            log.info("installed: " + downloadResults.getInstalledConfigIDs());
            if (downloadResults.isFailed()) {
                log.info("failure: ", downloadResults.getFailure());
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.system.plugin.DownloadResults

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.