public class DAXParser2 extends Parser implements DAXParser
org.griphyn.cPlanner.classes.Job
,
org.griphyn.cPlanner.classes.DagInfo
,
org.griphyn.cPlanner.classes.ADag
,
org.griphyn.cPlanner.classes.PCRelation
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DAX_VERSION_WITHOUT_DOUBLE_NEGATIVE
The constant designating the version when the double negative transfer
and registration flags were removed.
|
private boolean |
infoAboutAllFilesRecv
A boolean variable set to true when we have got all the logical filenames.
|
private boolean |
mArgumentTag |
private Callback |
mCallback
The handle to the class implementing the callback interface.
|
private java.lang.String |
mCurrentChildId
These store the current child element for the child parent relationship.
|
private Job |
mCurrentJobSubInfo
Holds information regarding the current job being parsed.
|
private java.lang.String |
mDAGLFN
The file attribute encountered in the dag element.
|
private java.lang.String |
mDAXLFN
The file attribute encountered in the dax element.
|
java.lang.String |
mDaxSchemaVersion |
private static java.util.Map<java.lang.String,java.lang.String> |
mExecutionToHintsNamespace
The map that maps keys in execution tag to hints namespace.
|
protected java.lang.String |
mJobPrefix
The job prefix that needs to be applied to the job file basenames.
|
private java.lang.String |
mNamespace
For holding the namespace if specified in the Profile Element.
|
private java.util.List<PCRelation> |
mParents
The list of parents of a node referred to by mCurrentChildId.
|
private java.lang.String |
mProfileKey
For holding the key attribute in profile tag.
|
private boolean |
mProfileTag
Set as and when Profile and Argument tags are started and ended.
|
private boolean |
mUseDoubleNegative
A boolean indicating whether to use the double negative flags for
transfer and register or not.
|
private java.lang.String |
mUsesLinkType
The uses link type for a file when uses tag is parsed.
|
private PegasusFile |
mUsesPegasusFile
The PegasusFile object that a uses tag corresponds to.
|
private java.util.Set |
mVJobInpFiles
Holds the input files for a particular job making the aDag.
|
private java.util.Set |
mVJobOutFiles
Holds the output files for a particular job making the aDag.
|
private java.lang.String |
mWholeCommandString
All the arguments to a particular job.
|
static java.lang.String |
SCHEMA_LOCATION
The "not-so-official" location URL of the DAX schema definition.
|
static java.lang.String |
SCHEMA_NAMESPACE
URI namespace
|
DEFAULT_PARSER_NAME, mAdjFName, mLocator, mLogger, mLogMsg, mParser, mProps, mTextContent, mTextString
Constructor and Description |
---|
DAXParser2(PegasusBag bag)
The default constructor
|
Modifier and Type | Method and Description |
---|---|
private TransformationCatalogEntry |
constructTCEntryFromJobHints(Job job)
Constructs a TC entry object from the contents of a job.
|
void |
endDocument()
Here we have all the elements in our data structure.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Overrides the default implementation when the elements end tag comes.
|
private static java.lang.String |
executionToHintsNamespace(java.lang.String key)
Maps the execution key to corresponding key in hints namespace.
|
java.lang.String |
extractVersionFromSchema(java.lang.String schema)
Determines the version of the DAX as specified in a schema string.
|
Callback |
getDAXCallback()
Retuns the DAXCallback for the parser
|
java.lang.String |
getSchemaLocation()
Helps the load database to locate the DAX XML schema, if available.
|
java.lang.String |
getSchemaNamespace()
Returns the XML schema namespace that a document being parsed conforms
to.
|
java.lang.String |
getSchemaOfDocument(java.lang.String file)
A convenience method that tries to get the name of the schema the document
refers to.
|
java.lang.String |
getVersionOfDAX(java.lang.String file)
A convenience method that tries to determine the version of the dax
schema by reading ahead in the DAX file, and searching for
the version attribue in the file.
|
private void |
handleAdagTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the adag element is got.
|
private void |
handleArgumentTagEnd()
Invoked when the end of the Argument Tag is reached.
|
private void |
handleArgumentTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the Argument Tag is reached.
|
private void |
handleChildTagEnd()
This passes the child and it's parents list to the callback object.
|
private void |
handleChildTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the child element is got.
|
private void |
handleDAGTagEnd()
Invoked when the end of the dag tag is reached.
|
private void |
handleDAGTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the dax element is retrieved.
|
private void |
handleDAXTagEnd()
Invoked when the end of the job tag is reached.
|
private void |
handleDAXTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the dax element is retrieved.
|
private void |
handleExecutionTagEnd()
Invoked when the end of the execution element is reached.
|
private void |
handleExecutionTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Replaces the keys associated with the execution tag, with the corresponding
keys in the hints profile namespace
|
private void |
handleFilenameTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the filename element is got.
|
private void |
handleJobTagEnd()
Invoked when the end of the job tag is reached.
|
private void |
handleJobTagStart(Job job)
Invoked when the starting of the job element is got.
|
private void |
handleJobTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the job element is got.
|
private void |
handleMetadataTagEnd()
Resets the text content buffer
|
private void |
handleMetadataTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Metadata parsing is ignored for time being.
|
private void |
handleParentTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the parent element is got.
|
private void |
handleProfileTagEnd()
Invoked when the end of the profile element is got.
|
private void |
handleProfileTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the profile element is got.
|
private void |
handleStderrTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the stdout tag is reached.
|
private void |
handleStdinTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the stdin tag is reached.
|
private void |
handleStdoutTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the stdout tag is reached.
|
private void |
handleUsesPFNTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when start of the pfn element nested in uses element is encountered
|
private void |
handleUsesTagEnd()
Handles the end of a uses tag.
|
private void |
handleUsesTagStart(java.lang.String local,
org.xml.sax.Attributes attrs)
Invoked when the starting of the uses element is got.
|
java.lang.String |
ignoreWhitespace(java.lang.String str)
Our own implementation for ignorable whitespace.
|
static void |
main(java.lang.String[] args)
The main program.
|
void |
setDAXCallback(Callback c)
Set the DAXCallback for the parser to call out to.
|
float |
shiftRight(java.lang.String value)
Returns a float with the decimal point shifted right till the end.
|
void |
startElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw,
org.xml.sax.Attributes attrs)
Overriding the empty implementation provided by
DefaultHandler of ContentHandler.
|
void |
startParser(java.lang.String daxFileName)
This starts the parsing of the file by the parser.
|
protected boolean |
useDoubleNegative(java.lang.String daxVersion)
Determines whether to use a doubleNegative or not.
|
characters, ignoreWhitespace, setDocumentLocator, setParserFeature, setSchemaLocations, testForFile
public static final java.lang.String SCHEMA_LOCATION
public static final java.lang.String SCHEMA_NAMESPACE
private static final java.lang.String DAX_VERSION_WITHOUT_DOUBLE_NEGATIVE
private static java.util.Map<java.lang.String,java.lang.String> mExecutionToHintsNamespace
public java.lang.String mDaxSchemaVersion
private boolean infoAboutAllFilesRecv
private Callback mCallback
private java.lang.String mProfileKey
private java.lang.String mNamespace
private boolean mProfileTag
private boolean mArgumentTag
private java.lang.String mCurrentChildId
private java.util.List<PCRelation> mParents
private Job mCurrentJobSubInfo
private java.lang.String mWholeCommandString
private java.util.Set mVJobInpFiles
org.griphyn.cPlanner.classes.PegasusFile
private java.util.Set mVJobOutFiles
org.griphyn.cPlanner.classes.PegasusFile
private boolean mUseDoubleNegative
protected java.lang.String mJobPrefix
private java.lang.String mUsesLinkType
private PegasusFile mUsesPegasusFile
private java.lang.String mDAXLFN
private java.lang.String mDAGLFN
public DAXParser2(PegasusBag bag)
bag
- the bag of objects that is useful for initialization.private static java.lang.String executionToHintsNamespace(java.lang.String key)
key
- the key in execution tagpublic void setDAXCallback(Callback c)
setDAXCallback
in interface DAXParser
c
- the callbackpublic Callback getDAXCallback()
getDAXCallback
in interface DAXParser
public void startParser(java.lang.String daxFileName)
startParser
in class Parser
daxFileName
- the path/uri to the XML file you want to parse.public void startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class Parser
org.xml.sax.SAXException
public java.lang.String getVersionOfDAX(java.lang.String file)
file
- the name of the dax file.public java.lang.String extractVersionFromSchema(java.lang.String schema)
schema
- the schema string as specified in the root element of
the DAX.public java.lang.String getSchemaOfDocument(java.lang.String file)
file
- the name of the dax file.private void handleAdagTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleExecutionTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
local
- the local name of the leemntattrs
- the attributesprivate void handleFilenameTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleMetadataTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
local
- attrs
- private void handleMetadataTagEnd()
private void handleUsesTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleUsesTagEnd()
private void handleUsesPFNTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
local
- the local name of the elementattrs
- the map of attributes and values in the element tagprivate void handleDAGTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
local
- the local name of the elementattrs
- the attributesprivate void handleDAXTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
local
- the local name of the elementattrs
- the attributesprivate void handleJobTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
local
- the local name of the elementattrs
- the attributesprivate void handleJobTagStart(Job job)
job
- the Job
objectprivate void handleDAGTagEnd()
private void handleDAXTagEnd()
private void handleJobTagEnd()
private void handleProfileTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleExecutionTagEnd()
private TransformationCatalogEntry constructTCEntryFromJobHints(Job job)
job
- the job objectprivate void handleProfileTagEnd()
private void handleChildTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleChildTagEnd()
private void handleParentTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleArgumentTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleArgumentTagEnd()
public java.lang.String ignoreWhitespace(java.lang.String str)
ignoreWhitespace
in class Parser
str
- The string that contains whitespaces.private void handleStdoutTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleStdinTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
private void handleStderrTagStart(java.lang.String local, org.xml.sax.Attributes attrs)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
endElement
in class Parser
public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class Parser
public static void main(java.lang.String[] args)
public java.lang.String getSchemaNamespace()
getSchemaNamespace
in class Parser
public java.lang.String getSchemaLocation()
getSchemaLocation
in class Parser
protected boolean useDoubleNegative(java.lang.String daxVersion)
daxVersion
- the version of the dax as determined.public float shiftRight(java.lang.String value)
value
- the value that has to be shifted right.