com.ptc.windchill.structconf
Class TargetFileContentsCollector

java.lang.Object
  extended bycom.ptc.windchill.structconf.TargetFileContentsCollector
All Implemented Interfaces:
CollectedProperties

public class TargetFileContentsCollector
extends Object
implements CollectedProperties

An XconfHandler that will record the values of all properties, services, and resources specified from the root declaration and site xconf files, will assign each of these to its target property file, and will write these derived files after the parse of xconf files is complete

See Also:
XconfHandler

Nested Class Summary
private  class TargetFileContentsCollector.CollectingXconfHandler
           
 
Field Summary
private  boolean analysisNeeded_
           
private  String currentServiceOrResourcePropStart_
           
private  URLSet declXconfUrls_
           
private  HashSet derivedFiles_
           
private  HashMap derivedProperties_
           
private  boolean lenientValidation_
           
private static String LINE_SEPARATOR
           
private  ArrayList propagationActionInstantiators_
           
private  HashMap propertyInfos_
           
private static HashMap providerPropsFromName__
           
private  URLSet siteXconfUrls_
           
private  HashMap targetFilePathsIsDeclaredMap_
           
private  boolean targetUnix_
           
private static String TypeBasedServiceProviderFromProperties
           
private static String TypeBasedServiceProviderFromProperties_customPropertyFiles
           
private static String WTServiceProviderFromProperties
           
private static String WTServiceProviderFromProperties_customPropertyFiles
           
private  XconfAnalysis xconfAnalysis_
           
 
Constructor Summary
TargetFileContentsCollector(boolean target_unix, boolean lenient_validation)
           
 
Method Summary
private  void addDerivedFile(DerivedFile derived_file)
           
private  FileUtil.FileInfo[] backup(DerivedFile[] derived_files)
           
private  void buildDerivedProperties()
           
private  void checkWritability(DerivedFile[] derived_files)
           
private  void cleanupUnnecessaryBackups(FileUtil.FileInfo[] updated_file_info, FileUtil.FileInfo[] backup_file_info)
           
(package private)  void collect()
           
private  void evaluatePropagationActions()
           
 Collection getAllPropertyNames()
          All property names collected.
 XconfAnalysis getAnalysis()
           
private  File getCanonicalizedTargetFileFromParser(XconfParser parser)
          All requests to parser.getCurrentTargetFile() should go thorugh this method so that we can accurately track if target files are referenced from declarative xconfs of site xconfs!!!
(package private)  URL[] getDeclarativeXconfUrls()
           
private  DerivedProperties getDerivedProperties(File canonicalized_target_file, boolean is_annotated)
          Method getDerivedProperties.
private  PropertyInfo getPropertyInfo_(String prop_name)
           
private  PropertyInfo getPropertyInfo_(String prop_name, boolean overridable, String multi_valued_delimiter)
           
 PropertyInfo getPropertyInfo(String property_name)
          All values for the specified property.
(package private)  Iterator getPropertyInfos()
          Gets iterator over unordered set of properties.
(package private)  URL[] getSiteXconfUrls()
           
private  String getTargetFileRelativePathFromParser(XconfParser parser)
           
private  DerivedFile[] getTargetFiles()
           
private  File getUncanonicalizedTargetFileFromParser(XconfParser parser)
           
(package private)  ArrayList getUndeclaredTargetFiles()
          Collection of File which are not referenced from declarative xconf files.
private  File getWtPropertiesTargetFileCanonicalized()
          Returns the canonical file for wt.properties.
private  File getWtPropertiesTargetFileUncanonicalized()
          Returns the canonical file for wt.properties.
private  boolean isADeclaredTargetFile(File canonicalized_target_file)
          Report if the target file was referenced from a declarative xconf file.
private  boolean isADeclaredTargetFile(String canonicalized_target_file_path)
          Report if the target file was referenced from a declarative xconf file.
(package private)  boolean isXconfDeclarative(URL xconf_url)
           
private  void markTargetFileDeclared(File canonicalized_target_file, boolean is_declared)
          Keep track of which target files are referenced from declarative xconf files.
(package private) static boolean propIsAServiceProviderProperty(String property_name)
           
private  void resetContainers()
           
private  FileUtil.FileInfo[] write(DerivedFile[] derived_files, FileUtil.FileInfo[] matching_backups)
           
(package private)  FileUtil.FileInfo[] writeTargetFiles()
          Write all target files, backing them up first and return a set of FileInfo instances describing the produced files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_SEPARATOR

private static final String LINE_SEPARATOR

WTServiceProviderFromProperties

private static final String WTServiceProviderFromProperties
See Also:
Constant Field Values

TypeBasedServiceProviderFromProperties

private static final String TypeBasedServiceProviderFromProperties
See Also:
Constant Field Values

WTServiceProviderFromProperties_customPropertyFiles

private static final String WTServiceProviderFromProperties_customPropertyFiles
See Also:
Constant Field Values

TypeBasedServiceProviderFromProperties_customPropertyFiles

private static final String TypeBasedServiceProviderFromProperties_customPropertyFiles
See Also:
Constant Field Values

providerPropsFromName__

private static final HashMap providerPropsFromName__

lenientValidation_

private boolean lenientValidation_

targetUnix_

private boolean targetUnix_

siteXconfUrls_

private URLSet siteXconfUrls_

declXconfUrls_

private URLSet declXconfUrls_

propertyInfos_

private HashMap propertyInfos_

derivedProperties_

private HashMap derivedProperties_

derivedFiles_

private HashSet derivedFiles_

propagationActionInstantiators_

private ArrayList propagationActionInstantiators_

currentServiceOrResourcePropStart_

private String currentServiceOrResourcePropStart_

targetFilePathsIsDeclaredMap_

private HashMap targetFilePathsIsDeclaredMap_

xconfAnalysis_

private XconfAnalysis xconfAnalysis_

analysisNeeded_

private boolean analysisNeeded_
Constructor Detail

TargetFileContentsCollector

public TargetFileContentsCollector(boolean target_unix,
                                   boolean lenient_validation)
Method Detail

getPropertyInfo

public PropertyInfo getPropertyInfo(String property_name)
All values for the specified property.

Specified by:
getPropertyInfo in interface CollectedProperties
Returns:
null if the property is not declared or specified in xconfs

getPropertyInfos

Iterator getPropertyInfos()
Gets iterator over unordered set of properties.


getPropertyInfo_

private PropertyInfo getPropertyInfo_(String prop_name)
                               throws SAXException
Throws:
SAXException

getPropertyInfo_

private PropertyInfo getPropertyInfo_(String prop_name,
                                      boolean overridable,
                                      String multi_valued_delimiter)
                               throws SAXException
Throws:
SAXException

resetContainers

private void resetContainers()

collect

void collect()
       throws StructConfManagerException
Throws:
StructConfManagerException

getSiteXconfUrls

URL[] getSiteXconfUrls()

getDeclarativeXconfUrls

URL[] getDeclarativeXconfUrls()

isXconfDeclarative

boolean isXconfDeclarative(URL xconf_url)

getWtPropertiesTargetFileCanonicalized

private File getWtPropertiesTargetFileCanonicalized()
                                             throws SAXException
Returns the canonical file for wt.properties.

Throws:
SAXException

getWtPropertiesTargetFileUncanonicalized

private File getWtPropertiesTargetFileUncanonicalized()
                                               throws SAXException
Returns the canonical file for wt.properties.

Throws:
SAXException

getAllPropertyNames

public Collection getAllPropertyNames()
All property names collected.

Specified by:
getAllPropertyNames in interface CollectedProperties
Returns:
a set of property names (this set is a mutable copy that the caller may modify with no ill effects)

addDerivedFile

private void addDerivedFile(DerivedFile derived_file)

getTargetFiles

private DerivedFile[] getTargetFiles()

getDerivedProperties

private DerivedProperties getDerivedProperties(File canonicalized_target_file,
                                               boolean is_annotated)
                                        throws IOException
Method getDerivedProperties.

Returns:
DerivedProperties
Throws:
IOException

isADeclaredTargetFile

private boolean isADeclaredTargetFile(File canonicalized_target_file)
Report if the target file was referenced from a declarative xconf file.


isADeclaredTargetFile

private boolean isADeclaredTargetFile(String canonicalized_target_file_path)
Report if the target file was referenced from a declarative xconf file.


markTargetFileDeclared

private void markTargetFileDeclared(File canonicalized_target_file,
                                    boolean is_declared)
Keep track of which target files are referenced from declarative xconf files.


getUndeclaredTargetFiles

ArrayList getUndeclaredTargetFiles()
Collection of File which are not referenced from declarative xconf files.


getAnalysis

public XconfAnalysis getAnalysis()

writeTargetFiles

FileUtil.FileInfo[] writeTargetFiles()
                               throws StructConfManagerException,
                                      PartialPropagationException
Write all target files, backing them up first and return a set of FileInfo instances describing the produced files.

Returns:
set of all files that were updated
Throws:
StructConfManagerException
PartialPropagationException - if not all files were successfully written

buildDerivedProperties

private void buildDerivedProperties()
                             throws IOException
Throws:
IOException

checkWritability

private void checkWritability(DerivedFile[] derived_files)
                       throws PropagationException
Throws:
PropagationException

evaluatePropagationActions

private void evaluatePropagationActions()
                                 throws PropagationActionException
Throws:
PropagationActionException

backup

private FileUtil.FileInfo[] backup(DerivedFile[] derived_files)
                            throws StructConfManagerException
Throws:
StructConfManagerException

write

private FileUtil.FileInfo[] write(DerivedFile[] derived_files,
                                  FileUtil.FileInfo[] matching_backups)
                           throws PartialPropagationException
Throws:
PartialPropagationException

cleanupUnnecessaryBackups

private void cleanupUnnecessaryBackups(FileUtil.FileInfo[] updated_file_info,
                                       FileUtil.FileInfo[] backup_file_info)

getCanonicalizedTargetFileFromParser

private File getCanonicalizedTargetFileFromParser(XconfParser parser)
All requests to parser.getCurrentTargetFile() should go thorugh this method so that we can accurately track if target files are referenced from declarative xconfs of site xconfs!!!


getTargetFileRelativePathFromParser

private String getTargetFileRelativePathFromParser(XconfParser parser)

getUncanonicalizedTargetFileFromParser

private File getUncanonicalizedTargetFileFromParser(XconfParser parser)

propIsAServiceProviderProperty

static boolean propIsAServiceProviderProperty(String property_name)