/** * Convert map to real values based on factory Params. * * @param factory * @param params * @return Map with real values that may be acceptable to GDSFactory * @throws IOException DOCUMENT ME! */ public static Map toParams(GridFormatFactorySpi factory, Map params) throws IOException { final Map map = new HashMap(params.size()); final ParameterValueGroup info = factory.createFormat().getReadParameters(); // Convert Params into the kind of Map we actually need for (Iterator i = params.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); Object value = find(info, key).getValue(); if (value != null) { map.put(key, value); } } return Collections.synchronizedMap(map); }
/** * Returns an array with all available {@link GridFormatFactorySpi} implementations. * * <p>It can be used toget basic information about all the available {@link GridCoverage} * plugins. Note that this method finds all the implemented plugins but returns only the * available one. * * <p>A plugin could be implemented but not available due to missing dependencies. * * @return an array with all available {@link GridFormatFactorySpi} implementations. */ public static Format[] getFormatArray() { final Set<GridFormatFactorySpi> formats = GridFormatFinder.getAvailableFormats(); final List<Format> formatSet = new ArrayList<Format>(formats.size()); for (Iterator<GridFormatFactorySpi> iter = formats.iterator(); iter.hasNext(); ) { final GridFormatFactorySpi element = iter.next(); formatSet.add(element.createFormat()); } return formatSet.toArray(new Format[formatSet.size()]); }
/** * Returns all the {@link Format}s that can read the supplied {@link Object} o. * * @param o is the object to search a {@link Format} that is able to read * @param hints the {@link Hints} to control the format search. * @return an unmodifiable {@link Set} comprising all the {@link Format} that can read the * {@link Object} o. */ public static synchronized Set<AbstractGridFormat> findFormats(Object o, Hints hints) { final Set<GridFormatFactorySpi> availableFormats = getAvailableFormats(); final Set<AbstractGridFormat> formats = new HashSet<AbstractGridFormat>(); final Iterator<GridFormatFactorySpi> it = availableFormats.iterator(); while (it.hasNext()) { // get the factory final GridFormatFactorySpi spi = it.next(); // create a format for it final AbstractGridFormat retVal = spi.createFormat(); // check if we can accept it if (retVal instanceof AbstractGridFormat) { if (retVal.accepts(o, hints)) formats.add(retVal); } } return Collections.unmodifiableSet(formats); }
/** * Returns an array with all available {@link GridFormatFactorySpi} * implementations. * * <p> * It can be used toget basic information about all the available * {@link GridCoverage} plugins. Note that this method finds all the * implemented plugins but returns only the availaible one. * * <p> * A plugin could be implemented but not availaible due to missing * dependencies. * * * @return an array with all available {@link GridFormatFactorySpi} * implementations. */ public static Format[] getFormatArray() { final Set<GridFormatFactorySpi> formats = GridFormatFinder.getAvailableFormats(); final List<Format> formatSet = new ArrayList<Format>(formats.size()); for (Iterator<GridFormatFactorySpi> iter = formats.iterator(); iter.hasNext();) { final GridFormatFactorySpi element = (GridFormatFactorySpi) iter.next(); formatSet.add(element.createFormat()); } return (Format[]) formatSet.toArray(new Format[formatSet.size()]); }
/** * Returns an array with all available {@link GridFormatFactorySpi} * implementations. * * <p> * It can be used toget basic information about all the available * {@link GridCoverage} plugins. Note that this method finds all the * implemented plugins but returns only the availaible one. * * <p> * A plugin could be implemented but not availaible due to missing * dependencies. * * * @return an array with all available {@link GridFormatFactorySpi} * implementations. */ public static Format[] getFormatArray() { GridFormatFactorySpi element; Set formats = GridFormatFinder.getAvailableFormats(); List formatSet = new ArrayList(formats.size()); for (Iterator iter = formats.iterator(); iter.hasNext();) { element = (GridFormatFactorySpi) iter.next(); formatSet.add(element.createFormat()); } return (Format[]) formatSet.toArray(new Format[formatSet.size()]); }
/** * Returns all the {@link Format}s that can read the supplied * {@link Object} o. * * @param o * is the object to search a {@link Format} that is able to read * @return an unmodifiable {@link Set} comprising all the {@link Format} * that can read the {@link Object} o. */ public static synchronized Set findFormats(Object o) { final Set availaibleFormats = getAvailableFormats(); final Set formats=new HashSet(); final Iterator it = availaibleFormats.iterator(); Format retVal = null; GridFormatFactorySpi spi = null; while (it.hasNext()) { // get the factory spi = (GridFormatFactorySpi) it.next(); // create a format for it retVal = spi.createFormat(); // check if we can accept it if (retVal instanceof AbstractGridFormat) { if (((AbstractGridFormat) retVal).accepts(o)) formats.add(retVal); } } return Collections.unmodifiableSet(formats); }
/** * Returns all the {@link Format}s that can read the supplied * {@link Object} o. * * @param o * is the object to search a {@link Format} that is able to read * @param hints * the {@link Hints} to control the format search. * @return an unmodifiable {@link Set} comprising all the {@link Format} * that can read the {@link Object} o. */ public static synchronized Set<AbstractGridFormat> findFormats(Object o, Hints hints) { final Set<GridFormatFactorySpi> availaibleFormats = getAvailableFormats(); final Set<AbstractGridFormat> formats=new HashSet<AbstractGridFormat>(); final Iterator<GridFormatFactorySpi> it = availaibleFormats.iterator(); while (it.hasNext()) { // get the factory final GridFormatFactorySpi spi = (GridFormatFactorySpi) it.next(); // create a format for it final AbstractGridFormat retVal = spi.createFormat(); // check if we can accept it if (retVal instanceof AbstractGridFormat) { if (((AbstractGridFormat) retVal).accepts(o,hints)) formats.add(retVal); } } return Collections.unmodifiableSet(formats); }