Package jsky.catalog.astrocat

Examples of jsky.catalog.astrocat.AstroCatConfig


            set.add(new URI(url));
        }
        set.add(new URI(ROOT_URL));

        // Determine current VO registries being used: map URL to display name
        AstroCatConfig config = AstroCatConfig.getConfigFile();
        Map<URI, String> map = new HashMap<URI, String>();
        for (Catalog cat : config.getCatalogs()) {
            if (cat instanceof VoCatalogDirectory) {
                VoCatalogDirectory dir = (VoCatalogDirectory) cat;
                URI uri = dir.getURL().toURI();
                String name = dir.getName();
                if (name == null) {
View Full Code Here


                map.put(url, name);
            }
        }

        // Remove any unchecked catalog dirs from the main catalog list
        final AstroCatConfig config = AstroCatConfig.getConfigFile();
        for (Catalog cat : new ArrayList<Catalog>(config.getCatalogs())) {
            if (cat instanceof VoCatalogDirectory) {
                VoCatalogDirectory catDir = (VoCatalogDirectory) cat;
                if (map.get(catDir.getURL().toString()) == null) {
                    config.removeCatalog(cat);
                }
            }
        }

        // Add any checked catalog dirs (this can take some time, so use background threads)
        new SwingWorker() {
            public Object construct() {
                try {
                    for (String urlStr : map.keySet()) {
                        String name = map.get(urlStr);
                        URL url = new URL(urlStr);
                        CatalogDirectory dir = _findDir(config.getCatalogs(), url);
                        if (dir != null) {
                            dir.setName(name);
                        } else {
                            config.addCatalog(VoCatalogDirectory.getCatalogList(name, url));
                        }
                    }
                    return null;
                } catch (Exception e) {
                    return e;
                }
            }

            @Override
            public void finished() {
                Object o = getValue();
                if (o instanceof Exception) {
                    DialogUtil.error((Exception) o);
                } else {
                    setVisible(false);
                    config.save();
                    _fireChangeEvent();
                }
            }
        }.start();
    }
View Full Code Here

TOP

Related Classes of jsky.catalog.astrocat.AstroCatConfig

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.