Package slash.navigation.download

Examples of slash.navigation.download.Download


    private void initializeEdition(String edition) throws JAXBException, FileNotFoundException {
        String uri = edition.toLowerCase() + ".xml";
        String url = System.getProperty("datasources", "http://www.routeconverter.com/datasources/") + "edition/" + uri;
        log.info(format("Downloading edition '%s'", url));

        Download download = downloadManager.queueForDownload("RouteConverter " + edition + " Edition: Catalog of Data Sources",
                url, Copy, null, new FileAndChecksum(new java.io.File(getTarget(), uri), null), null);
        downloadManager.waitForCompletion(asList(download));

        java.io.File target = download.getFile().getFile();
        if (!target.exists()) {
            log.warning(format("Cannot find %s to load '%s' data", target, download.getDescription()));
            return;
        }
        dataSourceService.load(new FileInputStream(download.getFile().getFile()));
    }
View Full Code Here


        for (DataSource dataSource : dataSourceService.getDataSources()) {
            for (File file : dataSource.getFiles()) {
                String url = dataSource.getBaseUrl() + file.getUri();
                log.info(format("Downloading data source '%s'", url));

                Download download = downloadManager.queueForDownload(dataSource.getName() + ": Data Source " + file.getUri(),
                        url, Copy, null, new FileAndChecksum(new java.io.File(getTarget(), file.getUri().toLowerCase()), file.getLatestChecksum()), null);
                downloads.add(download);
            }
        }
        downloadManager.waitForCompletion(downloads);

        for (Download download : downloads) {
            java.io.File target = download.getFile().getFile();
            if (!target.exists()) {
                log.warning(format("Cannot find %s to load '%s' data", target, download.getDescription()));
                continue;
            }
            dataSourceService.load(new FileInputStream(target));
        }
    }
View Full Code Here

*/

public class DownloadsTableCellRenderer extends AlternatingColorTableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int columnIndex) {
        JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, rowIndex, columnIndex);
        Download download = (Download) value;
        switch (columnIndex) {
            case 0:
                label.setText(download.getDescription());
                label.setToolTipText(download.getUrl());
                break;
            case 1:
                String text = download.getState().name();
                if (Downloading.equals(download.getState()) || Processing.equals(download.getState()) || Resuming.equals(download.getState()))
                    text += " (" + download.getPercentage() + "%)";
                label.setText(text);
                label.setToolTipText(download.getUrl());
                break;
            default:
                throw new IllegalArgumentException("Row " + rowIndex + ", column " + columnIndex + " does not exist");
        }
        return label;
View Full Code Here

    @Test
    public void testSaveAndLoadDownloads() throws IOException {
        CompactCalendar now = now();
        List<Download> downloads = new ArrayList<>();
        downloads.add(new Download("description", "url", Flatten, new FileAndChecksum(fileTarget, createChecksum()),
                asList(new FileAndChecksum(fragmentTarget1, createChecksum()), new FileAndChecksum(fragmentTarget2, createChecksum())),
                "etag", Downloading, tempFile));
        persister.save(queueFile, downloads, now);

        QueuePersister.Result result = persister.load(queueFile);
View Full Code Here

TOP

Related Classes of slash.navigation.download.Download

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.