Package org.apache.ace.agent.DownloadHandle

Examples of org.apache.ace.agent.DownloadHandle.DownloadProgressListener


        DownloadHandler downloadHandler = m_agentContext.getHandler(DownloadHandler.class);

        final DownloadHandle handle = downloadHandler.getHandle(m_200url);
        handle.discard();

        Future<DownloadResult> future = handle.start(new DownloadProgressListener() {
            @Override
            public void progress(long read) {
                Thread.currentThread().interrupt();
            }
        });
View Full Code Here


        DownloadResult downloadResult;
        Future<DownloadResult> future;

        final DownloadHandle handle = downloadHandler.getHandle(m_testContentURL);
        future = handle.start(new DownloadProgressListener() {
            @Override
            public void progress(long bytesRead) {
                handle.stop();
            }
        });
View Full Code Here

        DownloadResult downloadResult;
        Future<DownloadResult> future;

        final DownloadHandle handle = downloadHandler.getHandle(m_testContentURL);
        // Start the download, but interrupt it after reading the first chunk of data...
        future = handle.start(new DownloadProgressListener() {
            @Override
            public void progress(long bytesRead) {
                System.out.printf("Downloaded %d bytes, interrupting download...%n", bytesRead);
                Thread.currentThread().interrupt();
            }
        });

        assertDownloadStopped(future);

        File file = ((DownloadHandleImpl) handle).getDownloadFile();
        long firstFileLength = file.length();

        assertTrue(file.exists(), file.getName() + " does not exist?!");
        assertTrue(firstFileLength > 0, "Nothing downloaded yet for " + file.getName() + "?");
        assertTrue(firstFileLength < m_contentLength, "Everything downloaded for " + file.getName() + "?");

        final DownloadHandle handle2 = downloadHandler.getHandle(m_testContentURL);
        // Resume the download, but stop it after reading the first chunk of data...
        future = handle2.start(new DownloadProgressListener() {
            private int m_count = 5;

            @Override
            public void progress(long bytesRead) {
                if (--m_count == 0) {
View Full Code Here

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

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

TOP

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

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.