edu.isi.pegasus.planner.parser.dax

## Class DAX2Graph

- java.lang.Object
- - edu.isi.pegasus.planner.parser.dax.DAX2Graph

All Implemented Interfaces:
  Callback

Direct Known Subclasses:
  DAX2LabelGraph

    public class DAX2Graph
    extends java.lang.Object
    implements Callback

This callback implementation ends up building a detailed structure of the graph referred to by the abstract plan in dax, that should make the graph traversals easier. Later on this graph representation would be used uniformly in the Pegasus code base.

Version:
  $Revision$
Author:
  Karan Vahi

### Field Summary

Fields
`static java.lang.String` `DUMMY_NODE_ID` The id of the dummy root node added on the top of the graph.
`protected java.util.Map` `mAbstractGraph` The map containing the a graph node for each of the jobs referred to in the dax.
`protected boolean` `mDone` A flag to specify whether the graph has been generated for the partition or not.
`protected java.lang.String` `mLabel` The label of the abstract dax as set by Chimera.
`protected LogManager` `mLogger` The logging object.
`protected PegasusProperties` `mProps` The handle to the properties object.
`protected GraphNode` `mRoot` The root node for the graph that is constructed.

### Fields inherited from interface edu.isi.pegasus.planner.parser.dax.Callback

`VERSION`

### Constructor Summary

Constructors
Constructor and Description
`DAX2Graph()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `cbCompoundTransformation(CompoundTransformation compoundTransformation)` Callback when a compound transformation is encountered in the DAX
`void` `cbDocument(java.util.Map attributes)` Callback when the opening tag was parsed.
`void` `cbDone()` Callback to signal that traversal of the DAX is complete.
`void` `cbExecutable(TransformationCatalogEntry tce)` Callback when a transformation catalog entry is encountered in the DAX
`void` `cbFile(ReplicaLocation rl)` Callback when a replica catalog entry is encountered in the DAX
`void` `cbJob(Job job)` This constructs a graph node for the job and ends up storing it in the internal map.
`void` `cbParents(java.lang.String child, java.util.List parents)` This updates the internal graph nodes of child with references to it's parents referred to by the list of parents passed.
`void` `cbWfInvoke(Invoke invoke)` Callback when a invoke entry is encountered in the top level inside the adag element in the DAX.
`java.lang.Object` `get(java.lang.Object key)` It returns the value associated with the key in the map.
`java.lang.Object` `getConstructedObject()` Returns a Map indexed by the logical ID of the jobs, and each value being a GraphNode object.
`java.lang.String` `getNameOfDAX()` Returns the name of the dax.
`void` `initialize(PegasusBag bag, java.lang.String dax)` The overloaded constructor.
`protected void` `put(java.lang.Object key, java.lang.Object value)` It puts the key and the value in the internal map.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DUMMY_NODE_ID

    public static final java.lang.String DUMMY_NODE_ID

The id of the dummy root node added on the top of the graph. Makes easier the starting of the traversal.

See Also:
  Constant Field Values

#### mAbstractGraph

    protected java.util.Map mAbstractGraph

The map containing the a graph node for each of the jobs referred to in the dax. The key is the logical id of the job.

#### mDone

    protected boolean mDone

A flag to specify whether the graph has been generated for the partition or not.

#### mLabel

    protected java.lang.String mLabel

The label of the abstract dax as set by Chimera.

#### mRoot

    protected GraphNode mRoot

The root node for the graph that is constructed.

#### mProps

    protected PegasusProperties mProps

The handle to the properties object.

#### mLogger

    protected LogManager mLogger

The logging object.

### Constructor Detail

#### DAX2Graph

    public DAX2Graph()

### Method Detail

#### initialize

    public void initialize(PegasusBag bag,
                           java.lang.String dax)

The overloaded constructor.

Specified by:
  `initialize` in interface `Callback`
Parameters:
  `bag` - the bag of initialization objects containing the properties and the logger
  `dax` - the path to the DAX file.

#### getConstructedObject

    public java.lang.Object getConstructedObject()

Returns a Map indexed by the logical ID of the jobs, and each value being a GraphNode object.

Specified by:
  `getConstructedObject` in interface `Callback`
Returns:
  ADag object containing the abstract plan referred in the dax.

#### cbDocument

    public void cbDocument(java.util.Map attributes)

Callback when the opening tag was parsed. This contains all attributes and their raw values within a map. It ends up storing the attributes with the adag element in the internal memory structure.

Specified by:
  `cbDocument` in interface `Callback`
Parameters:
  `attributes` - is a map of attribute key to attribute value

#### cbWfInvoke

    public void cbWfInvoke(Invoke invoke)

Callback when a invoke entry is encountered in the top level inside the adag element in the DAX.

Specified by:
  `cbWfInvoke` in interface `Callback`
Parameters:
  `invoke` - the invoke object

#### cbJob

    public void cbJob(Job job)

This constructs a graph node for the job and ends up storing it in the internal map.

Specified by:
  `cbJob` in interface `Callback`
Parameters:
  `job` - the job that was parsed.

#### cbParents

    public void cbParents(java.lang.String child,
                          java.util.List parents)

This updates the internal graph nodes of child with references to it's parents referred to by the list of parents passed. It gets the handle to the parents graph nodes from it's internal map.

Specified by:
  `cbParents` in interface `Callback`
Parameters:
  `child` - the logical id of the child node.
  `parents` - list containing the logical id's of the parents of the child nodes.

#### getNameOfDAX

    public java.lang.String getNameOfDAX()

Returns the name of the dax.

Returns:
  name of dax

#### cbDone

    public void cbDone()

Callback to signal that traversal of the DAX is complete. At this point a dummy root node is added to the graph, that is the parents to all the root nodes in the existing DAX.

Specified by:
  `cbDone` in interface `Callback`

#### put

    protected void put(java.lang.Object key,
                       java.lang.Object value)

It puts the key and the value in the internal map.

Parameters:
  `key` - the key to the entry in the map.
  `value` - the entry in the map.

#### get

    public java.lang.Object get(java.lang.Object key)

It returns the value associated with the key in the map.

Parameters:
  `key` - the key to the entry in the map.
Returns:
  the object

#### cbCompoundTransformation

    public void cbCompoundTransformation(CompoundTransformation compoundTransformation)

Callback when a compound transformation is encountered in the DAX

Specified by:
  `cbCompoundTransformation` in interface `Callback`
Parameters:
  `compoundTransformation` - the compound transforamtion

#### cbFile

    public void cbFile(ReplicaLocation rl)

Callback when a replica catalog entry is encountered in the DAX

Specified by:
  `cbFile` in interface `Callback`
Parameters:
  `rl` - the ReplicaLocation object

#### cbExecutable

    public void cbExecutable(TransformationCatalogEntry tce)

Callback when a transformation catalog entry is encountered in the DAX

Specified by:
  `cbExecutable` in interface `Callback`
Parameters:
  `tce` - the transformation catalog entry object.