org.griphyn.cPlanner.partitioner
Class DAXWriter

java.lang.Object
  extended byorg.griphyn.cPlanner.partitioner.DAXWriter
Direct Known Subclasses:
MultipleLook, SingleLook

public abstract class DAXWriter
extends Object

The abstract class that identifies the interface for writing out a dax corresponding to a partition. The interface stipulates that the jobs making up the partition and relations between those jobs in the partition are identified when invoking it. However all the job details are to be gotten by the implementing classes by parsing the original dax.

Version:
$Revision: 1.6 $
Author:
Karan Vahi

Field Summary
protected  String mDaxFile
          The dax file that is being partitioned.
protected  LogManager mLogger
          The handle to the logging object.
protected  String mPartitionName
          The name of the partition dax that are generated.
protected  String mPDAXDirectory
          The directory in which the daxes corresponding to the partition are generated.
protected  PrintWriter mWriteHandle
          The write handle to the xml file being written.
static String PACKAGE_NAME
          The name of the package in which the writers are implemented.
static String PARTITION_PREFIX
          The suffix added to the name of the dax to identify it is a partitioned dax.
 
Constructor Summary
protected DAXWriter()
          The default constructor
protected DAXWriter(String daxFile, String directory)
          The overloaded constructor.
 
Method Summary
 void close()
          Close the write handle to the file that is written.
private static String constructPartitionName(String daxName, boolean addPrefix)
          It constructs the partition name given the daxName.
 String getPartitionName()
          It returns the name of the partitioned dax, that the object is currently writing or initialized to write.
static String getPDAXFilename(String daxName, int index)
          It constructs the name of the partitioned dax file that has to be written corresponding to a partition of the dax.
static String getPDAXFilename(String daxName, int index, boolean addPrefix)
          It constructs the name of the partitioned dax file that has to be written corresponding to a partition of the dax.
 void initializeWriteHandle(int index)
          This initializes the write handle a file in directory specified when creating the instance of this class.
 void initializeWriteHandle(String fileName)
          This initializes the write handle to the file in directory specified when creating the instance of this class.
static DAXWriter loadDAXWriter(String daxFile, String directory)
          The ends up loading the PDAXWriter.
static DAXWriter loadDAXWriter(String className, String daxFile, String directory)
          Loads the implementing PDAXWriter.
 void setPartitionName(String daxName)
          It sets the name of the partition in the dax that is generated.
 void writeln(String st)
          Writes out to the file.
 boolean writePartitionDax(Partition partition)
          It writes out a dax consisting of the jobs as specified in the partition.
abstract  boolean writePartitionDax(Partition partition, int index)
          It writes out a dax consisting of the jobs as specified in the partition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARTITION_PREFIX

public static final String PARTITION_PREFIX
The suffix added to the name of the dax to identify it is a partitioned dax.

See Also:
Constant Field Values

PACKAGE_NAME

public static final String PACKAGE_NAME
The name of the package in which the writers are implemented.

See Also:
Constant Field Values

mDaxFile

protected String mDaxFile
The dax file that is being partitioned. The dax file is the repository for all the jobs in the partitioned daxes.


mPDAXDirectory

protected String mPDAXDirectory
The directory in which the daxes corresponding to the partition are generated.


mPartitionName

protected String mPartitionName
The name of the partition dax that are generated.


mLogger

protected LogManager mLogger
The handle to the logging object.


mWriteHandle

protected PrintWriter mWriteHandle
The write handle to the xml file being written.

Constructor Detail

DAXWriter

protected DAXWriter()
The default constructor


DAXWriter

protected DAXWriter(String daxFile,
                    String directory)
The overloaded constructor.

Parameters:
daxFile - the path to the dax file that is being partitioned.
directory - the directory in which the partitioned daxes are to be generated.
Method Detail

writePartitionDax

public boolean writePartitionDax(Partition partition)
It writes out a dax consisting of the jobs as specified in the partition.

Parameters:
partition - the partition object containing the relations and id's of the jobs making up the partition.
Returns:
boolean true if dax successfully generated and written. false in case of error.

writePartitionDax

public abstract boolean writePartitionDax(Partition partition,
                                          int index)
It writes out a dax consisting of the jobs as specified in the partition.

Parameters:
partition - the partition object containing the relations and id's of the jobs making up the partition.
index - the index of the partition.
Returns:
boolean true if dax successfully generated and written. false in case of error.

loadDAXWriter

public static DAXWriter loadDAXWriter(String daxFile,
                                      String directory)
The ends up loading the PDAXWriter. It selects the writer as specified by the vds.partition.parse.mode property.

Parameters:
daxFile - the path to the dax file that is being partitioned.
directory - the directory in which the partitioned daxes are to be generated.

loadDAXWriter

public static DAXWriter loadDAXWriter(String className,
                                      String daxFile,
                                      String directory)
Loads the implementing PDAXWriter. The name of the class that is to be loaded is passed and can be complete(with package name) or just the name of the class, in which case the class is loaded from the default package.

Parameters:
className - the name of the class with or without the package name.
daxFile - the path to the dax file that is being partitioned.
directory - the directory in which the partitioned daxes are to be generated.

getPDAXFilename

public static String getPDAXFilename(String daxName,
                                     int index)
It constructs the name of the partitioned dax file that has to be written corresponding to a partition of the dax. The dax name returned has no prefix added to it.

Parameters:
daxName - the name attribute in the adag element of the dax.
index - the partition number of the partition.

getPDAXFilename

public static String getPDAXFilename(String daxName,
                                     int index,
                                     boolean addPrefix)
It constructs the name of the partitioned dax file that has to be written corresponding to a partition of the dax.

Parameters:
daxName - the name attribute in the adag element of the dax.
index - the partition number of the partition.
addPrefix - whether you want to addPrefix or not.

constructPartitionName

private static String constructPartitionName(String daxName,
                                             boolean addPrefix)
It constructs the partition name given the daxName. It only ends up adding the prefix if the addPrefix parameter is set.

Parameters:
daxName - the name attribute in the adag element of the dax.
addPrefix - whether to add prefix or not.

setPartitionName

public void setPartitionName(String daxName)
It sets the name of the partition in the dax that is generated. It suffixes PARTITION_PREFIX to the name of the dax.

Parameters:
daxName - the name attribute in the adag element of the dax.

getPartitionName

public String getPartitionName()
It returns the name of the partitioned dax, that the object is currently writing or initialized to write. By the name, one means the value that is set to the name attribute in the adag element.


initializeWriteHandle

public void initializeWriteHandle(int index)
This initializes the write handle a file in directory specified when creating the instance of this class. The name of the file is constructed by default, by looking at the partition name that is assigned to the name attribute for the adag element.

Parameters:
index - the partition number of the partition.

initializeWriteHandle

public void initializeWriteHandle(String fileName)
This initializes the write handle to the file in directory specified when creating the instance of this class.

Parameters:
fileName - the name of the file that is to be written in the directory.

writeln

public void writeln(String st)
Writes out to the file.


close

public void close()
Close the write handle to the file that is written.



Copyright © 2003 The University of Chicago and The University of Southern California. All Rights Reserved.