com.ptc.windchill.structconf
Class DerivedProperties

java.lang.Object
  extended bycom.ptc.windchill.structconf.DerivedFile
      extended bycom.ptc.windchill.structconf.DerivedProperties

public class DerivedProperties
extends DerivedFile

Maintains the mapping of properties, services, and resources to their xconf files and can write a properties file that adheres to the spec in the javadoc for java.util.Properties and which is commented to allow developers to easlity determine which xconf files each property comes from.


Nested Class Summary
private  class DerivedProperties.AnalyzedPropertyName
           
 
Field Summary
private  ArrayList contentToPreserve_
           
private  File file_
           
private  boolean isDeclared_
           
private static String MAGIC_END_SEPARATOR
           
private static String MAGIC_START_SEPARATOR
          Don't change this! If you do then xconf-generated content that gets appended to the end of a target property file that is not declared as a target file will be orphaned as junk in the customer's property file.
private static String NOT_SO_MAGIC_SEPARATOR
           
private  HashMap propertyInfos_
           
private  File unannotatedBase_
           
private  Properties unmanagedProperties_
           
 
Constructor Summary
DerivedProperties(File file, boolean is_declared)
           
DerivedProperties(File file, boolean is_declared, File unannotated_base)
           
 
Method Summary
 void add(PropertyInfo property_info)
           
private  void addAnnotationComment(BufferedWriter bw)
           
private  Collection asAnalyzedPropertyNamesSorted(Collection property_names)
           
 File getTargetFile()
           
private  boolean isAnnotated()
           
private  void readContentToPreserve()
          If the file exists read everything outside the MAGIC_SEPARATORs and each line as a container of Strings, otherwise returns a null reference.
 void write(BufferedOutputStream bos)
          Write the contents of the derived file returned in getTargetFile() to the BufferedOutputStream.
private  void writeCopyright(BufferedWriter bw)
           
private  void writeDeclaredWarningBlock(BufferedWriter bw)
           
private  void writePreservedContent(BufferedWriter bw)
           
private  void writeTopUndeclaredWarningBlock(BufferedWriter bw)
           
private  void writeUndeclaredWarningEndBlock(BufferedWriter bw)
           
private  void writeUndeclaredWarningStartBlock(BufferedWriter bw)
           
private  void writeXconfContent(BufferedWriter bw, BufferedOutputStream bos)
           
 
Methods inherited from class com.ptc.windchill.structconf.DerivedFile
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGIC_START_SEPARATOR

private static final String MAGIC_START_SEPARATOR
Don't change this! If you do then xconf-generated content that gets appended to the end of a target property file that is not declared as a target file will be orphaned as junk in the customer's property file.

See Also:
Constant Field Values

MAGIC_END_SEPARATOR

private static final String MAGIC_END_SEPARATOR
See Also:
Constant Field Values

NOT_SO_MAGIC_SEPARATOR

private static final String NOT_SO_MAGIC_SEPARATOR
See Also:
Constant Field Values

file_

private File file_

isDeclared_

private boolean isDeclared_

unannotatedBase_

private File unannotatedBase_

propertyInfos_

private HashMap propertyInfos_

contentToPreserve_

private ArrayList contentToPreserve_

unmanagedProperties_

private Properties unmanagedProperties_
Constructor Detail

DerivedProperties

public DerivedProperties(File file,
                         boolean is_declared)
                  throws IOException

DerivedProperties

public DerivedProperties(File file,
                         boolean is_declared,
                         File unannotated_base)
                  throws IOException
Method Detail

isAnnotated

private boolean isAnnotated()

readContentToPreserve

private void readContentToPreserve()
                            throws IOException
If the file exists read everything outside the MAGIC_SEPARATORs and each line as a container of Strings, otherwise returns a null reference.

Throws:
IOException

add

public void add(PropertyInfo property_info)

getTargetFile

public final File getTargetFile()
Specified by:
getTargetFile in class DerivedFile

write

public void write(BufferedOutputStream bos)
           throws IOException
Description copied from class: DerivedFile
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.

Specified by:
write in class DerivedFile
Throws:
IOException - subclasses may throw an IOException to signal problems while writing the DerivedFile contents.

writeXconfContent

private void writeXconfContent(BufferedWriter bw,
                               BufferedOutputStream bos)
                        throws IOException
Throws:
IOException

writePreservedContent

private void writePreservedContent(BufferedWriter bw)
                            throws IOException
Throws:
IOException

writeCopyright

private void writeCopyright(BufferedWriter bw)
                     throws IOException
Throws:
IOException

writeDeclaredWarningBlock

private void writeDeclaredWarningBlock(BufferedWriter bw)
                                throws IOException
Throws:
IOException

addAnnotationComment

private void addAnnotationComment(BufferedWriter bw)
                           throws IOException
Throws:
IOException

writeTopUndeclaredWarningBlock

private void writeTopUndeclaredWarningBlock(BufferedWriter bw)
                                     throws IOException
Throws:
IOException

writeUndeclaredWarningStartBlock

private void writeUndeclaredWarningStartBlock(BufferedWriter bw)
                                       throws IOException
Throws:
IOException

writeUndeclaredWarningEndBlock

private void writeUndeclaredWarningEndBlock(BufferedWriter bw)
                                     throws IOException
Throws:
IOException

asAnalyzedPropertyNamesSorted

private Collection asAnalyzedPropertyNamesSorted(Collection property_names)