Package org.apache.ace.agent

Examples of org.apache.ace.agent.DownloadHandle.start()


        DownloadResult downloadResult;
        Future<DownloadResult> future;

        final DownloadHandle handle = downloadHandler.getHandle(m_testContentURL);
        future = handle.start(null);

        downloadResult = future.get(5, TimeUnit.SECONDS);
        assertTrue(downloadResult.isComplete());

        File file = ((DownloadHandleImpl) handle).getDownloadFile();
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

        // Discard the result...
        handle.discard();

        // Restart & finish the download...
        DownloadHandle handle2 = downloadHandler.getHandle(m_testContentURL);
        future = handle2.start(null);

        downloadResult = future.get(5, TimeUnit.SECONDS);
        assertTrue(downloadResult.isComplete());

        fileLength = file.length();
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();
            }
View Full Code Here

        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

        assertTrue(secondFileLength >= firstFileLength, "Downloaded restarted for " + file.getName() + "?");
        assertTrue(secondFileLength < m_contentLength, "Everything downloaded for " + file.getName() + "?");

        DownloadHandle handle3 = downloadHandler.getHandle(m_testContentURL);
        // Resume the download, and finish it...
        future = handle3.start(null);

        downloadResult = future.get(5, TimeUnit.SECONDS);
        assertTrue(downloadResult.isComplete());

        assertEquals(file.length(), m_contentLength, "Not all content downloaded for " + file.getName() + "?");
View Full Code Here

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