Examples of DownloadResults


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

    }

    public void installPlugins(GeronimoDeploymentManager mgr, PluginListType list, String defaultRepository, ConsoleReader consoleReader, ServerConnection connection) throws IOException, DeploymentException {
        long start = System.currentTimeMillis();
        Object key = mgr.startInstall(list, defaultRepository, false, null, null);
        DownloadResults results = CommandInstallCAR.showProgress(consoleReader, mgr, key);
        int time = (int) (System.currentTimeMillis() - start) / 1000;
        CommandInstallCAR.printResults(consoleReader, results, time);
    }
View Full Code Here

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

    }


    public void assembleServer(GeronimoDeploymentManager mgr, PluginListType list, String repositoryPath, String relativeServerPath, ConsoleReader consoleReader) throws Exception {
        long start = System.currentTimeMillis();
        DownloadResults results = mgr.installPluginList(repositoryPath, relativeServerPath, list);
        int time = (int) (System.currentTimeMillis() - start) / 1000;
        CommandInstallCAR.printResults(consoleReader, results, time);
    }
View Full Code Here

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

            this.progressInfo = progressInfo;
            this.session = session;
        }

        public void run() {
            DownloadResults results;

            while (true) {
                results = configInstaller.checkOnInstall(downloadKey);
                progressInfo.setMainMessage(results.getCurrentMessage());
                progressInfo.setProgressPercent(results.getCurrentFilePercent());
                progressInfo.setFinished(results.isFinished());
                log.debug(progressInfo.getMainMessage());
                if (results.isFinished()) {
                    log.debug("Installation finished");
                    session.setAttribute(DOWNLOAD_RESULTS_SESSION_KEY, results);
                    break;
                } else {
                    try { Thread.sleep(1000); } catch (InterruptedException e) {
View Full Code Here

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

        String repo = request.getParameter("repository");
        String user = request.getParameter("repo-user");
        String pass = request.getParameter("repo-pass");
        String configId = request.getParameter("configId");

        DownloadResults results = (DownloadResults) request.getPortletSession(true).getAttribute(DOWNLOAD_RESULTS_SESSION_KEY);
        if(results.isFailed()) {
            throw new PortletException("Unable to install configuration", results.getFailure());
        }
        List dependencies = new ArrayList();
        for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
            Artifact uri = results.getDependenciesInstalled()[i];
            dependencies.add(new InstallResults(uri.toString(), "installed"));
        }
        for (int i = 0; i < results.getDependenciesPresent().length; i++) {
            Artifact uri = results.getDependenciesPresent()[i];
            dependencies.add(new InstallResults(uri.toString(), "already present"));
        }
        request.getPortletSession(true).setAttribute("car.install.results", dependencies);

        response.setRenderParameter("configId", configId);
View Full Code Here

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

        moduleIdName = moduleIdName.replaceAll("SERVER", getServerType());
        URL repo = getFirstPluginRepository(kernel);
        PluginMetadata target = new PluginMetadata("Sample Application", null, "Samples", "A sample application",
                                                   null, null, null, false, true);
        target.setDependencies(new String[]{moduleIdName});
        DownloadResults results = installer.install(new PluginList(new URL[]{repo, new URL("http://www.ibiblio.org/maven2/")},
                                                    new PluginMetadata[]{target}), null, null);
        if(results.isFailed()) {
            throw new ServletException("Unable to install sample application", results.getFailure());
        }
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        for (int i = 0; i < results.getInstalledConfigIDs().length; i++) {
            Artifact artifact = results.getInstalledConfigIDs()[i];
            if(mgr.isConfiguration(artifact)) {
                try {
                    if(!mgr.isLoaded(artifact)) {
                        mgr.loadConfiguration(artifact);
                    }
View Full Code Here

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

                }
                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 String[]{target.getModuleId().toString()});
                }
            } catch (IOException e) {
View Full Code Here

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

    public DownloadResults install(PluginList installList, String username, String password) {
        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
        for (Iterator it = set.iterator(); it.hasNext();) {
            AbstractName name = (AbstractName) it.next();
            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name, PluginInstaller.class);
            DownloadResults results = installer.install(installList, username, password);
            kernel.getProxyManager().destroyProxy(installer);
            return results;
        }
        return null;
    }
View Full Code Here

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

    public DownloadResults checkOnInstall(Object key) {
        Set set = kernel.listGBeans(new AbstractNameQuery(PluginInstaller.class.getName()));
        for (Iterator it = set.iterator(); it.hasNext();) {
            AbstractName name = (AbstractName) it.next();
            PluginInstaller installer = (PluginInstaller) kernel.getProxyManager().createProxy(name, PluginInstaller.class);
            DownloadResults result = installer.checkOnInstall(key);
            kernel.getProxyManager().destroyProxy(installer);
            return result;
        }
        return null;
    }
View Full Code Here

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

            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 String[]{target.toString()});
            }
        } else {
View Full Code Here

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

    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
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.