Package org.apache.ace.agent

Examples of org.apache.ace.agent.UpdateHandler


         * @param updateType
         *            the type of update we're performing, cannot be <code>null</code>.
         */
        private void checkForUpdate(UpdateType updateType) {
            try {
                UpdateHandler updateHandler = getUpdateHandler(updateType);

                Version installed = updateHandler.getInstalledVersion();
                Version available = updateHandler.getHighestAvailableVersion();
                if (installed != null && installed.compareTo(available) < 0) {
                    // Update available, ask the user whether we should download it...
                    if (!m_agentUser.downloadAvailableUpdate(updateType, getAgentId(), installed, available)) {
                        // No, we may not download this update now...
                        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();
                }
View Full Code Here


         * @param updateType
         *            the type of update we want an update handler for, cannot be <code>null</code>.
         * @return an {@link UpdateHandler} instance, never <code>null</code>.
         */
        private UpdateHandler getUpdateHandler(UpdateType updateType) {
            UpdateHandler updateHandler;
            if (UpdateType.AGENT == updateType) {
                updateHandler = m_agentControl.getAgentUpdateHandler();
            }
            else {
                updateHandler = m_agentControl.getDeploymentHandler();
View Full Code Here

         * @param updateType
         *            the type of update we're performing, cannot be <code>null</code>.
         */
        private void checkForUpdate(UpdateType updateType) {
            try {
                UpdateHandler updateHandler = getUpdateHandler(updateType);

                Version installed = updateHandler.getInstalledVersion();
                Version available = updateHandler.getHighestAvailableVersion();
                if (installed != null && installed.compareTo(available) < 0) {
                    // Update available, ask the user whether we should download it...
                    if (!m_agentUser.downloadAvailableUpdate(updateType, getAgentId(), installed, available)) {
                        // No, we may not download this update now...
                        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();
                }
View Full Code Here

         * @param updateType
         *            the type of update we want an update handler for, cannot be <code>null</code>.
         * @return an {@link UpdateHandler} instance, never <code>null</code>.
         */
        private UpdateHandler getUpdateHandler(UpdateType updateType) {
            UpdateHandler updateHandler;
            if (UpdateType.AGENT == updateType) {
                updateHandler = m_agentContext.getHandler(AgentUpdateHandler.class);
            }
            else {
                updateHandler = m_agentContext.getHandler(DeploymentHandler.class);
View Full Code Here

TOP

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

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.