public ParseResult parseSources(String sources[])
      throws IOException
  {
    final CourierParseResult result = new CourierParseResult();

    try
    {
      for (String source : sources)
      {
        final File sourceFile = new File(source);
        if (sourceFile.exists())
        {
          if (sourceFile.isDirectory())
          {
            final List<File> sourceFilesInDirectory = FileUtil.listFiles(sourceFile, _fileExtensionFilter);
            for (File f : sourceFilesInDirectory)
            {
              parseFile(f, result);
            }
          }
          else
          {
            parseFile(sourceFile, result);
          }
        }
        else
        {
          final StringBuilder errorMessage = new StringBuilder();
          final DataSchema schema = _schemaResolver.findDataSchema(source, errorMessage);
          if (schema == null)
          {
            result.addMessage("File cannot be opened or schema name cannot be resolved: ").addMessage(source).addMessage("\n");
          }
          if (errorMessage.length() > 0)
          {
            result.addMessage(errorMessage.toString());
          }
        }
      }

      for (Map.Entry<String, DataSchemaLocation> entry : _schemaResolver.nameToDataSchemaLocations().entrySet()) {
        final DataSchema schema = _schemaResolver.bindings().get(entry.getKey());
        result.getSchemaAndLocations().put(schema, entry.getValue());
      }

      if (result.getMessage().length() > 0)
      {
        throw new IOException(result.getMessage());
      }

      appendSourceFilesFromSchemaResolver(result);

      return result;
    }
    catch (RuntimeException e)
    {
      if (result.getMessage().length() > 0)
      {
        e = new RuntimeException("Unexpected " + e.getClass().getSimpleName() + " encountered.\n" +
            "This may be caused by the following parsing or processing errors:\n" +
            result.getMessage(), e);
      }
      throw e;
    }
  }
public ParseResult parseSources ( String sources [ ] ) throws IOException { final CourierParseResult result = new CourierParseResult ( ) ; try { for ( String source : sources ) { final File sourceFile = new File ( source ) ; if ( sourceFile . exists ( ) ) { if ( sourceFile . isDirectory ( ) ) { final List < File > sourceFilesInDirectory = FileUtil . listFiles ( sourceFile , _fileExtensionFilter ) ; for ( File f : sourceFilesInDirectory ) { parseFile ( f , result ) ; } } else { parseFile ( sourceFile , result ) ; } } else { final StringBuilder errorMessage = new StringBuilder ( ) ; final DataSchema schema = _schemaResolver . findDataSchema ( source , errorMessage ) ; if ( schema == null ) { result . addMessage ( "File cannot be opened or schema name cannot be resolved: " ) . addMessage ( source ) . addMessage ( "\n" ) ; } if ( errorMessage . length ( ) > 0 ) { result . addMessage ( errorMessage . toString ( ) ) ; } } } for ( Map . Entry < String , DataSchemaLocation > entry : _schemaResolver . nameToDataSchemaLocations ( ) . entrySet ( ) ) { final DataSchema schema = _schemaResolver . bindings ( ) . get ( entry . getKey ( ) ) ; result . getSchemaAndLocations ( ) . put ( schema , entry . getValue ( ) ) ; } if ( result . getMessage ( ) . length ( ) > 0 ) { throw new IOException ( result . getMessage ( ) ) ; } appendSourceFilesFromSchemaResolver ( result ) ; return result ; } catch ( RuntimeException e ) { if ( result . getMessage ( ) . length ( ) > 0 ) { e = new RuntimeException ( "Unexpected " + e . getClass ( ) . getSimpleName ( ) + " encountered.\n" + "This may be caused by the following parsing or processing errors:\n" + result . getMessage ( ) , e ) ; } throw e ; } }
Parses sources that specify paths to schema files and/or fully qualified schema names.

@param sources provides the paths to schema files and/or fully qualified schema names.

@return {@link ParseResult} for what were read.

@throws java.io.IOException if there are problems opening or deleting files.