org.ipdr.ftp
Class ControlFile

java.lang.Object
  extended by org.ipdr.ftp.ControlFile

public class ControlFile
extends java.lang.Object

This class allows operations on a ControlFile. These operations include reading and writing IPDRDoc names from/to a control file.


Field Summary
protected  java.io.BufferedReader bufferedReader_
           
protected  java.lang.String controlFileLocation_
           
protected  java.net.URL controlFileURL_
           
protected  boolean countNoOfVer_
           
protected  int docCount_
           
protected  java.io.FileOutputStream fileOutStream_
           
protected  boolean reachedEnd_
           
protected  java.lang.String VERSION_NUMBER
           
 
Constructor Summary
ControlFile(java.lang.String controlFileLocation)
           Constructor for ControlFile class, which accepts control file location as paramter.
ControlFile(java.net.URL controlFileURL)
           Constructor for ControlFile class, which accepts controlfileURL.
 
Method Summary
 boolean addDocName(java.lang.String docName)
           This method writes the IPDRDoc name, given by Producer, to the control file
 int getDocCount()
           This method returns the value of docCount_
 java.lang.String getDocName()
           This method reads the IPDRDoc name, one by one, from the control file
 boolean isEnd()
           This method reads the control file, one line at one time.
 void refreshControlFile()
           This method gets a new input stream for the control file so that updated contents can be read.
 boolean writeEnd()
           This method writes the VERSION_NUMBER string at the end of the document
 boolean writeStart()
           This method writes the VERSION_NUMBER string at the start of the document
protected  boolean writeToControlFile(java.lang.String writeString)
           This method writes the string, passed, to the control file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

docCount_

protected int docCount_

bufferedReader_

protected java.io.BufferedReader bufferedReader_

fileOutStream_

protected java.io.FileOutputStream fileOutStream_

controlFileLocation_

protected java.lang.String controlFileLocation_

controlFileURL_

protected java.net.URL controlFileURL_

countNoOfVer_

protected boolean countNoOfVer_

VERSION_NUMBER

protected final java.lang.String VERSION_NUMBER
See Also:
Constant Field Values

reachedEnd_

protected boolean reachedEnd_
Constructor Detail

ControlFile

public ControlFile(java.net.URL controlFileURL)
            throws IPDRFTPException

Constructor for ControlFile class, which accepts controlfileURL. This constructor is used mainly by Consumer.

Parameters:
controlFileURL - The URL object to the control file.

Throws:
IPDRFTPException

ControlFile

public ControlFile(java.lang.String controlFileLocation)
            throws IPDRFTPException

Constructor for ControlFile class, which accepts control file location as paramter. This is used, mainly by the Producer.

Parameters:
controlFileLocation - The actual location of control file.

Throws:
IPDRFTPException
Method Detail

writeStart

public boolean writeStart()
                   throws IPDRFTPException

This method writes the VERSION_NUMBER string at the start of the document

Returns:
boolean Return true if VERSION_NUMBER string is successfully written to the Control file else return false.

Throws:
IPDRFTPException

writeEnd

public boolean writeEnd()
                 throws IPDRFTPException

This method writes the VERSION_NUMBER string at the end of the document

Returns:
boolean Return true if VERSION_NUMBER string is successfully written to the Control file else return false.

Throws:
IPDRFTPException

addDocName

public boolean addDocName(java.lang.String docName)
                   throws IPDRFTPException

This method writes the IPDRDoc name, given by Producer, to the control file

Parameters:
docName - String that contains the IPDRDoc name to be written to the Control file.
Returns:
boolean Return true if IPDRDocName string is successfully written to the Control file else return false.

Throws:
IPDRFTPException

getDocName

public java.lang.String getDocName()
                            throws IPDRFTPException

This method reads the IPDRDoc name, one by one, from the control file

Returns:
String The IPDRDoc Name read from the ControlFile.

Throws:
IPDRFTPException

isEnd

public boolean isEnd()
              throws IPDRFTPException

This method reads the control file, one line at one time. Returns true if it finds end of file VERSION_NUMBER string otherwise false.

Returns:
boolean indicating whether the end of file has reached or not.

Throws:
IPDRFTPException

getDocCount

public int getDocCount()
                throws IPDRFTPException

This method returns the value of docCount_

Returns:
int The number of documents that have been written/read till now.

Throws:
IPDRFTPException

writeToControlFile

protected boolean writeToControlFile(java.lang.String writeString)
                              throws IPDRFTPException

This method writes the string, passed, to the control file.

Parameters:
writeString - the String that is to be written to the control file.
Returns:
void

Throws:
IPDRFTPException

refreshControlFile

public void refreshControlFile()
                        throws IPDRFTPException

This method gets a new input stream for the control file so that updated contents can be read. It starts reading from the new line.

Throws:
IPDRFTPException