legacy/src/main/java/thredds/cataloggen/config/DatasetSource.java
public static final DatasetSource newDatasetSource( String name, DatasetSourceType type,
                                             DatasetSourceStructure structure,
                                             String accessPoint,
                                             ResultService resultService )
  {
    if ( type == null)
    {
      String tmpMsg = "DatasetSource type cannot be null";
      logger.error( "newDatasetSource(): " + tmpMsg);
      throw new IllegalArgumentException( tmpMsg);
    }

    DatasetSource tmpDsSource = null;

    if ( type == DatasetSourceType.getType( "Local"))
    {
      tmpDsSource = new LocalDatasetSource();
    }
    else if ( type == DatasetSourceType.getType( "DodsDir"))
    {
      tmpDsSource = new DodsDirDatasetSource();
    }
    else if ( type == DatasetSourceType.getType( "DodsFileServer"))
    {
      tmpDsSource = new DodsFileServerDatasetSource();
    }
    else if ( type == DatasetSourceType.getType( "GrADSDataServer"))
    {
      tmpDsSource = new GrADSDataServerDatasetSource();
    }
    else
    {
      String tmpMsg = "Unsupported DatasetSource type <" + type.toString() + ">.";
      logger.error( "newDatasetSource(): " + tmpMsg);
      throw new IllegalArgumentException( tmpMsg);
    }

    tmpDsSource.setName( name);
    tmpDsSource.setStructure( structure);
    tmpDsSource.setAccessPoint( accessPoint);
    tmpDsSource.setResultService( resultService);
    // Test validity and append messages to log.

    logger.debug( "DatasetSource(): constructor done.");
    StringBuilder log = new StringBuilder();
    if ( tmpDsSource.validate( log))
    {
      logger.debug( "DatasetSource(): new DatasetSource is valid: {}", log.toString());
    }
    else
    {
      logger.debug( "DatasetSource(): new DatasetSource is invalid: {}", log.toString());
    }

    return( tmpDsSource);
  }
public static final DatasetSource newDatasetSource( String name, DatasetSourceType type,
                                             DatasetSourceStructure structure,
                                             String accessPoint,
                                             ResultService resultService )
  {
    if ( type == null)
    {
      String tmpMsg = "DatasetSource type cannot be null";
      logger.error( "newDatasetSource(): " + tmpMsg);
      throw new IllegalArgumentException( tmpMsg);
    }

    DatasetSource tmpDsSource = null;

    if ( type == DatasetSourceType.getType( "Local"))
    {
      tmpDsSource = new LocalDatasetSource();
    }
    else if ( type == DatasetSourceType.getType( "DodsDir"))
    {
      tmpDsSource = new DodsDirDatasetSource();
    }
    else if ( type == DatasetSourceType.getType( "DodsFileServer"))
    {
      tmpDsSource = new DodsFileServerDatasetSource();
    }
    else if ( type == DatasetSourceType.getType( "GrADSDataServer"))
    {
      tmpDsSource = new GrADSDataServerDatasetSource();
    }
    else
    {
      String tmpMsg = "Unsupported DatasetSource type <" + type.toString() + ">.";
      logger.error( "newDatasetSource(): " + tmpMsg);
      throw new IllegalArgumentException( tmpMsg);
    }

    tmpDsSource.setName( name);
    tmpDsSource.setStructure( structure);
    tmpDsSource.setAccessPoint( accessPoint);
    tmpDsSource.setResultService( resultService);
    // Test validity and append messages to log.

    logger.debug( "DatasetSource(): constructor done.");
    StringBuilder log = new StringBuilder();
    if ( tmpDsSource.validate( log))
    {
      logger.debug( "DatasetSource(): new DatasetSource is valid: {}", log.toString());
    }
    else
    {
      logger.debug( "DatasetSource(): new DatasetSource is invalid: {}", log.toString());
    }

    return( tmpDsSource);
  }
Factory method for this abstract class.
@param name
@param type
@param structure
@param accessPoint

@throws IllegalArgumentException if DatasetSource type is null or unsupported.