Package org.apache.ace.agent

Examples of org.apache.ace.agent.DownloadHandle


            DefaultController controller = getController();
            controller.logInfo("Starting download of %s update, %s => %s...", m_type, updateInfo.m_from, updateInfo.m_to);

            try {
                DownloadHandle downloadHandle = delegate.getDownloadHandle(updateInfo.m_to, updateInfo.m_fixPackage);

                try {
                    Future<DownloadResult> future = downloadHandle.start(this);
                    DownloadResult downloadResult = future.get();

                    if (downloadResult.isComplete()) {
                        controller.logInfo("Installing %s update %s => %s...", m_type, updateInfo.m_from, updateInfo.m_to);

                        startInstallation(updateInfo);

                        delegate.install(downloadResult.getInputStream());

                        installationSuccess(updateInfo);

                        // Clean up any temporary files...
                        downloadHandle.discard();
                    }
                }
                catch (InterruptedException exception) {
                    controller.logInfo("Download of %s update is INTERRUPTED. Resuming download later on...", m_type);
                }
View Full Code Here


                        return;
                    }

                    System.out.printf("Downloading %s update (from v%s to v%s)...%n", updateType, installed, available);

                    DownloadHandle downloadHandle = updateHandler.getDownloadHandle(available, false /* fixPackage */);

                    Future<DownloadResult> future = downloadHandle.start(new DownloadProgressListener() {
                        @Override
                        public void progress(long bytesRead) {
                            System.out.printf("Download progress: %d bytes read...%n", bytesRead);
                        }
                    });
                    // Block until the download is complete...
                    DownloadResult result = future.get();

                    // Download is complete, ask the user once more if we're allowed to install the update...
                    if (m_agentUser.installAvailableUpdate(updateType, getAgentId(), installed, available)) {
                        System.out.printf("Installing %s update (from v%s to v%s)...%n", updateType, installed, available);

                        // We've confirmation that we can install this update...
                        updateHandler.install(result.getInputStream());
                    }

                    // Throw away downloaded packages...
                    downloadHandle.discard();
                }
            }
            catch (Exception exception) {
                System.out.printf("%s update failed with %s.%n", updateType, exception.getMessage());
                exception.printStackTrace(System.out);
View Full Code Here

                        return;
                    }

                    logInfo("Downloading %s update (from v%s to v%s)...", updateType, installed, available);

                    DownloadHandle downloadHandle = updateHandler.getDownloadHandle(available, false /* fixPackage */);

                    Future<DownloadResult> future = downloadHandle.start(new DownloadProgressListener() {
                        @Override
                        public void progress(long bytesRead) {
                            logInfo("Download progress: %d bytes read...", bytesRead);
                        }
                    });
                    // Block until the download is complete...
                    DownloadResult result = future.get();

                    // Download is complete, ask the user once more if we're allowed to install the update...
                    if (m_agentUser.installAvailableUpdate(updateType, getAgentId(), installed, available)) {
                        logInfo("Installing %s update (from v%s to v%s)...", updateType, installed, available);

                        // We've confirmation that we can install this update...
                        updateHandler.install(result.getInputStream());
                    }

                    // Throw away downloaded packages...
                    downloadHandle.discard();
                }
            }
            catch (Exception exception) {
                logWarning("%s update failed with %s.", exception, updateType, exception.getMessage());
                exception.printStackTrace(System.out);
View Full Code Here

TOP

Related Classes of org.apache.ace.agent.DownloadHandle

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.