/** * Finds all avalaible implementations of {@link GridFormatFactorySpi} which have registered * using the services mechanism, and that have the appropriate libraries on the classpath. * * @return An unmodifiable {@link Set} of all discovered datastores which have registered * factories, and whose available method returns true. */ public static synchronized Set<GridFormatFactorySpi> getAvailableFormats() { // get all GridFormatFactorySpi implementations scanForPlugins(); return getServiceRegistry() .getFactories(GridFormatFactorySpi.class, true) .filter(GridFormatFactorySpi::isAvailable) .collect(toUnmodifiableSet()); }
/** * Finds all avalaible implementations of {@link GridFormatFactorySpi} which * have registered using the services mechanism, and that have the * appropriate libraries on the classpath. * * @return An unmodifiable {@link Set} of all discovered datastores which * have registered factories, and whose available method returns * true. */ public static synchronized Set getAvailableFormats() { // get all GridFormatFactorySpi implementations scanForPlugins(); Iterator it = getServiceRegistry(). getServiceProviders(GridFormatFactorySpi.class, true); final Set formats= new HashSet(5); GridFormatFactorySpi spi; while (it.hasNext()) { spi = (GridFormatFactorySpi) it.next(); if (spi.isAvailable()) formats.add(spi); } return Collections.unmodifiableSet(formats); }
/** * Finds all avalaible implementations of {@link GridFormatFactorySpi} which * have registered using the services mechanism, and that have the * appropriate libraries on the classpath. * * @return An unmodifiable {@link Set} of all discovered datastores which * have registered factories, and whose available method returns * true. */ public static synchronized Set<GridFormatFactorySpi> getAvailableFormats() { // get all GridFormatFactorySpi implementations scanForPlugins(); final Iterator<GridFormatFactorySpi> it = getServiceRegistry(). getServiceProviders(GridFormatFactorySpi.class, true); final Set<GridFormatFactorySpi> formats= new HashSet<GridFormatFactorySpi>(); while (it.hasNext()) { final GridFormatFactorySpi spi = (GridFormatFactorySpi) it.next(); if (spi.isAvailable()) formats.add(spi); } return Collections.unmodifiableSet(formats); }
/** * return a gridcoverage for Raster file. Use a Map containing key "url" * @param params * @return GridCoverage */ public static GridCoverageReader getGridCoverageReader(Map params){ URL url = (URL) params.get("url"); if (url != null) { File file = DataUtilities.urlToFile(url); if (file != null&&file.exists()&&file.canRead()) { // try a geotiff gridcoverage GridFormatFinder.scanForPlugins(); final Format format=GridFormatFinder.findFormat(file); if(format!=null&&!(format instanceof UnknownFormat)) return ((AbstractGridFormat)format).getReader(file); } } return null; } }