wt.introspection
Class XmlIiGenerator

java.lang.Object
  extended bywt.introspection.XmlIiGenerator
Direct Known Subclasses:
XmlClassIiGenerator, XmlPackageIiGenerator, XmlRegistryIiGenerator

public abstract class XmlIiGenerator
extends Object

XmlIiGenerator is a tool which is used for producing "InfoReports" describing the structure of modeled Windchill classes in XML format.

Supported API: false

Extendable: false

See Also:
WTIntrospector, ClassInfo, LinkInfo, AttributeDescriptor

Field Summary
protected  File directory
           
protected static Class ENUMERATED_TYPE
           
protected  boolean ignoreProblems
           
protected static MappedRegistry modelRegistry
           
protected  File outputDirectory
           
protected  boolean printReport
           
protected  String suffix
           
protected static Class WINDCHILL_CLASS
           
 
Constructor Summary
protected XmlIiGenerator()
          For use by subtypes.
protected XmlIiGenerator(XmlIiGenerator parent)
          For use by subtypes.
 
Method Summary
private static XmlIiGenerator[] createTestsFor(String target)
           
private static Class dynamicallyLoadClassForStaticInitializer(String class_name)
          For use by the static initializer to dynamically load the specified class.
protected  File getOutputDirectory()
          The directory into which reports should be written.
static boolean isIntrospectable(Class the_class)
          A class is introspectable if it is an interface or extends wt.fc.NetFactor or wt.fc.EnumeratedType.
static void main(String[] args)
          Parameters:
protected static Document newDocument()
           
protected  void print(Enumeration collection)
          Print the values of a Enumerations.
protected  void print(Object[] array)
          Print the values of a Array to the report
abstract  void process()
          Must be implemented by a subclass to do the actual work.
private static void process(XmlIiGenerator[] tests, boolean print_report, String suffix, File directory)
           
protected  void report(String line)
          Write the specified line to the output file if outputing a report file.
 void setDirectory(File directory)
          The root directory from which introspection information files should be loaded.
 void setIgnoreProblems(boolean ignore_problems)
          Specify whether problems should result in thrown exceptions (and termination) or not.
 void setOutputDirectory(File output_directory)
           
 void setPrintReport(boolean printReport)
          Indicate whether to produce the report or not.
 void setSuffix(String suffix)
          Specify an optional suffix to add to report file names.
private static boolean stringSpecifiesRegistry(String class_names)
          Determines if the string equals 'registry' or '*'
static String tail(String aString, char aSeparator, int level)
          tail - pull off the trailing token following the supplied separator
protected static void writeDocument(Document document, File file)
          Write the DOM document to the specified File creating the containing directories as needed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelRegistry

protected static MappedRegistry modelRegistry

WINDCHILL_CLASS

protected static Class WINDCHILL_CLASS

ENUMERATED_TYPE

protected static Class ENUMERATED_TYPE

printReport

protected boolean printReport

suffix

protected String suffix

directory

protected File directory

outputDirectory

protected File outputDirectory

ignoreProblems

protected boolean ignoreProblems
Constructor Detail

XmlIiGenerator

protected XmlIiGenerator()
For use by subtypes. Default attribute values are used.


XmlIiGenerator

protected XmlIiGenerator(XmlIiGenerator parent)
For use by subtypes. Uses attributes of parent generator.

Method Detail

isIntrospectable

public static final boolean isIntrospectable(Class the_class)
A class is introspectable if it is an interface or extends wt.fc.NetFactor or wt.fc.EnumeratedType. This matches the criteria in wt.tools.metamodel.Rule.hasInfoObject().


dynamicallyLoadClassForStaticInitializer

private static Class dynamicallyLoadClassForStaticInitializer(String class_name)
                                                       throws ExceptionInInitializerError
For use by the static initializer to dynamically load the specified class.

Throws:
ExceptionInInitializerError - if the class cannot be loaded

setIgnoreProblems

public final void setIgnoreProblems(boolean ignore_problems)
Specify whether problems should result in thrown exceptions (and termination) or not.


setDirectory

public final void setDirectory(File directory)
The root directory from which introspection information files should be loaded. This is an optional property.


setSuffix

public final void setSuffix(String suffix)
Specify an optional suffix to add to report file names.


setPrintReport

public final void setPrintReport(boolean printReport)
Indicate whether to produce the report or not. If not, the class will be thoroughly introspected, but the report will simply not be saved.


getOutputDirectory

protected final File getOutputDirectory()
The directory into which reports should be written. Is whatever is specified in the system property wt.temp, so wt.properties should be pushed into the system properties before calling this method. If wt.temp is not in the system properties, then c:/temp will be returned.

Returns:
a non-null File instance

setOutputDirectory

public final void setOutputDirectory(File output_directory)

process

public abstract void process()
                      throws WTIntrospectionException
Must be implemented by a subclass to do the actual work.

Throws:
WTIntrospectionException

main

public static void main(String[] args)
Parameters:
  args[0] (required) - What run introspection on
      acceptable: pattern: registry | com.acme.foo.* | comma-delimited-list-of-class-names
   args[1] (optional) - whether or not to output report
      acceptable: true | false
   args[2] (optional) - additional suffix to the report file name
      acceptable: whatever caller wants
   args[3] (optional) - directory to load introspection data relative to
      acceptable: a valid path


createTestsFor

private static XmlIiGenerator[] createTestsFor(String target)

process

private static void process(XmlIiGenerator[] tests,
                            boolean print_report,
                            String suffix,
                            File directory)
                     throws WTIntrospectionException
Throws:
WTIntrospectionException

newDocument

protected static Document newDocument()

writeDocument

protected static void writeDocument(Document document,
                                    File file)
                             throws IOException,
                                    SAXException
Write the DOM document to the specified File creating the containing directories as needed

Throws:
IOException
SAXException

stringSpecifiesRegistry

private static boolean stringSpecifiesRegistry(String class_names)
Determines if the string equals 'registry' or '*'


print

protected final void print(Object[] array)
Print the values of a Array to the report

Parameters:
array - the collection of values to print (the values will be rendered via toString())

print

protected final void print(Enumeration collection)
Print the values of a Enumerations.

Parameters:
collection - the collection of object values to print (the values will be rendered via toString())

report

protected final void report(String line)
Write the specified line to the output file if outputing a report file.

Parameters:
line - the line to write

tail

public static String tail(String aString,
                          char aSeparator,
                          int level)
tail - pull off the trailing token following the supplied separator