package nxm.sys.inc;

import nxm.sys.lib.IOResource;
import nxm.sys.lib.Midas;
import nxm.sys.lib.Table;

/** A factory that will produce an {@link IOResource} instance.
 *  @author J. Czechowski IV
 *  @since NeXtMidas 3.7.2
 */
//@FunctionalInterface // <-- Java 8
public interface IOResourceFactory {
  /** Factory method to return a new {@link IOResource} of the required type that is initialized
   *  with the supplied parameters.
   *  @param M      The current Midas context.
   *  @param type   This will usually be {@link IOResource#USER}.
   *  @param urlstr The URL string for the resource to instantiate.
   *  @param dir    One of: {@link IOResource#DIR_INPUT}, {@link IOResource#DIR_INOUT},
   *                {@link IOResource#DIR_OUTPUT}, etc.
   *  @param quals  The qualifier table to attempt to look up a file in.
   *  @return A new {@link IOResource} that is appropriate for the specified resource type or null.
   *  @since NeXtMidas 3.7.2
   */
  IOResource getResourceFor (Midas M, int type, String urlstr, int dir, Table quals);
}
