All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geotools.data.FileGroupProvider Maven / Gradle / Ivy

Go to download

The main module contains the GeoTools public interfaces that are used by other GeoTools modules (and GeoTools applications). Where possible we make use industry standard terms as provided by OGC and ISO standards. The formal GeoTools public api consists of gt-metadata, jts and the gt-main module. The main module contains the default implementations that are available provided to other GeoTools modules using our factory system. Factories are obtained from an appropriate FactoryFinder, giving applications a chance configure the factory used using the Factory Hints facilities. FilterFactory ff = CommonFactoryFinder.getFilterFactory(); Expression expr = ff.add( expression1, expression2 ); If you find yourself using implementation specific classes chances are you doing it wrong: Expression expr = new AddImpl( expression1, expressiom2 );

The newest version!
/*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
 *
 *    (C) 2015, Open Source Geospatial Foundation (OSGeo)
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.data;

import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * A {@link FileGroup} provider allowing to return a {@link CloseableIterator} of {@link
 * FileGroup}s.
 */
public interface FileGroupProvider {

    /**
     * A Group of Files consisting of a reference to a mainFile, plus a set of support Files (if
     * any) and metadata map.
     */
    public static class FileGroup {

        @Override
        public String toString() {
            return "FileGroup [mainFile="
                    + mainFile
                    + ", supportFiles="
                    + supportFiles
                    + ", metadata="
                    + printMetadata(metadata)
                    + "]";
        }

        private String printMetadata(Map metadata) {
            if (metadata != null && !metadata.isEmpty()) {
                StringBuilder builder = new StringBuilder();
                Set keys = metadata.keySet();
                for (String key : keys) {
                    builder.append(key).append("=").append(metadata.get(key)).append("\n");
                }
                return builder.toString();
            } else {
                return null;
            }
        }

        public FileGroup(File mainFile, List supportFiles, Map metadata) {
            this.mainFile = mainFile;
            this.supportFiles = supportFiles;
            this.metadata = metadata;
        }

        /** The main File of the group */
        File mainFile = null;

        /** The support files (if any) */
        List supportFiles = null;

        /**
         * Metadata for this group. As an instance, domain information) A sample entry of that
         * mapping could be <"time",DateRange> to indicate that this group is covering the reported
         * time range.
         */
        Map metadata;

        public void setMainFile(File mainFile) {
            this.mainFile = mainFile;
        }

        public void setSupportFiles(List supportFiles) {
            this.supportFiles = supportFiles;
        }

        public void setMetadata(Map metadata) {
            this.metadata = metadata;
        }

        public Map getMetadata() {
            return metadata;
        }

        public File getMainFile() {
            return mainFile;
        }

        public List getSupportFiles() {
            return supportFiles;
        }
    }

    /**
     * Return {@link FileGroup}s matching the specified query (if any).
     *
     * 

Specifying a null query will result in returning all the available {@link * FileGroup}s. */ CloseableIterator getFiles(Query query); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy