edu.nrao.sss.model.source.parser
Interface SourceCatalogReader

All Known Implementing Classes:
AbstractSourceCatalogReader, CarmaSourceCatalogReader, GbtSourceCatalogReader, OldVlbaSourceCatalogReader, PdBISourceCatalogReader, PstSourceCatalogReader, VlaCalibDbHtmlReader, VlbaSourceCatalogReader, XmlSourceCatalogReader

public interface SourceCatalogReader

A reader that creates source catalogs from text.

CVS Info:

$Revision: 1273 $
$Date: 2008-05-07 13:46:38 -0600 (Wed, 07 May 2008) $
$Author: jrochfor $

Since:
2006-11-20
Author:
David M. Harland

Method Summary
 SourceCatalog getCatalog()
          Returns the catalog most recently created by this reader.
 String getError(int index)
          Returns the indexth error found during the most recent read.
 int getErrorCount()
          Returns the number of errors found during the most recent read.
 StringBuilder getErrors()
          Returns the combined text of all errors found during the most recent read.
 boolean getSuccess()
          Returns true if the most recently read data caused no parsing errors.
 boolean read(InputStream in)
          Reads data from in and uses it to add sources to a SourceCatalog.
 boolean read(InputStream in, FileCompressionFormat format)
          Reads data from in and uses it to add sources to a SourceCatalog.
 boolean read(InputStream in, SourceCatalog destination)
          Reads data from in and uses it to add sources to destination.
 boolean read(InputStream in, SourceCatalog destination, FileCompressionFormat format)
          Reads data from in and uses it to add sources to destination.
 boolean read(Reader in)
          Reads data from in and uses it to add sources to a SourceCatalog.
 boolean read(Reader in, SourceCatalog destination)
          Reads data from in and uses it to add sources to destination.
 boolean read(String fileName)
          Reads data from a file and uses it to add sources to a SourceCatalog.
 boolean read(String fileName, SourceCatalog destination)
          Reads data from a file and uses it to add sources to destination.
 void setOriginOfSourceInformation(String origin)
          Sets text that will be used as the source of information for each source read by this reader.
 void setPrefixForHistoricalRecords(String prefix)
          Sets text that will be used as a prefix for any historical source records generated by this reader.
 

Method Detail

read

boolean read(String fileName)
             throws FileNotFoundException
Reads data from a file and uses it to add sources to a SourceCatalog.

Parameters:
fileName - the name of a data file.
Returns:
true if nothing unexpected occurred while reading data.
Throws:
FileNotFoundException - if the data file could not be found.
See Also:
read(Reader, SourceCatalog)

read

boolean read(String fileName,
             SourceCatalog destination)
             throws FileNotFoundException
Reads data from a file and uses it to add sources to destination.

Parameters:
fileName - the name of a data file.
destination - the catalog to which the sources should be added. If this parameter is null, a new catalog will be created.
Returns:
true if nothing unexpected occurred while reading data.
Throws:
FileNotFoundException - if the data file could not be found.
See Also:
read(Reader, SourceCatalog)

read

boolean read(Reader in)
Reads data from in and uses it to add sources to a SourceCatalog.

Parameters:
in - the source of text that can be read and turned into Source objects.
Returns:
true if nothing unexpected occurred while reading data.
See Also:
read(Reader, SourceCatalog)

read

boolean read(Reader in,
             SourceCatalog destination)
Reads data from in and uses it to add sources to destination.

Parameters:
in - the source of text that can be read and turned into Source objects.
destination - the catalog to which the sources should be added. If this parameter is null, a new catalog will be created.
Returns:
true if nothing unexpected occurred while reading data.
See Also:
getCatalog(), getErrors()

read

boolean read(InputStream in)
Reads data from in and uses it to add sources to a SourceCatalog.

Parameters:
in - the source of text that can be read and turned into Source objects.
Returns:
true if nothing unexpected occurred while reading data.
See Also:
read(InputStream, SourceCatalog)

read

boolean read(InputStream in,
             SourceCatalog destination)
Reads data from in and uses it to add sources to destination.

Parameters:
in - the source of text that can be read and turned into Source objects.
destination - the catalog to which the sources should be added. If this parameter is null, a new catalog will be created.
Returns:
true if nothing unexpected occurred while reading data.
See Also:
getCatalog(), getErrors()

read

boolean read(InputStream in,
             FileCompressionFormat format)
Reads data from in and uses it to add sources to a SourceCatalog. If format is specified and non-null, the InputStream should be uncompressed if necessary before being used as a source for Source information.

Parameters:
in - the source of text that can be read and turned into Source objects.
Returns:
true if nothing unexpected occurred while reading data.
See Also:
getCatalog(), getErrors()

read

boolean read(InputStream in,
             SourceCatalog destination,
             FileCompressionFormat format)
Reads data from in and uses it to add sources to destination. If format is specified and non-null, the InputStream should be uncompressed if necessary before being used as a source for Source information.

Parameters:
in - the source of text that can be read and turned into Source objects.
destination - the catalog to which the sources should be added. If this parameter is null, a new catalog will be created.
Returns:
true if nothing unexpected occurred while reading data.
See Also:
getCatalog(), getErrors()

getCatalog

SourceCatalog getCatalog()
Returns the catalog most recently created by this reader.

If this reader had trouble parsing the catalog data, the returned catalog may be partially or completely unfilled. If the read method has never been called, a new catalog will be returned.

Returns:
the catalog most recently created by this reader. This value is guaranteed to be non-null.

getSuccess

boolean getSuccess()
Returns true if the most recently read data caused no parsing errors. Note that the SourceCatalog created by this reader may be perfectly fine even if this method returns false.

Returns:
true if there were no incidents during the most recent read.

getErrors

StringBuilder getErrors()
Returns the combined text of all errors found during the most recent read.

Note that an "error" is anything unexpected encountered while reading. Not all errors are harmful. The text of each error includes the line number where it occurred and an explanation of what was wrong.

Returns:
the combined text of all errors found during the most recent read.

getError

String getError(int index)
Returns the indexth error found during the most recent read.

Parameters:
index - a positional value >= zero and < getErrorCount().
Returns:
the indexth error found during the most recent read.
See Also:
getErrors()

getErrorCount

int getErrorCount()
Returns the number of errors found during the most recent read.

Returns:
the number of errors found during the most recent read.
See Also:
getErrors()

setOriginOfSourceInformation

void setOriginOfSourceInformation(String origin)
Sets text that will be used as the source of information for each source read by this reader.

Parameters:
origin - text that will be used as the source of information for each source read by this reader. A value of null will be interpreted as a single not to set the source's origin of information.

setPrefixForHistoricalRecords

void setPrefixForHistoricalRecords(String prefix)
Sets text that will be used as a prefix for any historical source records generated by this reader.

Parameters:
prefix - text that will be used as a prefix for any historical source records generated by this reader.


Copyright © 2009. All Rights Reserved.