edu.ucla.stat.SOCR.TG_distributome.editor
Class FileParser

java.lang.Object
  extended by edu.ucla.stat.SOCR.TG_distributome.editor.FileParser

public class FileParser
extends java.lang.Object

Class that parses a file and extracts provenance data.

Version:
11 September 2007

Constructor Summary
FileParser(java.io.File file)
          Constructs a File Parser.
 
Method Summary
 void decodeError(DecodingException e)
          Receives notification of a decoding error.
 java.lang.String[] encodeData(SourceTree targetTree, TreeModule data)
          Encodes data to the specified target.
 void encodeError(EncodingException e)
          Receives notification of an encoding error.
 void error(org.xml.sax.SAXParseException e)
          Receives notification of a recoverable parser error.
 void fatalError(org.xml.sax.SAXParseException e)
          Receives notification of a non-recoverable parser error.
 void flowFinished(Module module)
          Called by a Flow Engine whenever it finishes directing flow through a Module.
 void flowStarted(Module module)
          Called by a Flow Engine whenever it starts directing flow through a Module.
 org.w3c.dom.Node getProvenanceNode()
          Gets the parsed provenance data.
 void groupIdAssigned(java.lang.String groupId, java.net.URI[] uris)
          Called by a Source Translator when a group id for a source has been assigned.
 void groupIdNotAssigned(java.lang.Exception e, java.net.URI[] uris)
          Called by a Source Translator when the group id for a source cannot be assigned.
 void groupNotTranslated(java.lang.Exception e, java.net.URI[] uris, java.lang.String[] sourceNames, java.lang.String[] targetNames)
          Called by a Source Translator when a translation group cannot be translated.
 void groupTranslated(java.lang.String[] sourceNames, java.lang.String[] targetNames)
          Called by a Source Translator when a translation group is translated.
 void multipleGroupAssignmentBegun()
          Called by a Source Translator when multiple sources are about to be assigned group ids.
 void multipleGroupAssignmentEnded(int successNumber)
          Called by a Source Translator when multiple sources have been assigned group ids.
 void multipleSourceIdentificationBegun()
          Called by a Source Translator when multiple sources are about to be identified.
 void multipleSourceIdentificationEnded(int successNumber)
          Called by a Source Translator when multiple sources have been identified.
 void multipleTranslationBegun()
          Called by a Source Translator when multiple sources are about to be translated.
 void multipleTranslationEnded(int successNumber)
          Called by a Source Translator when multiple sources have been translated.
 void sourceDataLoaded(java.lang.String sourceName, java.net.URI[] uris)
          Called by a Source Translator when a source has been decoded and its values have been copied into a translation.
 void sourceDataNotLoaded(java.lang.Exception e, java.lang.String sourceName, java.net.URI[] uris)
          Called by a Source Translator when a source has not been decoded and its values were not copied into a translation.
 void sourceIdentified(java.lang.String sourceName, java.net.URI[] uris)
          Called by a Source Translator when a source name has been identified.
 void sourceMisidentified(java.lang.String sourceName, java.lang.Exception e, java.net.URI[] uris)
          Called by a Source Translator when a source is misidentified.
 void sourceNotIdentified(java.lang.Exception e, java.net.URI[] uris)
          Called by a Source Translator when a source name can not be identified.
 void targetDataNotWritten(java.lang.Exception e, java.lang.String targetName)
          Called by a Source Translator when target data could not be written due to an unsuccessful translation.
 void targetDataWritten(java.lang.String targetName, java.lang.String[] target)
          Called by a Source Translator when a target has been written after a successful translation.
 void translationGroupsFormed(int numberOfGroups)
          Called by a Source Translator when multiple sources have been separated into translation groups.
 void warning(org.xml.sax.SAXParseException e)
          Receives notification of a parser warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileParser

public FileParser(java.io.File file)
           throws java.io.IOException
Constructs a File Parser.

Parameters:
file - File to parse and extract provenance data from.
Throws:
java.io.IOException - If an I/O error occurs.
Method Detail

getProvenanceNode

public org.w3c.dom.Node getProvenanceNode()
Gets the parsed provenance data.

Returns:
Node containing the parsed provenance data.

encodeData

public java.lang.String[] encodeData(SourceTree targetTree,
                                     TreeModule data)
                              throws java.io.IOException
Encodes data to the specified target.

Parameters:
targetTree - Source Tree that describes the target.
data - Tree Module of data to encode.
Returns:
String representation of the targets written to.
Throws:
java.io.IOException - If an I/O error occurs.

multipleSourceIdentificationBegun

public void multipleSourceIdentificationBegun()
Called by a Source Translator when multiple sources are about to be identified.


sourceIdentified

public void sourceIdentified(java.lang.String sourceName,
                             java.net.URI[] uris)
Called by a Source Translator when a source name has been identified.

Parameters:
sourceName - Name of the identified source.
uris - URI's that have been identified.

sourceMisidentified

public void sourceMisidentified(java.lang.String sourceName,
                                java.lang.Exception e,
                                java.net.URI[] uris)
Called by a Source Translator when a source is misidentified.

Parameters:
sourceName - Misidentified source name.
e - Exception resulting from the error.
uris - URI's that were misidentified.

sourceNotIdentified

public void sourceNotIdentified(java.lang.Exception e,
                                java.net.URI[] uris)
Called by a Source Translator when a source name can not be identified.

Parameters:
e - Exception resulting from the error.
uris - URI's that have not been identified.

multipleSourceIdentificationEnded

public void multipleSourceIdentificationEnded(int successNumber)
Called by a Source Translator when multiple sources have been identified.

Parameters:
successNumber - Number of successful sources identified.

multipleGroupAssignmentBegun

public void multipleGroupAssignmentBegun()
Called by a Source Translator when multiple sources are about to be assigned group ids.


groupIdAssigned

public void groupIdAssigned(java.lang.String groupId,
                            java.net.URI[] uris)
Called by a Source Translator when a group id for a source has been assigned.

Parameters:
groupId - Group id assigned.
uris - URI's that have been assigned a group id.

groupIdNotAssigned

public void groupIdNotAssigned(java.lang.Exception e,
                               java.net.URI[] uris)
Called by a Source Translator when the group id for a source cannot be assigned.

Parameters:
e - Exception resulting from the error.
uris - URI's that have not been assigned a group id.

multipleGroupAssignmentEnded

public void multipleGroupAssignmentEnded(int successNumber)
Called by a Source Translator when multiple sources have been assigned group ids.

Parameters:
successNumber - Number of successful group ids assigned.

multipleTranslationBegun

public void multipleTranslationBegun()
Called by a Source Translator when multiple sources are about to be translated.


translationGroupsFormed

public void translationGroupsFormed(int numberOfGroups)
Called by a Source Translator when multiple sources have been separated into translation groups.

Parameters:
numberOfGroups - Number of translation groups formed.

sourceDataLoaded

public void sourceDataLoaded(java.lang.String sourceName,
                             java.net.URI[] uris)
Called by a Source Translator when a source has been decoded and its values have been copied into a translation.

Parameters:
sourceName - Name of the source.
uris - URI's that have been decoded and whose values have been copied into a translation.

sourceDataNotLoaded

public void sourceDataNotLoaded(java.lang.Exception e,
                                java.lang.String sourceName,
                                java.net.URI[] uris)
Called by a Source Translator when a source has not been decoded and its values were not copied into a translation.

Parameters:
e - Exception resulting from the error.
sourceName - Name of the source.
uris - URI's that have not been decoded and whose values were not copied into a translation.

targetDataWritten

public void targetDataWritten(java.lang.String targetName,
                              java.lang.String[] target)
Called by a Source Translator when a target has been written after a successful translation.

Parameters:
targetName - Name of the target.
target - String representation of the target.

targetDataNotWritten

public void targetDataNotWritten(java.lang.Exception e,
                                 java.lang.String targetName)
Called by a Source Translator when target data could not be written due to an unsuccessful translation.

Parameters:
e - Exception resulting from the error.
targetName - Name of the target.

groupTranslated

public void groupTranslated(java.lang.String[] sourceNames,
                            java.lang.String[] targetNames)
Called by a Source Translator when a translation group is translated.

Parameters:
sourceNames - Names of the translation sources.
targetNames - Names of the translation targets.

groupNotTranslated

public void groupNotTranslated(java.lang.Exception e,
                               java.net.URI[] uris,
                               java.lang.String[] sourceNames,
                               java.lang.String[] targetNames)
Called by a Source Translator when a translation group cannot be translated.

Parameters:
e - Exception resulting from the error.
uris - URI's that have not been translated.
sourceNames - Names of the translation sources.
targetNames - Names of the translation targets.

multipleTranslationEnded

public void multipleTranslationEnded(int successNumber)
Called by a Source Translator when multiple sources have been translated.

Parameters:
successNumber - Number of successful translations.

flowStarted

public void flowStarted(Module module)
Called by a Flow Engine whenever it starts directing flow through a Module.

Parameters:
module - Module that the Flow Engine is starting to direct flow through.

flowFinished

public void flowFinished(Module module)
Called by a Flow Engine whenever it finishes directing flow through a Module.

Parameters:
module - Module that the Flow Engine has finished directing flow through.

warning

public void warning(org.xml.sax.SAXParseException e)
Receives notification of a parser warning.

Parameters:
e - Exception resulting from the warning.

error

public void error(org.xml.sax.SAXParseException e)
Receives notification of a recoverable parser error.

Parameters:
e - Exception resulting from the recoverable error.

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
Receives notification of a non-recoverable parser error.

Parameters:
e - Exception resulting from the non-recoverable error.

decodeError

public void decodeError(DecodingException e)
Receives notification of a decoding error.

Parameters:
e - Exception resulting from the decoding error.

encodeError

public void encodeError(EncodingException e)
Receives notification of an encoding error.

Parameters:
e - Exception resulting from the encoding error.