Package jsky.catalog

Examples of jsky.catalog.CatalogDirectory


    /**
     * Return an array of Catalog or CatalogDirectory objects representing the
     * path from the root catalog directory to this catalog.
     */
    public Catalog[] getPath() {
        CatalogDirectory parent = getParent();
        if (parent == null)
            return null;

        return parent.getPath(this);
    }
View Full Code Here


            if (urlStr != null) {
                urlStr = _getQueryUrl(urlStr, queryArgs);
                if (urlStr.startsWith(File.separator)
                        || (urlStr.length() > 2 && urlStr.charAt(1) == ':')) { // C:\dir\command ...
                    // may be a local command path name (for security, must be from a local config file)
                    CatalogDirectory catDir = _entry.getConfigFile();
                    if (catDir != null && !catDir.isLocal())
                        throw new RuntimeException("Invalid catalog URL: " + urlStr
                                + ", in remote config file");
                    Process process = Runtime.getRuntime().exec(urlStr);
                    //InputStream stderr = process.getErrorStream();
                    InputStream stdout = process.getInputStream();
View Full Code Here

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

    // Searches the given catalog list for a catDir with the given URL
    private CatalogDirectory _findDir( List<Catalog> list, URL url) {
        for(Catalog cat : list) {
            if (cat instanceof CatalogDirectory) {
                CatalogDirectory catDir = (CatalogDirectory)cat;
                if (url.equals(catDir.getURL())) {
                    return catDir;
                }
            }
        }
        return null;
View Full Code Here

            }
        } else if (catalog instanceof CatalogDirectory) {
            // For catalog directories, include the "class" attribute, which indicates
            // which class is responsible for finding and parsing the catalog list
            _addAttr(attrs, "class", catalog.getClass().getName());
            CatalogDirectory catDir = (CatalogDirectory) catalog;
            URL url = catDir.getURL();
            if (catDir.configNeedsUrl() && url != null) {
                String protocol = url.getProtocol();
                String host = url.getHost();
                String path = url.getPath();
                int port = url.getPort();
                if (path != null && path.length() != 0) {
View Full Code Here

    public CatalogDirectory getParent() {
        return _parent;
    }

    public Catalog[] getPath() {
        CatalogDirectory parent = getParent();
        if (parent == null) {
            return null;
        }

        return parent.getPath(this);
    }
View Full Code Here

     * @return a new JComponent displaying the contents of (or the interface for searching) the given catalog
     */
    protected JComponent makeCatalogComponent(Catalog catalog) {
        // catalog may contain multiple tables and implement the CatalogDirectory interface
        if (catalog instanceof CatalogDirectory) {
            CatalogDirectory catalogDirectory = (CatalogDirectory) catalog;
            int numCatalogs = catalogDirectory.getNumCatalogs();
            if (numCatalogs == 1) {
                Catalog c = catalogDirectory.getCatalog(0);
                if (c instanceof TableQueryResult) {
                    return makeTableQueryResultComponent((TableQueryResult) c);
                } else {
                    DialogUtil.error(_I18N.getString("subCatalogError") + ": " + c);
                    return new EmptyPanel();
                }
            } else if (numCatalogs > 1) {
                return makeTableQueryResultComponent(catalogDirectory.getCatalogList());
            }
        }
        if (catalog instanceof TableQueryResult) {
            return makeTableQueryResultComponent((TableQueryResult) catalog);
        }
View Full Code Here

     * Reload the catalog config file and return the new object for it.
     */
    public Catalog reload() {
        _removePersistent(getURL());
        _reloadFlag = true;
        CatalogDirectory catDir = null;
        try {
            catDir = getCatalogList(getName(), getURL());
        } finally {
            _reloadFlag = false;
        }
View Full Code Here

        _updateModel();
    }

    // Recursively add tree nodes to match the catalog directory structure
    private void addNodes(DefaultMutableTreeNode root) {
        CatalogDirectory catDir = (CatalogDirectory) root.getUserObject();
        List<Catalog> list = catDir.getCatalogs();
        for (Catalog cat : list) {
            boolean isDir = cat instanceof CatalogDirectory && ((CatalogDirectory)cat).getNumCatalogs() > 0;
            if (isDir || _matches(cat)) {
                DefaultMutableTreeNode node = new DefaultMutableTreeNode(cat);
                root.add(node);
View Full Code Here

    }

    // Updates the tree model after a change in the underlying catalog directory
    private void _updateModel() {
        DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) getRoot();
        CatalogDirectory dir = (CatalogDirectory)rootTreeNode.getUserObject();

        rootTreeNode.removeAllChildren();
        _nodeMap.clear();
        _nodeMap.put(dir, rootTreeNode);
        addNodes(rootTreeNode);
View Full Code Here

TOP

Related Classes of jsky.catalog.CatalogDirectory

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.