edu.isi.pegasus.planner.parser.dax
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 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 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 String |
mDAGLFN
The file attribute encountered in the dag element.
|
private String |
mDAXLFN
The file attribute encountered in the dax element.
|
String |
mDaxSchemaVersion |
private static Map<String,String> |
mExecutionToHintsNamespace
The map that maps keys in execution tag to hints namespace.
|
protected String |
mJobPrefix
The job prefix that needs to be applied to the job file basenames.
|
private String |
mNamespace
For holding the namespace if specified in the Profile Element.
|
private List<PCRelation> |
mParents
The list of parents of a node referred to by mCurrentChildId.
|
private 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 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 Set |
mVJobInpFiles
Holds the input files for a particular job making the aDag.
|
private Set |
mVJobOutFiles
Holds the output files for a particular job making the aDag.
|
private String |
mWholeCommandString
All the arguments to a particular job.
|
static String |
SCHEMA_LOCATION
The "not-so-official" location URL of the DAX schema definition.
|
static 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(String uri,
String localName,
String qName)
Overrides the default implementation when the elements end tag comes.
|
private static String |
executionToHintsNamespace(String key)
Maps the execution key to corresponding key in hints namespace.
|
String |
extractVersionFromSchema(String schema)
Determines the version of the DAX as specified in a schema string.
|
Callback |
getDAXCallback()
Retuns the DAXCallback for the parser
|
String |
getSchemaLocation()
Helps the load database to locate the DAX XML schema, if available.
|
String |
getSchemaNamespace()
Returns the XML schema namespace that a document being parsed conforms
to.
|
String |
getSchemaOfDocument(String file)
A convenience method that tries to get the name of the schema the document
refers to.
|
String |
getVersionOfDAX(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(String local,
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(String local,
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(String local,
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(String local,
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(String local,
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(String local,
Attributes attrs)
Replaces the keys associated with the execution tag, with the corresponding
keys in the hints profile namespace
|
private void |
handleFilenameTagStart(String local,
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(String local,
Attributes attrs)
Invoked when the starting of the job element is got.
|
private void |
handleMetadataTagEnd()
Resets the text content buffer
|
private void |
handleMetadataTagStart(String local,
Attributes attrs)
Metadata parsing is ignored for time being.
|
private void |
handleParentTagStart(String local,
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(String local,
Attributes attrs)
Invoked when the starting of the profile element is got.
|
private void |
handleStderrTagStart(String local,
Attributes attrs)
Invoked when the starting of the stdout tag is reached.
|
private void |
handleStdinTagStart(String local,
Attributes attrs)
Invoked when the starting of the stdin tag is reached.
|
private void |
handleStdoutTagStart(String local,
Attributes attrs)
Invoked when the starting of the stdout tag is reached.
|
private void |
handleUsesPFNTagStart(String local,
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(String local,
Attributes attrs)
Invoked when the starting of the uses element is got.
|
String |
ignoreWhitespace(String str)
Our own implementation for ignorable whitespace.
|
static void |
main(String[] args)
The main program.
|
void |
setDAXCallback(Callback c)
Set the DAXCallback for the parser to call out to.
|
float |
shiftRight(String value)
Returns a float with the decimal point shifted right till the end.
|
void |
startElement(String uri,
String local,
String raw,
Attributes attrs)
Overriding the empty implementation provided by
DefaultHandler of ContentHandler.
|
void |
startParser(String daxFileName)
This starts the parsing of the file by the parser.
|
protected boolean |
useDoubleNegative(String daxVersion)
Determines whether to use a doubleNegative or not.
|
characters, ignoreWhitespace, setDocumentLocator, setParserFeature, setSchemaLocations, testForFile
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
public static final String SCHEMA_LOCATION
public static final String SCHEMA_NAMESPACE
private static final String DAX_VERSION_WITHOUT_DOUBLE_NEGATIVE
private static Map<String,String> mExecutionToHintsNamespace
public String mDaxSchemaVersion
private boolean infoAboutAllFilesRecv
private Callback mCallback
private String mProfileKey
private String mNamespace
private boolean mProfileTag
private boolean mArgumentTag
private String mCurrentChildId
private List<PCRelation> mParents
private Job mCurrentJobSubInfo
private String mWholeCommandString
private Set mVJobInpFiles
org.griphyn.cPlanner.classes.PegasusFile
private Set mVJobOutFiles
org.griphyn.cPlanner.classes.PegasusFile
private boolean mUseDoubleNegative
protected String mJobPrefix
private String mUsesLinkType
private PegasusFile mUsesPegasusFile
private String mDAXLFN
private String mDAGLFN
public DAXParser2(PegasusBag bag)
bag
- the bag of objects that is useful for initialization.private static String executionToHintsNamespace(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(String daxFileName)
startParser
in class Parser
daxFileName
- the path/uri to the XML file you want to parse.public void startElement(String uri, String local, String raw, Attributes attrs) throws SAXException
startElement
in interface ContentHandler
startElement
in class Parser
SAXException
public String getVersionOfDAX(String file)
file
- the name of the dax file.public String extractVersionFromSchema(String schema)
schema
- the schema string as specified in the root element of
the DAX.public String getSchemaOfDocument(String file)
file
- the name of the dax file.private void handleAdagTagStart(String local, Attributes attrs)
private void handleExecutionTagStart(String local, Attributes attrs)
local
- the local name of the leemntattrs
- the attributesprivate void handleFilenameTagStart(String local, Attributes attrs)
private void handleMetadataTagStart(String local, Attributes attrs)
local
- attrs
- private void handleMetadataTagEnd()
private void handleUsesTagStart(String local, Attributes attrs)
private void handleUsesTagEnd()
private void handleUsesPFNTagStart(String local, Attributes attrs)
local
- the local name of the elementattrs
- the map of attributes and values in the element tagprivate void handleDAGTagStart(String local, Attributes attrs)
local
- the local name of the elementattrs
- the attributesprivate void handleDAXTagStart(String local, Attributes attrs)
local
- the local name of the elementattrs
- the attributesprivate void handleJobTagStart(String local, 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(String local, Attributes attrs)
private void handleExecutionTagEnd()
private TransformationCatalogEntry constructTCEntryFromJobHints(Job job)
job
- the job objectprivate void handleProfileTagEnd()
private void handleChildTagStart(String local, Attributes attrs)
private void handleChildTagEnd()
private void handleParentTagStart(String local, Attributes attrs)
private void handleArgumentTagStart(String local, Attributes attrs)
private void handleArgumentTagEnd()
public String ignoreWhitespace(String str)
ignoreWhitespace
in class Parser
str
- The string that contains whitespaces.private void handleStdoutTagStart(String local, Attributes attrs)
private void handleStdinTagStart(String local, Attributes attrs)
private void handleStderrTagStart(String local, Attributes attrs)
public void endElement(String uri, String localName, String qName)
endElement
in interface ContentHandler
endElement
in class Parser
public void endDocument()
endDocument
in interface ContentHandler
endDocument
in class Parser
public static void main(String[] args)
public String getSchemaNamespace()
getSchemaNamespace
in class Parser
public String getSchemaLocation()
getSchemaLocation
in class Parser
protected boolean useDoubleNegative(String daxVersion)
daxVersion
- the version of the dax as determined.public float shiftRight(String value)
value
- the value that has to be shifted right.