Package org.apache.geronimo.system.plugin

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


            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

        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");
        try {
            PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath, targetServerPath, servers, kernel, getClass().getClassLoader());
            installer.install(pluginList, sourceRepo, true, null, null, downloadPoller);
        } finally {
            kernel.shutdown();
        }
        log.info("Installed plugins: ");
        for (Artifact artifact: downloadPoller.getInstalledConfigIDs()) {
            log.info("    " + artifact);
        }
        log.info("Installed dependencies: ");
        for (Artifact artifact: downloadPoller.getDependenciesInstalled()) {
            log.info("    " + artifact);
        }
        if (downloadPoller.isFailed()) {
            throw downloadPoller.getFailure();
        }
    }
View Full Code Here

        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());
        }
        cleanup();
    }
View Full Code Here

                }
                int selection = Integer.parseInt(answer);
                PluginMetadata target = ((PluginMetadata) available.get(selection - 1));
                long start = System.currentTimeMillis();
                Object key = mgr.startInstall(PluginList.createInstallList(data, target.getModuleId()), null, null);
                DownloadResults results = CommandInstallCAR.showProgress(mgr, key);
                int time = (int)(System.currentTimeMillis() - start) / 1000;
                out.println();
                if(!results.isFailed()) {
                    out.print(DeployUtils.reformat("**** Installation Complete!", 4, 72));
                    for (int i = 0; i < results.getDependenciesPresent().length; i++) {
                        Artifact uri = results.getDependenciesPresent()[i];
                        out.print(DeployUtils.reformat("Used existing: "+uri, 4, 72));
                    }
                    for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
                        Artifact uri = results.getDependenciesInstalled()[i];
                        out.print(DeployUtils.reformat("Installed new: "+uri, 4, 72));
                    }
                    out.println();
                    out.print(DeployUtils.reformat("Downloaded "+(results.getTotalDownloadBytes()/1024)+" kB in "+time+"s ("+results.getTotalDownloadBytes()/(1024*time)+" kB/s)", 4, 72));
                }
                if(results.isFinished() && !results.isFailed()) {
                    out.print(DeployUtils.reformat("Now starting "+target.getModuleId()+"...", 4, 72));
                    out.flush();
                    new CommandStart().execute(out, connection, new BaseCommandArgs(new String[]{target.getModuleId().toString()}));
                }
            } catch (IOException e) {
View Full Code Here

            if(!carFile.exists() || !carFile.canRead()) {
                throw new DeploymentException("CAR file cannot be read: "+carFile.getAbsolutePath());
            }
            Object key = mgr.startInstall(carFile, null, null);
            long start = System.currentTimeMillis();
            DownloadResults results = showProgress(mgr, key);
            int time = (int)(System.currentTimeMillis() - start) / 1000;
            System.out.println();
            if(!results.isFailed()) {
                System.out.print(DeployUtils.reformat("**** Installation Complete!", 4, 72));
                for (int i = 0; i < results.getDependenciesPresent().length; i++) {
                    Artifact uri = results.getDependenciesPresent()[i];
                    System.out.print(DeployUtils.reformat("Used existing: "+uri, 4, 72));
                }
                for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
                    Artifact uri = results.getDependenciesInstalled()[i];
                    System.out.print(DeployUtils.reformat("Installed new: "+uri, 4, 72));
                }
                if(results.getTotalDownloadBytes() > 0 && time > 0) {
                    System.out.println();
                    System.out.print(DeployUtils.reformat("Downloaded "+(results.getTotalDownloadBytes()/1024)+" kB in "+time+"s ("+results.getTotalDownloadBytes()/(1024*time)+" kB/s)", 4, 72));
                }
            }
            if(results.isFinished() && !results.isFailed() && results.getInstalledConfigIDs().length == 1) {
                Artifact target = results.getInstalledConfigIDs()[0];
                System.out.print(DeployUtils.reformat("Now starting "+target+"...", 4, 72));
                System.out.flush();
                new CommandStart().execute(out, connection, new BaseCommandArgs(new String[]{target.toString()}));
            }
        } else {
View Full Code Here

    static DownloadResults showProgress(GeronimoDeploymentManager mgr, Object key) {
        System.out.println("Checking for status every 1000ms:");
        String last = null, status;
        while(true) {
            DownloadResults results = mgr.checkOnInstall(key);
            if(results.getCurrentFile() != null) {
                if(results.getCurrentFilePercent() > -1) {
                    status = results.getCurrentMessage()+" ("+results.getCurrentFilePercent()+"%)";
                } else {
                    status = results.getCurrentMessage();
                }
                if(last == null || !last.equals(status)) {
                    last = status;
                    System.out.println(status);
                }
            }
            if(results.isFinished()) {
                if(results.isFailed()) {
                    System.err.println("Installation FAILED: "+results.getFailure().getMessage());
                }
                return results;
            }
            try {
                Thread.sleep(1000);
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.