legacy/src/main/java/thredds/crawlabledataset/CrawlableDatasetFactory.java
public static CrawlableDataset createCrawlableDataset( String path, String className, Object configObj )
          throws IOException,
                 ClassNotFoundException, NoSuchMethodException,
                 IllegalAccessException, InvocationTargetException,
                 InstantiationException, IllegalArgumentException, NullPointerException
          // throws CrDsException, IllegalArgumentException
  {
    if ( path == null ) throw new NullPointerException( "Given path must not be null.");
    String tmpClassName = ( className == null
                            ? defaultClassName
                            : className );

    // @todo Remove alias until sure how to handle things like ".scour*" being a regular file.
//    if ( CrawlableDatasetAlias.isAlias( tmpPath) )
//        return new CrawlableDatasetAlias( tmpPath, tmpClassName, configObj );

    // Get the Class instance for desired CrawlableDataset implementation.
    Class crDsClass = Class.forName( tmpClassName );

    // Check that the Class is a CrawlableDataset.
    if ( ! CrawlableDataset.class.isAssignableFrom( crDsClass ) )
    {
      throw new IllegalArgumentException( "Requested class <" + className + "> not an implementation of thredds.crawlabledataset.CrawlableDataset.");
    }

    // Instantiate the desired CrawlableDataset.
    Class [] argTypes = { String.class, Object.class };
    Object [] args = { path, configObj };
    Constructor constructor = crDsClass.getDeclaredConstructor( argTypes );

    try
    {
      return (CrawlableDataset) constructor.newInstance( args );
    }
    catch ( InvocationTargetException e )
    {
      if ( IOException.class.isAssignableFrom( e.getCause().getClass()) )
        throw (IOException) e.getCause();
      else throw e;
    }
  }
public static CrawlableDataset createCrawlableDataset( String path, String className, Object configObj )
          throws IOException,
                 ClassNotFoundException, NoSuchMethodException,
                 IllegalAccessException, InvocationTargetException,
                 InstantiationException, IllegalArgumentException, NullPointerException
          // throws CrDsException, IllegalArgumentException
  {
    if ( path == null ) throw new NullPointerException( "Given path must not be null.");
    String tmpClassName = ( className == null
                            ? defaultClassName
                            : className );

    // @todo Remove alias until sure how to handle things like ".scour*" being a regular file.
//    if ( CrawlableDatasetAlias.isAlias( tmpPath) )
//        return new CrawlableDatasetAlias( tmpPath, tmpClassName, configObj );

    // Get the Class instance for desired CrawlableDataset implementation.
    Class crDsClass = Class.forName( tmpClassName );

    // Check that the Class is a CrawlableDataset.
    if ( ! CrawlableDataset.class.isAssignableFrom( crDsClass ) )
    {
      throw new IllegalArgumentException( "Requested class <" + className + "> not an implementation of thredds.crawlabledataset.CrawlableDataset.");
    }

    // Instantiate the desired CrawlableDataset.
    Class [] argTypes = { String.class, Object.class };
    Object [] args = { path, configObj };
    Constructor constructor = crDsClass.getDeclaredConstructor( argTypes );

    try
    {
      return (CrawlableDataset) constructor.newInstance( args );
    }
    catch ( InvocationTargetException e )
    {
      if ( IOException.class.isAssignableFrom( e.getCause().getClass()) )
        throw (IOException) e.getCause();
      else throw e;
    }
  }
Construct a CrawlableDataset for the given path using the
CrawlableDataset implementation indicated by the given class name.

The class given by className is used to instantiate the requested
CrawlableDataset and so must be an implementation of
thredds.crawlabledataset.CrawlableDataset. The given class must also
supply a public constructor with a single String argument. The String
argument is the path for the CrawlableDataset being constructed.

If className is null, thredds.crawlabledataset.CrawlableDatasetFile will
be used.

If the path is an alias containing wildcard characters ("*"),
the class thredds.crawlabledataset.CrawlableDatasetAlias will be used to
expand the alias into a collection of CrawlableDatasets of the type given
by className.

@param path the path of the CrawlableDataset.
@param className the class name of the CrawlableDataset implementation to instantiate.
@param configObj

@return a CrawlableDataset for the given path and of the type given by the class name.

@throws IOException if a CrawlableDataset cannot be created due to IO problems.
@throws ClassNotFoundException if the given CrawlableDataset implementation was not found.
@throws NoSuchMethodException if the given CrawlableDataset implementation does not have a constructor with a single String parameter which is required.
@throws IllegalAccessException if the constructor is inaccessible due to Java language access control.
@throws InvocationTargetException if the constructor throws an exception.
@throws InstantiationException if the given CrawlableDataset implementation is an abstract class.

@throws NullPointerException if the given path is null.
@throws IllegalArgumentException if the given class name is not an implementation of CrawlableDataset.