com.ptc.windchill.structconf
Class DerivedFile

java.lang.Object
  extended bycom.ptc.windchill.structconf.DerivedFile
Direct Known Subclasses:
DerivedProperties, IePropertiesAction.MyTextDerivedFile, SamplePropagationAction.MyTextDerivedFile

public abstract class DerivedFile
extends Object

Abstraction to represent files that the propagator may need to write after a propagation. Only package implementors need to use this API.


Constructor Summary
DerivedFile()
           
 
Method Summary
abstract  File getTargetFile()
           
(package private)  long write()
          Write the contents of the file to the file returned in getTargetFile() and return the CRC32 crc value of the contents of the file.
abstract  void write(BufferedOutputStream bos)
          Write the contents of the derived file returned in getTargetFile() to the BufferedOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerivedFile

public DerivedFile()
Method Detail

getTargetFile

public abstract File getTargetFile()

write

final long write()
          throws IOException
Write the contents of the file to the file returned in getTargetFile() and return the CRC32 crc value of the contents of the file. This CRC value will be used to compare the new file to the backup of the file and if they are identical the redundant backup will be used. Thus it is important that repeated writing of the file with the same logical contents produce the same CRC each time. So avoid putting things like generation timestamp in your derived files.

Throws:
IOException

write

public abstract void write(BufferedOutputStream bos)
                    throws IOException
Write the contents of the derived file returned in getTargetFile() to the BufferedOutputStream. If character set conversion is desired, then use java.util.OutputStreamWriter to produce an appropriate writer.

Subclasses needs only worry about flushing the stream if they wrap the stream with a buffering stream of their own. Otherwise this base class manages flushing and closing the stream.

Note subclasses should not supposed directly open and close the file streams themselfs. The sturcutured configuration manager does this to facility proper backup and recovery in the event of a file writing failure.

Throws:
IOException - subclasses may throw an IOException to signal problems while writing the DerivedFile contents.