com.ptc.windchill.structconf
Class RebuildAnalyzer

java.lang.Object
  extended bycom.ptc.windchill.structconf.RebuildAnalyzer

public class RebuildAnalyzer
extends Object

Determines if xconf files need to be propagated into derived properties files. It does this by:

  1. Scanning the declarative and site-specific xconf files for target file references
  2. Determining if any of the target files is missing; if so report that target files should be regenerated
  3. If all target files are present, compare their timestamps to the xconf file timestamps; if any xconf file is newer than any target file, report that target files should be regenerated
  4. Cache the xconf and target files in a local "hidden" file to speed future scans. As long as this cache is newer than all xconf files, then you can quickly avoid rescanning all the xconf files

This class can be created once and shouldPropagate(boolean,boolean may invoked repeatedly. Each time it is invoked, the analysis will be reperformed.


Field Summary
private  long cachedTargetFileHintsFileTimestamp_
           
private  File descriptPropsFile_
           
private static String PROP_XCONF_DEPENDENCY_CACHE_FILE
           
private  int propagatableItemCount_
           
private  File propertiesHtmlFile_
           
private  HashSet sourceFileSet_
           
private static String TARGET_FILE_HINTS_FILE
           
private  HashMap targetFileInfoHints_
           
private  HashSet targetFileSet_
           
 
Constructor Summary
RebuildAnalyzer()
           
 
Method Summary
private  void cacheDependencies()
           
private  String commafy(String str)
           
private  String decommafy(String str)
           
private  FileUtil.FileInfo getHintsFor(File file)
           
private  File getPropXconfDepCacheFile()
           
private  File getTargetFileHintsFile()
           
private  boolean hintsUpToDate()
           
private  long lastModified(URL url)
           
private  boolean outOfDate(boolean force_xconf_scan)
           
private  boolean readCachedDependencies()
           
private  boolean readHints()
           
private  void scanXconfsForDependencies()
           
 boolean shouldPropagate(boolean force_propagate, boolean force_xconf_scan)
           
private  boolean shouldScanForDependencies()
           
private  void show(String title, HashSet file_set)
           
 void updateTargetFileHints(FileUtil.FileInfo[] file_infos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_XCONF_DEPENDENCY_CACHE_FILE

private static final String PROP_XCONF_DEPENDENCY_CACHE_FILE
See Also:
Constant Field Values

TARGET_FILE_HINTS_FILE

private static final String TARGET_FILE_HINTS_FILE
See Also:
Constant Field Values

sourceFileSet_

private HashSet sourceFileSet_

targetFileSet_

private HashSet targetFileSet_

targetFileInfoHints_

private HashMap targetFileInfoHints_

propagatableItemCount_

private int propagatableItemCount_

cachedTargetFileHintsFileTimestamp_

private long cachedTargetFileHintsFileTimestamp_

propertiesHtmlFile_

private File propertiesHtmlFile_

descriptPropsFile_

private File descriptPropsFile_
Constructor Detail

RebuildAnalyzer

public RebuildAnalyzer()
Method Detail

show

private void show(String title,
                  HashSet file_set)

readCachedDependencies

private boolean readCachedDependencies()
                                throws StructConfManagerException
Returns:
true if the file was successfully read
Throws:
StructConfManagerException

cacheDependencies

private void cacheDependencies()
                        throws StructConfManagerException
Throws:
StructConfManagerException

getHintsFor

private FileUtil.FileInfo getHintsFor(File file)
                               throws StructConfManagerException
Throws:
StructConfManagerException

readHints

private boolean readHints()
                   throws StructConfManagerException
Throws:
StructConfManagerException

updateTargetFileHints

public void updateTargetFileHints(FileUtil.FileInfo[] file_infos)
                           throws StructConfManagerException
Throws:
StructConfManagerException

hintsUpToDate

private boolean hintsUpToDate()

decommafy

private String decommafy(String str)

commafy

private String commafy(String str)

scanXconfsForDependencies

private void scanXconfsForDependencies()
                                throws StructConfManagerException
Throws:
StructConfManagerException

shouldScanForDependencies

private boolean shouldScanForDependencies()
                                   throws StructConfManagerException
Throws:
StructConfManagerException

outOfDate

private boolean outOfDate(boolean force_xconf_scan)
                   throws StructConfManagerException
Throws:
StructConfManagerException

lastModified

private long lastModified(URL url)
                   throws IOException
Returns:
0L if it cannot be determined
Throws:
IOException

shouldPropagate

public boolean shouldPropagate(boolean force_propagate,
                               boolean force_xconf_scan)
                        throws StructConfManagerException
Throws:
StructConfManagerException

getTargetFileHintsFile

private File getTargetFileHintsFile()

getPropXconfDepCacheFile

private File getPropXconfDepCacheFile()