NOTICE = """
## Versavant Topic Map Application Bus / Subject Addressing Engine v%s
## Copyright 2005 Steven R. Newcomb
## 
## This software is licensed under the Apache License, Version 2.0 
## (the "License"); you may not use this file except in compliance 
## with the License.  Copies of the License are available at       
##        http://www.apache.org/licenses/LICENSE-2.0               
## 
## Unless required by applicable law or agreed to in writing,      
## software distributed under the License is distributed on an "AS 
## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
## express or implied.  See the License for the specific language  
## governing permissions and limitations under the License.        
##                                                                 
## Copies of the source code and the license are available at      
##        http://www.versavant.org                                 
"""

#####################################
## Apache License                  ##
## Version 2.0, January 2004       ##
## http://www.apache.org/licenses/ ##
#####################################
##
## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
##
## 1. Definitions.
##
## "License" shall mean the terms and conditions for use, reproduction,
##           and distribution as defined by Sections 1 through 9 of this
##           document.
##
## "Licensor" shall mean the copyright owner or entity authorized by the
##           copyright owner that is granting the License.
##
## "Legal Entity" shall mean the union of the acting entity and all other
##           entities that control, are controlled by, or are under
##           common control with that entity. For the purposes of this
##           definition, "control" means (i) the power, direct or
##           indirect, to cause the direction or management of such
##           entity, whether by contract or otherwise, or (ii) ownership
##           of fifty percent (50%) or more of the outstanding shares, or
##           (iii) beneficial ownership of such entity.
##
## "You" (or "Your") shall mean an individual or Legal Entity exercising
##           permissions granted by this License.
##
## "Source" form shall mean the preferred form for making modifications,
##           including but not limited to software source code,
##           documentation source, and configuration files.
##
## "Object" form shall mean any form resulting from mechanical
##          transformation or translation of a Source form, including but
##          not limited to compiled object code, generated documentation,
##          and conversions to other media types.
##
## "Work" shall mean the work of authorship, whether in Source or Object
##          form, made available under the License, as indicated by a
##          copyright notice that is included in or attached to the work
##          (an example is provided in the Appendix below).
##
## "Derivative Works" shall mean any work, whether in Source or Object
##          form, that is based on (or derived from) the Work and for
##          which the editorial revisions, annotations, elaborations, or
##          other modifications represent, as a whole, an original work
##          of authorship. For the purposes of this License, Derivative
##          Works shall not include works that remain separable from, or
##          merely link (or bind by name) to the interfaces of, the Work
##          and Derivative Works thereof.
##
## "Contribution" shall mean any work of authorship, including the
##          original version of the Work and any modifications or
##          additions to that Work or Derivative Works thereof, that is
##          intentionally submitted to Licensor for inclusion in the Work
##          by the copyright owner or by an individual or Legal Entity
##          authorized to submit on behalf of the copyright owner. For
##          the purposes of this definition, "submitted" means any form
##          of electronic, verbal, or written communication sent to the
##          Licensor or its representatives, including but not limited to
##          communication on electronic mailing lists, source code
##          control systems, and issue tracking systems that are managed
##          by, or on behalf of, the Licensor for the purpose of
##          discussing and improving the Work, but excluding
##          communication that is conspicuously marked or otherwise
##          designated in writing by the copyright owner as "Not a
##          Contribution."
##
## "Contributor" shall mean Licensor and any individual or Legal Entity
##          on behalf of whom a Contribution has been received by
##          Licensor and subsequently incorporated within the Work.
##
## 2. Grant of Copyright License.
##
##    Subject to the terms and conditions of this License, each
##    Contributor hereby grants to You a perpetual, worldwide,
##    non-exclusive, no-charge, royalty-free, irrevocable copyright
##    license to reproduce, prepare Derivative Works of, publicly
##    display, publicly perform, sublicense, and distribute the Work and
##    such Derivative Works in Source or Object form.
##
## 3. Grant of Patent License.
##
##    Subject to the terms and conditions of this License, each
##    Contributor hereby grants to You a perpetual, worldwide,
##    non-exclusive, no-charge, royalty-free, irrevocable (except as
##    stated in this section) patent license to make, have made, use,
##    offer to sell, sell, import, and otherwise transfer the Work, where
##    such license applies only to those patent claims licensable by such
##    Contributor that are necessarily infringed by their Contribution(s)
##    alone or by combination of their Contribution(s) with the Work to
##    which such Contribution(s) was submitted. If You institute patent
##    litigation against any entity (including a cross-claim or
##    counterclaim in a lawsuit) alleging that the Work or a Contribution
##    incorporated within the Work constitutes direct or contributory
##    patent infringement, then any patent licenses granted to You under
##    this License for that Work shall terminate as of the date such
##    litigation is filed.
##
## 4. Redistribution.
##
##    You may reproduce and distribute copies of the Work or Derivative
##    Works thereof in any medium, with or without modifications, and in
##    Source or Object form, provided that You meet the following
##    conditions:
##
##    1. You must give any other recipients of the Work or Derivative
##       Works a copy of this License; and
##
##    2. You must cause any modified files to carry prominent notices
##       stating that You changed the files; and
##
##    3. You must retain, in the Source form of any Derivative Works that
##       You distribute, all copyright, patent, trademark, and
##       attribution notices from the Source form of the Work, excluding
##       those notices that do not pertain to any part of the Derivative
##       Works; and
##
##    4. If the Work includes a "NOTICE" text file as part of its
##       distribution, then any Derivative Works that You distribute must
##       include a readable copy of the attribution notices contained
##       within such NOTICE file, excluding those notices that do not
##       pertain to any part of the Derivative Works, in at least one of
##       the following places: within a NOTICE text file distributed as
##       part of the Derivative Works; within the Source form or
##       documentation, if provided along with the Derivative Works; or,
##       within a display generated by the Derivative Works, if and
##       wherever such third-party notices normally appear. The contents
##       of the NOTICE file are for informational purposes only and do
##       not modify the License. You may add Your own attribution notices
##       within Derivative Works that You distribute, alongside or as an
##       addendum to the NOTICE text from the Work, provided that such
##       additional attribution notices cannot be construed as modifying
##       the License.
##
##    You may add Your own copyright statement to Your modifications and
##    may provide additional or different license terms and conditions
##    for use, reproduction, or distribution of Your modifications, or
##    for any such Derivative Works as a whole, provided Your use,
##    reproduction, and distribution of the Work otherwise complies with
##    the conditions stated in this License.
##
## 5. Submission of Contributions.
##
##    Unless You explicitly state otherwise, any Contribution
##    intentionally submitted for inclusion in the Work by You to the
##    Licensor shall be under the terms and conditions of this License,
##    without any additional terms or conditions. Notwithstanding the
##    above, nothing herein shall supersede or modify the terms of any
##    separate license agreement you may have executed with Licensor
##    regarding such Contributions.
##
## 6. Trademarks.
##
##    This License does not grant permission to use the trade names,
##    trademarks, service marks, or product names of the Licensor, except
##    as required for reasonable and customary use in describing the
##    origin of the Work and reproducing the content of the NOTICE file.
##
## 7. Disclaimer of Warranty.
##
##    Unless required by applicable law or agreed to in writing, Licensor
##    provides the Work (and each Contributor provides its Contributions)
##    on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
##    either express or implied, including, without limitation, any
##    warranties or conditions of TITLE, NON-INFRINGEMENT,
##    MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
##    solely responsible for determining the appropriateness of using or
##    redistributing the Work and assume any risks associated with Your
##    exercise of permissions under this License.
##
## 8. Limitation of Liability.
##
##    In no event and under no legal theory, whether in tort (including
##    negligence), contract, or otherwise, unless required by applicable
##    law (such as deliberate and grossly negligent acts) or agreed to in
##    writing, shall any Contributor be liable to You for damages,
##    including any direct, indirect, special, incidental, or
##    consequential damages of any character arising as a result of this
##    License or out of the use or inability to use the Work (including
##    but not limited to damages for loss of goodwill, work stoppage,
##    computer failure or malfunction, or any and all other commercial
##    damages or losses), even if such Contributor has been advised of
##    the possibility of such damages.
##
## 9. Accepting Warranty or Additional Liability.
##
##    While redistributing the Work or Derivative Works thereof, You may
##    choose to offer, and charge a fee for, acceptance of support,
##    warranty, indemnity, or other liability obligations and/or rights
##    consistent with this License. However, in accepting such
##    obligations, You may act only on Your own behalf and on Your sole
##    responsibility, not on behalf of any other Contributor, and only if
##    You agree to indemnify, defend, and hold each Contributor harmless
##    for any liability incurred by, or claims asserted against, such
##    Contributor by reason of your accepting any such warranty or
##    additional liability.
##
## END OF TERMS AND CONDITIONS
##
###############################
## Apache License ends here. ##
###############################

####################################
cvsRevision = "$Revision: 1.35 $" ##
####################################




import sys, re, os, os.path, types, time, pyclbr, traceback, cPickle, xml.parsers.expat, shutil, shelve, copy

## following needed for http server
import BaseHTTPServer
import socket


# messaging functions for standard, debug, and error messages
from messaging import stdMsg, dbgMsg, errMsg, sendDebugMessages

#############################
## Versavant configuration ##
#############################

sendDebugMessages( True)   # False makes dbgMsg() calls ineffective

fieldSeparator = ',,'

##############################
## some regular expressions ##
##############################

proxyIdLookalikeREString = '^00[0-9]+$'
proxyIdLookalikeRE = re.compile( proxyIdLookalikeREString)

propertyNameREString = '(^.+)%s(.+$)' % ( fieldSeparator)
propertyNameRE = re.compile( propertyNameREString)
propertyInstanceKeyREString = '(^.+)%s(.+)%s(.+$)' % ( fieldSeparator, fieldSeparator)
propertyInstanceKeyRE = re.compile( propertyInstanceKeyREString)

propertyAddressREString = '(^.+)%s(.+)%s(.+)%s(.+$)' % ( fieldSeparator, fieldSeparator, fieldSeparator)
propertyAddressRE = re.compile( propertyAddressREString)

vsvFieldSeparatorPattern = re.compile( fieldSeparator)
pythonExpressionUrlHexEscapePattern = re.compile( '%[0-9A-Fa-f][0-9A-Fa-f]')

badNameCharsStr = '[^A-Za-z0-9_ ]+'
badNameCharsRE = re.compile( badNameCharsStr)



###################
## miscellaneous ##
###################

def sysBootstrapOrigPopTask():
            ## this is just to get past the value type check for the system original
    pass    ## population task


#########################
#########################
## HTTP SERVER section ##
#########################
#########################

#######################################################
def HexDigitChar2Int( c):
    if c in '0123456789':
        return ord( c) - ord( '0')
    if c in 'abcdef':
        return ( ord( c) - ord( 'a')) + 10
    if c in 'ABCDEF':
        return ( ord( c) - ord( 'A')) + 10


#######################################################
def Hex2Char( matchObject):

    return chr( ( HexDigitChar2Int( matchObject.group(0)[ 1]) * 16) + HexDigitChar2Int( matchObject.group(0)[ 2]))

#######################################################
def pythonExpressionUrlUnescapify( str):
    return pythonExpressionUrlHexEscapePattern.sub( Hex2Char, str)

#######################################################
def pythonExpressionUrlEscapify( str):
    outStr = ''
    for c in str:
        if c in '!@#$%^&*_-+=|\\;:()[]{},~`. \'"':
            outStr = '%s%s%02x' % ( outStr, '%', ord( c))
        else:
            outStr = '%s%s' % ( outStr, c)
        
    return outStr

#######################################################
def pickleStringXMLUnescapify( str):  ## same function as pythonExpressionUrlUnescapify()
    return pythonExpressionUrlHexEscapePattern.sub( Hex2Char, str)


#######################################################
def pickleStringXMLEscapify( str):
    outStr = ''
    for c in str:
        ordc = ord( c)
        if c in '<&%' or ordc < 32 or ordc > 126:
            outStr = '%s%s%02x' % ( outStr, '%', ordc)
        else:
            outStr = '%s%s' % ( outStr, c)
        
    return outStr


#######################################################
def vsvUrl( urlBody):
    """ Given an url body, return a real URL with the servername, etc. """
    global vsv
    return 'HTTP://%s:%d/%s' % ( vsv.server_name, vsv.server_port, urlBody)


#######################################################
def proxyOrPropertyLinkStr( vsv, mayBeProxyIdOrPropertyInstanceKey):

    if vsv.THUMBNAILMODE:

        topicMap = vsv.topicMaps[ vsv.nowBrowsingTopicMapName]

        if vsv.proxyIdStrValidatorRE.match( mayBeProxyIdOrPropertyInstanceKey):
            if topicMap.proxies.has_key( mayBeProxyIdOrPropertyInstanceKey):
                return ' %s' % ( proxyThumbnail(
                    vsv,
                    topicMap.proxies[ mayBeProxyIdOrPropertyInstanceKey],
                    'proxyThumbnailAsGlossOnString', ## thumbnailClassStr
                    'link to subject proxy apparently referenced by this string value')) ## thumbnailTitleStr

        if vsv.isPropertyInstanceKey( mayBeProxyIdOrPropertyInstanceKey, topicMap):
            proxyId, TMAName, propertyClassName = vsv.parsePropertyKey3( mayBeProxyIdOrPropertyInstanceKey)
            return ' %s' % ( propertyThumbnail( vsv, topicMap.proxies[ proxyId].propertyInstances[ vsv.catKey( TMAName, propertyClassName)], 'propertyThumbnailAsGlossOnString', 'link to property instance apparently referenced by this string value'))

    return ''

#######################################################
def formatListOfAvailableTopicMapsInHTMLPage( vsv, spc):

    message = ''
    message = message+'%s<H2 TITLE="Menu of topic maps that are open in this session." class="pgHd">Available Topic Maps:</H2>\n' % ( ' '*spc)

    topicMapNames = vsv.topicMaps.keys()
    topicMapNames.sort()
    message = message+'%s<UL>\n' % ( ' '*spc)
    for topicMapName in topicMapNames:
        message = message+'%s<LI>%s : %s &nbsp;&nbsp; %s</LI>\n' % (
            ' '*(spc + 2),
            objectIdStr( vsv, topicMapName, suppressObjectDescription = True, titleStr = 'the name of a topic map that\'s open in this session'),
            proxyThumbnail( vsv, vsv.topicMaps[ topicMapName].topicMapProxies[ 0],
                            'proxyThumbnailAsGlossOnString',
                            'link to this topic map\'s subject proxy for itself'),
            '<A TITLE="link to object that implements this topic map" HREF="%s">%s</A>' % (
                vsv.vsvUrl( vsv.catKey( vsv.VSVOBJECTCommandForServer, pythonExpressionUrlEscapify( '.topicMaps[ \'%s\']' % ( topicMapName)))),
                objectIdStr( vsv, vsv.topicMaps[ topicMapName])))

    message = message+'%s</UL>\n' % ( ' '*spc)

    return message
    

#######################################################
def parsePythonInstanceRepr( vsv, object):
    str = '%s' % ( object)
    matchObj = vsv.extractInfoFromPythonReprRE.match( str)
    if not matchObj:
        errMsg( 'cannot parse %s' % ( object))
        sys.exit( 1)

    moduleName = matchObj.group( 2)
    className = matchObj.group( 4)
    hexAddress = matchObj.group( 6)
    return moduleName, className, hexAddress

#######################################################
def noBreakSpace( str):
    return str.replace( ' ', '&nbsp;')

#######################################################
def objectIdStr( vsv, object, **args):

    if args.has_key( 'titleStr'):
        titleStr = ' TITLE="%s"' % ( args[ 'titleStr'])
    else:
        titleStr = ''

    if args.has_key( 'suppressObjectDescription'):
        suppressObjectDescription = args[ 'suppressObjectDescription']
    else:
        suppressObjectDescription = False

    if vsv.HEXADDRESSMODE:
        addressStr = ' at %x' % ( id( object))
    else:
        addressStr = ''

    if isinstance( object, types.InstanceType):
        moduleName, className, hexAddress = parsePythonInstanceRepr( vsv, object)
        return '<span class="objdesc"%s>&lt;%s.%s%s&gt;</span>' % (
            titleStr, noBreakSpace( moduleName), noBreakSpace( className), addressStr)

    elif isinstance( object, types.StringType):
        str = repr( object)

        if args.has_key( 'stringValueLengthLimit'):
            stringValueLengthLimit = args[ 'stringValueLengthLimit']
            if len( str) > stringValueLengthLimit:
                str = '%s...' % ( str[ 0: stringValueLengthLimit - 2])
                str = noBreakSpace( str)

        if suppressObjectDescription:
            return '<span class="stringVal"%s>%s</span>' % ( titleStr, str)
        else:
            return '<span class="stringVal"%s>%s</span> <span class=objdesc>(string%s)</span>' % ( titleStr, str, addressStr)

    elif isinstance( object, types.ListType):
        return '<span class="objdesc"%s>&lt;%s-item list%s&gt;</span>' % ( titleStr, len( object), addressStr)
        
    elif isinstance( object, types.TupleType):
        return '<span class="objdesc"%s>&lt;%s-member tuple%s&gt;</span>' % ( titleStr, len( object), addressStr)
        
    elif isinstance( object, types.DictType):
        return '<span class="objdesc"%s>&lt;%s-key dict%s&gt;</span>' % ( titleStr, len( object), addressStr)
        
    elif isinstance( object, types.NoneType):
        return '<span class="objdesc"%s>&lt;(Pythonic&nbsp;None%s)&gt;</span>' % ( titleStr, addressStr)

    elif isinstance( object, types.FunctionType):
        return '<span class="objdesc"%s>&lt;function %s() in module %s&gt;</span>' % ( titleStr, object.func_name, object.__module__)

    elif isinstance( object, types.MethodType):
        return '<span class="objdesc"%s>&lt;method %s() in module %s&gt;</span>' % ( titleStr, object.func_name, object.__module__)
    else:
        return '<span class="objdesc"%s>(%s)</span>' % ( titleStr, repr( object))

#######################################################
def objectIdStrNoMarkup( vsv, object, **args):

    if args.has_key( 'suppressObjectDescription'):
        suppressObjectDescription = args[ 'suppressObjectDescription']
    else:
        suppressObjectDescription = False

    if vsv.HEXADDRESSMODE:
        addressStr = ' at %x' % ( id( object))
    else:
        addressStr = ''

    if isinstance( object, types.InstanceType):
        moduleName, className, hexAddress = parsePythonInstanceRepr( vsv, object)
        return '&lt;%s.%s%s&gt;' % ( moduleName, className, addressStr)

    elif isinstance( object, types.StringType):
        str = repr( object)

        if args.has_key( 'stringValueLengthLimit'):
            stringValueLengthLimit = args[ 'stringValueLengthLimit']
            if len( str) > stringValueLengthLimit:
                str = '%s...' % ( str[ 0: stringValueLengthLimit - 2])

        if suppressObjectDescription:
            return '%s' % ( str)
        else:
            return '%s (string%s)' % ( str, addressStr)

    elif isinstance( object, types.ListType):
        return '&lt;%s-item list%s&gt;' % ( len( object), addressStr)
        
    elif isinstance( object, types.TupleType):
        return '&lt;%s-member tuple%s&gt;' % ( len( object), addressStr)
        
    elif isinstance( object, types.DictType):
        return '&lt;%s-key dict%s&gt;' % ( len( object), addressStr)
        
    elif isinstance( object, types.NoneType):
        return '&lt;(Pythonic None%s)&gt;' % ( addressStr)

    elif isinstance( object, types.FunctionType):
        return '&lt;function %s() in module %s&gt;' % ( object.func_name, object.__module__)

    elif isinstance( object, types.MethodType):
        return '&lt;method %s() in module %s&gt;' % ( object.func_name, object.__module__)
    else:
        return '(%s)' % ( repr( object))

#######################################################
def formatProxyPage( vsv, spc, proxy):
    message = ''
    if proxy.forwardTo:
        deadStr = 'Dead '
    else:
        deadStr = ''
        
    moduleName, className, hexAddress = parsePythonInstanceRepr( vsv, proxy)

    message = message+'%s<H2 class="PgHd">%s\
<div class="tmName" title="%s">%s</div>\
<div \
    title="A subject proxy is a set of instances of TMA-defined property classes that represents a subject (see the draft ISO/IEC 13250-5 Topic Maps Reference Model).  In Versavant, this abstraction is *implemented* as a &lt;%s.%s&gt; object.  This page portrays the abstraction, not the object." \
    class="proxyHd">Subject Proxy <span class="proxyId" title="%s">%s</span> <A CLASS="proxyObject" HREF="%s" TITLE="&lt;%s.%s&gt; object that represents this subject proxy"><br>(corresponding %s)</A></div>\
</H2>\n' % (
        ' '*spc,
        deadStr,
        vsv.topicMaps[ proxy.topicMapName].TMDesc,
        proxy.topicMapName,
        moduleName, className,
        vsv.proxyIdDesc,
        proxy.proxyId,
        vsv.vsvUrl( vsv.catKey( vsv.VSVOBJECTCommandForServer, pythonExpressionUrlEscapify(
              '.topicMaps[ \'%s\'].proxies[ \'%s\']'
               % ( proxy.topicMapName, proxy.proxyId)))),
        moduleName, className,
        objectIdStr( vsv, proxy))

    if proxy.forwardTo:
        message = message + 'This <b>DEAD PROXY</b> was merged into <A HREF="%s" class="proxyId">%s</A>' % (
            vsv.vsvUrl( vsv.catKey( proxy.topicMapName, proxy.forwardTo.proxyId)),
            proxy.forwardTo.proxyId)

    topicMap = vsv.topicMaps[ vsv.nowBrowsingTopicMapName]

    ## find previous and next living and livingOrDead proxyIds; set
    ## prevProxyIdString, nextProxyIdString, prevLivingProxyIdString,
    ## nextLivingProxyIdString
    proxyIdInt = nextProxyIdInt = prevProxyIdInt = int( proxy.proxyId)
    prevProxyIdString = '<span class="previousProxy">(no prev proxy)</span>'
    prevLivingProxyIdString = '<span class="previousLivingProxy">(no prev living proxy)</span>'
    foundPrevProxy = foundPrevLivingProxy = False
    while prevProxyIdInt > 1:
        prevProxyIdInt -= 1
        prevProxyId = vsv.proxyIdFromInteger( prevProxyIdInt)
        if topicMap.proxies.has_key( prevProxyId):
            if not foundPrevProxy:
                prevProxyIdString = '<A CLASS="previousProxy" TITLE="previous proxy, dead or alive" HREF="%s">%s<SPAN CLASS="leftRightArrow">&#9664;</SPAN></A>' % ( vsv.vsvUrl( prevProxyId), prevProxyId)
                foundPrevProxy = True
            if not topicMap.proxies[ prevProxyId].forwardTo:
                prevLivingProxyIdString = '<A CLASS="previousLivingProxy" TITLE="previous living proxy" HREF="%s">%s<SPAN CLASS="leftRightArrow">&#9664;&#9664;</SPAN></A>' % ( vsv.vsvUrl( prevProxyId), prevProxyId)
                foundPrevLivingProxy = True
        if foundPrevLivingProxy:
            break
    nextProxyIdString = '<span class="nextProxy">(no next proxy)</span>'
    nextLivingProxyIdString = '<span class="nextLivingProxy">(no next living proxy)</span>'
    foundNextProxy = foundNextLivingProxy = False
    while nextProxyIdInt < vsv.proxyCount:
        nextProxyIdInt += 1
        nextProxyId = vsv.proxyIdFromInteger( nextProxyIdInt)
        if topicMap.proxies.has_key( nextProxyId):
            if not foundNextProxy:
                nextProxyIdString = '<A CLASS="nextProxy" TITLE="next proxy, dead or alive" HREF="%s"><SPAN CLASS="leftRightArrow">&#9654;</SPAN>%s</A>' % ( vsv.vsvUrl( nextProxyId), nextProxyId)
                foundNextProxy = True
            if not topicMap.proxies[ nextProxyId].forwardTo:
                nextLivingProxyIdString = '<A CLASS="nextLivingProxy" TITLE="next living proxy" HREF="%s"><SPAN CLASS="leftRightArrow">&#9654;&#9654;</SPAN>%s</A>' % ( vsv.vsvUrl( nextProxyId), nextProxyId)
                foundNextLivingProxy = True
        if foundNextLivingProxy:
            break

    message = message + '%s<div class="prevNextProxyButtons">%s&nbsp;&nbsp;%s&nbsp;&nbsp;&nbsp;&nbsp;%s&nbsp;&nbsp;%s</div>\n' % \
        ( ' '*spc, prevLivingProxyIdString, prevProxyIdString, nextProxyIdString, nextLivingProxyIdString)

    message = message+'%s<H3>property instances:</H3>\n' % ( ' '*spc)

    propertyKey2List = propertyKey2Sort( proxy)

    message = message + '%s<UL>\n' % ( ' '*spc)
    for propertyKey2 in propertyKey2List:
        property = proxy.propertyInstances[ propertyKey2]
        if vsv.propertyInstanceIsSIP( property):
            sipOrOpStr = '&nbsp; <span class="sipop" title="Subject Identity Property">(SIP)</span>'
        else:
            sipOrOpStr = '&nbsp; <span class="sipop" title="\'Other\' Property (not a Subject Identity Property)">(OP)</span>'
        bigKey = vsv.catKey( property.topicMapName, property.propertyInstanceKey)
        littleKey = '<span class="tmaName" title="%s">%s</span><span class="fsep">%s</span><span class="pClass" title="%s">%s</span>' % (
            property.propertyClass.TMA.TMADesc,
            property.TMAName,
            vsv.fieldSeparator,
            property.propertyClass.PCDesc,
            property.propertyClassName
            )
        message = message + '%s<LI><P><A HREF="%s">%s</A> %s&nbsp;<A TARGET="_blank" class="auditArrow" HREF="%s" TITLE="audit the value of this property">&#9650;</A><A TARGET="_blank" class="dependArrow" TITLE="properties whose values depend on this property" HREF="%s">&#9660;</A>&nbsp;<span class="pValue">%s</span></P></LI>\n' % (
           ' '*(spc + 2),
           vsvUrl( bigKey),
           littleKey,
           sipOrOpStr,
           vsv.vsvUrl( vsv.catKey( vsv.AUDITVALUESOURCESCommandForServer, bigKey)),
           vsv.vsvUrl( vsv.catKey( vsv.AUDITDEPENDENTVALUESCommandForServer, bigKey)),
           formatValue( vsv, 0, vsv.catKey( property.topicMapName, property.propertyInstanceKey), property._value, showThumbnail = True)
           )
    message = message + '%s</UL>\n' % ( ' '*spc)


    return message


#######################################################
def formatAuditDependentValuesPage( vsv, spc, propertyAddress):
    message = ''
    topicMapName, proxyId, TMAName, propertyClassName = vsv.parsePropertyKey4( propertyAddress)
    topicMap = vsv.topicMaps[ topicMapName]
    proxy = topicMap.proxies[ proxyId]
    propertyInstance = proxy.propertyInstances[ vsv.catKey( TMAName, propertyClassName)]
    
    if proxy.forwardTo:
        forwardToPropertyAddress = vsv.catKey( topicMap.topicMapName, proxy.forwardTo.proxyId, TMAName, propertyClassName)
        forwardToPropertyKey = vsv.catKey( proxy.forwardTo.proxyId, TMAName, propertyClassName)
        deadOrAliveStr = '(DEAD; merged into <A HREF="%s">%s</A>)' % ( vsv.vsvUrl( forwardToPropertyAddress), forwardToPropertyKey)
    else:
        deadOrAliveStr = ''

    message = message+'%s<H2 class="pgHd">audit of values that depend on the value of property instance <br><A HREF="%s">%s</A></H2>\n' % (
        ' '*spc,
        vsv.vsvUrl( propertyAddress),
        propertyInstance.propertyInstanceKey)
    message = message + '%s<P>%s</P>\n' % (
        ' '*spc,
        deadOrAliveStr)


    dependentPropertyInstances = propertyInstance.dependentPropertyInstances

    livingDependents = {}
    deadDependents = {}
    for dependentPropertyInstanceKey in dependentPropertyInstances:
        dependentPropertySearch( dependentPropertyInstanceKey, livingDependents, deadDependents)

    message = message + '%s<UL>\n' % ( ' '*( spc + 2))
    message = message + '%s<LI>\n' % ( ' '*( spc + 4))
    if len( livingDependents):
        message = message + '%s<P><B>Living dependents:</B></P>\n' % ( ' '*( spc + 6))
    else:
        message = message + '%s<P><B>(no living dependents)</B></P>\n' % ( ' '*( spc + 6))
    message = message + '%s<UL>\n' % ( ' '*( spc + 8))

    livingDependentPropertyKeyList = livingDependents.keys()
    livingDependentPropertyKeyList.sort( cmpPropertyKeys3)
    for livingDependentPropertyKey in livingDependentPropertyKeyList:
        message = message + formatOneDependentProperty( vsv, spc + 10, topicMapName, livingDependentPropertyKey, livingDependents[ livingDependentPropertyKey])

    message = message + '%s</UL>\n' % ( ' '*( spc + 8))
    message = message + '%s</LI>\n' % ( ' '*( spc + 4))
    message = message + '%s<LI>\n' % ( ' '*( spc + 4))
    if len( deadDependents):
        message = message + '%s<P><B>Dead dependents (i.e., dependent properties that have been merged into others):</B></P>\n' % ( ' '*( spc + 6))
    else:
        message = message + '%s<P><B>(no dead dependents)</B></P>\n' % ( ' '*( spc + 6))
    message = message + '%s<UL>\n' % ( ' '*( spc + 8))

    deadDependentPropertyKeyList = deadDependents.keys()
    deadDependentPropertyKeyList.sort( cmpPropertyKeys3)
    for deadDependentPropertyKey in deadDependentPropertyKeyList:
        message = message + formatOneDependentProperty( vsv, spc + 10, topicMapName, deadDependentPropertyKey, deadDependents[ deadDependentPropertyKey])

    message = message + '%s</UL>\n' % ( ' '*( spc + 8))
    message = message + '%s</LI>\n' % ( ' '*( spc + 4))
    message = message + '%s</UL>\n' % ( ' '*( spc + 2))

    return message


#######################################################
def formatOneDependentProperty( vsv, spc, topicMapName, propertyInstanceKey, propertyValue):

    propertyAddress = vsv.catKey( topicMapName, propertyInstanceKey)

    message = ''

    message = message + '%s<LI>\n' % ( ' '*( spc + 0))
    message = message + '%s<P>%s<br>\n' % ( ' '*( spc + 2), formatValue( vsv, 0, propertyAddress, propertyValue, titleStr='dependent property instance value'))
    message = message + '%s   <A HREF="%s" TITLE="link to dependent property instance">%s</A> <A TARGET="_blank" HREF="%s" TITLE="audit the value of this property instance" class="auditArrow">&#9650;</A></P>\n' % (
        ' '*( spc + 2),
        vsv.vsvUrl( propertyAddress),
        propertyInstanceKey,
        vsv.vsvUrl( vsv.catKey( vsv.AUDITVALUESOURCESCommandForServer, propertyAddress)))
    message = message + '%s</LI>\n' % ( ' '*( spc + 0))

    return message

#######################################################
def dependentPropertySearch( dependentPropertyInstanceKey, livingDependents, deadDependents):
    propertyInstance = vsv.propertyInstanceFromPropertyInstanceKey( dependentPropertyInstanceKey)
    if propertyInstance.proxy.forwardTo:
        deadDependents[ dependentPropertyInstanceKey] = propertyInstance._value
    else:
        livingDependents[ dependentPropertyInstanceKey] = propertyInstance._value

    for dependentPropertyInstanceKey in propertyInstance.dependentPropertyInstances:
        dependentPropertySearch( dependentPropertyInstanceKey, livingDependents, deadDependents)

#######################################################
def formatAuditValueSourcesPage( vsv, spc, propertyAddress):
    message = ''
    topicMapName, proxyId, TMAName, propertyClassName = vsv.parsePropertyKey4( propertyAddress)
    topicMap = vsv.topicMaps[ topicMapName]
    proxy = topicMap.proxies[ proxyId]
    propertyInstance = proxy.propertyInstances[ vsv.catKey( TMAName, propertyClassName)]
    
    if proxy.forwardTo:
        forwardToPropertyAddress = vsv.catKey( topicMap.topicMapName, proxy.forwardTo.proxyId, TMAName, propertyClassName)
        forwardToPropertyKey = vsv.catKey( proxy.forwardTo.proxyId, TMAName, propertyClassName)
        deadOrAliveStr = '(DEAD; merged into <A HREF="%s">%s</A>)' % ( vsv.vsvUrl( forwardToPropertyAddress), forwardToPropertyKey)
    else:
        deadOrAliveStr = ''

    message = message+'%s<H2 class="pgHd">audit of value sources of property instance <br><A HREF="%s">%s</A></H2>\n' % (
        ' '*spc,
        vsv.vsvUrl( propertyAddress),
        propertyInstance.propertyInstanceKey)
    message = message + '%s<P>%s</P>\n' % (
        ' '*spc,
        deadOrAliveStr)

    message = message + '%s<UL class="audit">\n' % ( ' '*(spc + 0))
    message = message + '%s<LI>\n' % ( ' '*( spc + 2))
    message = message + _formatAuditValueSourcesPage( vsv, spc + 4, propertyInstance, 1)  ## callDepth of 1
    message = message + '%s</LI>\n' % ( ' '*( spc + 2))
    message = message + '%s</UL>\n' % ( ' '*( spc + 0))

    return message

#######################################################
def _formatAuditValueSourcesPage( vsv, spc, propertyInstanceOrPropertyAddress, callDepth):


    if hasattr( propertyInstanceOrPropertyAddress, 'ObjectClass'):
        propertyInstance = propertyInstanceOrPropertyAddress
        propertyAddress = vsv.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)
    else:
        propertyInstance = vsv.propertyInstanceFromPropertyAddress( propertyInstanceOrPropertyAddress)
        propertyAddress = propertyInstanceOrPropertyAddress

    topicMap = propertyInstance.topicMap
    topicMapName = topicMap.topicMapName
    procOperation = propertyInstance.procOperation
    procSpecObject = procOperation.procSpecObject

    message = ''

    message = message + '%s<P>%s<br>\n' % ( ' '*( spc + 0), formatValue( vsv, 0, propertyAddress, propertyInstance._value, titleStr='value being audited'))

    if callDepth:
        auditSourcesButtonString = ''
    else:
        auditSourcesButtonString = ' <A class="auditArrow" HREF="%s" TITLE="audit the value of this property">&#9650;</A>' % (
            vsv.vsvUrl( vsv.catKey( vsv.AUDITVALUESOURCESCommandForServer, propertyAddress)))

    message = message + '%s   <A HREF="%s" TITLE="link to property instance page" class="auditPropertyInstanceKeyLink">%s</A>%s <A TARGET="_blank" class="dependArrow" TITLE="properties whose values depend on this property" HREF="%s">&#9660;</A><br>\n' % (
        ' '*( spc + 0),
        vsv.vsvUrl( propertyAddress),
        propertyInstance.propertyInstanceKey,
        auditSourcesButtonString,
        vsv.vsvUrl( vsv.catKey( vsv.AUDITDEPENDENTVALUESCommandForServer, propertyAddress)))

    if callDepth > 0:
        if procSpecObject.ObjectClass == 'PropertyClass':
            message = message + '%s   <A HREF="%s" TITLE="link to ProcOperation object for this merger" class="auditString">merger of:</A><br>\n' % (
                ' '*( spc + 0),
                vsv.vsvUrl( vsv.catKey(
                    vsv.VSVOBJECTCommandForServer, 
                    pythonExpressionUrlEscapify( '.topicMaps[ \'%s\'].proxies[ \'%s\'].propertyInstances[ \'%s\'].procOperation' % (
                        propertyInstance.topicMap.topicMapName, propertyInstance.proxyId, propertyInstance.propertyInstanceInProxyKey)))))

            message = message + '%s<OL>\n' % ( ' '*( spc + 2))

            for valueSourcePropertyInstanceKey in procOperation.valueSources:
                message = message + '%s<LI>\n' % ( ' '*( spc + 4))
                message = message + _formatAuditValueSourcesPage( vsv, spc + 6, vsv.catKey( topicMapName, valueSourcePropertyInstanceKey), callDepth - 1)
                message = message + '%s</LI>\n' % ( ' '*( spc + 4))

            message = message + '%s</OL>\n' % ( ' '*( spc + 2))

            message = message + '%s</P>\n' % ( ' '*( spc + 0))

        elif procSpecObject.ObjectClass == 'OriginalPopulationTask':
            message = message + '%s   <A HREF="%s" TITLE="link to ProcOperation object for this original population task" class="auditString"> original population task "%s"</A><br>\n' % (
                ' '*( spc + 0),
                vsv.vsvUrl( vsv.catKey(
                    vsv.VSVOBJECTCommandForServer, 
                    pythonExpressionUrlEscapify( '.topicMaps[ \'%s\'].proxies[ \'%s\'].propertyInstances[ \'%s\'].procOperation' % (
                       propertyInstance.topicMap.topicMapName, propertyInstance.proxyId, propertyInstance.propertyInstanceInProxyKey)))),
                procSpecObject.originalPopulationTaskName)

        elif procSpecObject.ObjectClass == 'ConferralRule':
            message = message + '%s   <A HREF="%s" TITLE="link to ProcOperation object for this conferral rule" class="auditString">conferral rule "%s":</A><br>\n' % (
                ' '*( spc + 0),
                vsv.vsvUrl( vsv.catKey(
                    vsv.VSVOBJECTCommandForServer,
                    pythonExpressionUrlEscapify( '.topicMaps[ \'%s\'].proxies[ \'%s\'].propertyInstances[ \'%s\'].procOperation' % (
                        propertyInstance.topicMap.topicMapName, propertyInstance.proxyId, propertyInstance.propertyInstanceInProxyKey)))),
                procSpecObject.conferralRuleName)

            message = message + '%s<UL>\n' % ( ' '*( spc + 2))
            message = message + '%s<LI>\n' % ( ' '*( spc + 4))
            message = message + '%s<P>conferral triggers:<br>\n' % ( ' '*( spc + 6))
            message = message + '%s<UL>\n' % ( ' '*( spc + 8))

            triggerList = procOperation.triggers.keys()
            triggerList.sort()
            for roleKey in triggerList:
                message = message + '%s<LI>\n' % ( ' '*( spc + 10))
                message = message + '%s"%s" role: ' % ( ' '*( spc + 12), roleKey)
                message = message + _formatAuditValueSourcesPage( vsv, spc + 12, vsv.catKey( topicMapName, procOperation.triggers[ roleKey]), callDepth - 1)
                message = message + '%s</LI>\n' % ( ' '*( spc + 10))

            message = message + '%s</UL>\n' % ( ' '*( spc + 8))
            message = message + '%s</P>\n' % ( ' '*( spc + 6))
            message = message + '%s</LI>\n' % ( ' '*( spc + 4))
            message = message + '%s<LI>\n' % ( ' '*( spc + 4))
            message = message + '%s<P>sources of conferred value:<br>\n' % ( ' '*( spc + 6))
            message = message + '%s<UL>\n' % ( ' '*( spc + 8))

            valueSourceList = procOperation.valueSources.keys()
            valueSourceList.sort()
            for roleKey in valueSourceList:
                message = message + '%s<LI>\n' % ( ' '*( spc + 10))
                message = message + '%s"%s" role: ' % ( ' '*( spc + 12), roleKey)
                message = message + _formatAuditValueSourcesPage( vsv, spc + 12, vsv.catKey( topicMapName, procOperation.valueSources[ roleKey]), callDepth - 1)
                message = message + '%s</LI>\n' % ( ' '*( spc + 10))

            message = message + '%s</UL>\n' % ( ' '*( spc + 8))
            message = message + '%s</P>\n' % ( ' '*( spc + 6))
            message = message + '%s</LI>\n' % ( ' '*( spc + 4))

            message = message + '%s</UL>\n' % ( ' '*( spc + 2))

            message = message + '%s</P>\n' % ( ' '*( spc + 0))

        else:
            message = message + '%s<P>Unknown procSpecObject ObjectClass = "%s"</P>\n' % ( ' '*spc, procSpecObject.ObjectClass)


    return message

#######################################################
def formatPropertyPage( vsv, spc, property):
    message = ''
    propertyAddress = vsv.catKey( property.topicMapName, property.propertyInstanceKey)
    if property.proxy.forwardTo:
        forwardToPropertyAddress = vsv.catKey( property.topicMapName, property.proxy.forwardTo.proxyId, property.TMAName, property.propertyClassName)
        forwardToPropertyKey = vsv.catKey( property.proxy.forwardTo.proxyId, property.TMAName, property.propertyClassName)
        deadOrAliveStr = '(DEAD; merged into <A HREF="%s">%s</A>)' % ( vsv.vsvUrl( forwardToPropertyAddress), forwardToPropertyKey)
    else:
        deadOrAliveStr = ''

    message = message+'%s<H2 class="pgHd">Property Instance:<br>%s</H2><P>%s</P>\n' % (
        ' '*spc,
        propertyAddress,
        deadOrAliveStr)

    message = message+'%s<P><A TARGET="_blank" HREF="%s" class="auditArrow" TITLE="audit the value of this property instance">(&#9650; audit value sources)</A>&nbsp; &nbsp;<A TARGET="_blank" HREF="%s" class="dependArrow" TITLE="properties whose values depend on this property">(audit dependent values &#9660;)</A></P>\n' % (
        ' '*spc,
        vsv.vsvUrl( vsv.catKey( vsv.AUDITVALUESOURCESCommandForServer, propertyAddress)),
        vsv.vsvUrl( vsv.catKey( vsv.AUDITDEPENDENTVALUESCommandForServer, propertyAddress)))

    return _formatValuePage( vsv, message, spc, property, vsv.VSVOBJECTCommandForServer, '.topicMaps[ \'%s\'].proxies[ \'%s\'].propertyInstances[ \'%s\']' % (
        property.topicMap.topicMapName, property.proxyId, property.propertyInstanceInProxyKey))

#######################################################
def proxyThumbnail( vsv, proxy, thumbnailClassStr = '', thumbnailTitleStr = ''):

    propertyKeyList = propertyKey2Sort( proxy)

    if len( propertyKeyList):
        TMAName, propertyClassName = vsv.parsePropertyKey2( propertyKeyList[ 0])

        valueStr = '%s' % ( objectIdStr( vsv, proxy.propertyInstances[ propertyKeyList[ 0]]._value, suppressObjectDescription = True, stringValueLengthLimit = vsv.thumbnailStringValueLengthLimit))

        TMAName = TMAName.strip()
        TMAName = TMAName.replace( ' ', '&nbsp;')
        propertyClassName = propertyClassName.strip()
        propertyClassName = propertyClassName.replace( ' ', '&nbsp;')
        valueStr = valueStr.strip()
        valueStr = valueStr.replace( ' ', '&nbsp;')
        return '\
    <A HREF="%s" class="%s" TITLE="%s">\
    <span class="tmaName">%s</span>\
    <span class="fsep">%s</span>\
    <span class="pClass">%s</span>\
    =\
    <span class="pValue">%s</span>\
    </A>' % ( vsv.vsvUrl( vsv.catKey( proxy.topicMap.topicMapName, proxy.proxyId)),
              thumbnailClassStr, thumbnailTitleStr, 
              TMAName, vsv.fieldSeparator, propertyClassName, valueStr)

    else:
        return '<A HREF="%s" class="%s" TITLE="%s">(no properties)</A>' % (
            vsv.vsvUrl( vsv.catKey( proxy.topicMap.topicMapName, proxy.proxyId)),
            thumbnailClassStr, thumbnailTitleStr)

#######################################################
def propertyThumbnail( vsv, propertyInstance, thumbnailClassStr = '', thumbnailTitleStr = ''):

    proxyId = propertyInstance.proxyId
    _TMAName = propertyInstance.propertyClass.TMA.TMAName
    _propertyClassName = propertyInstance.propertyClass.propertyClassName

    valueStr = '%s' % ( objectIdStr( vsv, propertyInstance._value, suppressObjectDescription = True, stringValueLengthLimit = vsv.thumbnailStringValueLengthLimit))

    TMAName = _TMAName.strip()
    TMAName = TMAName.replace( ' ', '&nbsp;')
    propertyClassName = _propertyClassName.strip()
    propertyClassName = propertyClassName.replace( ' ', '&nbsp;')
    valueStr = valueStr.strip()
    valueStr = valueStr.replace( ' ', '&nbsp;')

    return '\
<A HREF="%s" class="%s" TITLE="%s">\
<span class="proxyId">%s</span>\
<span class="fsep">%s</span>\
<span class="tmaName">%s</span>\
<span class="fsep">%s</span>\
<span class="propClass">%s</span>\
=\
<span class="propValue">%s</span>\
</A>' % (
    vsv.vsvUrl( vsv.catKey( propertyInstance.topicMap.topicMapName,
                            proxyId, _TMAName, _propertyClassName)),
    thumbnailClassStr, thumbnailTitleStr,
    proxyId, vsv.fieldSeparator, TMAName, vsv.fieldSeparator, propertyClassName, valueStr)


#######################################################
def formatValue( vsv,
                 spc,
                 propertyAddress,  ## the address of the property
                 value,             ## the value to be formatted
                 pythonExpression = '',  ## the python expression that yielded this value.
                                    ## If pythonExpression == '', then this is the
                                    ## direct value of a property.
                 **args
                 ):

    """ Format one value. """

    if args.has_key( 'suppressThumbnail'): ## allow this to be suppressed even if vsv.THUMBNAILMODE == True
        suppressThumbnail = args[ 'suppressThumbnail']  
    else:
        suppressThumbnail = False

    if args.has_key( 'suppressSample'): ## allow this to be suppressed even if vsv.SAMPLEMODE == True
        suppressSample = args[ 'suppressSample']  
    else:
        suppressSample = False

    if args.has_key( 'suppressHexAddress'): ## allow this to be suppressed even if vsv.HEXADDRESSMODE == True
        suppressHexAddress = args[ 'suppressHexAddress']  
    else:
        suppressHexAddress = False

    if vsv.THUMBNAILMODE and ( not suppressThumbnail):
        showThumbnail = True
    else:
        showThumbnail = False

    if vsv.SAMPLEMODE and ( not suppressSample):
        showSample = True
    else:
        showSample = False

    if vsv.HEXADDRESSMODE and ( not suppressHexAddress):
        showHexAddress = True
    else:
        showHexAddress = False

    if args.has_key( 'suppressObjectDescription'):  ## allow this to be suppressed.  Takes effect in objectIdStr(), only for strings.
        suppressObjectDescription = args[ 'suppressObjectDescription']  
    else:
        suppressObjectDescription = False

    if args.has_key( 'titleStr'):
        titleStr = args[ 'titleStr']
    else:
        if isinstance( value, types.StringType) or isinstance( value, types.FunctionType) or isinstance( value, types.NoneType):
            titleStr = 'value'
        else:
            titleStr = 'value (and link to %s object)' % ( objectIdStrNoMarkup( vsv, value))

    message = ''

    if isinstance( value, types.InstanceType):
        moduleName, className, hexAddress = parsePythonInstanceRepr( vsv, value)
        if moduleName == vsv.versavantModuleName and className == 'ProxyObject':

            if value.forwardTo:
                deadStr = ' (dead)'
            else:
                deadStr = ''

            itemStr = ' <A HREF="%s">%s</A>' % (
                vsv.vsvUrl( vsv.catKey( vsv.VSVOBJECTCommandForServer, pythonExpressionUrlEscapify( '.topicMaps[ \'%s\'].proxies[ \'%s\']' % ( value.topicMap.topicMapName, value.proxyId)))),
                objectIdStr( vsv, value, titleStr = titleStr))

            if showThumbnail:
                thumbnailStr = '  %s' % ( proxyThumbnail( vsv, value,
                    'proxyThumbnailForProxyObjectObjectValue',
                    'link to page for subject proxy represented by this object'))
            else:
                thumbnailStr = ''

            ## message = message+'%s%s%s%s' % ( ' '*spc, itemStr, thumbnailStr, deadStr)
            message = message+'%s%s%s' % ( itemStr, thumbnailStr, deadStr)

        elif moduleName == vsv.versavantModuleName and className == 'PropertyInstance':

            if value.proxy.forwardTo:
                deadStr = ' (dead)'
            else:
                deadStr = ''

            itemStr = ' <A HREF="%s">%s</A>' % (
                vsv.vsvUrl( vsv.catKey( vsv.nowBrowsingTopicMapName, value.propertyInstanceKey)),
                objectIdStr( vsv, value, titleStr = titleStr))

            if showThumbnail:
                thumbnailStr = ' %s' % ( propertyThumbnail( vsv, value,
                    'propertyThumbnailForPropertyInstanceObjectValue',
                    'link to page for this PropertyInstance object'))
            else:
                thumbnailStr = ''

            ## message = message+'%s%s%s%s' % ( ' '*spc, itemStr, thumbnailStr, deadStr)
            message = message+'%s%s%s' % ( itemStr, thumbnailStr, deadStr)


        else:
            itemStr = ' <A HREF="%s">%s</A>' % (
                vsv.vsvUrl( vsv.catKey( propertyAddress, pythonExpressionUrlEscapify( pythonExpression))),
                objectIdStr( vsv, value, titleStr = titleStr))

            ## message = message+'%s%s' % ( ' '*spc, itemStr)
            message = message+'%s' % ( itemStr)

    elif isinstance( value, types.StringType):

        if showThumbnail:
            tmpStr = vsv.proxyOrPropertyLinkStr( vsv, value)
            if len( tmpStr):
                thumbnailStr = ' &nbsp; (%s)' % ( tmpStr)
            else:
                thumbnailStr = ''
        else:
            thumbnailStr = ''

        ## message = message + '%s%s%s\n' % ( ' '*(spc + 2), objectIdStr( vsv, value), thumbnailStr)
        message = message + '%s%s\n' % ( objectIdStr( vsv, value, titleStr = titleStr), thumbnailStr)

    elif isinstance( value, types.NoneType):

        ## message = message + '%s(Pythonic None)\n' % ( ' '*(spc + 2))
        message = message + objectIdStr( vsv, value, titleStr = titleStr)

    elif isinstance( value, types.ListType) or isinstance( value, types.TupleType):

        itemStr = ' <A HREF="%s">%s</A>' % (
            vsv.vsvUrl( vsv.catKey( propertyAddress, pythonExpressionUrlEscapify( pythonExpression))),
            objectIdStr( vsv, value, titleStr = titleStr))

        if showSample and len( value) > 0:
            sampleValStr = objectIdStr( vsv, value[ 0], suppressObjectDescription = True)
            if isinstance( value, types.ListType):
                sampleStr = ' <span class="listsample" title="the first item on the list, shown here as a sample">%s</span>' % ( sampleValStr)
            else:  ## it's a tuple
                sampleStr = ' <span class="listsample" title="the first member of the tuple, shown here as a sample">%s</span>' % ( sampleValStr)

        else:
            sampleStr = ''

        ## message = message+'%s%s%s' % ( ' '*spc, itemStr, sampleStr)
        message = message+'%s%s' % ( itemStr, sampleStr)

    elif isinstance( value, types.DictType):

        itemStr = ' <A HREF="%s">%s</A>' % (
            vsv.vsvUrl( vsv.catKey( propertyAddress, pythonExpressionUrlEscapify( pythonExpression))),
            objectIdStr( vsv, value, titleStr = titleStr))

        if showSample and len( value) > 0:
            dictKeyList = value.keys()
            dictKeyList.sort()
            dictKey = dictKeyList[ 0]
            dictKeyVal = value[ dictKey]
            dictKeyStr = objectIdStr( vsv, dictKey, suppressObjectDescription = True)
            dictKeyValStr = objectIdStr( vsv, dictKeyVal, suppressObjectDescription = True)

            sampleStr = '  <span class="dictsample" title="a sample key/value pair in the dictionary"><span class="dictkey">%s</span>=<span class="dictval">%s</span></span>' % (
                dictKeyStr, dictKeyValStr)
        else:
            sampleStr = ''

        ## message = message+'%s%s%s' % ( ' '*spc, itemStr, sampleStr)
        message = message+'%s%s' % ( itemStr, sampleStr)

    else:
        ## message = message + '%s%s\n' % ( ' '*( spc + 2), objectIdStr( vsv, value))
        message = message + '%s\n' % ( objectIdStr( vsv, value, titleStr = titleStr))

    return message

#######################################################
def formatValuePage( vsv, spc, property, propertyAddress, pythonExpression, **argDict):

    message = ''

    if vsv.nowBrowsingTopicMapName:
        message = message + '%s<H2 class="PgHd"><div class="tmName" title="%s">%s</div></H2>\n' % (
            ' '*spc,
            vsv.topicMaps[ vsv.nowBrowsingTopicMapName].TMDesc,
            vsv.nowBrowsingTopicMapName)

    message = message + '%s<H3 class="pgValue">Value:<br>%s&nbsp;%s</H3>\n' % ( ' '*spc, propertyAddress, pythonExpression)
    
    if argDict.has_key( 'suppressNonSystemProxies'):
        suppressNonSystemProxies = True
    else:
        suppressNonSystemProxies = False

    if argDict.has_key( 'suppressDeadProxies'):
        suppressDeadProxies = True
    else:
        suppressDeadProxies = False

    if suppressNonSystemProxies and suppressDeadProxies:
        message = message + '%s<H3>(with only live, non-system proxies shown)</H3>\n' % ( ' '*spc)
    elif suppressNonSystemProxies:
        message = message + '%s<H3>(with only non-system proxies shown)</H3>\n' % ( ' '*spc)
    elif suppressDeadProxies:
        message = message + '%s<H3>(with only live proxies shown)</H3>\n' % ( ' '*spc)

    if property == None:
        if pythonExpression == '' or pythonExpression == '.':
            value = vsv
        else:
            execStr = 'value = vsv%s' % ( pythonExpression)
            try:
                exec( execStr)  ## hope this works!
            except:
                message = message + '%s<P>Error: Python expression "%s" invalid.</P>\n' % ( ' '*( spc + 2), execStr)
                return message
    else:
        if pythonExpression != '':
            execStr = 'value = property._value%s' % ( pythonExpression)
            try:
                exec( execStr)  ## hope this works!
            except:
                message = message + '%s<P>Error: expression "%s" is invalid.</P>\n' % ( ' '*( spc + 2), execStr)
                return message
        else:
            value = property._value

    return _formatValuePage( vsv, message, spc, value, propertyAddress, pythonExpression, suppressNonSystemProxies, suppressDeadProxies)

#######################################################
def cmpPropertyKeys2( a, b):
    a1, a2 = vsv.parsePropertyKey2( a)
    b1, b2 = vsv.parsePropertyKey2( b)

    trial = cmp( a1, b1)
    if trial:
        return trial
    return cmp( a2, b2)

#######################################################
def cmpPropertyKeys3( a, b):

    a1, a2, a3 = vsv.parsePropertyKey3( a)
    b1, b2, b3 = vsv.parsePropertyKey3( b)

    try:
        trial = int( a1) - int( b1)
    except:
        trial = cmp( a2, b2)
    if trial:
        return trial
    trial = cmp( a2, b2)
    if trial:
        return trial
    return cmp( a3, b3)

#######################################################
def cmpProcOperationIDs( a, b):
    aMatch = vsv.procOperationIDValidatorRE.match( a)
    bMatch = vsv.procOperationIDValidatorRE.match( b)
    aNumString = aMatch.group(2)
    bNumString = bMatch.group(2)
    return int( aNumString) - int( bNumString)

#######################################################
def cmpStringsAsIntegers( a, b):
    return int( a) - int( b)

#######################################################
def cmpPropertyAddresses( a, b):
    a1, a2, a3, a4 = vsv.parsePropertyKey4( a)
    b1, b2, b3, b4 = vsv.parsePropertyKey4( b)

    if a1 != b1:
        traceback.print_stack()
        errMsg( 'Attempting to compare addresses of properties in two different topic maps: "%s", "%s".' % ( a, b))
        sys.exit( 1)

    trial = int( a2) - int( b2)
    if trial:
        return trial
    trial = cmp( a3, b3)
    if trial:
        return trial
    return cmp( a4, b4)

#######################################################
def propertyKey2Sort( proxy):
    ## return the list of property keys in property-key-sort
    ## order, which is that TMAs of the properties are
    ## sorted alphabetically, and the property classes within each
    ## TMA are sorted alphabetically, EXCEPT that the
    ## first property within each TMA is the SIP for that
    ## TMA, if any.

    dictOfTMAs = {}
    for propertyName in proxy.propertyInstances:
        TMAName, propertyClassName = vsv.parsePropertyKey2( propertyName)
        thisProperty = proxy.propertyInstances[ propertyName]
        if not dictOfTMAs.has_key( TMAName):
            thisTMADict = dictOfTMAs[ TMAName] = { 'SIPs': {},
                                                'OPs': {}}
        else:
            thisTMADict = dictOfTMAs[ TMAName]

        if vsv.propertyInstanceIsSIP( thisProperty):
            thisTMADict[ 'SIPs'][ propertyName] = thisProperty
        else:
            thisTMADict[ 'OPs'][ propertyName] = thisProperty

    listOfTMANamesWithSIPs = []
    listOfTMANamesWithoutSIPs = []
    for thisTMAName in dictOfTMAs:
        thisTMADict = dictOfTMAs[ thisTMAName]

        thisTMADictSIPNameKeyList = thisTMADict[ 'SIPkeys'] = thisTMADict[ 'SIPs'].keys()
        thisTMADictSIPNameKeyList.sort( cmpPropertyKeys2)
        thisTMADictOPNameKeyList = thisTMADict[ 'OPkeys'] = thisTMADict[ 'OPs'].keys()
        thisTMADictOPNameKeyList.sort( cmpPropertyKeys2)
        
        if len( thisTMADictSIPNameKeyList):
            listOfTMANamesWithSIPs.append( thisTMAName)
        else:
            listOfTMANamesWithoutSIPs.append( thisTMAName)

    listOfTMANamesWithSIPs.sort()
    listOfTMANamesWithoutSIPs.sort()

    finalList = []
    for passCounterA in range( 0, 2):
        if passCounterA == 0:
            TMANameList = listOfTMANamesWithSIPs
        else:
            TMANameList = listOfTMANamesWithoutSIPs
        for TMAName in TMANameList:
            thisTMADict = dictOfTMAs[ TMAName]
            for passCounterB in range( 0, 2):
                if passCounterB == 0:
                    propertyKey2List = thisTMADict[ 'SIPkeys']
                else:
                    propertyKey2List = thisTMADict[ 'OPkeys']
                finalList.extend( propertyKey2List)

    return finalList


#######################################################
def _formatValuePage( vsv, message, spc, value, propertyAddress, pythonExpression, suppressNonSystemProxies = False, suppressDeadProxies = False):

    if isinstance( value, types.StringType):
        message = message + '%s<div class="valuePageDesc">%s%s</div>\n' % (
            ' '*(spc + 2),
            objectIdStr( vsv, value, titleStr='this string is the value that this page is about'),
            proxyOrPropertyLinkStr( value))

    elif isinstance( value, types.ListType) or isinstance( value, types.TupleType):
        if isinstance( value, types.ListType):
            message = message + '%s<div class="valuePageDesc">%s:</div>\n' % ( ' '*(spc + 2),
                objectIdStr( vsv, value, titleStr='list whose items are shown below'))
        else: ## it's a tuple
            message = message + '%s<div class="valuePageDesc">%s:</div>\n' % ( ' '*(spc + 2),
                objectIdStr( vsv, value, titleStr='tuple whose members are shown below'))
        if len( value):
            message = message + '%s<OL class="valuePageList">\n' % ( ' '*(spc + 4))
            counter = 0
            for item in value:
                message = message + '%s<LI class="valuePageListItem">\n' % ( ' '*(spc +6))
                message = message + formatValue( vsv, spc + 8, propertyAddress, item, '%s[ %s]' % ( pythonExpression, counter), titleStr="list item")
                message = message + '%s</LI>\n' % ( ' '*(spc +6))
                counter += 1
            message = message + '%s</OL>\n' % ( ' '*(spc + 4))
        else:
            if isinstance( value, types.ListType):
                message = message + ( '%s<P class="valuePageExcuse">(no items exist in this list)</P>\n' % ( ' '*( spc + 4)))
            else:  ## it's a tuple
                message = message + ( '%s<P class="valuePageExcuse">(this tuple has no members)</P>\n' % ( ' '*( spc + 4)))

    elif isinstance( value, types.DictType):
        message = message + '%s<div class="valuePageDesc">%s</div>\n' % ( ' '*(spc + 2), objectIdStr( vsv, value, titleStr='dictionary whose key/value pairs are listed below'))
        dictKeys = value.keys()
        if len( dictKeys):
            if isinstance( dictKeys[0], types.StringType):
                f1, f2, f3 = vsv.parsePropertyKey3( dictKeys[ 0])
                if vsv.isProxyId( dictKeys[ 0], vsv.topicMaps[ vsv.nowBrowsingTopicMapName]):
                    dictKeys.sort( cmpStringsAsIntegers)
                elif vsv.isProcOperationID( dictKeys[ 0]):
                    dictKeys.sort( cmpProcOperationIDs)
                elif f1:
                    dictKeys.sort( cmpPropertyKeys3)
                else:
                    dictKeys.sort()
            elif isinstance( dictKeys[0], types.IntType):
                dictKeys.sort()
            tmpMessage = ''
            tmpMessage = tmpMessage + '%s<UL class="valuePageDict">\n' % ( ' '*(spc + 4))
            shownCount = suppressedCount = 0
            for key in dictKeys:
                if suppressNonSystemProxies:
                    if vsv.proxies.has_key( key):
                        thisParticularProxy = vsv.proxies[ key]
                        if thisParticularProxy.TMAsWithSIPsInThisProxy.has_key( vsv.systemTMAName) and len( thisParticularProxy.TMAsWithSIPsInThisProxy) == 1:
                            suppressedCount += 1
                            continue
                if suppressDeadProxies:
                    if vsv.proxies.has_key( key):
                        if vsv.proxies[ key].forwardTo:
                            suppressedCount += 1
                            continue
                        
                shownCount += 1
                tmpMessage = tmpMessage + '%s<LI>\n' % ( ' '*(spc +6))
                tmpMessage = tmpMessage + \
'[ <span class="dictKey" title="a key in this dictionary">' \
+ objectIdStr( vsv, key, suppressObjectDescription = True) \
+ '</span>] = <span class="dictVal">' \
+ formatValue( vsv, 1, propertyAddress, value[ key], \
               '%s[ \'%s\']' % ( pythonExpression, key), showThumbnail = True, titleStr = 'object that is the value of the dict key on the left') \
+ '</span>'
                tmpMessage = tmpMessage + '%s</LI>\n' % ( ' '*(spc +6))

            tmpMessage = tmpMessage + '%s</UL>\n' % ( ' '*(spc + 4))

            if suppressNonSystemProxies and suppressDeadProxies:
                message = message + '%s<div class="valuePageDesc">(%s of %s shown; %s dead and/or system proxy listings suppressed)</div>\n' % (
                    ' '*(spc + 2),
                    shownCount,
                    shownCount + suppressedCount,
                    suppressedCount)
            elif suppressNonSystemProxies:
                message = message + '%s<div class="valuePageDesc">(%s of %s shown; %s system proxy listings suppressed)</div>\n' % (
                    ' '*(spc + 2),
                    shownCount,
                    shownCount + suppressedCount,
                    suppressedCount)
            elif suppressDeadProxies:
                message = message + '%s<div class="valuePageDesc">(%s of %s shown; %s dead proxy listings suppressed)</div>\n' % (
                    ' '*(spc + 2),
                    shownCount,
                    shownCount + suppressedCount,
                    suppressedCount)

            message = message + tmpMessage

        else:
            message = message + ( '%s<div class="valuePageDesc">(there are no keys in this dictionary)</div>\n' % ( ' '*( spc + 4)))

    elif isinstance( value, types.InstanceType):

        moduleName, className, hexAddress = parsePythonInstanceRepr( vsv, value)

        if moduleName == vsv.versavantModuleName and className == 'ProxyObject':
            message = message + '%s<div title="This object is not a subject proxy; it represents and implements a subject proxy." class="valuePageDesc">%s</div>\n' % ( ' '*(spc + 2), objectIdStr( vsv, value))

            message = message + '(corresponding subject proxy: %s)' % ( proxyThumbnail( vsv, value,
                'proxyThumbnailForProxyObjectObjectValue',
                'link to page for subject proxy represented by this object'))
        else:
            message = message + '%s<div class="valuePageDesc">%s</div>\n' % ( ' '*(spc + 2), objectIdStr( vsv, value, titleStr = 'object whose attributes are listed below, along with their values'))




        message = message + '%s<UL class="valuePageObjectAttributeList">\n' % ( ' '*(spc + 4))
        attributeNameList = dir( value)
        for attributeName in attributeNameList:

            if moduleName == vsv.versavantModuleName:
                if className == 'TopicMap':
                    if ( attributeName.startswith( 'opc_system') or
                         attributeName.startswith( 'opi_system') or
                         attributeName.startswith( 'sipc_system') or
                         attributeName.startswith( 'sipi_system') or
                         attributeName.startswith( 'valt_system') or
                         attributeName.startswith( 'writeBoot') or
                         attributeName.startswith( 'app__system') or
                         attributeName == 'topicMapProxy' or
                         attributeName == 'systemOriginalPopulationTask') :
                        continue
                elif className == 'Versavant':
                    if attributeName in [
##                         'TMA',
##                         'ConferralRule',
##                         'OriginalPopulationTask',
##                         'ObjectClass',
##                         'PropertyClass',
##                         'PropertyInstance',
##                         'ProxyObject',
##                         'TopicMap',
##                         'VSVOBJECTCommandForServer',
##                         'ValueType',
##                         'catKey',
##                         'checkOneProxy',
##                         'conferOnce',
##                         'conferralRuleCommandsTagNoArgStringRE',
##                         'configFileCommand',
##                         'configFileLineNumber',
##                         'dbgMsg',
##                         'errMsg',
##                         'audit',
##                         'isTMAName',
##                         'isPropertyClassName',
##                         'isPropertyInstanceKey',
##                         'isPropertyInProxy',
##                         'isProxyId',
##                         'isTopicMapName',
##                         'liveProxy',
##                         'mergeListOfProxies',
##                         'mergeOnce',
##                         'moduleImporter',
##                         'loadTMA',
##                         'newPropertyInstance',
##                         'newProxyObject',
##                         'newTopicMap',
##                         'nowImportingFromModuleFileName',
##                         'nowUsingTmaConfigFilePath',
##                         'overallMergeWasSignificant',
##                         'parsePropertyKey3',
##                         'parsePropertyKey2',
##                         'populate',
##                         'propertyInstanceKeyRE',
##                         'proxyIdFromInteger',
##                         'propertyInstanceIsSIP',
##                         'propertyNameRE',
##                         'proxyOrPropertyLinkStr',
##                         'proxyIdStrValidatorRE',
##                         'proxyStrZeroFill',
##                         'pyModuleNameFixRE',
##                         'readmodule_ex',
##                         'registerOriginalPopulationTask',
##                         'registerPropertyClass',
##                         'registerValueType',
##                         'server_name',
##                         'server_port',
##                         'setPropertyValue',
##                         'startTime',
##                         'stdMsg',
##                         'stop_serving',
##                         'systemAppDirName', 
##                         'systemAppDirPath', 
##                         'systemTMAName', 
##                         'systemAppPropertyClassesFileName', 
##                         'systemAppPropertyClassesFilePath', 
##                         'systemAppPropertyClassesModuleName', 
##                         'systemAppValueTypesFileName', 
##                         'systemAppValueTypesFilePath', 
##                         'systemAppValueTypesModuleName', 
##                         'systemBootstrapCodeFileName',
##                         'systemBootstrapCodeFilePath',
##                         'systemBootstrapOriginalPopulationTaskName',
##                         'systemExecDirPath',
##                         'valueTypesAndPropertyClassesCommandsTagNoArgStringRE',
##                         'vsvUrl'
                        ]:
                        continue
            if attributeName.startswith('__'):
                continue

            attributeDescStr = ''
            attributeDescStrKey = '%s.%s' % ( className, attributeName)
            if vsv.VsysAttributeDescriptionDict.has_key( attributeDescStrKey):
                attributeDescStr = ' TITLE="%s"' % ( vsv.VsysAttributeDescriptionDict[ attributeDescStrKey])
            else:
                errMsg( 'no entry in vsv.VsysAttributeDescriptionDict for "%s"' % ( attributeDescStrKey))
                
            message = message + '%s<LI>\n' % ( ' '*(spc +6))

            execStr = 'attrValue = value.%s' % ( attributeName)
            exec( execStr)
            message = message + '%s.<span class="objectAttributeName"%s>%s</span> = <span class="objectAttributeValue" >%s</span>\n' % (
                ' '*( spc+8),
                attributeDescStr,
                attributeName,
                formatValue( vsv, 0, propertyAddress, attrValue, '%s.%s' % ( pythonExpression, attributeName)))

            message = message + '%s</LI>\n' % ( ' '*(spc +6))

        message = message + '%s</UL>\n' % ( ' '*(spc + 4))

    else:
        message = message + '%s<div class="valuePageDesc">%s</div>\n' % ( ' '*(spc + 2), objectIdStr( vsv, value, titleStr='value that this page is about'))

    return message

#######################################################
def formatHTMLMessage( qStr):
    workArgs = qStr.split( vsv.fieldSeparator)

    modeArgs = workArgs[ 0].split( ',')
    if modeArgs[ 0] in [ vsv.SAMPLEMODEModeArgForServer,
                         vsv.NOSAMPLEMODEModeArgForServer,
                         vsv.THUMBNAILMODEModeArgForServer,
                         vsv.NOTHUMBNAILMODEModeArgForServer,
                         vsv.HEXADDRESSMODEModeArgForServer,
                         vsv.NOHEXADDRESSMODEModeArgForServer]:
        del workArgs[ 0] ## get rid of this; we're done with it
        for modeArg in modeArgs:
            if modeArg == vsv.SAMPLEMODEModeArgForServer:
                vsv.SAMPLEMODE = True
            elif modeArg == vsv.NOSAMPLEMODEModeArgForServer:
                vsv.SAMPLEMODE = False
            elif modeArg == vsv.THUMBNAILMODEModeArgForServer:
                vsv.THUMBNAILMODE = True
            elif modeArg == vsv.NOTHUMBNAILMODEModeArgForServer:
                vsv.THUMBNAILMODE = False
            elif modeArg == vsv.HEXADDRESSMODEModeArgForServer:
                vsv.HEXADDRESSMODE = True
            elif modeArg == vsv.NOHEXADDRESSMODEModeArgForServer:
                vsv.HEXADDRESSMODE = False
            else:
                vsv.errMsg( 'Unrecognized modeArg: "%s"' % ( modeArg))
                sys.exit( 1)

    qStr = workArgs[ 0]
    for workArg in workArgs[ 1:]:
        qStr = '%s%s%s' % ( qStr, vsv.fieldSeparator, workArg)

    args = []
    for arg in workArgs:
        args.append( pythonExpressionUrlUnescapify( arg))

    if qStr == vsv.STOPSERVINGCommandForServer:
        vsv.stop_serving = True

    message = ''
    message = message+'%s<HTML>\n' % ( ' '*0)
    message = message+'%s<HEAD>\n' % ( ' '*2)
    message = message+'%s<TITLE>Versavant - Topic Map Inspection Tool</TITLE>\n' % ( ' '*4)
    message = message+'%s<STYLE TYPE="text/css"><!--\n' % ( ' '*4)
    message = message+'\
  body { margin:0 0 0 0; height:100%;}\n\
  .content {\n\
    margin:0 0 0 3;\n\
  }\n\
  a { text-decoration: none; }\n\
  a:visited { color: blue; }\n\
  a:hover { color: #000099;/* dark blue*/ }\n\
  .topnav {\n\
    width: 100%;\n\
    background-color: #dddddd;\n\
  }\n\
  .topnav a {\n\
    font-size: smaller;\n\
    font-family: sans-serif;\n\
    color: #555555;/*dark gray*/\n\
  }\n\
  .bottomnav {\n\
    width: 100%;\n\
    margin:60 0 0 -3;\n\
    background-color: #dddddd;\n\
  }\n\
  .bottomnav a {\n\
    font-size: smaller;\n\
    font-family: sans-serif;\n\
    color: #555555;/*dark gray*/\n\
  }\n\
  .stopbutton {\n\
    margin:0 0 0 0;\n\
    padding:0 0 0 0;\n\
  }\n\
  .stopbutton a {\n\
    /*height:18px;*/\n\
    margin:0 0 0 0;\n\
    padding:0 3 0 3;\n\
    background-color: #aa2211;\n\
  }\n\
  .viewOptions {\n\
    /*background-color: #dddddd;*/\n\
  }\n\
  .leftRightArrow {\n\
    font-size: 125%;\n\
  }\n\
  .auditArrow, a.auditArrow:visited {\n\
    color: #cccccc;/*ccccff;*/\n\
    font-size: 97%;\n\
  }\n\
  a.auditArrow:hover {\n\
    color: #000099;\n\
    font-size: 97%;\n\
  }\n\
  .dependArrow, a.dependArrow:visited {\n\
    color: #cccccc;/*ccccff;*/\n\
    font-size: 97%;\n\
  }\n\
  a.dependArrow:hover {\n\
    color: #000099;\n\
    font-size: 97%;\n\
  }\n\
  H3 { font-family: sans-serif; font-weight: normal; }\n\
  .thumbnail {\n\
    background-color: wheat;\n\
    font-size: smaller;\n\
  }\n\
  .proxyId {\n\
    /*color: red;*/\n\
  }\n\
  .proxyObject {\n\
    margin:0 0 0 0;\n\
    font-size: 12pt;\n\
    font-weight: light;\n\
    font-family: sans-serif;\n\
  }\n\
  .pgHd {  /* Header for all page types */ \n\
    margin:20 0 0 20;\n\
    text-indent: -20px;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: normal;\n\
  }\n\
  .proxyPgHd {  /* Header for subject proxy pages */ \n\
    margin:20 0 0 0;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: normal;\n\
  }\n\
  .proxyHd {  /* Page title for specific subject proxy */ \n\
    margin:20 0 0 0;\n\
  }\n\
  .pgValue {\n\
    margin-left: 20px;\n\
    text-indent: -20px;\n\
  }\n\
  .tmName {  /* topic map name */ \n\
    margin:20 0 0 0;\n\
  }\n\
  .tmaName /* TMA name */  {\n\
    font-style: italic;\n\
    font-family: serif;\n\
  }\n\
  .pClass { /* property class */  \n\
    font-style: normal;\n\
    font-family: serif;\n\
  }\n\
  .pValue {  /* property value */ \n\
    color: black;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
  }\n\
  .fsep {  /* field separator */ \n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: light;\n\
    font-size: smaller;\n\
  }\n\
  a.nextLivingProxy, a.nextLivingProxy:visited {  /*  */ \n\
    color: firebrick;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: light;\n\
    font-size: smaller;\n\
  }\n\
  a.nextProxy, a.nextProxy:visited {  /*  */ \n\
    color: peru;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: light;\n\
    font-size: smaller;\n\
  }\n\
  a.previousLivingProxy, a.previousLivingProxy:visited {  /*  */ \n\
    color: firebrick;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: light;\n\
    font-size: smaller;\n\
  }\n\
  a.previousProxy, a.previousProxy:visited {  /*  */ \n\
    color: peru;\n\
    font-style: normal;\n\
    font-family: sans-serif;\n\
    font-weight: light;\n\
    font-size: smaller;\n\
  }\n\
  .proxyThumbnailForProxyObjectObjectValue {\n\
    background-color:#ffff99;/*yellow*/\n\
    text-decoration: underline;\n\
  }\n\
  .proxyThumbnailAsGlossOnString {\n\
    background-color:#ffcc99;/*peach*/\n\
    text-decoration: underline;\n\
  }\n\
  .listsample {\n\
    background-color:#ccffcc;/*green*/\n\
  }\n\
  .dictsample {\n\
    background-color:#ccffff; /*aqua*/\n\
  }\n\
  li {\n\
    list-style-type: none;\n\
    margin:3 0 0 30;\n\
    text-indent: -30px;\n\
  }\n\
  ul.audit li {\n\
    list-style-type: none;\n\
    margin:7 0 0 0;\n\
    text-indent: 0px;\n\
  }\n\
  li p {\n\
    margin:0 0 0 0;\n\
  }\n\
  p ul {\n\
    margin:0 0 0 0;\n\
  }\n\
  b {\n\
    font-weight:normal;\n\
  }\n\
'  
    message = message+'%s--></STYLE>\n' % ( ' '*4)
    message = message+'%s</HEAD>\n' % ( ' '*2)
    message = message+'%s<BODY>\n' % ( ' '*2)

    if vsv.stop_serving == False:
        if qStr == '':  ## ''  i.e., the null string
                        ## Format the list of available topicMaps
            message = message + formatProxyListButtons( vsv, 'topnav', qStr, special='StopServerOnly')
            message = message+formatListOfAvailableTopicMapsInHTMLPage( vsv, 4)
            message = message + formatProxyListButtons( vsv, 'bottomnav', qStr, special='StopServerOnly')

        elif args[ 0] == vsv.ALLPROXIESCommandForServer:
            if len( args) < 2:
                message = message + '<H2>Error: No topic map specified.  Request should have been something like "%s".</H2>\n' % (
                    vsv.vsvUrl( vsv.catKey( args[ 0], 'topicMapName')))
            else:
                if not vsv.topicMaps.has_key( args[ 1]):
                    message = message + '%s<H2>Error: "%s" is not a topic map name.</H2>\n' % ( ' '*4, args[ 1])
                else: 
                    vsv.nowBrowsingTopicMapName = args[ 1]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    message = message + formatValuePage(
                        vsv,
                        4,
                        None,
                        vsv.VSVOBJECTCommandForServer,
                        '.topicMaps[ \'%s\'].proxies' % vsv.nowBrowsingTopicMapName)
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif args[ 0] == vsv.NONSYSTEMPROXIESCommandForServer:
            if len( args) < 2:
                message = message + '<H2>Error: No topic map specified.  Request should have been something like "%s".</H2>\n' % (
                    vsv.vsvUrl( vsv.catKey( args[ 0], 'topicMapName')))
            else:
                if not vsv.topicMaps.has_key( args[ 1]):
                    message = message + '%s<H2>Error: "%s" is not a topic map name.</H2>\n' % ( ' '*4, args[ 1])
                else: 
                    vsv.nowBrowsingTopicMapName = args[ 1]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    message = message + formatValuePage(
                        vsv,
                        4,
                        None,
                        vsv.VSVOBJECTCommandForServer,
                        '.topicMaps[ \'%s\'].proxies' % vsv.nowBrowsingTopicMapName,
                        suppressNonSystemProxies = True)
                message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif args[ 0] == vsv.LIVEPROXIESCommandForServer:
            if len( args) < 2:
                message = message + '<H2>Error: No topic map specified.  Request should have been something like "%s".</H2>\n' % (
                    vsv.vsvUrl( vsv.catKey( args[ 0], 'topicMapName')))
            else:
                if not vsv.topicMaps.has_key( args[ 1]):
                    message = message + '%s<H2>Error: "%s" is not a topic map name.</H2>\n' % ( ' '*4, args[ 1])
                else: 
                    vsv.nowBrowsingTopicMapName = args[ 1]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    message = message + formatValuePage(
                        vsv,
                        4,
                        None,
                        vsv.VSVOBJECTCommandForServer,
                        '.topicMaps[ \'%s\'].proxies' % vsv.nowBrowsingTopicMapName,
                        suppressDeadProxies = True)
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif args[ 0] == vsv.LIVENONSYSTEMPROXIESCommandForServer:
            if len( args) < 2:
                message = message + '<H2>Error: No topic map specified.  Request should have been something like "%s".</H2>\n' % (
                    vsv.vsvUrl( vsv.catKey( args[ 0], 'topicMapName')))
            else:
                if not vsv.topicMaps.has_key( args[ 1]):
                    message = message + '%s<H2>Error: "%s" is not a topic map name.</H2>\n' % ( ' '*4, args[ 1])
                else: 
                    vsv.nowBrowsingTopicMapName = args[ 1]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    message = message + formatValuePage(
                        vsv,
                        4,
                        None,
                        vsv.VSVOBJECTCommandForServer,
                        '.topicMaps[ \'%s\'].proxies' % vsv.nowBrowsingTopicMapName,
                        suppressNonSystemProxies = True,
                        suppressDeadProxies = True)
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif args[ 0] == vsv.AUDITVALUESOURCESCommandForServer:
            if len( args) < 2:
                message = message + '<H2>Error: No topic map specified.  Request should have been something like "%s".</H2>\n' % (
                    vsv.vsvUrl( vsv.catKey( args[ 0], 'topicMapName')))
            else:
                if not vsv.topicMaps.has_key( args[ 1]):
                    message = message + '%s<H2>Error: "%s" is not a topic map name.</H2>\n' % ( ' '*4, args[ 1])
                else: 
                    vsv.nowBrowsingTopicMapName = args[ 1]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    propertyAddressMatchObject = vsv.AuditValueSourcesRE.match( qStr)
                    message = message + formatAuditValueSourcesPage( vsv, 4, pythonExpressionUrlUnescapify( propertyAddressMatchObject.group(3)))
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif args[ 0] == vsv.AUDITDEPENDENTVALUESCommandForServer:
            if len( args) < 2:
                message = message + '<H2>Error: No topic map specified.  Request should have been something like "%s".</H2>\n' % (
                    vsv.vsvUrl( vsv.catKey( args[ 0], 'topicMapName')))
            else:
                if not vsv.topicMaps.has_key( args[ 1]):
                    message = message + '%s<H2>Error: "%s" is not a topic map name.</H2>\n' % ( ' '*4, args[ 1])
                else: 
                    vsv.nowBrowsingTopicMapName = args[ 1]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    propertyAddressMatchObject = vsv.AuditDependentValuesRE.match( qStr)
                    message = message + formatAuditDependentValuesPage( vsv, 4, pythonExpressionUrlUnescapify( propertyAddressMatchObject.group(3)))
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif len( args) == 1:
            if args[ 0] == vsv.VSVOBJECTCommandForServer:
                ## value page for the versavant object.
                vsv.nowBrowsingTopicMapName = None  ## this may break something, but the only way you
                                                    ## can be here is to manually create this URL.
                message = message + formatValuePage( vsv, 4, None, args[ 0], '')
            else:
                proxy = vsv.isProxyId( args[ 0])
                if proxy:
                                           ## Format the proxy whose ID it is.
                    vsv.nowBrowsingTopicMapName = proxy.topicMap.topicMapName
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    message = message + formatProxyPage( vsv, 4, vsv.proxies[ args[ 0]])
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)
                elif vsv.isTopicMapName( args[ 0]):  ## [topicMapName]
                                             ## Format the proxy of the named TM
                    vsv.nowBrowsingTopicMapName = args[ 0]
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    if len( vsv.topicMapProxyIds[ args[ 0]]) == 1:
                        message = message + formatProxyPage( vsv, 4, vsv.proxies[ vsv.topicMapProxyIds[ args[ 0]][0]])
                    else:
                        message = message + '%s<H2>choose a proxy of TM %s:</H2>\n' % ( ' '*4, vsv.topicMapProxyIds[ args[ 0]])
                        message = message + '%s<OL>\n' % ( ' '*4)
                        for topicMapProxyId in vsv.topicMapProxyIds[ args[ 0]]:
                            message = message + '%s<LI><P><A HREF="%s">%s</A></P></LI>\n' % ( ' '*6, vsv.vsvUrl( topicMapProxyId), topicMapProxyId)
                        message = message + '%s</OL>\n' % ( ' '*4)
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

                else:
                    message = message + '%s<H2>Error: "%s" is neither a proxy ID nor a TM name.</H2>\n' % ( ' '*4, args[ 0])

        elif len( args) == 2:
            if args[ 0] == vsv.VSVOBJECTCommandForServer:
                ## value page for straight python object; args[ 1] is
                ## python expression relative to the Versavant object (vsv).
                foundTopicMapNameMatchObject = vsv.extractTopicMapNameFromVsvUrlPythonExpressionRE.match( args[ 1])
                if foundTopicMapNameMatchObject:
                    vsv.nowBrowsingTopicMapName = foundTopicMapNameMatchObject.group( 2)
                else:
                    vsv.nowBrowsingTopicMapName = None
                message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                message = message + formatValuePage( vsv, 4, None, args[ 0], args[ 1])
                message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)
            else:
                topicMapName = args[ 0]
                proxyId = args[ 1]
                topicMapNameIsGood = proxyIdIsGood = thingsMatchUp = True
                if not vsv.isTopicMapName( topicMapName):
                    message = message + '%s<H2>Error: "%s" is not the name of a topic map.</H2>\n' % ( ' '*4, topicMapName)
                    topicMapNameIsGood = False
                if not vsv.isProxyId( proxyId):
                    message = message + '%s<H2>Error: "%s" is not a proxyId.</H2>\n' % ( ' '*4, proxyId)
                    proxyIdIsGood = False
                if topicMapNameIsGood and proxyIdIsGood:
                    if vsv.proxies[ proxyId].topicMapName != topicMapName:
                        message = message + '%s<H2>Error: proxy "%s" thinks it is part of TM "%s", not "%s".</H2>\n' % ( ' '*4, proxyId, vsv.proxies[ proxyId].topicMapName, topicMapName)
                        thingsMatchUp = False
                    if proxyId not in vsv.topicMaps[ topicMapName].proxies:
                        message = message + '%s<H2>Error: proxy "%s" is not part of TM "%s"</H2>\n' % ( ' '*4, proxyId, topicMapName)
                        thingsMatchUp = False
                if topicMapNameIsGood and proxyIdIsGood and thingsMatchUp:
                    vsv.nowBrowsingTopicMapName = topicMapName
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    message = message + formatProxyPage( vsv, 4, vsv.proxies[ args[ 1]])
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        elif len( args) == 4 or len( args) == 5:  ## all property pages / value pages here
            topicMapName = args[ 0]
            proxyId = args[ 1]
            TMAName = args[ 2]
            propertyClassName = args[ 3]
            topicMapNameIsGood = proxyIdIsGood = TMANameIsGood = propertyClassNameIsGood = topicMapNameAndProxyIdMatch = proxyHasProperty = True

            if not vsv.isTopicMapName( topicMapName):
                message = message + '%s<H2>Error: "%s" is not the name of a TM.</H2>\n' % ( ' '*4, topicMapName)
                topicMapNameIsGood = False
            if not vsv.isProxyId( proxyId):
                message = message + '%s<H2>Error: "%s" is not a proxyId.</H2>\n' % ( ' '*4, proxyId)
                proxyIdIsGood = False
            if topicMapNameIsGood and proxyIdIsGood:
                if vsv.proxies[ proxyId].topicMapName != topicMapName:
                    message = message + '%s<H2>Error: proxy "%s" thinks it is part of TM "%s", not "%s".</H2>\n' % ( ' '*4, proxyId, vsv.proxies[ proxyId].topicMapName, topicMapName)
                    topicMapNameAndProxyIdMatch = False
                if proxyId not in vsv.topicMaps[ topicMapName].proxies:
                    message = message + '%s<H2>Error: proxy "%s" is not part of TM "%s"</H2>\n' % ( ' '*4, proxyId, topicMapName)
                    topicMapNameAndProxyIdMatch = False
            if topicMapNameIsGood and proxyIdIsGood and topicMapNameAndProxyIdMatch:
                if not vsv.isTMAName( topicMapName, TMAName):
                    message = message + '%s<H2>Error: TMA "%s" is not part of TM "%s"</H2>\n' % ( ' '*4, TMAName, topicMapName)
                    TMANameIsGood = False
                if TMANameIsGood:
                    if not vsv.isPropertyClassName( topicMapName, TMAName, propertyClassName):
                        message = message + '%s<H2>Error: TMA "%s" (of TM "%s") defines no property class "%s".</H2>\n' % ( ' '*4, TMAName, topicMapName, propertyClassName)
                        propertyClassNameIsGood = False
                if TMANameIsGood and propertyClassNameIsGood:
                    if not vsv.isPropertyInProxy( topicMapName, proxyId, TMAName, propertyClassName):
                        message = message + '%s<H2>Error: proxy "%s" has no property instance "%s".</H2>\n' % ( ' '*4, proxyId, vsv.catKey( TMAName, propertyClassName))
                        proxyHasProperty = False

                if TMANameIsGood and propertyClassNameIsGood and proxyHasProperty:
                    vsv.nowBrowsingTopicMapName = topicMapName
                    message = message + formatProxyListButtons( vsv, 'topnav', qStr)
                    property = vsv.topicMaps[ topicMapName].proxies[ proxyId].propertyInstances[ vsv.catKey( TMAName, propertyClassName)]
                    if len( args) == 4:  ## format a property page
                        message = message + formatPropertyPage( vsv, 4, property)
                    if len( args) == 5:  ## format a property value page
                        message = message + formatValuePage( vsv, 4, property, vsv.catKey( topicMapName, proxyId, TMAName, propertyClassName), args[ 4])
                    message = message + formatProxyListButtons( vsv, 'bottomnav', qStr)

        else:
            message = message + '%s<H2>Error: server cannot interpret "%s"; number of fields separated by "%s" == %s.</H2>\n' % ( ' '*4, pythonExpressionUrlUnescapify( qStr), vsv.fieldSeparator, len( args))


    else:  ## vsv.stop_serving == True
        message = message+'%s<P>Versavant server has stopped.</P>\n' % ( ' '*4)


    message = message+'%s</BODY>\n' % ( ' '*2)
    message = message+'%s</HTML>\n' % ( ' '*0)
    return message
    
#######################################################
def formatProxyListButtons( vsv, navClassName, qStr, **args):
    
    if args.has_key( 'special'):
        if args[ 'special'] == 'StopServerOnly':
            return '%s<DIV class="%s">\n\
%s<span class="stopbutton"><A HREF="%s" TITLE="Tell the server to exit, ending the call to inspect()." style="color:white">Stop&nbsp;server</A></span>\n\
</DIV><div class="content">' % (
                ' '*4,
                navClassName,
                ' '*6, vsvUrl( vsv.STOPSERVINGCommandForServer),
                )


    if vsv.SAMPLEMODE:
        sampleModeButtonStr = \
            '%s<A TITLE="Mode change: don\'t show samples of list values and dict key/value pairs" HREF="%s" style="color:#555555;">&#149;Suppress&nbsp;samples&nbsp;&nbsp;</A>\n' % (
                ' '*6, vsvUrl( vsv.catKey( vsv.NOSAMPLEMODEModeArgForServer, qStr)))
    else: 
        sampleModeButtonStr = \
            '%s<A TITLE="Mode change: show samples of list values and dict key/value pairs" HREF="%s" style="color:#555555;">&#149;Show&nbsp;samples&nbsp;&nbsp;</A>\n' % (
                ' '*6, vsvUrl( vsv.catKey( vsv.SAMPLEMODEModeArgForServer, qStr)))
        
    if vsv.THUMBNAILMODE:
        thumbnailModeButtonStr = \
            '%s<A HREF="%s" TITLE="Mode change: don\'t show thumbnails of proxies/properties" style="color:#555555;">&#149;Suppress&nbsp;thumbnails&nbsp;&nbsp;</A>\n' % (
                ' '*6, vsvUrl( vsv.catKey( vsv.NOTHUMBNAILMODEModeArgForServer, qStr)))
    else: 
        thumbnailModeButtonStr = \
            '%s<A HREF="%s" TITLE="Mode change: show thumbnails of proxies/properties" style="color:#555555;">&#149;Show&nbsp;thumbnails&nbsp;&nbsp;</A>\n' % (
                ' '*6, vsvUrl( vsv.catKey( vsv.THUMBNAILMODEModeArgForServer, qStr)))
        
    if vsv.HEXADDRESSMODE:
        hexAddressModeButtonStr = \
            '%s<A HREF="%s" TITLE="Mode change: don\'t show hex addresses of objects" style="color:#555555;">&#149;Suppress&nbsp;hex&nbsp;addresses&nbsp;&nbsp;</A>\n' % (
                ' '*6, vsvUrl( vsv.catKey( vsv.NOHEXADDRESSMODEModeArgForServer, qStr)))
    else: 
        hexAddressModeButtonStr = \
            '%s<A HREF="%s" TITLE="Mode change: show hex addresses of objects" style="color:#555555;">&#149;Show&nbsp;hex&nbsp;addresses&nbsp;&nbsp;</A>\n' % (
                ' '*6, vsvUrl( vsv.catKey( vsv.HEXADDRESSMODEModeArgForServer, qStr)))
        

    return '%s<DIV class="%s">\n\
%s<SPAN CLASS="stopbutton"><A HREF="%s" TITLE="Tell the server to exit, ending the call to inspect()." style="color:white;">Stop&nbsp;server</A></SPAN>\n\
%s<SPAN CLASS="viewOptions"><A HREF="%s" TITLE="Menu of topic maps to inspect" style="color:#555555;">&#149;All&nbsp;topic&nbsp;maps&nbsp;&nbsp;</A>\n\
%s<A HREF="%s" TITLE="Menu of all proxies in topic map \'%s\'" style="color:#555555;">&#149;All&nbsp;proxies&nbsp;&nbsp;</A>\n\
%s<A HREF="%s" TITLE="Menu of all living and dead non-system proxies in topic map \'%s\'" style="color:#555555;">&#149;All&nbsp;non-system&nbsp;proxies&nbsp;&nbsp;</A>\n\
%s<A HREF="%s" TITLE="Menu of all living proxies in topic map \'%s\', both non-system and system" style="color:#555555;">&#149;All&nbsp;live&nbsp;proxies&nbsp;&nbsp;</A>\n\
%s<A HREF="%s" TITLE="Menu of all living non-system proxies in topic map \'%s\'" style="color:#555555; font-weight:bold">&#149;All&nbsp;live&nbsp;non-system&nbsp;proxies&nbsp;&nbsp;</A>\n\
%s\
%s\
%s\
</DIV><div class="content">' % (
                ' '*4,
                navClassName,
                ' '*6, vsvUrl( vsv.STOPSERVINGCommandForServer),
                ' '*6, vsvUrl( ''),
                ' '*6, vsvUrl( vsv.catKey( vsv.ALLPROXIESCommandForServer, vsv.nowBrowsingTopicMapName)),
                vsv.nowBrowsingTopicMapName,
                ' '*6, vsvUrl( vsv.catKey( vsv.NONSYSTEMPROXIESCommandForServer, vsv.nowBrowsingTopicMapName)),
                vsv.nowBrowsingTopicMapName,
                ' '*6, vsvUrl( vsv.catKey( vsv.LIVEPROXIESCommandForServer, vsv.nowBrowsingTopicMapName)),
                vsv.nowBrowsingTopicMapName,
                ' '*6, vsvUrl( vsv.catKey( vsv.LIVENONSYSTEMPROXIESCommandForServer, vsv.nowBrowsingTopicMapName)),
                vsv.nowBrowsingTopicMapName,
                sampleModeButtonStr,
                thumbnailModeButtonStr,
                hexAddressModeButtonStr
                )



#######################################################
class VersavantHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):

    """ 

    (null string) ## The list of available topicMaps and their proxies.
    [proxyId]    ## The proxy whose ID it is.
    [topicMapName]    ## If there is only one proxy of the TM, that proxy.
                  ## If there are multiple proxies of the TM, the list of those proxyIds.
    [topicMapName],,[proxyId]  ## The proxy that has the ID.
                            ## (This query does some cross-checking.)
    [topicMapName],,[proxyId],,[TMAName],,[propertyClassName]
                            ## Display the requested property.
    [topicMapName],,[proxyId],,[TMAName],,[propertyClassName],,
                            ## Display the requested property's value
    [topicMapName],,[proxyId],,[TMAName],,[propertyClassName],,[python expression]
                            ## Display the value requested by the
                            ## python expression, starting at the
                            ## specified property instance value
    VSVOBJECT,,[python expression]
                            ## Display the value requested by the python
                            ## expression, starting at vsv
                            ## (the Versavant object).
    STOPSERVING             ## kill the server and close the browser window (maybe)
    ALLPROXIES,,[topicmapName]  ## list of all proxies in the named topic map
    NONSYSTEMPROXIES,,[topicmapName]        ## list of non-system proxies (proxies that have any non-Vsys
                            ## properties)
    LIVEPROXIES,,[topicmapName]             ## list non-dead proxies
    LIVENONSYSTEMPROXIES,,[topicmapName]    ## list of non-dead, non-system proxies
    AUDITVALUESOURCES,,[topicMapName],,[proxyId],,[TMAName],,[propertyClassName]
                            ## an audit of the value sources of the property.
    AUDITDEPENDENTVALUES,,[topicMapName],,[proxyId],,[TMAName],,[propertyClassName]
                            ## a list of living and dead properties that regard this property as
                            ## a value source


    Any of the above may be preceded by
    'SAMPLEMODE,,' or 'NOSAMPLEMODE,,' (show samples of lists and dicts)
    'THUMBNAILMODE,,' or 'NOTHUMBNAILMODE,,' (show thumbnails of proxies where it seems appropriate)
    'HEXADDRESSMODE,,' or 'NOHEXADDRESSMODE,,' (show addresses or don't)

    See also: inspect()

    """

    def do_GET(self):
        """Serve a GET request."""

        
        global vsv


            ## URLbody handled below
        self.qStr = self.path[1:]

        message = formatHTMLMessage( self.qStr)

        self.send_response(200)
        self.send_header("Content-type", 'text/html')
        self.send_header("Content-Length", str( len( message)))
        self.end_headers()
        self.wfile.write( message)

        if vsv.writeHttpMessage:
            dbgfo = open( 'httpmessage', 'w')
            dbgfo.write( message)
            dbgfo.close()



    #######################################################
    def log_message(self, format, *args):
        """Log an arbitrary message.

        This is used by all other logging functions.  Override
        it if you have specific logging wishes.

        The first argument, FORMAT, is a format string for the
        message to be logged.  If the format string contains
        any % escapes requiring parameters, they should be
        specified as subsequent arguments (it's just like
        printf!).

        The client host and current date/time are prefixed to
        every message.

        """

## alternative, more verbose way:
##         sys.stderr.write("\"%s\" %s - - [%s] %s\n" %
##                          (self.qStr,
##                           self.address_string(),
##                           self.log_date_time_string(),
##                           format%args))

        if sendDebugMessages:
            sys.stderr.write("request received by server: \"%s\"\n" %
                         (self.qStr))


#######################################################
def makeLocalServer( vsv, ServerClass = BaseHTTPServer.HTTPServer,
                     HandlerClass = VersavantHTTPRequestHandler):

    port = 8000
    portMax = 8100
    while 1:
	try:
	    server_address = ('localhost', port)
	    httpd = ServerClass( server_address,
				 HandlerClass)
	    break
	except socket.error:
	    port = port + 1
            if port == portMax:
                raise

    vsv.server_name = httpd.server_name
    vsv.server_port = httpd.server_port

    return httpd

#######################################
## here ends the HTTP SERVER SECTION ##
#######################################



#########################################
#########################################
## XML PARSER (expat handlers) section ##
#########################################
#########################################


#######################################################
def start_element_DTD_A( gi, attrs):
    thisElement = { 'gi': gi,
                    'attrs': attrs,
                    'content': ''}
    vsv.currentTopicMapHoldingDict[ 'openElementsStack'].append( thisElement)

    if gi == 'VersavantTopicMap':

        vsv.currentTopicMapHoldingDict[ 'VersavantTopicMapDTDVersion'] = \
                 thisElement[ 'attrs'][ 'VersavantTopicMapDTDVersion'].encode( 'ascii')

        vsv.currentTopicMapHoldingDict[ 'VersavantSystemTMAName'] = \
                 thisElement[ 'attrs'][ 'VersavantSystemTMAName'].encode( 'ascii')

        vsv.currentTopicMapHoldingDict[ 'OSPathSeparator'] = \
                 thisElement[ 'attrs'][ 'OSPathSeparator'].encode( 'ascii')

        vsv.currentTopicMapHoldingDict[ 'TopicMapName'] = \
                 thisElement[ 'attrs'][ 'TopicMapName'].encode( 'ascii')

        vsv.currentTopicMapHoldingDict[ 'PythonVersion'] = \
                 thisElement[ 'attrs'][ 'PythonVersion'].encode( 'ascii')

        vsv.currentTopicMapHoldingDict[ 'VersavantVersion'] = \
                 thisElement[ 'attrs'][ 'VersavantVersion'].encode( 'ascii')

        vsv.currentTopicMapHoldingDict[ 'currentTMAName'] = None

    elif gi == 'VersavantTMA':
        fileTMAName = attrs[ 'AppNm'].encode( 'ascii')
        if vsv.currentTopicMapHoldingDict[ 'TMANameMap'].has_key( fileTMAName):
            newTMAName = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ fileTMAName]
        else:
            newTMAName = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ fileTMAName] = fileTMAName
            
        if vsv.currentTopicMapHoldingDict[ 'TMAs'].has_key( newTMAName):
            errMsg( 'There is already a TMA named %s in currentTopicMapHoldingDict.  Check the TMA name map for duplicates: "%s"' % ( newTMAName, vsv.currentTopicMapHoldingDict[ 'TMANameMap']))
            sys.exit( 1)

        vsv.currentTopicMapHoldingDict[ 'TMAs'][ newTMAName] = \
                                        { 'fileTMAName': fileTMAName,
                                          'ConfSrcPath': '',
                                          'localConfSrcPath': '',
                                          'modules': {},
                                          'TMAProxies': [],
                                          'valueTypes': {},
                                          'propertyClasses': {},
                                          'conferralRules': {}
                                        }

        vsv.currentTopicMapHoldingDict[ 'currentTMAName'] = newTMAName

    elif gi == 'TMAConfigFile':

        currentTMA = vsv.currentTopicMapHoldingDict[ 'TMAs'][ vsv.currentTopicMapHoldingDict[ 'currentTMAName']]
        currentTMA[ 'ConfSrcPath'] = attrs[ 'ConfSrcPath'].encode( 'ascii')

    elif gi == 'TMAModule':
        currentTMA = vsv.currentTopicMapHoldingDict[ 'TMAs'][ vsv.currentTopicMapHoldingDict[ 'currentTMAName']]
        moduleName = attrs[ 'ModName'].encode( 'ascii')
        if currentTMA[ 'modules'].has_key( moduleName):
            errMsg( 'There is already a module named "%s" in TMA %s (in-file TMA name %s)' % ( moduleName, vsv.currentTopicMapHoldingDict[ 'currentTMAName'], currentTMA[ 'fileTMAName']))
            sys.exit( 1)
        currentModule = currentTMA[ 'modules'][ moduleName] = {}
        currentModule[ 'ModSrcFileName'] = attrs[ 'ModSrcFileName'].encode( 'ascii')

    elif gi == 'ProxyObject':
        currentProxy = vsv.currentTopicMapHoldingDict[ 'currentProxy'] = {
                     'id': int( attrs[      'id'].encode( 'ascii')[ 1:]),  ## get rid of the leading 'o' and convert to int
                'proxyId': int( attrs[ 'proxyId'].encode( 'ascii'))        ## convert to int (which ignores the leading double zero)
            }
        vsv.currentTopicMapHoldingDict[ 'proxies'].append( currentProxy)

    elif gi == 'Property':
        pass

    elif gi == 'IoMapsDict':
        pass

    else:
        errMsg( 'Unrecognized GI: "%s"' % ( gi))
        sys.exit( 1)

#######################################################
def end_element_DTD_A( gi):
    thisElement = vsv.currentTopicMapHoldingDict[ 'openElementsStack'].pop()
    if thisElement[ 'gi'] != gi:
        errMsg( 'gi == "%s", thisElement[ \'gi\'] == "%s"' % ( gi, thisElement[ 'gi']))
        sys.exit( 1)

    if gi == 'VersavantTopicMap':
        pass

    elif gi == 'VersavantTMA':
        vsv.currentTopicMapHoldingDict[ 'currentTMAName'] = None

    elif gi == 'TMAConfigFile':
        currentTMA = vsv.currentTopicMapHoldingDict[ 'TMAs'][ vsv.currentTopicMapHoldingDict[ 'currentTMAName']]
        currentTMA[ 'TMAConfigFile'] = vsv.cPickleLoadObjectFromXMLContentString( thisElement[ 'content'].encode( 'ascii'))

    elif gi == 'TMAModule':
        currentTMA = vsv.currentTopicMapHoldingDict[ 'TMAs'][ vsv.currentTopicMapHoldingDict[ 'currentTMAName']]
        currentTMA[ 'modules'][ thisElement[ 'attrs'][ 'ModName'].encode( 'ascii')][ 'software'] = \
            vsv.cPickleLoadObjectFromXMLContentString( thisElement[ 'content'].encode( 'ascii'))

    elif gi == 'ProxyObject':
        vsv.currentTopicMapHoldingDict[ 'currentProxy'] = None

    elif gi == 'Property':
        propertyClassName = thisElement[ 'attrs'][ 'PClass'].encode( 'ascii')
        fileTMAName = thisElement[ 'attrs'][ 'PAppNm'].encode( 'ascii')

        if vsv.currentTopicMapHoldingDict[ 'TMANameMap'].has_key( fileTMAName):
            newTMAName = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ fileTMAName]
        else:
            vsv.errMsg( 'TMA "%s" is unknown, and should be known by now.  Is the topic map file being imported corrupt?' % ( fileTMAName))
            sys.exit( 1)

        propertyKey2 = vsv.catKey( newTMAName, propertyClassName)

        if newTMAName == vsv.systemTMAName:
            valueType = vsv.currentTopicMapHoldingDict[ 'topicMapObjectBeingImportedInto'].TMAs[ vsv.systemTMAName].propertyClasses[ propertyClassName].valueType
            if valueType.XMLContentStringToInstanceOf__ValueTypeFArgString:
                execStr = 'value = valueType.XMLContentStringToInstanceOf__ValueTypeF( vsv, thisElement[ \'content\'].encode( \'ascii\'), None, %s)' % ( valueType.XMLContentStringToInstanceOf__ValueTypeFArgString)
                exec( execStr)
            else:
                value = valueType.XMLContentStringToInstanceOf__ValueTypeF( vsv, thisElement[ 'content'].encode( 'ascii'), None)  ## "None" is used only
                                                                                                                                  ## for system TMA properties.
                                                                                                                                  ## Everywhere else, it's a
                                                                                                                                  ## propertyClass object.
                                                                                                                                  
        else:
            value = thisElement[ 'content'].encode( 'ascii')  ## we'll do the InstanceOf__ValueTypeToXMLContentString() stuff later,
                                                              ## so the value adjustment can involve proxyId adjustments.  (No system values are
                                                              ## proxyIds.)

        thisProxyIndexValue = len( vsv.currentTopicMapHoldingDict[ 'proxies']) - 1
            ## where in the list of proxies you can find the proxy we're populating right now.

        vsv.currentTopicMapHoldingDict[ 'currentProxy'][ propertyKey2] = { 'value': value,
                                                                           'IsSIP': thisElement[ 'attrs'][ 'IsSIP'].encode( 'ascii')}

        if newTMAName == vsv.systemTMAName:
            topicMap = vsv.currentTopicMapHoldingDict[ 'topicMapObjectBeingImportedInto']
            if propertyClassName == topicMap.sipc_system_TMAName_PCN:  ## value is TMA name
                value = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ value]
                TMADict = vsv.currentTopicMapHoldingDict[ 'TMAs'][ value][ 'TMAProxies'].append( thisProxyIndexValue)
                
            elif propertyClassName == topicMap.sipc_system_conferralRule_PCN:  ## value is "TMA name,,conferral rule name"
                TMAName, conferralRuleName = vsv.parsePropertyKey2( value)
                TMAName = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ TMAName]
                if not vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'conferralRules'].has_key( conferralRuleName):
                    vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'conferralRules'][ conferralRuleName] = []
                vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'conferralRules'][ conferralRuleName].append( thisProxyIndexValue)

            elif propertyClassName == topicMap.sipc_system_propertyClass_PCN:  ## value is "TMA name,,property class name"
                TMAName, propertyClassName = vsv.parsePropertyKey2( value)
                TMAName = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ TMAName]
                if not vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'propertyClasses'].has_key( propertyClassName):
                    vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'propertyClasses'][ propertyClassName] = []
                vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'propertyClasses'][ propertyClassName].append( thisProxyIndexValue)

            elif propertyClassName == topicMap.sipc_system_valueType_PCN:      ## value is "TMA name,,value type name"
                TMAName, valueTypeName = vsv.parsePropertyKey2( value)
                TMAName = vsv.currentTopicMapHoldingDict[ 'TMANameMap'][ TMAName]
                if not vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'valueTypes'].has_key( valueTypeName):
                    vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'valueTypes'][ valueTypeName] = []
                vsv.currentTopicMapHoldingDict[ 'TMAs'][ TMAName][ 'valueTypes'][ valueTypeName].append( thisProxyIndexValue)

    elif gi == 'IoMapsDict':
        fileIoMapsDict = \
            vsv.cPickleLoadObjectFromXMLContentString( thisElement[ 'content'].encode( 'ascii'))
        vsv.currentTopicMapHoldingDict[ 'IoMapsDict'] = newIoMapsDict = {}

        tmaNameMap = vsv.currentTopicMapHoldingDict[ 'TMANameMap']

        for key in fileIoMapsDict:
            if key == 'TMAs':
                fileTMADict = fileIoMapsDict[ key]
                newTMADict = newIoMapsDict[ key] = {}
                for tmaKey in fileTMADict:
                    newTMADict[ tmaNameMap[ tmaKey]] = fileTMADict[ tmaKey]
            else:
                newIoMapsDict[ key] = fileIoMapsDict[ key]

    else:
        errMsg( 'Unrecognized GI: "%s"' % ( gi))
        sys.exit( 1)

#######################################################
def char_data_DTD_A( data):
    vsv.currentTopicMapHoldingDict[ 'openElementsStack'][ -1][ 'content'] = vsv.currentTopicMapHoldingDict[ 'openElementsStack'][ -1][ 'content'] + data



#######################################################
def start_element_tmaConfigFile( gi, attrs):
    thisElement = { 'gi': gi,
                    'attrs': attrs,
                    'content': ''}
    vsv.currentTMAConfigFileHoldingDict[ 'openElementsStack'].append( thisElement)

    if gi == 'VersavantTMA':

        vsv.currentTMAConfigFileHoldingDict[ 'VersavantTMADTDVersion'] = \
                 thisElement[ 'attrs'][ 'VersavantTMADTDVersion'].encode( 'ascii')
        vsv.currentTMAConfigFileHoldingDict[ 'TMADesc'] = ''

    elif gi == 'Desc':
        pass

    elif gi == 'ValueType':
        valueTypeName = thisElement[ 'attrs'][ 'ValueTypeName'].encode( 'ascii')
        if vsv.currentTMAConfigFileHoldingDict[ 'valueTypes'].has_key( valueTypeName):
            errMsg( 'Multiple definitions of value type "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                valueTypeName, 
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)

        vsv.currentTMAConfigFileHoldingDict[ 'valueTypeSequence'].append( valueTypeName)

        vsv.currentTMAConfigFileHoldingDict[ 'valueTypes'][ valueTypeName] = \
            vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict'] = {

                'valueTypeName': valueTypeName,

                'ValueIsNotOfType__FMF': None,
                'ValueIsNotOfType__FN': None,
                'ValueIsNotOfType__FArgString': '',

                'InstanceOf__ValueTypeToXMLContentStringFMF': None,
                'InstanceOf__ValueTypeToXMLContentStringFN': None,
                'InstanceOf__ValueTypeToXMLContentStringFArgString': '',

                'XMLContentStringToInstanceOf__ValueTypeFMF': None,
                'XMLContentStringToInstanceOf__ValueTypeFN': None,
                'XMLContentStringToInstanceOf__ValueTypeFArgString': '',
                'valueTypeDesc': ''
            }

    elif gi == 'ValueIsNotOfType__':
        valueTypeDict = vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict']

        if valueTypeDict[ 'ValueIsNotOfType__FMF'] != None or \
           valueTypeDict[ 'ValueIsNotOfType__FN']  != None:
            errMsg( 'Multiple definitions of ValueIsNotOfType__ implementation for value type "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                valueTypeDict[ 'valueTypeName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        valueTypeDict[ 'ValueIsNotOfType__FMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        valueTypeDict[ 'ValueIsNotOfType__FN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            valueTypeDict[ 'ValueIsNotOfType__FArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            valueTypeDict[ 'ValueIsNotOfType__FArgString' ] = ''

    elif gi == 'InstanceOf__ValueTypeToXMLContentString':
        valueTypeDict = vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict']

        if valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFMF'] != None or \
           valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFN']  != None:
            errMsg( 'Multiple definitions of InstanceOf__ValueTypeToXMLContentString implementation for value type "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                valueTypeDict[ 'valueTypeName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFArgString' ] = ''

    elif gi == 'XMLContentStringToInstanceOf__ValueType':
        valueTypeDict = vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict']

        if valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFMF'] != None or \
           valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFN']  != None:
            errMsg( 'Multiple definitions of XMLContentStringToInstanceOf__ValueType implementation for value type "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                valueTypeDict[ 'valueTypeName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFArgString' ] = ''

    elif gi == 'PropertyClass':
        propertyClassName = thisElement[ 'attrs'][ 'PropertyClassName'].encode( 'ascii')

        if vsv.currentTMAConfigFileHoldingDict[ 'propertyClasses'].has_key( propertyClassName):
            errMsg( 'Multiple definitions of property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassName, 
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)

        vsv.currentTMAConfigFileHoldingDict[ 'propertyClassSequence'].append( propertyClassName)

        vsv.currentTMAConfigFileHoldingDict[ 'propertyClasses'][ propertyClassName] = \
            vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict'] = {

                'propertyClassName': propertyClassName,

                'valueTypeName': thisElement[ 'attrs'][ 'ValueType'].encode( 'ascii'),

                'Add__PropToOverheadDictFMF': None,
                'Add__PropToOverheadDictFN': None,
                'Add__PropToOverheadDictFArgString': '',

                'Remove__PropFromOverheadDictFMF': None,
                'Remove__PropFromOverheadDictFN': None,
                'Remove__PropFromOverheadDictFArgString': '',

                'ValueIsInvalidFor__PropertyFMF': None,
                'ValueIsInvalidFor__PropertyFN': None,
                'ValueIsInvalidFor__PropertyFArgString': '',

                'Merge__PropertyValuesFMF': None,
                'Merge__PropertyValuesFN': None,
                'Merge__PropertyValuesFArgString': '',

                'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF': None,
                'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN': None,
                'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString': '',

                'ContextOf__PropertyIsInvalidFMF': None,
                'ContextOf__PropertyIsInvalidFN': None,
                'ContextOf__PropertyIsInvalidFArgString': '',

                'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF': None,
                'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN': None,
                'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString': '',

                'ProxiesWith__ValueNotSignificantlyDifferentFromFMF': None,
                'ProxiesWith__ValueNotSignificantlyDifferentFromFN': None,
                'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString': '',

                'UpdateProxyReferencesIn__ValueFMF': None,
                'UpdateProxyReferencesIn__ValueFN': None,
                'UpdateProxyReferencesIn__ValueFArgString': '',

                'propertyClassDesc': ''
            }

    elif gi == 'Add__PropToOverheadDict':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'Add__PropToOverheadDictFMF'] != None or \
           propertyClassDict[ 'Add__PropToOverheadDictFN']  != None:
            errMsg( 'Multiple definitions of Add__PropToOverheadDict implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'Add__PropToOverheadDictFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'Add__PropToOverheadDictFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'Add__PropToOverheadDictFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'Add__PropToOverheadDictFArgString' ] = ''

    elif gi == 'Remove__PropFromOverheadDict':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'Remove__PropFromOverheadDictFMF'] != None or \
           propertyClassDict[ 'Remove__PropFromOverheadDictFN']  != None:
            errMsg( 'Multiple definitions of Remove__PropFromOverheadDict implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'Remove__PropFromOverheadDictFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'Remove__PropFromOverheadDictFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'Remove__PropFromOverheadDictFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'Remove__PropFromOverheadDictFArgString' ] = ''

    elif gi == 'ValueIsInvalidFor__Property':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'ValueIsInvalidFor__PropertyFMF'] != None or \
           propertyClassDict[ 'ValueIsInvalidFor__PropertyFN']  != None:
            errMsg( 'Multiple definitions of ValueIsInvalidFor__Property implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'ValueIsInvalidFor__PropertyFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'ValueIsInvalidFor__PropertyFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'ValueIsInvalidFor__PropertyFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'ValueIsInvalidFor__PropertyFArgString' ] = ''

    elif gi == 'Merge__PropertyValues':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'Merge__PropertyValuesFMF'] != None or \
           propertyClassDict[ 'Merge__PropertyValuesFN']  != None:
            errMsg( 'Multiple definitions of Merge__PropertyValues implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'Merge__PropertyValuesFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'Merge__PropertyValuesFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'Merge__PropertyValuesFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'Merge__PropertyValuesFArgString' ] = ''

    elif gi == 'ValuesOf__PropertyInstancesAreSignificantlyDifferent':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'] != None or \
           propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN']  != None:
            errMsg( 'Multiple definitions of ValuesOf__PropertyInstancesAreSignificantlyDifferent implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString' ] = ''

    elif gi == 'ContextOf__PropertyIsInvalid':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'ContextOf__PropertyIsInvalidFMF'] != None or \
           propertyClassDict[ 'ContextOf__PropertyIsInvalidFN']  != None:
            errMsg( 'Multiple definitions of ContextOf__PropertyIsInvalid implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'ContextOf__PropertyIsInvalidFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'ContextOf__PropertyIsInvalidFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'ContextOf__PropertyIsInvalidFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'ContextOf__PropertyIsInvalidFArgString' ] = ''

    elif gi == 'MergeProxiesBecause__PropertyInstancesSpecifySameSubject':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'] != None or \
           propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN']  != None:
            errMsg( 'Multiple definitions of MergeProxiesBecause__PropertyInstancesSpecifySameSubject implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString' ] = ''

    elif gi == 'ProxiesWith__ValueNotSignificantlyDifferentFrom':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMF'] != None or \
           propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN']  != None:
            errMsg( 'Multiple definitions of ProxiesWith__ValueNotSignificantlyDifferentFrom implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString' ] = ''

    elif gi == 'UpdateProxyReferencesIn__Value':
        propertyClassDict = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']

        if propertyClassDict[ 'UpdateProxyReferencesIn__ValueFMF'] != None or \
           propertyClassDict[ 'UpdateProxyReferencesIn__ValueFN']  != None:
            errMsg( 'Multiple definitions of UpdateProxyReferencesIn__Value implementation for property class "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                propertyClassDict[ 'propertyClassName'],
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)
        
        propertyClassDict[ 'UpdateProxyReferencesIn__ValueFMF'] = thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii')
        propertyClassDict[ 'UpdateProxyReferencesIn__ValueFN' ] = thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii')
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            propertyClassDict[ 'UpdateProxyReferencesIn__ValueFArgString' ] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            propertyClassDict[ 'UpdateProxyReferencesIn__ValueFArgString' ] = ''

    elif gi == 'ConferralRule':

        conferralRuleName = thisElement[ 'attrs'][ 'ConferralRuleName'].encode( 'ascii')
        if vsv.currentTMAConfigFileHoldingDict[ 'conferralRules'].has_key( conferralRuleName):
            errMsg( 'Multiple definitions of conferral rule "%s" in TMA configuration file "%s" (attempting to load with TMAName="%s")' % (
                conferralRuleName, 
                vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                vsv.currentTMAConfigFileHoldingDict[ 'TMAName']))
            sys.exit( 1)

        if conferralRuleName not in vsv.currentTMAConfigFileHoldingDict[ 'conferralRuleSequence']:
            vsv.currentTMAConfigFileHoldingDict[ 'conferralRuleSequence'].append( conferralRuleName)

        vsv.currentTMAConfigFileHoldingDict[ 'conferralRules'][ conferralRuleName] = \
            vsv.currentTMAConfigFileHoldingDict[ 'currentConferralRuleDict'] = conferralRuleDict = {
                    'conferralRuleName': conferralRuleName,
                    'conferralRuleFMF': thisElement[ 'attrs'][ 'functionModuleFilePath'].encode( 'ascii'),
                    'conferralRuleFN' : thisElement[ 'attrs'][ 'functionName'          ].encode( 'ascii'),
                    'conferralRuleDesc': ''
                }
        if thisElement[ 'attrs'].has_key( 'functionExtraArgsString'):
            conferralRuleDict[ 'conferralRuleFArgString'] = thisElement[ 'attrs'][ 'functionExtraArgsString'].encode( 'ascii')
        else:
            conferralRuleDict[ 'conferralRuleFArgString'] = ''

    else:
        errMsg( 'Unrecognized GI in "%s": "%s"' % ( vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'], gi))
        sys.exit( 1)

#######################################################
def end_element_tmaConfigFile( gi):
    thisElement = vsv.currentTMAConfigFileHoldingDict[ 'openElementsStack'].pop()

    if gi == 'ValueType':
        vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict'] = None

    elif gi == 'PropertyClass':
        vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict'] = None

    elif gi == 'ConferralRule':
        vsv.currentTMAConfigFileHoldingDict[ 'currentConferralRuleDict'] = None

    elif gi == 'Desc':

        if vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict']:
            valueTypeName = vsv.currentTMAConfigFileHoldingDict[ 'currentValueTypeDict'][ 'valueTypeName']
            if vsv.currentTMAConfigFileHoldingDict[ 'valueTypes'][ valueTypeName][ 'valueTypeDesc']:
                errMsg( 'More than one description (<Desc>) for value type "%s" in "%"' % ( valueTypeName, vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']))
                sys.exit( 1)
            else:
                vsv.currentTMAConfigFileHoldingDict[ 'valueTypes'][ valueTypeName][ 'valueTypeDesc'] = thisElement[ 'content'].encode( 'ascii')

        elif vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict']:
            propertyClassName = vsv.currentTMAConfigFileHoldingDict[ 'currentPropertyClassDict'][ 'propertyClassName']
            if vsv.currentTMAConfigFileHoldingDict[ 'propertyClasses'][ propertyClassName][ 'propertyClassDesc']:
                errMsg( 'More than one description (<Desc>) for property class "%s" in "%s"' % ( propertyClassName, vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']))
                sys.exit( 1)
            else:
                vsv.currentTMAConfigFileHoldingDict[ 'propertyClasses'][ propertyClassName][ 'propertyClassDesc'] = thisElement[ 'content'].encode( 'ascii')

        elif vsv.currentTMAConfigFileHoldingDict[ 'currentConferralRuleDict']:
            conferralRuleName = vsv.currentTMAConfigFileHoldingDict[ 'currentConferralRuleDict'][ 'conferralRuleName']
            if vsv.currentTMAConfigFileHoldingDict[ 'conferralRules'][ conferralRuleName][ 'conferralRuleDesc']:
                errMsg( 'More than one description (<Desc>) for conferral rule "%s" in "%s"' % ( conferralRuleName, vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']))
                sys.exit( 1)
            else:
                vsv.currentTMAConfigFileHoldingDict[ 'conferralRules'][ conferralRuleName][ 'conferralRuleDesc'] = thisElement[ 'content'].encode( 'ascii')


        else:  ## must be the tma description.

            if vsv.currentTMAConfigFileHoldingDict[ 'TMADesc']:
                errMsg( 'More than one description (<Desc>) for TMA "%s": \n\nalready have "%s"; \n\nnow finding "%s" (config file: "%s")' % ( vsv.currentTMAConfigFileHoldingDict[ 'TMAName'], vsv.currentTMAConfigFileHoldingDict[ 'TMADesc'], thisElement[ 'content'].encode( 'ascii'), vsv.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']))
                sys.exit( 1)
            else:
                vsv.currentTMAConfigFileHoldingDict[ 'TMADesc'] = thisElement[ 'content'].encode( 'ascii')

            
#######################################################
def char_data_tmaConfigFile( data):
    vsv.currentTMAConfigFileHoldingDict[ 'openElementsStack'][ -1][ 'content'] = vsv.currentTMAConfigFileHoldingDict[ 'openElementsStack'][ -1][ 'content'] + data


#######################################################
## here ends the XML PARSER (expat handlers) section ##
#######################################################





#############################
########  CLASSES ###########
#############################

#######################################################
class TMA:
    def __init__( self,
                  vsv,
                  topicMap,
                  TMAName,
                  TMADesc,
                  tmaConfigFilePath,
                  pythonModules,
                  ):

        self.ObjectClass = 'TMA'
        self.topicMap = topicMap
        self.TMAName = TMAName
        self.TMADesc = TMADesc
        self.tmaConfigFilePath = tmaConfigFilePath
        self.pythonModules = pythonModules

        if topicMap.TMAs.has_key( TMAName):
            traceback.print_stack()
            errMsg( 'A TMA named "%s" already exists.' % ( TMAName))
            sys.exit( 1)
        topicMap.TMAs[ TMAName] = self
        topicMap.TMASequence.append( TMAName)

        self.TMAProxyIds = []  ## same list as topicMap.topicMapProxy.propertyInstances[ topicMap.opc_system_TMAProxies_topicMap_PNK]._value

        self.valueTypes = {}
            ## Keys are value type names; values are ValueType objects

        self.propertyClasses = {}
            ## Keys are property class names; values are PropertyClass objects
        self.propertyClassSequence = []
            ## Property Class names in the order in which they were registered.
            ## This is the order in which they will be polled at merge time.

        self.conferralRules = {}
            ## Keys are conferral rule names; values are ConferralRule objects
        self.conferralRuleSequence = []
            ## Conferral rule names in the order in which they were registered.
            ## This is the order in which they will be polled at merge time.

##         self.moduleNames = {}
##             ## Keys are Python module names; values are full paths.


#######################################################
class ConferralRule:
    def __init__( self,
                  vsv,
                  topicMap,
                  TMA,
                  conferralRuleName,
                  conferralRuleDesc,
                  conferralRuleFMF,
                  conferralRuleFMN,
                  conferralRuleFN,
                  conferralRuleF,
                  conferralRuleFArgString,
                  conferralRuleTriggerRoles,
                  conferralRuleValueSourceRoles,
                  procOperations):

        self.ObjectClass = 'ConferralRule'

        self.topicMap = topicMap
        self.TMA = TMA
        self.procSpecName = self.conferralRuleName = conferralRuleName
        self.conferralRuleDesc = conferralRuleDesc
        self.conferralRuleFMF = conferralRuleFMF
        self.conferralRuleFMN = conferralRuleFMN
        self.conferralRuleFN = conferralRuleFN
        self.conferralRuleF = conferralRuleF
        self.conferralRuleFArgString = conferralRuleFArgString
        self.conferralRuleTriggerRoles = conferralRuleTriggerRoles
        self.conferralRuleValueSourceRoles = conferralRuleValueSourceRoles

        self.conferralRuleKey = vsv.catKey( TMA.TMAName, conferralRuleName)

        if TMA.conferralRules.has_key( conferralRuleName):
            traceback.print_stack()
            errMsg( 'Conferral rule "%s" already exists.' % ( self.conferralRuleKey))
            sys.exit( 1)
        TMA.conferralRules[ conferralRuleName] = self
        if conferralRuleName not in TMA.conferralRuleSequence:
            TMA.conferralRuleSequence.append( conferralRuleName)

        self.procOperations = procOperations
        self.conferralRuleProxyIds = None
        self.conferralRuleProxies = None

#######################################################
class OriginalPopulationTask:
    def __init__( self,
                  originalPopulationTaskName,              ## unique name of the task; user-specified
                  topicMapName,
                  moduleFilePath,        ## path to file containing original population task function
                  originalPopulationTaskFMN,  ## module name of that file
                  originalPopulationTaskFN,  ## function name
                  originalPopulationTaskF,      ## the function itself
                  originalPopulationTaskFArgString,  ## the extra args to pass to the function, if any
                  procOperations,                 ## the list of propertyInstances populated (same list object as in
                                                       ## the opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PCN
                                                       ## property of task proxy)
                  origPopTaskDesc     ## description of the original population task
                  ):           
        self.ObjectClass = 'OriginalPopulationTask'
        self.procSpecName = self.originalPopulationTaskName = originalPopulationTaskName
        self.topicMapName = topicMapName
        self.moduleFilePath = moduleFilePath
        self.originalPopulationTaskFMN = originalPopulationTaskFMN
        self.originalPopulationTaskFN = originalPopulationTaskFN
        self.originalPopulationTaskF = originalPopulationTaskF
        self.originalPopulationTaskFArgString = originalPopulationTaskFArgString
        self.procOperations = procOperations
        self.oPTProxyIds = None
        self.oPTProxies = None
        self.topicMap = vsv.topicMaps[ topicMapName]
        self.origPopTaskDesc = origPopTaskDesc

#######################################################
class ProcOperation:
    """

    The value of each property instance is the result of the operation
    of exactly one processing specification.  There are three kinds of
    processing specifications (so-called "procSpecObject"s) whose
    operations are recorded by ProcOperation objects: (1) original
    population tasks, (2) conferral rules, and (3) merging rules.  In
    fact, however, there is no such thing as a procSpecObject; instead, there
    are OriginalPopulationTask, ConferralRule, and PropertyClass
    objects, and all of these are treated as procSpecObjects.
    "procSpecObject" is really a virtual base class, if you like, but
    I didn't write it that way; instead the three object classes share
    certain attribute names, most notably "propertyValuesThatWereSet", which
    records which property instances were created by each procSpec.

    Each ProcOperation object documents exactly one processing
    operation.  Each procOperation object is referenced from only the
    first, or from both the first and second, of the following two
    contexts, as explained below:

    (1) As the value of the "procOperation" attribute of a PropertyInstance
        object, a procOperation object documents the origin of the value of the
        property instance.

    (2) As the value of a propertyInstanceKey in the dictionary that is the
        "dependentPropertyInstances" attribute of a PropertyInstance object, it
        documents the fact that the "value" attribute of the PropertyInstance
        object was used in the process of conferring or merging the value of the
        property specified by the propertyInstanceKey.  ProcOperation objects
        are not referenced from this kind of context if they are operations of
        original population task processing specifications, but they are always
        referenced from this kind of context if they are operations of conferral
        rule processing specifications or merging rule processing
        specifications.

    Original population tasks and conferral rules are both documented
    and implemented by user-provided Python functions, and so it is
    reasonable to consider that each proxy of an original population
    task or conferral rule reifies the corresponding user-provided
    Python function.  Merging rules, too, are documented and
    implemented by Python functions, but each such function is only
    one of a set of functions that implements a given property class.
    Versavant's convention for the value of the procSpecObject
    attribute of ProcOperation objects ignores this detail; when a
    procSpecObject attribute's value is a reference to a PropertyClass
    object, the processing specification is the merging rule
    documented/implemented by the referenced Property Class's
    Merge__PropertyValuesF function.  So, as already noted, the
    convention for procSpecObject values is that the procSpecObject
    attribute references exactly one instance of one of the following
    three classes: (1) OriginalProcessingTask, or (2) ConferralRule,
    or (3) PropertyClass.

    ProcOperation objects also document the sources of property values, via the
    valueSources attribute.  If the value of the procSpecObject attribute is a
    PropertyClass object, the valueSources attribute is a *list* of the
    propertyInstanceKeys of the dead properties that were merged into it.  If
    the value of the procSpecObject attribute is an OriginalPopulationTask
    object, then the valueSources attribute is Pythonic None.  If the value of
    the procSpecObject attribute is a ConferralRule object, then the
    valueSources attribute is dictionary of conferral rule role names, the value
    of each of which is the propertyInstanceKey of the property whose value
    played the role.
    
    """

    #######################################################
    def __init__( self, topicMap, description, procSpecObject = None):

        self.ObjectClass = 'ProcOperation'

        vsv.procOperationCount += 1
        self.procOperationID = '*ProcOp%d*' % ( vsv.procOperationCount)

        self.topicMap = topicMap

        self.topicMap.procOperations[ self.procOperationID] = self

        self.description = description

        self.procSpecObject = procSpecObject
            ## The object corresponding to the processing
            ## specification: an OriginalPopulationTask object (if the
            ## property value was original), a ConferralRule Object,
            ## (if the property value was conferred), or PropertyClass
            ## (if the property value was the result of a merger).

        if self.procSpecObject:
            self.procSpecObject.procOperations[ self.procOperationID] = self

        self.valueSources = None
            ## A dictionary of propertyInstances of other proxies from whose
            ## values the property instance value was wholly or partly
            ## derived/calculated.  (Normally, anyway) none of the
            ## propertyInstances of any proxies of the processing
            ## specification specified in self.procSpecObject are in
            ## this list; the processing specification itself is not
            ## considered a "property value source".

            ## If procSpecObject is an OriginalPopulationTask object,
            ## this is Pythonic None.  If procSpecObject is a
            ## PropertyClass object (and this is a merging
            ## procOperation, as opposed to a pre-merging operation in
            ## which references to proxies are being updated, in which
            ## case the value is Pythonic None), this is a list of
            ## property instance keys.  If procSpecObject is a
            ## Conferral Rule, this is a dictionary in which the keys
            ## are role names (each role is calculational, as opposed
            ## to triggering), and the value of each key is a list of
            ## propertyInstanceKeys.

        self.triggers = None

            ## If procSpecObject is an OriginalPopulationTask or PropertyClass
            ## object, this is Pythonic None.  If procSpecObject is a Conferral
            ## Rule, this is a dictionary in which the keys are role names (each
            ## role is triggering, as opposed to calculational), and the value
            ## of each key is a list of propertyInstanceKeys.

        self.propertyValuesThatWereSet = {}
            ## The value is a dictionary that reflects the property
            ## instances whose values were set by the processing
            ## operation that is being described by the procOperation
            ## instance.  The keys are propertyInstanceKeys; the value
            ## of each key is the value of the property instance that
            ## was set.

        self.proxiesThatWereCreated = {}
            ## The value is a dictionary whose keys are proxyIds and whose
            ## values are the proxies that were created as part of this
            ## processing operation.

#######################################################
class PropertyClass:

    ## Note: PropertyClass objects are created *only* by the
    ## Add_propertyClass_PropToOverheadDict() function in
    ## VsysTMA/PropertyClasses.py.  Nobody else
    ## should ever call this __init__().

    def __init__( self,
                  vsv,
                  topicMap,
                  TMA,
                  propertyClassName,
                  PCDesc,
                  valueTypeName,
                  overheadDict,
                  procOperations,
                  propertyInstancesMerged,
                  proxiesKilled,
                  Add__PropToOverheadDictFMF,
                  Add__PropToOverheadDictFMN,
                  Add__PropToOverheadDictFN,
                  Add__PropToOverheadDictF,
                  Add__PropToOverheadDictFArgString,
                  Remove__PropFromOverheadDictFMF,
                  Remove__PropFromOverheadDictFMN,
                  Remove__PropFromOverheadDictFN,
                  Remove__PropFromOverheadDictF,
                  Remove__PropFromOverheadDictFArgString,
                  ValueIsInvalidFor__PropertyFMF,
                  ValueIsInvalidFor__PropertyFMN,
                  ValueIsInvalidFor__PropertyFN,
                  ValueIsInvalidFor__PropertyF,
                  ValueIsInvalidFor__PropertyFArgString,
                  Merge__PropertyValuesFMF,
                  Merge__PropertyValuesFMN,
                  Merge__PropertyValuesFN,
                  Merge__PropertyValuesF,
                  Merge__PropertyValuesFArgString,
                  ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF,
                  ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN,
                  ValuesOf__PropertyInstancesAreSignificantlyDifferentFN,
                  ValuesOf__PropertyInstancesAreSignificantlyDifferentF,
                  ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString,
                  ContextOf__PropertyIsInvalidFMF = None,
                  ContextOf__PropertyIsInvalidFMN = None,
                  ContextOf__PropertyIsInvalidFN = None,
                  ContextOf__PropertyIsInvalidF = None,
                  ContextOf__PropertyIsInvalidFArgString = None,
                  MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF = None,
                  MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN = None,
                  MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN = None,
                  MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF = None,
                  MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString = None,
                  ProxiesWith__ValueNotSignificantlyDifferentFromFMF = None,
                  ProxiesWith__ValueNotSignificantlyDifferentFromFMN = None,
                  ProxiesWith__ValueNotSignificantlyDifferentFromFN = None,
                  ProxiesWith__ValueNotSignificantlyDifferentFromF = None,
                  ProxiesWith__ValueNotSignificantlyDifferentFromFArgString = None,
                  UpdateProxyReferencesIn__ValueFMF = None,
                  UpdateProxyReferencesIn__ValueFMN = None,
                  UpdateProxyReferencesIn__ValueFN = None,
                  UpdateProxyReferencesIn__ValueF = None,
                  UpdateProxyReferencesIn__ValueFArgString = None
                  ):

        self.ObjectClass = 'PropertyClass'

        self.topicMap = topicMap
        self.TMA = TMA
        self.procSpecName = self.propertyClassName = propertyClassName
        self.PCDesc = PCDesc
        self.valueTypeName = valueTypeName
        self.overheadDict = overheadDict
        self.procOperations = procOperations

        self.Add__PropToOverheadDictFMF = Add__PropToOverheadDictFMF
        self.Add__PropToOverheadDictFMN = Add__PropToOverheadDictFMN
        self.Add__PropToOverheadDictFN = Add__PropToOverheadDictFN
        self.Add__PropToOverheadDictF = Add__PropToOverheadDictF
        self.Add__PropToOverheadDictFArgString = Add__PropToOverheadDictFArgString
        self.Remove__PropFromOverheadDictFMF = Remove__PropFromOverheadDictFMF
        self.Remove__PropFromOverheadDictFMN = Remove__PropFromOverheadDictFMN
        self.Remove__PropFromOverheadDictFN = Remove__PropFromOverheadDictFN
        self.Remove__PropFromOverheadDictF = Remove__PropFromOverheadDictF
        self.Remove__PropFromOverheadDictFArgString = Remove__PropFromOverheadDictFArgString
        self.ValueIsInvalidFor__PropertyFMF = ValueIsInvalidFor__PropertyFMF
        self.ValueIsInvalidFor__PropertyFMN = ValueIsInvalidFor__PropertyFMN
        self.ValueIsInvalidFor__PropertyFN = ValueIsInvalidFor__PropertyFN
        self.ValueIsInvalidFor__PropertyF = ValueIsInvalidFor__PropertyF
        self.ValueIsInvalidFor__PropertyFArgString = ValueIsInvalidFor__PropertyFArgString
        self.Merge__PropertyValuesFMF = Merge__PropertyValuesFMF
        self.Merge__PropertyValuesFMN = Merge__PropertyValuesFMN
        self.Merge__PropertyValuesFN = Merge__PropertyValuesFN
        self.Merge__PropertyValuesF = Merge__PropertyValuesF
        self.Merge__PropertyValuesFArgString = Merge__PropertyValuesFArgString
        self.ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF = ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF
        self.ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN = ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN
        self.ValuesOf__PropertyInstancesAreSignificantlyDifferentFN = ValuesOf__PropertyInstancesAreSignificantlyDifferentFN
        self.ValuesOf__PropertyInstancesAreSignificantlyDifferentF = ValuesOf__PropertyInstancesAreSignificantlyDifferentF
        self.ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString = ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString
        self.ContextOf__PropertyIsInvalidFMF = ContextOf__PropertyIsInvalidFMF
        self.ContextOf__PropertyIsInvalidFMN = ContextOf__PropertyIsInvalidFMN
        self.ContextOf__PropertyIsInvalidFN = ContextOf__PropertyIsInvalidFN
        self.ContextOf__PropertyIsInvalidF = ContextOf__PropertyIsInvalidF
        self.ContextOf__PropertyIsInvalidFArgString = ContextOf__PropertyIsInvalidFArgString
        self.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF = MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF
        self.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN = MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN
        self.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN = MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN
        self.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF = MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF
        self.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString = MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString
        self.ProxiesWith__ValueNotSignificantlyDifferentFromFMF = ProxiesWith__ValueNotSignificantlyDifferentFromFMF
        self.ProxiesWith__ValueNotSignificantlyDifferentFromFMN = ProxiesWith__ValueNotSignificantlyDifferentFromFMN
        self.ProxiesWith__ValueNotSignificantlyDifferentFromFN = ProxiesWith__ValueNotSignificantlyDifferentFromFN
        self.ProxiesWith__ValueNotSignificantlyDifferentFromF = ProxiesWith__ValueNotSignificantlyDifferentFromF
        self.ProxiesWith__ValueNotSignificantlyDifferentFromFArgString = ProxiesWith__ValueNotSignificantlyDifferentFromFArgString

        self.UpdateProxyReferencesIn__ValueFMF = UpdateProxyReferencesIn__ValueFMF
        self.UpdateProxyReferencesIn__ValueFMN = UpdateProxyReferencesIn__ValueFMN
        self.UpdateProxyReferencesIn__ValueFN = UpdateProxyReferencesIn__ValueFN
        self.UpdateProxyReferencesIn__ValueF = UpdateProxyReferencesIn__ValueF
        self.UpdateProxyReferencesIn__ValueFArgString = UpdateProxyReferencesIn__ValueFArgString

        if TMA.propertyClasses.has_key( propertyClassName):
            traceback.print_stack()
            errMsg( 'Property class "%s" already exists.' % ( propertyClassName))
            sys.exit( 1)
        TMA.propertyClasses[ propertyClassName] = self
        TMA.propertyClassSequence.append( propertyClassName)

        self.propertyInstancesMerged = propertyInstancesMerged
            ## This is here because PropertyClass objects are actually
            ## instances of subclasses of the ProcSpecObject
            ## nonexistent superclass.

        self.proxiesKilled = proxiesKilled

        self.valueType = None  ## this will be set by Add_propertyClass_PropToOverheadDict() after
                               ## this function returns.



#######################################################
class PropertyInstance:
    """

Every subject proxy consists mostly of a dictionary (.propertyInstances) in
which the keys are of the form TMAName, vsv.fieldSeparator,
propertyClassName, and the value of each key is one of these PropertyInstance
objects.

The keyword-ard (**args) stuff is only for bootstrapping.

    """

    def __init__( self, vsv, proxyId, TMAName,
                  propertyClassName, **args):

        global propertyClassProxyDict

        self.ObjectClass = 'PropertyInstance'

        self.proxyId = proxyId
        self.proxy = vsv.proxies[ self.proxyId]
        self.topicMapName = self.proxy.topicMapName
                             ## The name of the TM in which this is a proxy.

        if args.has_key( 'TMObject'):
            self.topicMap = args[ 'TMObject']
        else:
            self.topicMap = vsv.topicMaps[ self.topicMapName]

        if args.has_key( 'procOperation'):
            self.procOperation = args[ 'procOperation']
        else:
            self.procOperation = None

        self.dependentPropertyInstances = {}

            ## A dictionary of property instances, the value of each of which
            ## was calculated, at least in part, on the basis of the value of
            ## this property, either by merger or conferral.  The keys are
            ## propertyInstanceKeys.  The value of each is a list of
            ## ProcOperation objects; these specify the nature of the
            ## dependency.

        self.conferralsTriggered = {}

            ## This attribute "looks forward" (where "forward" means "toward the
            ## things that have happened since the property instance was first
            ## given a value"); it reflects the conferral operations that have
            ## been triggered by this property instance and its merge ancestors.
            ## This attribute is used by conferralMayBeSignificant(), which is
            ## called by conferral rule implementations, in order to determine
            ## whether a given conferral operation would have no substantive
            ## effect on the topic map, and therefore should not be done.

            ## Keys are TMAName,,conferralRuleName,,triggeringRole; the
            ## value of each is a dictionary.  The keys in that dictionary are
            ## procOperationIDs.  Each value is the procOperation object.


        self.conferralTriggerAncestry = {}

            ## This attribute "looks backward" (where "backward" means "toward
            ## the properties that triggered value conferrals upon it or its
            ## merge ancestors); it represents the conferral operations that
            ## caused it or its merge ancestors to exist.

            ## This dictionary is used to detect situations in which conferral
            ## rules are triggering each other.  It is very similar to
            ## self.conferralsTriggered; it has the same data structure.
            ## However, conferralTriggerAncestry is different in that, instead
            ## of procOperations that represent conferral operations that were
            ## triggered by this property instance and all of its merge
            ## ancestors, this attribute lists procOperations in the "ancestry
            ## of conferral".  In other words, whenever a property value is set
            ## by conferral, this attribute made to reflect all of the
            ## processing operations that were triggered by the triggers and
            ## their merge ancestors.

        self.TMAName = TMAName
                             ## The TMA that declares the property class
                             ## of which this property is an instance.

        self.propertyClassName = propertyClassName
                             ## The name of the class of which this
                             ## property is an instance.


        self.listOfIdsOfReferencedProxies = []
                             ## If this property instance contains proxy references,
                             ## this will be a list of the references that appear
                             ## in the value.

        self.valueUpdates = []
                             ## If this property instance contains proxy references,
                             ## this will be the list of updates that have been made
                             ## to those references.  (When proxies are merged out of
                             ## existence, we need to update these references so they
                             ## refer to the living proxies into which the dead proxies
                             ## were merged.)


        if args.has_key( 'PCProxy'):  ## initial bootstrapping
            self.propertyClassProxies = [ args[ 'PCProxy']]
            self.propertyClassProxyIds = [ args[ 'PCProxy'].proxyId]
                ## This has to be done manually for certain property instances at bootstrap time.
            self.propertyClass = None  ## placeholder; will be set later

        elif args.has_key( 'TMObject'):  ## later bootstrapping
                ## For after inital bootstrap but still bootstrapping; overheadDict
                ## data not available yet, so have to go to the proxy that has the info:
            appsProp = self.topicMap.topicMapProxy.propertyInstances[ self.topicMap.opc_system_TMAProxies_topicMap_PNK]
            appProxyId = appsProp._value[ self.TMAName][ 0]
            appProxy = self.topicMap.proxies[ appProxyId]

            PCProxyId = propertyClassProxyDict[ self.propertyClassName][ 0]  ## the first one listed

            self.propertyClassProxies = [ self.topicMap.proxies[ PCProxyId] ]
            self.propertyClassProxyIds = [ PCProxyId]
            self.propertyClass = None  ## placeholder; will be set later

        else:
                ## Normal way of doing it: the overheadDict data can be used now.
            self.propertyClass = self.topicMap.TMAs[ TMAName].propertyClasses[propertyClassName]
            self.propertyClassProxies = self.propertyClass.propertyClassProxies
            self.propertyClassProxyIds = self.propertyClass.propertyClassProxyIds
            if self.propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF: ## if this property instance will be an SIP
                if self.proxy.TMAsWithSIPsInThisProxy.has_key( self.TMAName):
                    traceback.print_stack()
                    errMsg( 'Proxy "%s" already has an SIP defined by TMA "%s" -- %s; now attempting to add SIP "%s".  Only one SIP is allowed per TMA per proxy.' % ( self.proxyId, self.TMAName, vsv.catKey( self.TMAName, self.proxy.TMAsWithSIPsInThisProxy[ self.TMAName]), vsv.catKey( self.TMAName, self.propertyClass.propertyClassName)))
                    sys.exit( 1)
                self.proxy.TMAsWithSIPsInThisProxy[ self.TMAName] = self.propertyClassName

        self._value = None    ## The actual value of the property.  
                             ## The nature of this value is
                             ## user-defined, EXCEPT that Pythonic None
                             ## has a special meaning and cannot be used
                             ## as a property value.  If the
                             ## value is Pythonic None, it means that
                             ## the property was never given a value,
                             ## and there is no need to worry about
                             ## removing the value from the overheadDict
                             ## data for this property class before
                             ## giving it a value.

        self.propertyInstanceKey = vsv.catKey( self.proxyId,
                                                self.TMAName,
                                                self.propertyClassName)
        if vsv.isPropertyInstanceKey( self.propertyInstanceKey):
            traceback.print_stack()
            errMsg( 'Proxy %s already has a "%s" property.' % ( self.proxyId, vsv.catKey( self.TMAName, self.propertyClassName)))
            sys.exit( 1)

        self.propertyInstanceInProxyKey = vsv.catKey( self.TMAName,
                                                       self.propertyClassName)

        if not self.topicMap.proxies.has_key( self.proxyId):
            traceback.print_stack()
            errMsg( 'proxy %s does not exist in TM "%s"' %
                    ( self.proxyId, self.topicMapName))
            sys.exit( 1)

        if self.topicMap.proxies[ self.proxyId].propertyInstances.has_key(
            self.propertyInstanceInProxyKey):
            traceback.print_stack()
            errMsg( 'property %s already exists in proxy %s' %
                    ( self.propertyInstanceInProxyKey, self.proxyId))
            sys.exit( 1)

        self.topicMap.proxies[ self.proxyId].propertyInstances[
            self.propertyInstanceInProxyKey] = self
        
        self.hashablePropertyValue = None

#######################################################
class ProxyObject:
    def __init__( self, topicMapName, **args):

        self.ObjectClass = 'ProxyObject'
        self.topicMapName = topicMapName

        if args.has_key( 'TMObject'):
            ## For bootstrapping only.  Don't try this at home.
            self.topicMap = args[ 'TMObject']
        else:
            ## the normal way
            self.topicMap = vsv.topicMaps[ topicMapName]

        vsv.proxyCount += 1
        self.proxyId = vsv.proxyIdFromInteger( vsv.proxyCount)
          ## All subject proxies have all-decimal-digit strings as object
          ## identifiers (IDs).  All proxyIds begin with two zeroes.  This is
          ## nothing more or less than a Versavant convention; it makes the
          ## doggone things recognizable as such.  Some of the ways that the
          ## URLs sent to the http server are structured take advantage of this
          ## recognizability.
        
        self.forwardTo = None
          ## New proxies are always alive.  Every living proxy has None as the
          ## value of is forwardTo attribute.  In a dead proxy, forwardTo has a
          ## value, which is the proxy that replaced it (that was merged into
          ## it).  The forwarded-to proxy may also be dead, but presumably, at
          ## some level of recursion, the living proxy into which this proxy's
          ## propertyInstances were ultimately merged will be found.

        self.propertyInstances = {}
          ## The dictionary of propertyInstances.  Keys are
          ## propertyInstanceInProxyKeys (2 fields: first is
          ## TMAName, second is propertyClassName)

        self.topicMap.proxies[ self.proxyId] = vsv.proxies[ self.proxyId] = self
##         self.topicMap.proxies[ self.proxyId] = self

        self.TMAsWithSIPsInThisProxy = {}
            ## Keys are TMA names; each value is the property class instantiated.  Set by
            ## PropertyInstance.__init__

        self.procOperationThatCreatedThisProxy = None


#######################################################
class TopicMap:
    """
Each TopicMap object manages a single Topic Map.
    """
    def __init__( self, vsv, topicMapName, TMDesc):

        if sendDebugMessages:
            sys.stdout.write( 'initializing topic map "%s"... ' % ( topicMapName))
            

        global propertyClassProxyDict

        self.ObjectClass = 'TopicMap'

        self.topicMapName = topicMapName
        if vsv.topicMaps.has_key( self.topicMapName):
            traceback.print_stack()
            errMsg( 'There is already a TM named "%s"' % ( self.topicMapName))
            sys.exit( 1)

        self.TMDesc = TMDesc   ## String passed to the newTopicMap() function.

        self.proxies = {}         ## All the subject proxies of this TM are here,
                                         ## both "living" and "dead".

        self.referencedProxiesDict = {}
            ## Keeps track of which property instances have values
            ## that contain references to proxies, and what proxies
            ## they currently reference.  Keys are proxyIds of living
            ## proxies.  Values are propertyInstanceKeys of properties
            ## that contain references to the proxy.  When the proxy dies,
            ## these property values are updated.

        vsv.topicMaps[ self.topicMapName] = self

        self.topicMapProxyIds = []
           ## The proxyIds of the proxies of this TM.  This list,
           ## like many lists and dictionaries in Versavant, is
           ## exactly the same list that is maintained by {Add,Remove}
           ## functions in implementations of properties in the
           ## "Vsys" TMA.  This particular list is
           ## maintained by
           ## {Add,Remove}_topicMapProxySIP_PropFromOverheadDict()

        self.topicMapProxies = []
           ## The ProxyObject objects of the proxies of this TM.
           ## This list is maintained by
           ## {Add,Remove}_topicMapProxySIP_PropFromOverheadDict() in
           ## VsysTMA/PropertyClasses.py (which does lots and lots of
           ## bookkeeping).

        self.TMAs = {}  ## keys are TMA names, values are TMA objects
        self.TMASequence = []  
            ## A list of all the TMA names; their order is the
            ## order in which TMA rules will be processed in
            ## the confer/merge operations.  The order shouldn't make
            ## any difference, at least not in terms of the final
            ## result of a successfully-built topic map, but the order
            ## could affect merging/conferral efficiency, the audit
            ## trail, and it may have implications for debugging.  The
            ## order of the names on this list is the order in which
            ## TMA objects were created, so the system app
            ## (Vsys) is always first on the list.

        self.originalPopulationTasks = {}
            ## keys are original population task names; values are
            ## OriginalPopulationTask objects Note that this is NOT
            ## the same dictionary that appears as the value of the
            ## Vsys:originalPopulationTasks property.  In
            ## that dictionary, the keys are the same, but their
            ## values are lists of proxyIds (the IDs of the same
            ## proxies that appear in this dictionary).
        
        self.originalPopulationTaskSequence = []
            ## The order in which original population tasks were
            ## actually executed (the order in which vsv.populate()
            ## calls occurred).

        self.procOperations = {}
            ## Keys are procOperationIDs, values are ProcOperation objects.

        """

    Hand-assemble the proxies that have to be in place before the system can
    work.

    #######################################################
    ## BOOTSTRAPPING A TM INTO EXISTENCE WITH VERSAVANT ##
    #######################################################

    Bootstrapping a topic map into existence is pretty tricky because
    the system that's doing the bootstrapping appears in the topic
    map, and it has the same privileges as any other topic map
    application (TMA).

    The bootstrapping technique used here is, insofar as possible,
    very consistent with the overall philosophy of Versavant: that
    information that comes into the Topic Map, even including system
    information, first appears as subject proxies.  In Versavant in
    general, as property instances are added, their property class
    implementations are automatically called in order to create any
    other needed data structures.  This bootstrap process works the
    same way, except that many proxies (approximately 100) are added
    without calling the Add__...() function for any of their
    properties, and then, when that's done, all of the relevant
    Add__...() functions are called, at the end of the bootstrap
    process.

    These proxies have to be hand-assembled, instead of using the
    normal way of adding a property to a proxy (newPropertyInstance())
    because they need to be there before the normal way of producing
    proxies can work.  For example, you can't use the normal way of
    producing a proxy unless you can provide the auditing information
    for it, which in turn depends on there being a processing
    specification (such as an OriginalPopulationTask object) that can
    be audited.  But, logically, no such object can exist until the
    proxy for the task exists, and no proxy can exist until the task
    exists.  It's a typical kind of bootstrapping problem.

    Like all other subject proxes, even the proxies of SIP classes,
    and of the TM itself, can die (they can be merged out of
    existence).  This means that there are no permanent proxy object
    identifiers in Versavant, even for the support of Versavant
    itself.  Yeeow!  But: it's really not a terrible problem.  The
    answer lies mainly in the implementations of the Add__...()
    functions of the implementations of the Vsys
    TMA's property classes.

        """

    ## Don't pay too much respect to the following explanation
    ## regarding the naming of bootstrap constants.  The actual naming
    ## of these constants is not perfectly consistent with this
    ## explanation, but it's still the best explanation there is.

    ## Fields within the names of these variables, e.g.:

    ## 1   2      3                4         5
    ## self.opc_system_ValueIsNotOfType___ValueType_Proxy

    ## Field 1:
    ##      "app" -- A TMA proxy
    ##      "opc" -- An Other Property (OP) class proxy
    ##     "sipc" -- A Subject Identity Property (SIP) class proxy
    ##       "topicMap" -- A topic map proxy
    ##     "valt" -- A value type proxy

    ##     "sipi" -- An SIP instance 
    ##      "opi" -- An OP instance

    ## Field 2:
    ##     "system"  -- The System TMA (aka "Vsys")

    ## Field 3:

    ##     (The name of the property class or value type.  It may have
    ##     underscores inside it, which messes up the field count.
    ##     Sigh.  Well, no matter; machines don't read these doggone
    ##     names anyway.  Human readers beware!)

    ## Field 4
    ##     If the first field is "opc"
    ##       The name of the SIP class, if any, that must be instantiated
    ##       in any proxy that has this OP.
    ##     If the first field is "sipi" or "opi":
    ##       The name of the variable that is the proxy.



    ######################################
    ## bootstrap ProcOperation instance ##
    ######################################

        self.bootstrapProcOperation = ProcOperation( self, 'executing original population task "%s"' % ( vsv.systemBootstrapOriginalPopulationTaskName))

    ##########################################
    ## PROXIES OF ORIGINAL POPULATION TASKS ##
    ##########################################

        self.systemOriginalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
        ## This proxifies the task that gives rise to all the bootstrapped property values.

    #############################
    ## PROXY OF THE TOPIC MAP: ##
    #############################

        self.topicMapProxy = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the topic map that we're
            ## bootstrapping, here.

    ##############################
    ## PROXIES OF TMAS: ##
    ##############################

        self.app__system = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the system TMA.

    #################################################
    ## PROXIES OF PROPERTY CLASSES INSTANTIATED IN ##
    ##     PROXIES OF TOPIC MAPS:                  ##
    #################################################

        self.sipc_system_topicMap = ProxyObject( self.topicMapName, TMObject = self)
             ## The proxy of the SIP class that is instantiated in all
             ## proxies of topic maps.  Value type:
             ## Vsys,,string
        self.sipc_system_topicMap_PCN = 'topicMap'
        self.sipc_system_topicMap_PNK = vsv.catKey( vsv.systemTMAName, self.sipc_system_topicMap_PCN)
             ## The name of the SIP of all proxies whose subjects are topic maps.

        self.opc_system_TMAProxies_topicMap = ProxyObject( self.topicMapName, TMObject = self)
             ## The proxy of an OP class that is instantiated in all
             ## proxies of topic map.  Value type:
             ## Vsys,,dict.  Keys are TMA names; values are lists
             ## of proxies of the named TMAs.
        self.opc_system_TMAProxies_topicMap_PCN = 'TMAProxies'
        self.opc_system_TMAProxies_topicMap_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_TMAProxies_topicMap_PCN)
             ## The name of this OP.

        self.opc_system_doc_topicMap = ProxyObject( self.topicMapName, TMObject = self)
             ## The proxy of an OP class that is instantiated in all
             ## proxies of topic map.  Value type:
             ## Vsys,,string
        self.opc_system_doc_topicMap_PCN = 'TMDesc'
        self.opc_system_doc_topicMap_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_doc_topicMap_PCN)
             ## The name of this OP.

        self.opc_system_originalPopulationTasks_topicMap = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the set of
            ## original population tasks for this topic map.  Value
            ## type is Vsys,,dict.  Keys are original population
            ## task names; values are lists of proxyIds of proxies of OriginalPopulationTasks.
        self.opc_system_originalPopulationTasks_topicMap_PCN = 'origPopTasks'
        self.opc_system_originalPopulationTasks_topicMap_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTasks_topicMap_PCN)
            ## The name of this OP.

        self.opc_system_topicMapObject_topicMap = ProxyObject( self.topicMapName, TMObject = self)
             ## The proxy of an OP class that is instantiated in all
             ## proxies of topic maps.  Value type:
             ## Vsys,,topicMapObject
        self.opc_system_topicMapObject_topicMap_PCN = 'TMObj'
        self.opc_system_topicMapObject_topicMap_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_topicMapObject_topicMap_PCN)
             ## The name of this OP.

        self.opc_system_topicMapProcOperations_topicMap = ProxyObject( self.topicMapName, TMObject = self)
             ## The proxy of an OP class that is instantiated in all
             ## proxies of topic maps.  Value type: Vsys,,dict.
             ## Keys are procOperationIDs, values are ProcOperation
             ## objects.
        self.opc_system_topicMapProcOperations_topicMap_PCN = 'TMProcOps'
        self.opc_system_topicMapProcOperations_topicMap_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_topicMapProcOperations_topicMap_PCN)
             ## The name of this OP.

    ###########################################################################
    ## PROXIES OF PROPERTY CLASSES INSTANTIATED IN PROXIES OF TMAS ##
    ###########################################################################

        self.sipc_system_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the SIP class that is instantiated in all
            ## proxies of TMAs.  Value type is Vsys,,string.
        self.sipc_system_TMAName_PCN = 'TMAName'
        self.sipc_system_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.sipc_system_TMAName_PCN)
            ## The name of the SIP of all proxies whose subjects are TMAs.

        self.opc_system_TMADesc_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is description of the TMA that
            ## was imported from the TMA config file (the <Desc> element inside the
            ## <VersavantTMA>.
        self.opc_system_TMADesc_TMAName_PCN = 'TMADesc'
        self.opc_system_TMADesc_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_TMADesc_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_tmaConfigFilePath_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the filepath
            ## of the TMA configuration file.  Value type is Vsys,,string
        self.opc_system_tmaConfigFilePath_TMAName_PCN = 'TMAConfFile'
        self.opc_system_tmaConfigFilePath_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_tmaConfigFilePath_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_valueTypes_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the set of value types
            ## declared by the TMA.  Value type is Vsys,,dict
        self.opc_system_valueTypes_TMAName_PCN = 'valueTypes'
        self.opc_system_valueTypes_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_valueTypes_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_propertyClasses_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the set of
            ## property classes declared by the TMA.  Value type
            ## is Vsys,,dict
        self.opc_system_propertyClasses_TMAName_PCN = 'propClasses'
        self.opc_system_propertyClasses_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyClasses_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_propertyClassSequence_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the set of
            ## property classes declared by the TMA.  Value type
            ## is Vsys,,listOfStrings
        self.opc_system_propertyClassSequence_TMAName_PCN = 'propClassSeq'
        self.opc_system_propertyClassSequence_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyClassSequence_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_conferralRules_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the set of
            ## conferral rules declared by the TMA.  Value type is
            ## Vsys,,dict.  Keys are conferral rule names; values are
            ## lists of proxyIds.
        self.opc_system_conferralRules_TMAName_PCN = 'confRules'
        self.opc_system_conferralRules_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRules_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_pythonModules_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is a dictionary
            ## in which the keys are the names of the Python modules,
            ## and the values are the paths to the modules.  Value
            ## type is Vsys,,dict
        self.opc_system_pythonModules_TMAName_PCN = 'pythonModules'
        self.opc_system_pythonModules_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_pythonModules_TMAName_PCN)
            ## The name of this OP.

        self.opc_system_TMAObject_TMAName = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class whose value is the 
            ## TMA's TMA object.  Value type is
            ## Vsys,,TMAObject
        self.opc_system_TMAObject_TMAName_PCN = 'TMAObj'
        self.opc_system_TMAObject_TMAName_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_TMAObject_TMAName_PCN)
            ## The name of this OP.

    ##############################
    ## PROXIES OF VALUE TYPES: ##
    ##############################

        self.valt_system_string = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "string" value type.
        self.valt_system_string_VALTN = 'string'
        self.valt_system_string_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_string_VALTN)
            ## The name of the "string" value type.

        self.valt_system_listOfStrings = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "listOfStrings" value type.
        self.valt_system_listOfStrings_VALTN = 'listOfStrings'
        self.valt_system_listOfStrings_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_listOfStrings_VALTN)
            ## The name of the "listOfStrings" value type.

        self.valt_system_listOfProperties = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "listOfProperties" value type.
        self.valt_system_listOfProperties_VALTN = 'listOfProps'
        self.valt_system_listOfProperties_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_listOfProperties_VALTN)
            ## The name of the "listOfProperties" value type.

        self.valt_system_setOfStrings = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "setOfStrings" value type.
        self.valt_system_setOfStrings_VALTN = 'setOfStrings'
        self.valt_system_setOfStrings_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_setOfStrings_VALTN)
            ## The name of the "setOfStrings" value type.

        self.valt_system_function = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "function" value type.
        self.valt_system_function_VALTN = 'function'
        self.valt_system_function_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_function_VALTN)
            ## The name of the "function" value type.

        self.valt_system_dict = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "dict" value type
        self.valt_system_dict_VALTN = 'dict'
        self.valt_system_dict_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_dict_VALTN)
            ## The name of the "dict" value type.

        self.valt_system_topicMapObject = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "topicMapObject" value type
        self.valt_system_topicMapObject_VALTN = 'TMObj'
        self.valt_system_topicMapObject_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_topicMapObject_VALTN)
            ## The name of the "topicMapObject" value type.

        self.valt_system_TMAObject = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "TMAObject" value type
        self.valt_system_TMAObject_VALTN = 'TMAObj'
        self.valt_system_TMAObject_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_TMAObject_VALTN)
            ## The name of the "TMAObject" value type.

        self.valt_system_conferralRuleObject = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "conferralRuleObject" value type
        self.valt_system_conferralRuleObject_VALTN = 'confRuleObj'
        self.valt_system_conferralRuleObject_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_conferralRuleObject_VALTN)
            ## The name of the "conferralRuleObject" value type.

        self.valt_system_propertyClassObject = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the "propertyClassObject" value type
        self.valt_system_propertyClassObject_VALTN = 'propClassObj'
        self.valt_system_propertyClassObject_VALTNK = vsv.catKey( vsv.systemTMAName, self.valt_system_propertyClassObject_VALTN)
            ## The name of the "propertyClassObject" value type.


    #######################################################################
    ## PROXIES OF PROPERTY CLASSES INSTANTIATED IN VALUE TYPE PROXIES: ##
    #######################################################################

        self.sipc_system_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the SIP class that is instantiated in all
            ## value type proxies.  Value type is Vsys,,string.  The
            ## value is the concatenation of the TMA name, the
            ## system-defined field separator string, and the value type
            ## name.
        self.sipc_system_valueType_PCN = 'valueType'
        self.sipc_system_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.sipc_system_valueType_PCN)
            ## The name (key) of the SIP of proxies whose subjects are value types.

        self.opc_system_valueTypeTMAName_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all value type
            ## proxies whose value is the name of the TMA that
            ## declared the value type.  Value type is Vsys,,string
        self.opc_system_valueTypeTMAName_valueType_PCN = 'VTTMAName'
        self.opc_system_valueTypeTMAName_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_valueTypeTMAName_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_valueTypeName_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all value type
            ## and property class proxies whose value is the name of the
            ## value type.  Value type is Vsys,,string.
        self.opc_system_valueTypeName_valueType_PCN = 'VTName'
        self.opc_system_valueTypeName_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_valueTypeName_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_VTDesc_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all value type
            ## proxies whose value is the description of the
            ## value type.  Value type is Vsys,,string.
        self.opc_system_VTDesc_valueType_PCN = 'VTDesc'
        self.opc_system_VTDesc_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_VTDesc_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsNotOfType__FMF_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all value
            ## type proxies whose value is the path to the Python file
            ## that contains the function that validates instances of
            ## the value type.  Value type is Vsys,,string
        self.opc_system_ValueIsNotOfType__FMF_valueType_PCN = 'ValueIsNotOfType__FMF'
        self.opc_system_ValueIsNotOfType__FMF_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FMF_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsNotOfType__FMN_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## Name of the module in which the function appears.
        self.opc_system_ValueIsNotOfType__FMN_valueType_PCN = 'ValueIsNotOfType__FMN'
        self.opc_system_ValueIsNotOfType__FMN_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FMN_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsNotOfType__FN_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the function.
        self.opc_system_ValueIsNotOfType__FN_valueType_PCN = 'ValueIsNotOfType__FN'
        self.opc_system_ValueIsNotOfType__FN_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FN_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsNotOfType__F_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The function itself.
        self.opc_system_ValueIsNotOfType__F_valueType_PCN = 'ValueIsNotOfType__F'
        self.opc_system_ValueIsNotOfType__F_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsNotOfType__F_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsNotOfType__FArgString_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The argument string, if any, to be passed to the function.
        self.opc_system_ValueIsNotOfType__FArgString_valueType_PCN = 'ValueIsNotOfType__FArgString'
        self.opc_system_ValueIsNotOfType__FArgString_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FArgString_valueType_PCN)
            ## The name (key) of this OP.


        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in value
            ## type proxies whose value is the path to the Python file
            ## that contains the function that serializes instances of
            ## the value type.  Value type is Vsys,,string
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN = 'InstanceOf__ValueTypeToXMLContentStringFMF'
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## Name of the module in which the function appears.
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN = 'InstanceOf__ValueTypeToXMLContentStringFMN'
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the function.
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN = 'InstanceOf__ValueTypeToXMLContentStringFN'
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The function itself.
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN = 'InstanceOf__ValueTypeToXMLContentStringF'
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The argument string, if any, to be passed to the function.
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PCN = 'InstanceOf__ValueTypeToXMLContentStringFArgString'
        self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PCN)
            ## The name (key) of this OP.


        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all value
            ## type proxies whose value is the path to the Python file
            ## that contains the function that validates instances of
            ## the value type.  Value type is Vsys,,string
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN = 'XMLContentStringToInstanceOf__ValueTypeFMF'
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## Name of the module in which the function appears.
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN = 'XMLContentStringToInstanceOf__ValueTypeFMN'
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the function.
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN = 'XMLContentStringToInstanceOf__ValueTypeFN'
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The function itself.
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN = 'XMLContentStringToInstanceOf__ValueTypeF'
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN)
            ## The name (key) of this OP.

        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType = ProxyObject( self.topicMapName, TMObject = self)
            ## The argument string, if any, to be passed to the function.
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PCN = 'XMLContentStringToInstanceOf__ValueTypeFArgString'
        self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PCN)
            ## The name (key) of this OP.


    #################################
    ## PROXIES OF PROPERTY CLASSES ##
    #################################

        ## (see all entries beginning with self.sipc_ and self.opc_ )


    ##############################################
    ## PROXIES OF PROPERTY CLASSES INSTANTIATED ##
    ##      IN PROXIES OF PROPERTY CLASSES:     ##
    ##############################################

        self.sipc_system_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the SIP class that is instantiated in all
            ## property class proxies.  Value type is Vsys,,string.
            ## The value is the concatenation of the TMA name, the
            ## system-defined field separator string, and the property
            ## class name.
        self.sipc_system_propertyClass_PCN = 'propClass'
        self.sipc_system_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.sipc_system_propertyClass_PCN)
            ## The name (key) of the SIP of all proxies whose subjects are property
            ## classes.  For auditing purposes, this string is also used to report
            ## the procOperationType of procOperations whose
            ## procSpecs are property instance merging rules.

        self.opc_system_propertyClassTMAName_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all property
            ## class proxies whose value is the proxy of the
            ## TMA that declared the property class.  Value type
            ## is Vsys,,string
        self.opc_system_propertyClassTMAName_propertyClass_PCN = 'propClassTMAName'
        self.opc_system_propertyClassTMAName_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyClassTMAName_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_propertyClassName_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all property
            ## class proxies whose value is the name of the property
            ## class.  Value type is Vsys,,string.
        self.opc_system_propertyClassName_propertyClass_PCN = 'propClassName'
        self.opc_system_propertyClassName_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyClassName_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_PCDesc_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all 
            ## property class proxies whose value is the description of the
            ## property class.  Value type is Vsys,,string.
        self.opc_system_PCDesc_propertyClass_PCN = 'PCDesc'
        self.opc_system_PCDesc_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_PCDesc_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_PCValueType_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all 
            ## property class proxies whose value is the name of the
            ## value type.  Value type is Vsys,,string
        self.opc_system_PCValueType_propertyClass_PCN = 'PCValueType'
        self.opc_system_PCValueType_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_PCValueType_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Add__PropToOverheadDictFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all property
            ## class proxies whose value is the file (the function
            ## module file: "FMF") in which the function is found that
            ## is called whenever an instance of the property class is
            ## added to a subject proxy.  Value type is
            ## Vsys,,string.
        self.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN = 'Add__PropToOverheadDictFMF'
        self.opc_system_Add__PropToOverheadDictFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Add__PropToOverheadDictFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The module name of the above-described function.  Value
            ## type is Vsys,,string.
        self.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN = 'Add__PropToOverheadDictFMN'
        self.opc_system_Add__PropToOverheadDictFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Add__PropToOverheadDictFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The function name of the above-described function.  Value
            ## type is Vsys,,string.
        self.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN = 'Add__PropToOverheadDictFN'
        self.opc_system_Add__PropToOverheadDictFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Add__PropToOverheadDictF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.  Value
            ## type is Vsys,,function.
        self.opc_system_Add__PropToOverheadDictF_propertyClass_PCN = 'Add__PropToOverheadDictF'
        self.opc_system_Add__PropToOverheadDictF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Add__PropToOverheadDictFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## An option string of (probably keyword) arguments to
            ## pass to the above-described function.  Value type is
            ## Vsys,,string.
        self.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PCN = 'Add__PropToOverheadDictFArgString'
        self.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all property
            ## class proxies whose value is the file in which the
            ## function is found that is called in order to remove the
            ## value of an instance of the property, such as whenever
            ## such an instance is found in a dying proxy.  (Proxies
            ## die when they are merged into new proxies.)  It is the
            ## responsibility of this function to change the overheadDict
            ## data for the property class in such a way that it will
            ## be as though the property had never existed.  Audit
            ## data are not affected.  (Nothing ever changes a
            ## property of a subject proxy or of its audit object.)
            ## This function is always called *before* the newly
            ## merged property is added to the merged proxy that
            ## replaces the old ones.  In other words, during the
            ## merging process, the Add__PropToOverheadDictF() function is
            ## always called *after* the Remove__PropFromOverheadDict
            ## function has been called. Value type is Vsys,,string.
        self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN = 'Remove__PropFromOverheadDictFMF'
        self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the module of the above-described function.
            ## Value type is Vsys,,string.
        self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN = 'Remove__PropFromOverheadDictFMN'
        self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Remove__PropFromOverheadDictFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.  Value type
            ## is Vsys,,string
        self.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN = 'Remove__PropFromOverheadDictFN'
        self.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Remove__PropFromOverheadDictF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.  Value type is
            ## Vsys,,function.
        self.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN = 'Remove__PropFromOverheadDictF'
        self.opc_system_Remove__PropFromOverheadDictF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## Argument string to be passed to above-described
            ## function.  Value type is Vsys,,string.
        self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PCN = 'Remove__PropFromOverheadDictFArgString'
        self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)    
            ## The proxy of an OP class that appears in all property
            ## class proxies.  The value is the name of the file that
            ## contains the function that will be called to validate
            ## the value of the property as a value of that property
            ## (as opposed to being a value of some value type, which
            ## is a different function).  It returns False if the
            ## value is valid, True otherwise.  Value type is
            ## Vsys,,string
        self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN = 'ValueIsInvalidFor__PropertyFMF'
        self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)    
            ## Module name of the above-described function.  Value type
            ## is Vsys,,string
        self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN = 'ValueIsInvalidFor__PropertyFMN'
        self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)    
            ## Function name of the above-described function.  Value type
            ## is Vsys,,string
        self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN = 'ValueIsInvalidFor__PropertyFN'
        self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)    
            ## The actual function described above.  Value type is
            ## Vsys,,function.
        self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN = 'ValueIsInvalidFor__PropertyF'
        self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)    
            ## Module name of the above-described function.  Value type
            ## is Vsys,,string
        self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PCN = 'ValueIsInvalidFor__PropertyFArgString'
        self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Merge__PropertyValuesFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in all property
            ## class proxies.  The value of each instance of the OP is
            ## the name of the file in which the function is found
            ## that is called in order merge two instances of the
            ## property class into a single property instance.  The
            ## function takes two or more instances and returns the
            ## merged value.  Value type is Vsys,,string.
        self.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN = 'Merge__PropertyValuesFMF'
        self.opc_system_Merge__PropertyValuesFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Merge__PropertyValuesFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The module name of the above-described function.  Value
            ## type is Vsys,,string.
        self.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN = 'Merge__PropertyValuesFMN'
        self.opc_system_Merge__PropertyValuesFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Merge__PropertyValuesFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.  Value
            ## type is Vsys,,string.
        self.opc_system_Merge__PropertyValuesFN_propertyClass_PCN = 'Merge__PropertyValuesFN'
        self.opc_system_Merge__PropertyValuesFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Merge__PropertyValuesF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.  Value type is
            ## Vsys,,function.
        self.opc_system_Merge__PropertyValuesF_propertyClass_PCN = 'Merge__PropertyValuesF'
        self.opc_system_Merge__PropertyValuesF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Merge__PropertyValuesF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_Merge__PropertyValuesFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## Argument string to be passed to the above-described
            ## function.  Value type is Vsys,,string.
        self.opc_system_Merge__PropertyValuesFArgString_propertyClass_PCN = 'Merge__PropertyValuesFArgString'
        self.opc_system_Merge__PropertyValuesFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in all property
            ## class proxies.  The value of each instance of the OP is
            ## the name of the file in which the function is found
            ## that is called in order determine whether two
            ## propertyInstances values are significantly different.  This
            ## function is essential for deciding when to stop the
            ## iterative confer/merge process.  The function takes two
            ## instances and returns True or False.  Value type is
            ## Vsys,,string.
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN = 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The module name of the above-described function.  Value
            ## type is Vsys,,string.
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN = 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN'
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.  Value
            ## type is Vsys,,string.
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN = 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN'
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.  Value type is
            ## Vsys,,function.
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN = 'ValuesOf__PropertyInstancesAreSignificantlyDifferentF'
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## Argument string to be passed to the above-described
            ## function.  Value type is Vsys,,string.
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PCN = 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString'
        self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## all property classes; the value is the name of the file
            ## in which a function exists that is called at proxy
            ## validation time, either via vsv.checkOneProxy() or
            ## vsv.checkAllProxies().  The proxy containing an
            ## instance of the property class is passed to this
            ## user-defined function.  If the proxy passes the
            ## validation check provided by the function, the function
            ## returns the empty string.  If it does not pass, the
            ## function returns a string containing information as to
            ## what's wrong with the proxy.  Value type is
            ## Vsys,,string.
        self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN = 'ContextOf__PropertyIsInvalidFMF'
        self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the module of the above-described function.
            ## Value type is Vsys,,string
        self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN = 'ContextOf__PropertyIsInvalidFMN'
        self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.
            ## Value type is Vsys,,string.
        self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN = 'ContextOf__PropertyIsInvalidFN'
        self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.
            ## Value type is Vsys,,function.
        self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN = 'ContextOf__PropertyIsInvalidF'
        self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## An optional argument string to be passed to the above function.
            ## Value type is Vsys,,string
        self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PCN = 'ContextOf__PropertyIsInvalidFArgString'
        self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## all SIP (subject identity property) classes (and not in
            ## any OP class proxies); the value is the name of the
            ## file in which a function exists that is called at merge
            ## time.  The function reads the overheadDict data for the
            ## property class, in which all instances of the property
            ## class are accounted for, and then repeatedly calls the
            ## proxy-merging function (vsv.MergeListOfProxies()) for
            ## all proxies that have instances of the SIP whose values
            ## are such that they demand merging.  Value type is
            ## Vsys,,string.
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN = 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the module of the above-described function.
            ## Value type is Vsys,,string
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN = 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN'
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.
            ## Value type is Vsys,,string.
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN = 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN'
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.
            ## Value type is Vsys,,function.
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN = 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF'
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## An optional argument string to be passed to the above function.
            ## Value type is Vsys,,string
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PCN = 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString'
        self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## property classes whose values contain references to
            ## proxies.  Its value is the function module file (FMF)
            ## of a function that is called from mergeListOfProxies()
            ## when a proxy that is referenced in the value is being
            ## killed, so that the reference(s) in the property value
            ## will be updated, and will refer thereafter to the proxy
            ## that resulted from the merger, rather than to the
            ## now-dead proxy.  Value type is Vsys,,string.
        self.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN = 'UpdateProxyReferencesIn__ValueFMF'
        self.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the module of the above-described function.
            ## Value type is Vsys,,string
        self.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PCN = 'UpdateProxyReferencesIn__ValueFMN'
        self.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.
            ## Value type is Vsys,,string.
        self.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PCN = 'UpdateProxyReferencesIn__ValueFN'
        self.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.
            ## Value type is Vsys,,function.
        self.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PCN = 'UpdateProxyReferencesIn__ValueF'
        self.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## An optional argument string to be passed to the above function.
            ## Value type is Vsys,,string
        self.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass_PCN = 'UpdateProxyReferencesIn__ValueFArgString'
        self.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## all SIP (subject identity property) classes (and not in
            ## any OP class proxies); the value is the name of the
            ## file in which a function exists that is called in order
            ## to get the list of living proxies that have the same
            ## subject that a mythical proxy that has an instance of
            ## the SIP class with a certain value.  The function reads
            ## the overheadDict data for the property class, and returns a
            ## list of ProxyObject objects or proxyIds.  Value type
            ## is Vsys,,string

        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN = 'ProxiesWith__ValueNotSignificantlyDifferentFromFMF'
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the module of the above-described function.
            ## Value type is Vsys,,string
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN = 'ProxiesWith__ValueNotSignificantlyDifferentFromFMN'
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The name of the above-described function.
            ## Value type is Vsys,,string.
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN = 'ProxiesWith__ValueNotSignificantlyDifferentFromFN'
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The above-described function.
            ## Value type is Vsys,,function.
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN = 'ProxiesWith__ValueNotSignificantlyDifferentFromF'
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## An optional argument string to be passed to the above function.
            ## Value type is Vsys,,string
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PCN = 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString'
        self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_propertyClassObject_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of SIP classes.  The value is the PropertyClass
            ## object that corresponds to the subject of the proxy.  The value type is
            ## Vsys,,propertyClassObject.
        self.opc_system_propertyClassObject_propertyClass_PCN = 'propClassObj'
        self.opc_system_propertyClassObject_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyClassObject_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_proxiesKilled_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of SIP classes.  The value is the proxyIds of
            ## proxies that were killed in mergers demanded by
            ## instances of the property class.  The value type is
            ## Vsys,,setOfStrings; each string is a proxyId.
            ## (Cannot be Vsys,,setOfProxies because they would be
            ## updated to their forwarding addresses automagically)
        self.opc_system_proxiesKilled_propertyClass_PCN = 'proxiesKilled'
        self.opc_system_proxiesKilled_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_proxiesKilled_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_overheadDict_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## all property class proxies.  The value of each instance of
            ## the OP is the overheadDict data for all instances of the
            ## property class.  It is always a python dictionary.
            ## WARNING: there is no universal way for versavant to merge
            ## overheadDict dictionaries.  Therefore, the only reliable way to
            ## merge multiple topic maps is to construct a single topic
            ## map from them.  Simply concatenating them cannot work.  The
            ## system-defined merging rule is designed to work for
            ## system-defined overheadDict data (the overheadDict data for
            ## instances of property classes reified in this list) ONLY.
            ## Value type is Vsys,,dict
        self.opc_system_overheadDict_propertyClass_PCN = 'overheadDict'
        self.opc_system_overheadDict_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_overheadDict_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_propertyClassProcOperations_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## all property class proxies.  The value of each instance of
            ## the OP is a dictionary in which the keys are procOperationIDs,
            ## and the values are procOperations.  The procOperations are all
            ## merging procOperations; these are all the operations initiated
            ## by the property class's MergeProxiesBecause__.. function, if any.
            ## Value type is Vsys,,dict
        self.opc_system_propertyClassProcOperations_propertyClass_PCN = 'propClassProcOps'
        self.opc_system_propertyClassProcOperations_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyClassProcOperations_propertyClass_PCN)
            ## The name (key) of this OP.

        self.opc_system_propertyInstancesMerged_propertyClass = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that appears in the proxies of
            ## all SIP class proxies.  It is the list of
            ## propertyInstancesKeys of the properties that were
            ## merged on account of the fact that instances of the SIP
            ## class were deemed to require merging.  Value type is
            ## Vsys,,listOfProperties
        self.opc_system_propertyInstancesMerged_propertyClass_PCN = 'propInstancesMerged'
        self.opc_system_propertyInstancesMerged_propertyClass_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_propertyInstancesMerged_propertyClass_PCN)
            ## The name (key) of this OP.

    ##############################################
    ## PROXIES OF PROPERTY CLASSES INSTANTIATED ##
    ##      IN PROXIES OF CONFERRAL RULES:      ##
    ##############################################

        self.sipc_system_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the SIP class that is instantiated in all
            ## conferral rule proxies.  Value type is Vsys,,string.
            ## The value is the concatenation of the TMA name, the
            ## system-defined field separator string, and the conferral
            ## rule name.
        self.sipc_system_conferralRule_PCN = 'confRule'
        self.sipc_system_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.sipc_system_conferralRule_PCN)
            ## The name (key) of this SIP

        self.opc_system_conferralRuleName_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all conferral
            ## rule proxies whose value is the unadorned name of the
            ## conferral rule (i.e., without the TMA name
            ## prepended).  Value type is Vsys,,string
        self.opc_system_conferralRuleName_conferralRule_PCN = 'confRuleName'
        self.opc_system_conferralRuleName_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleName_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_confRuleDesc_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all conferral
            ## rule proxies whose value is the unadorned name of the
            ## conferral rule (i.e., without the TMA name
            ## prepended).  Value type is Vsys,,string
        self.opc_system_confRuleDesc_conferralRule_PCN = 'confRuleDesc'
        self.opc_system_confRuleDesc_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_confRuleDesc_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleTMAName_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all conferral
            ## rule proxies whose value is the name of the TMA that declares
            ## the conferral rule.  Value type is Vsys,,string
        self.opc_system_conferralRuleTMAName_conferralRule_PCN = 'confRuleTMAName'
        self.opc_system_conferralRuleTMAName_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleTMAName_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleProcOperations_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the OP class that appears in all conferral
            ## rule proxies whose value is the dictionary of procOperations of
            ## the conferral rule.  Value type is Vsys,,dict
        self.opc_system_conferralRuleProcOperations_conferralRule_PCN = 'confRuleProcOps'
        self.opc_system_conferralRuleProcOperations_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleProcOperations_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleFMF_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  The value is the name of
            ## the python code file (full path) that contains the
            ## function that implements the conferral rule.  The value
            ## type is Vsys,,string.
        self.opc_system_conferralRuleFMF_conferralRule_PCN = 'conferralRuleFMF'
        self.opc_system_conferralRuleFMF_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleFMF_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleFMN_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  The value is the name of
            ## the module contains the function that implements the
            ## conferral rule.  The value type is Vsys,,string.
        self.opc_system_conferralRuleFMN_conferralRule_PCN = 'conferralRuleFMN'
        self.opc_system_conferralRuleFMN_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleFMN_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleFN_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  The value is the name of the
            ## function that implements the conferral rule.  The value type
            ## is Vsys,,string.
        self.opc_system_conferralRuleFN_conferralRule_PCN = 'conferralRuleFN'
        self.opc_system_conferralRuleFN_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleFN_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleF_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  The value is the 
            ## function that implements the conferral rule.  The value type
            ## is Vsys,,function
        self.opc_system_conferralRuleF_conferralRule_PCN = 'conferralRuleF'
        self.opc_system_conferralRuleF_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleF_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleFArgString_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  The value is the string
            ## that will be considered a string of extra arguments to
            ## be passed to the function that implements the conferral
            ## rule.  Value type is Vsys,,string.
        self.opc_system_conferralRuleFArgString_conferralRule_PCN = 'conferralRuleFArgString'
        self.opc_system_conferralRuleFArgString_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleFArgString_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleTriggerRoles_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  Value type is Vsys,,dict; each key is a
            ## conferral rule triggering role name; the value of each
            ## key is an integer which is the limit on the number of
            ## times any given property instance, including its merge
            ## ancestors, can play that triggering role.  The default
            ## value is vsv.defaultConferralRoleTriggeringLimit.
            ## Non-default values can be supplied in the TMA
            ## configuration file.
        self.opc_system_conferralRuleTriggerRoles_conferralRule_PCN = 'confRuleTrigRoles'
        self.opc_system_conferralRuleTriggerRoles_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleTriggerRoles_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleValueSourceRoles_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  Value type is Vsys,,dict; each key is a
            ## conferral rule value source role name; the value of each
            ## key is Pythonic None.
        self.opc_system_conferralRuleValueSourceRoles_conferralRule_PCN = 'confRuleValSrcRoles'
        self.opc_system_conferralRuleValueSourceRoles_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleValueSourceRoles_conferralRule_PCN)
            ## The name (key) of this OP.

        self.opc_system_conferralRuleObject_conferralRule = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of conferral rules.  The value is the
            ## ConferralRule object that corresponds to the subject
            ## of the proxy.  Value
            ## type is Vsys,,conferralRule; each key is a
            ## propertyInstanceKey.
        self.opc_system_conferralRuleObject_conferralRule_PCN = 'confRuleObj'
        self.opc_system_conferralRuleObject_conferralRule_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_conferralRuleObject_conferralRule_PCN)
            ## The name (key) of this OP.



    #######################################################################################
    ## PROXIES OF PROPERTY CLASSES INSTANTIATED IN PROXIES OF ORIGINAL POPULATION TASKS: ##
    #######################################################################################

        self.sipc_system_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of the SIP class that is instantiated in all
            ## proxies of original population tasks.  Value type is Vsys,,string.
            ## Suggested value is the concatenation of the Python module name,
            ## the system-defined field separator string, and the Python
            ## function name.  Actually, though, the string is entirely user-specified.
        self.sipc_system_originalPopulationTask_PCN = 'origPopTask'
        self.sipc_system_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.sipc_system_originalPopulationTask_PCN)
            ## The name (key) of the SIP of all proxies whose subjects
            ## are original population tasks.  For auditing purposes, this string
            ## is also used to report the procOperationType of
            ## procOperations whose procSpecs are original population tasks.

        self.opc_system_origPopTaskDesc_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of original population tasks.  The value is the name of the
            ## python code file (full path) that contains the function that implements the original population
            ## task.  The value type is Vsys,,string.
        self.opc_system_origPopTaskDesc_originalPopulationTask_PCN = 'origPopTaskDesc'
        self.opc_system_origPopTaskDesc_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_origPopTaskDesc_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        self.opc_system_originalPopulationTaskFMF_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of original population tasks.  The value is the name of the
            ## python code file (full path) that contains the function that implements the original population
            ## task.  The value type is Vsys,,string.
        self.opc_system_originalPopulationTaskFMF_originalPopulationTask_PCN = 'originalPopulationTaskFMF'
        self.opc_system_originalPopulationTaskFMF_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTaskFMF_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        self.opc_system_originalPopulationTaskFMN_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of original population tasks.  The value is the name of the
            ## module contains the function that implements the original population
            ## task.  The value type is Vsys,,string.
        self.opc_system_originalPopulationTaskFMN_originalPopulationTask_PCN = 'originalPopulationTaskFMN'
        self.opc_system_originalPopulationTaskFMN_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTaskFMN_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        self.opc_system_originalPopulationTaskFN_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of original population tasks.  The value is the name of the
            ## function that implements the original population task.  The value type
            ## is Vsys,,string.
        self.opc_system_originalPopulationTaskFN_originalPopulationTask_PCN = 'originalPopulationTaskFN'
        self.opc_system_originalPopulationTaskFN_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTaskFN_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        self.opc_system_originalPopulationTaskF_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of original population tasks.  The value is the 
            ## function that implements the original population task.  The value type
            ## is Vsys,,function
        self.opc_system_originalPopulationTaskF_originalPopulationTask_PCN = 'originalPopulationTaskF'
        self.opc_system_originalPopulationTaskF_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTaskF_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        self.opc_system_originalPopulationTaskFArgString_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all
            ## proxies of original population tasks.  The value is the
            ## propertyInstanceKeys of the propertyInstances that resulted
            ## from the operation of the original population task.  The value
            ## type is Vsys,,dict; each key is a
            ## propertyInstanceKey.
        self.opc_system_originalPopulationTaskFArgString_originalPopulationTask_PCN = 'originalPopulationTaskFArgString'
        self.opc_system_originalPopulationTaskFArgString_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTaskFArgString_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask = ProxyObject( self.topicMapName, TMObject = self)
            ## The proxy of an OP class that is instantiated in all proxies of
            ## original population tasks.  The value is the propertyInstanceKeys of the
            ## propertyInstances that resulted from the original population task.  The value type is
            ## Vsys,,dict; each key is a propertyInstanceKey.
        self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PCN = 'origPopTaskProcOps'
        self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PNK = vsv.catKey( vsv.systemTMAName, self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PCN)
            ## The name (key) of this OP.

        #######################################################
        ## systemOriginalPopulationTask - property instances ##
        #######################################################

        ## instance of sipc_system_originalPopulationTask

            ## create the property instance:
        self.sipi_system_originalPopulationTask_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.sipc_system_originalPopulationTask_PCN, PCProxy = self.sipc_system_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.sipi_system_originalPopulationTask_originalPopulationTask._value = vsv.systemBootstrapOriginalPopulationTaskName

        ## instance of opc_system_origPopTaskDesc_originalPopulationTask

            ## create the property instance
        self.opi_system_origPopTaskDesc_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_origPopTaskDesc_originalPopulationTask_PCN, PCProxy = self.opc_system_origPopTaskDesc_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_origPopTaskDesc_originalPopulationTask._value = '\'System bootstrap\' original population task: proxies for the %s TMA, etc.' % ( vsv.systemTMAName)

        ## instance of opc_system_originalPopulationTaskFMF_originalPopulationTask

            ## create the property instance
        self.opi_system_originalPopulationTaskFMF_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTaskFMF_originalPopulationTask_PCN, PCProxy = self.opc_system_originalPopulationTaskFMF_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_originalPopulationTaskFMF_originalPopulationTask._value = 'versavant.py'

        ## instance of opc_system_originalPopulationTaskFMN_originalPopulationTask

            ## create the property instance
        self.opi_system_originalPopulationTaskFMN_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTaskFMN_originalPopulationTask_PCN, PCProxy = self.opc_system_originalPopulationTaskFMN_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_originalPopulationTaskFMN_originalPopulationTask._value = 'versavant'

        ## instance of opc_system_originalPopulationTaskFN_originalPopulationTask

            ## create the property instance
        self.opi_system_originalPopulationTaskFN_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTaskFN_originalPopulationTask_PCN, PCProxy = self.opc_system_originalPopulationTaskFN_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_originalPopulationTaskFN_originalPopulationTask._value = 'sysBootstrapOrigPopTask'

        
        ## instance of opc_system_originalPopulationTaskF_originalPopulationTask

            ## create the property instance
        self.opi_system_originalPopulationTaskF_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTaskF_originalPopulationTask_PCN, PCProxy = self.opc_system_originalPopulationTaskF_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_originalPopulationTaskF_originalPopulationTask._value = sysBootstrapOrigPopTask  ## never call this function

        ## instance of opc_system_originalPopulationTaskFArgString_originalPopulationTask

            ## create the property instance
        self.opi_system_originalPopulationTaskFArgString_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTaskFArgString_originalPopulationTask_PCN, PCProxy = self.opc_system_originalPopulationTaskFArgString_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_originalPopulationTaskFArgString_originalPopulationTask._value = ''

        
        ## instance of opc_system_originalPopulationTaskProcOperations_originalPopulationTask

            ## create the property instance
        self.opi_system_originalPopulationTaskProcOperations_originalPopulationTask = vsv.PropertyInstance( vsv, self.systemOriginalPopulationTask.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PCN, PCProxy = self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.opi_system_originalPopulationTaskProcOperations_originalPopulationTask._value = {}  ## a dict

        

        ################################
        ## topicMapProxy - property instances ##
        ################################

        ## instance of self.sipc_system_topicMap

            ## create the property instance:
        self.sipi_system_topicMap_topicMapProxy = vsv.PropertyInstance( vsv, self.topicMapProxy.proxyId, vsv.systemTMAName, self.sipc_system_topicMap_PCN, PCProxy = self.sipc_system_topicMap, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.sipi_system_topicMap_topicMapProxy._value = self.topicMapName
            ## Topic maps are distinguished by the names given to them
            ## by whoever calls vsv.newTopicMap()

        ## instance of self.opc_system_TMAProxies_topicMap

            ## create the property instance:
        self.opi_system_TMAProxies_topicMap_topicMapProxy = vsv.PropertyInstance( vsv, self.topicMapProxy.proxyId, vsv.systemTMAName, self.opc_system_TMAProxies_topicMap_PCN, PCProxy = self.opc_system_TMAProxies_topicMap, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the system TMA's proxy
            ## (the only TMA we know about right now)
        self.opi_system_TMAProxies_topicMap_topicMapProxy._value = { vsv.systemTMAName: [ self.app__system.proxyId] }  ## This list is created here and referenced later.
            ## the above list object will be replaced by the Add_ function, but that won't hurt anything.

        ## instance of self.opc_system_doc_topicMap

            ## create the property instance:
        self.opi_system_doc_topicMap_topicMapProxy = vsv.PropertyInstance( vsv, self.topicMapProxy.proxyId, vsv.systemTMAName, self.opc_system_doc_topicMap_PCN, PCProxy = self.opc_system_doc_topicMap, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the system TMA's proxy
            ## (the only TMA we know about right now)
        self.opi_system_doc_topicMap_topicMapProxy._value = self.TMDesc


        ## instance of self.opc_system_originalPopulationTasks_topicMap

            ## create the property instance:
        self.opi_system_originalPopulationTasks_topicMap_topicMapProxy = vsv.PropertyInstance( vsv, self.topicMapProxy.proxyId, vsv.systemTMAName, self.opc_system_originalPopulationTasks_topicMap_PCN, PCProxy = self.opc_system_originalPopulationTasks_topicMap, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the system boot original population task
            ## (the only OP task we know about right now)
        self.opi_system_originalPopulationTasks_topicMap_topicMapProxy._value = {}
            ## these are going to be lists of proxyIds, whereas
            ## self.originalPopulationTasks has a single OriginalPopulationTask
            ## object as the value of each key.  In both cases, the keys are
            ## original population task names.

        ## instance of self.opc_system_topicMapObject_topicMap

            ## create the property instance:
        self.opi_system_topicMapObject_topicMap_topicMapProxy = vsv.PropertyInstance( vsv, self.topicMapProxy.proxyId, vsv.systemTMAName, self.opc_system_topicMapObject_topicMap_PCN, PCProxy = self.opc_system_topicMapObject_topicMap, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: this TopicMap object
        self.opi_system_topicMapObject_topicMap_topicMapProxy._value = self


        ## instance of self.opc_system_topicMapProcOperations_topicMap

            ## create the property instance:
        self.opi_system_topicMapProcOperations_topicMap_topicMapProxy = vsv.PropertyInstance( vsv, self.topicMapProxy.proxyId, vsv.systemTMAName, self.opc_system_topicMapProcOperations_topicMap_PCN, PCProxy = self.opc_system_topicMapProcOperations_topicMap, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the TopicMap object's topicMapProcOperations attribute (which is a dictionary)
        self.opi_system_topicMapProcOperations_topicMap_topicMapProxy._value = self.procOperations


        ###########################################
        ## self.app__system - property instances ##
        ###########################################

        ## instance of self.sipc_system_TMAName

            ## create the property instance:
        self.sipi_system_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.sipc_system_TMAName_PCN, PCProxy = self.sipc_system_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value 
        self.sipi_system_TMAName_app__system._value = vsv.systemTMAName
            ## It's the system TMA!

        ## instance of self.opc_system_tmaConfigFilePath_TMAName

            ## create the property instance:
        self.opi_system_tmaConfigFilePath_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_tmaConfigFilePath_TMAName_PCN, PCProxy = self.opc_system_tmaConfigFilePath_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the system app's configuration file name
        self.opi_system_tmaConfigFilePath_TMAName_app__system._value = ''

        ## instance of self.opc_system_TMADesc_TMAName

            ## create the property instance:
        self.opi_system_TMADesc_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_TMADesc_TMAName_PCN, PCProxy = self.opc_system_TMADesc_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the system app's configuration file name
        self.opi_system_TMADesc_TMAName_app__system._value = 'Versavant \'system TMA\': value types and property classes for proxies whose subjects are value types, property classes, conferral rules, topic maps, original population tasks, and TMAs.'


        ## instance of self.opc_system_valueTypes_TMAName:

            ## create the property instance:
        self.opi_system_valueTypes_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_valueTypes_TMAName_PCN, PCProxy = self.opc_system_valueTypes_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the set of value types "declared" by the system app
        self.opi_system_valueTypes_TMAName_app__system._value = None  ## fix this at the end of the bootstrap process

        ## instance of self.opc_system_propertyClasses_TMAName:

            ## create the property instance:
        self.opi_system_propertyClasses_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_propertyClasses_TMAName_PCN, PCProxy = self.opc_system_propertyClasses_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the set of property classes "declared" by the
            ## system app
        self.opi_system_propertyClasses_TMAName_app__system._value = None  ## fix this at the end of the bootstrap process

        propertyClassProxyDict = {

            self.sipc_system_topicMap_PCN: [ self.sipc_system_topicMap.proxyId],
            self.opc_system_TMAProxies_topicMap_PCN: [ self.opc_system_TMAProxies_topicMap.proxyId],
            self.opc_system_doc_topicMap_PCN: [ self.opc_system_doc_topicMap.proxyId],
            self.opc_system_originalPopulationTasks_topicMap_PCN: [ self.opc_system_originalPopulationTasks_topicMap.proxyId],
            self.opc_system_topicMapObject_topicMap_PCN: [ self.opc_system_topicMapObject_topicMap.proxyId],
            self.opc_system_topicMapProcOperations_topicMap_PCN: [ self.opc_system_topicMapProcOperations_topicMap.proxyId],

            self.sipc_system_TMAName_PCN: [ self.sipc_system_TMAName.proxyId],
            self.opc_system_tmaConfigFilePath_TMAName_PCN:
            [ self.opc_system_tmaConfigFilePath_TMAName.proxyId],
            self.opc_system_TMADesc_TMAName_PCN:
            [ self.opc_system_TMADesc_TMAName.proxyId],
            self.opc_system_valueTypes_TMAName_PCN: [ self.opc_system_valueTypes_TMAName.proxyId],
            self.opc_system_propertyClasses_TMAName_PCN: [ self.opc_system_propertyClasses_TMAName.proxyId],
            self.opc_system_conferralRules_TMAName_PCN: [ self.opc_system_conferralRules_TMAName.proxyId],
            self.opc_system_pythonModules_TMAName_PCN: [ self.opc_system_pythonModules_TMAName.proxyId],
            self.opc_system_TMAObject_TMAName_PCN: [
            self.opc_system_TMAObject_TMAName.proxyId],
            self.opc_system_propertyClassSequence_TMAName_PCN: [
            self.opc_system_propertyClassSequence_TMAName.proxyId],

            self.sipc_system_valueType_PCN: [ self.sipc_system_valueType.proxyId],
            self.opc_system_valueTypeTMAName_valueType_PCN: [ self.opc_system_valueTypeTMAName_valueType.proxyId],
            self.opc_system_valueTypeName_valueType_PCN: [ self.opc_system_valueTypeName_valueType.proxyId],
            self.opc_system_VTDesc_valueType_PCN: [ self.opc_system_VTDesc_valueType.proxyId],

            self.opc_system_ValueIsNotOfType__FMF_valueType_PCN: [ self.opc_system_ValueIsNotOfType__FMF_valueType.proxyId],
            self.opc_system_ValueIsNotOfType__FMN_valueType_PCN: [ self.opc_system_ValueIsNotOfType__FMN_valueType.proxyId],
            self.opc_system_ValueIsNotOfType__FN_valueType_PCN: [ self.opc_system_ValueIsNotOfType__FN_valueType.proxyId],
            self.opc_system_ValueIsNotOfType__F_valueType_PCN: [ self.opc_system_ValueIsNotOfType__F_valueType.proxyId],
            self.opc_system_ValueIsNotOfType__FArgString_valueType_PCN: [ self.opc_system_ValueIsNotOfType__FArgString_valueType.proxyId],

            self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN: [ self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType.proxyId],
            self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN: [ self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType.proxyId],
            self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN: [ self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType.proxyId],
            self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN: [ self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType.proxyId],
            self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PCN: [ self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType.proxyId],

            self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN: [ self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType.proxyId],
            self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN: [ self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType.proxyId],
            self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN: [ self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType.proxyId],
            self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN: [ self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType.proxyId],
            self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PCN: [ self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType.proxyId],

            self.sipc_system_propertyClass_PCN: [ self.sipc_system_propertyClass.proxyId],
            self.opc_system_propertyClassTMAName_propertyClass_PCN: [ self.opc_system_propertyClassTMAName_propertyClass.proxyId],
            self.opc_system_propertyClassName_propertyClass_PCN: [ self.opc_system_propertyClassName_propertyClass.proxyId],
            self.opc_system_PCDesc_propertyClass_PCN: [ self.opc_system_PCDesc_propertyClass.proxyId],
            self.opc_system_PCValueType_propertyClass_PCN: [ self.opc_system_PCValueType_propertyClass.proxyId],
            self.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN: [ self.opc_system_Add__PropToOverheadDictFMF_propertyClass.proxyId],
            self.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN: [ self.opc_system_Add__PropToOverheadDictFMN_propertyClass.proxyId],
            self.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN: [ self.opc_system_Add__PropToOverheadDictFN_propertyClass.proxyId],
            self.opc_system_Add__PropToOverheadDictF_propertyClass_PCN: [ self.opc_system_Add__PropToOverheadDictF_propertyClass.proxyId],
            self.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PCN: [ self.opc_system_Add__PropToOverheadDictFArgString_propertyClass.proxyId],
            self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN:
            [ self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass.proxyId],
            self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN:
            [ self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass.proxyId],
            self.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN:
            [ self.opc_system_Remove__PropFromOverheadDictFN_propertyClass.proxyId],
            self.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN:
            [ self.opc_system_Remove__PropFromOverheadDictF_propertyClass.proxyId],
            self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PCN:
            [ self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass.proxyId],
            self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN:
            [ self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass.proxyId],
            self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN:
            [ self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass.proxyId],
            self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN:
            [ self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass.proxyId],
            self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN:
            [ self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass.proxyId],
            self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PCN:
            [ self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass.proxyId],

            self.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN:
            [ self.opc_system_Merge__PropertyValuesFMF_propertyClass.proxyId],
            self.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN:
            [ self.opc_system_Merge__PropertyValuesFMN_propertyClass.proxyId],
            self.opc_system_Merge__PropertyValuesFN_propertyClass_PCN: [
            self.opc_system_Merge__PropertyValuesFN_propertyClass.proxyId],
            self.opc_system_Merge__PropertyValuesF_propertyClass_PCN: [ self.opc_system_Merge__PropertyValuesF_propertyClass.proxyId],
            self.opc_system_Merge__PropertyValuesFArgString_propertyClass_PCN: [ self.opc_system_Merge__PropertyValuesFArgString_propertyClass.proxyId],

            self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN:
            [ self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass.proxyId],
            self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN:
            [ self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass.proxyId],
            self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN: [
            self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass.proxyId],
            self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN: [ self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass.proxyId],
            self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PCN: [ self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass.proxyId],

            self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN:
            [ self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass.proxyId],
            self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN:
            [ self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass.proxyId],
            self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN: [
            self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass.proxyId],
            self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN: [ self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass.proxyId],
            self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PCN: [ self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass.proxyId],

            self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN:
            [ self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass.proxyId],
            self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN:
            [ self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass.proxyId],
            self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN:
            [ self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass.proxyId],
            self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN:
            [ self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass.proxyId],
            self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PCN:
            [ self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass.proxyId],

            self.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN:
            [ self.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass.proxyId],
            self.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PCN:
            [ self.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass.proxyId],
            self.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PCN:
            [ self.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass.proxyId],
            self.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PCN:
            [ self.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass.proxyId],
            self.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass_PCN:
            [ self.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass.proxyId],

            self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN:
            [ self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass.proxyId],
            self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN:
            [ self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass.proxyId],
            self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN:
            [ self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass.proxyId],
            self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN:
            [ self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass.proxyId],
            self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PCN:
            [ self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass.proxyId],

            self.opc_system_propertyClassObject_propertyClass_PCN: [ self.opc_system_propertyClassObject_propertyClass.proxyId],
            self.opc_system_proxiesKilled_propertyClass_PCN: [ self.opc_system_proxiesKilled_propertyClass.proxyId],
            self.opc_system_overheadDict_propertyClass_PCN: [ self.opc_system_overheadDict_propertyClass.proxyId],
            self.opc_system_propertyClassProcOperations_propertyClass_PCN: [ self.opc_system_propertyClassProcOperations_propertyClass.proxyId],
            self.opc_system_propertyInstancesMerged_propertyClass_PCN: [ self.opc_system_propertyInstancesMerged_propertyClass.proxyId],

            self.sipc_system_originalPopulationTask_PCN: [ self.sipc_system_originalPopulationTask.proxyId],
            self.opc_system_origPopTaskDesc_originalPopulationTask_PCN:
            [ self.opc_system_origPopTaskDesc_originalPopulationTask.proxyId],
            self.sipc_system_originalPopulationTask_PCN: [ self.sipc_system_originalPopulationTask.proxyId],
            self.opc_system_originalPopulationTaskFMF_originalPopulationTask_PCN:
            [ self.opc_system_originalPopulationTaskFMF_originalPopulationTask.proxyId],
            self.opc_system_originalPopulationTaskFN_originalPopulationTask_PCN:
            [ self.opc_system_originalPopulationTaskFN_originalPopulationTask.proxyId],
            self.opc_system_originalPopulationTaskFMN_originalPopulationTask_PCN:
            [ self.opc_system_originalPopulationTaskFMN_originalPopulationTask.proxyId],
            self.opc_system_originalPopulationTaskF_originalPopulationTask_PCN:
            [ self.opc_system_originalPopulationTaskF_originalPopulationTask.proxyId],
            self.opc_system_originalPopulationTaskFArgString_originalPopulationTask_PCN:
            [ self.opc_system_originalPopulationTaskFArgString_originalPopulationTask.proxyId],
            self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PCN:
            [ self.opc_system_originalPopulationTaskProcOperations_originalPopulationTask.proxyId],

            self.sipc_system_conferralRule_PCN: [ self.sipc_system_conferralRule.proxyId],
            self.opc_system_conferralRuleName_conferralRule_PCN: [ self.opc_system_conferralRuleName_conferralRule.proxyId],
            self.opc_system_confRuleDesc_conferralRule_PCN: [ self.opc_system_confRuleDesc_conferralRule.proxyId],
            self.opc_system_conferralRuleTMAName_conferralRule_PCN: [ self.opc_system_conferralRuleTMAName_conferralRule.proxyId],
            self.opc_system_conferralRuleProcOperations_conferralRule_PCN: [ self.opc_system_conferralRuleProcOperations_conferralRule.proxyId],
            self.opc_system_conferralRuleFMF_conferralRule_PCN: [ self.opc_system_conferralRuleFMF_conferralRule.proxyId],
            self.opc_system_conferralRuleFMN_conferralRule_PCN: [ self.opc_system_conferralRuleFMN_conferralRule.proxyId],
            self.opc_system_conferralRuleFN_conferralRule_PCN: [ self.opc_system_conferralRuleFN_conferralRule.proxyId],
            self.opc_system_conferralRuleF_conferralRule_PCN: [ self.opc_system_conferralRuleF_conferralRule.proxyId],
            self.opc_system_conferralRuleFArgString_conferralRule_PCN: [ self.opc_system_conferralRuleFArgString_conferralRule.proxyId],
            self.opc_system_conferralRuleTriggerRoles_conferralRule_PCN: [ self.opc_system_conferralRuleTriggerRoles_conferralRule.proxyId],
            self.opc_system_conferralRuleValueSourceRoles_conferralRule_PCN: [ self.opc_system_conferralRuleValueSourceRoles_conferralRule.proxyId],
            self.opc_system_conferralRuleObject_conferralRule_PCN: [ self.opc_system_conferralRuleObject_conferralRule.proxyId],

            }

        ## instance of self.opc_system_propertyClassSequence_TMAName:

            ## create the property instance:
        self.opi_system_propertyClassSequence_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_propertyClassSequence_TMAName_PCN, PCProxy = self.opc_system_propertyClassSequence_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the sequence of property classes
        self.opi_system_propertyClassSequence_TMAName_app__system._value = None  ## need to fix this up at the end of the bootstrap process
            ## (since this makes no difference to the system app, using alphabetical order)

        ## instance of self.opc_system_conferralRules_TMAName:

            ## create the property instance:
        self.opi_system_conferralRules_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_conferralRules_TMAName_PCN, PCProxy = self.opc_system_conferralRules_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the set of property classes "declared" by the
            ## system app
        self.opi_system_conferralRules_TMAName_app__system._value = None  ## the system TMA has no conferral rules; but fix this up at end of bootstrap

        ## instance of self.opc_system_pythonModules_TMAName:

            ## create the property instance:
        self.opi_system_pythonModules_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_pythonModules_TMAName_PCN, PCProxy = self.opc_system_pythonModules_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the set of property classes "declared" by the
            ## system app
        self.opi_system_pythonModules_TMAName_app__system._value = {}  ## the system TMA has no conferral rules.

        ## instance of self.opc_system_TMAObject_TMAName:

            ## create the property instance:
        self.opi_system_TMAObject_TMAName_app__system = vsv.PropertyInstance( vsv, self.app__system.proxyId, vsv.systemTMAName, self.opc_system_TMAObject_TMAName_PCN, PCProxy = self.opc_system_TMAObject_TMAName, TMObject = self, procOperation = self.bootstrapProcOperation)

            ## record the value: the set of property classes "declared" by the
            ## system app
        self.opi_system_TMAObject_TMAName_app__system._value = None



        ##################################################################################
        ## get ready to write bootstrap code for value type and property class proxies ##
        ##################################################################################

        ## create bootstrap code file for later exec-ing.
        vsv.systemBootstrapCodeFilePath = os.path.join( vsv.defaultVsvCacheDir,
                                                         vsv.systemBootstrapCodeFileName)
        bFO = file( vsv.systemBootstrapCodeFilePath, 'w')
                ## bFO stands for "bootstrapFileObject"

        ######################################################
        ## all value type proxies - property instances ##
        ######################################################

        bFO.write( '%s\n\n' % ( NOTICE))

        bFO.write( '%ssys.path.append( \'%s\')\n' % ( ' '*0, vsv.systemAppDirPath))
        bFO.write( '%sexecStr = \'import %s\' %s vsv.systemAppValueTypesModuleName\n' % ( ' '*0, '%s', '%'))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'import %s\' %s vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, '%s', '%'))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        headerString = '### BELOW CODE WAS GENERATED BY writeBootstrapCodeForSystemValueTypeProxy() CALLS ###'
        bFO.write( '%s%s\n' % ( ' '*4, '#'*len( headerString)))
        bFO.write( '%s%s\n' % ( ' '*4, headerString))
        bFO.write( '%s%s\n' % ( ' '*4, '#'*len( headerString)))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_string', 'Python string object.')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_listOfStrings', 'Python list object containing Python string objects')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_listOfProperties', 'Python list object containing Versavant PropertyInstance objects')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_setOfStrings', 'Python list object containing Python string objects, but no duplicates.')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_function', 'Python function object')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_dict', 'Python dictionary object')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_topicMapObject', 'Versavant TopicMap object')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_TMAObject', 'Versavant TMA object')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_conferralRuleObject', 'Versavant ConferralRule object')
        self.writeBootstrapCodeForSystemValueTypeProxy( vsv, bFO, 'valt_system_propertyClassObject', 'Versavant PropertyClass object')

        ######################################################
        ## all property class proxies - property instances ##
        ######################################################

        headerString = '### BELOW CODE WAS GENERATED BY writeBootstrapCodeForSystemPropertyClassProxy() CALLS ###'
        bFO.write( '%s%s\n' % ( ' '*4, '#'*len( headerString)))
        bFO.write( '%s%s\n' % ( ' '*4, headerString))
        bFO.write( '%s%s\n' % ( ' '*4, '#'*len( headerString)))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'sipc_system_topicMap', 'valt_system_string', 'Name given to this topic map when it was created by calling newTopicMap().')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_TMAProxies_topicMap', 'valt_system_dict', 'Dictionary of the proxies of the TMAs (Topic Map Applications) that govern this topic map.  Keys are TMA names; values are lists of subject proxy IDs.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_doc_topicMap', 'valt_system_string', 'Description string, if any, passed to newTopicMap() when this topic map was created.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTasks_topicMap', 'valt_system_dict', 'Dictionary of original population tasks that have been registered for this topic map.  Keys are original population task names; values are Versavant OriginalPopulationTask objects.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_topicMapObject_topicMap', 'valt_system_topicMapObject', 'The Versavant TopicMap object that represents this topic map.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_topicMapProcOperations_topicMap', 'valt_system_dict', 'Dictionary of processing operations that have occurred with respect to this topic map.  Keys are the unique identifiers of the processing operations; values are Versavant ProcOperation objects.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'sipc_system_TMAName', 'valt_system_string', 'A TMA (Topic Map Application) that governs (or is ready to govern) some of the properties of subject proxies in this topic map.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_tmaConfigFilePath_TMAName', 'valt_system_string', 'The pathname of the TMA configuration file that specified the configuration of this TMA.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_TMADesc_TMAName', 'valt_system_string', 'A description of this TMA.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_valueTypes_TMAName', 'valt_system_dict',
            'A dictionary of the value types defined by this TMA.  Keys are value type names; values are Versavant ValueType objects.',
            Merge__PropertyValuesFArgString = 'topicMap = topicMap, propertyClass = propertyClass, proxyList = proxiesByPropertyName[ propertyName]')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyClasses_TMAName', 'valt_system_dict',
            'A dictionary of the property classes defined by this TMA.  Keys are property class names; values are Versavant PropertyClass objects.',
            Merge__PropertyValuesFArgString = 'topicMap = topicMap, propertyClass = propertyClass, proxyList = proxiesByPropertyName[ propertyName]')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyClassSequence_TMAName', 'valt_system_listOfStrings',
            'A Python list object in which the names of the property classes defined by this TMA appear in the order in which they appeared in the TMA configuration file.  This will be the order in which they will be processed for all purposes of merging, conferral, and checking',
            Merge__PropertyValuesFArgString = 'id( topicMap.TMAs[ propertyClass.TMA.TMAName].propertyClassSequence)')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRules_TMAName', 'valt_system_dict',
            'A dictionary of the conferral rules defined by this TMA.  Keys are conferral rule names; values are Versavant ConferralRule objects.',
            Merge__PropertyValuesFArgString = 'topicMap = topicMap, propertyClass = propertyClass, proxyList = proxiesByPropertyName[ propertyName]')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_pythonModules_TMAName', 'valt_system_dict',
            'A dictionary of the Python code modules that contain the implementations of the value types, property classes, and conferral rules of this TMA.  The keys are the module names, and the values are the paths to the code modules.  (These paths are to the code cache.)')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_TMAObject_TMAName', 'valt_system_TMAObject',
            'The Versavant TMA object that represents this TMA.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'sipc_system_valueType', 'valt_system_string',
            'A string that uniquely identifies the value type which is the subject of this proxy.  The string has two fields: the first field is the name of the TMA that defined the value type, and the second field is the name of the value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_valueTypeTMAName_valueType', 'valt_system_string',
            'The name of the TMA that defined this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_valueTypeName_valueType', 'valt_system_string', 'The name of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_VTDesc_valueType', 'valt_system_string',
            'A string that describes this value type, declared in a <Desc> element in the TMA config file.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsNotOfType__FMF_valueType', 'valt_system_string',
            'The path to the Python module file that contains the ValueIsNotOfType__() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsNotOfType__FMN_valueType', 'valt_system_string',
            'The name of the Python module that contains the ValueIsNotOfType__() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsNotOfType__FN_valueType', 'valt_system_string',
            'The name of the function that is used as the ValueIsNotOfType__() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsNotOfType__F_valueType', 'valt_system_function',
            'The function that is used as the ValueIsNotOfType__() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsNotOfType__FArgString_valueType', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the ValueIsNotOfType__() component of the implementation of this value type.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType', 'valt_system_string',
            'The path to the Python module file that contains the InstanceOf__ValueTypeToXMLContentString() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType', 'valt_system_string',
            'The name of the Python module that contains the InstanceOf__ValueTypeToXMLContentString() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType', 'valt_system_string',
            'The name of the function that is used as the InstanceOf__ValueTypeToXMLContentString() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType', 'valt_system_function',
            'The function that is used as the InstanceOf__ValueTypeToXMLContentString() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the InstanceOf__ValueTypeToXMLContentString() component of the implementation of this value type.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType', 'valt_system_string',
            'The path to the Python module file that contains the XMLContentStringToInstanceOf__ValueType() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType', 'valt_system_string',
            'The name of the Python module that contains the XMLContentStringToInstanceOf__ValueType() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType', 'valt_system_string',
            'The name of the function that is used as the XMLContentStringToInstanceOf__ValueType() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType', 'valt_system_function',
            'The function that is used as the XMLContentStringToInstanceOf__ValueType() component of the implementation of this value type.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the XMLContentStringToInstanceOf__ValueType() component of the implementation of this value type.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'sipc_system_propertyClass', 'valt_system_string',
            'A string that uniquely identifies the property class which is the subject of this proxy.  The string has two fields: the first field is the name of the TMA that defined the property class, and the second field is the name of the property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyClassTMAName_propertyClass', 'valt_system_string',
            'The name of the TMA that defined this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyClassName_propertyClass', 'valt_system_string',
            'The name of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_PCDesc_propertyClass', 'valt_system_string',
            'A string that describes this property class, declared in a <Desc> element in the TMA config file.  This very string, dear reader, is such a string.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_PCValueType_propertyClass', 'valt_system_string',
            'The name of the type of the value of all instances of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Add__PropToOverheadDictFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the Add__PropToOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Add__PropToOverheadDictFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the Add__PropToOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Add__PropToOverheadDictFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the Add__PropToOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Add__PropToOverheadDictF_propertyClass', 'valt_system_function',
            'The function that is used as the Add__PropToOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Add__PropToOverheadDictFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the Add__PropToOverheadDict() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Remove__PropFromOverheadDictFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the Remove__PropFromOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Remove__PropFromOverheadDictFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the Remove__PropFromOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Remove__PropFromOverheadDictFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the Remove__PropFromOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Remove__PropFromOverheadDictF_propertyClass', 'valt_system_function',
            'The function that is used as the Remove__PropFromOverheadDict() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Remove__PropFromOverheadDictFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the Remove__PropFromOverheadDict() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the ValueIsInvalidFor__Property() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the ValueIsInvalidFor__Property() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsInvalidFor__PropertyFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the ValueIsInvalidFor__Property() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsInvalidFor__PropertyF_propertyClass', 'valt_system_function',
            'The function that is used as the ValueIsInvalidFor__Property() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the ValueIsInvalidFor__Property() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Merge__PropertyValuesFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the Merge__PropertyValues() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Merge__PropertyValuesFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the Merge__PropertyValues() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Merge__PropertyValuesFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the Merge__PropertyValues() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Merge__PropertyValuesF_propertyClass', 'valt_system_function',
            'The function that is used as the Merge__PropertyValues() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_Merge__PropertyValuesFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the Merge__PropertyValues() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the ValuesOf__PropertyInstancesAreSignificantlyDifferent() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the ValuesOf__PropertyInstancesAreSignificantlyDifferent() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the ValuesOf__PropertyInstancesAreSignificantlyDifferent() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass', 'valt_system_function',
            'The function that is used as the ValuesOf__PropertyInstancesAreSignificantlyDifferent() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the ValuesOf__PropertyInstancesAreSignificantlyDifferent() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the ContextOf__PropertyIsInvalid() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the ContextOf__PropertyIsInvalid() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ContextOf__PropertyIsInvalidFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the ContextOf__PropertyIsInvalid() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ContextOf__PropertyIsInvalidF_propertyClass', 'valt_system_function',
            'The function that is used as the ContextOf__PropertyIsInvalid() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the ContextOf__PropertyIsInvalid() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the MergeProxiesBecause__PropertyInstancesSpecifySameSubject() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the MergeProxiesBecause__PropertyInstancesSpecifySameSubject() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the MergeProxiesBecause__PropertyInstancesSpecifySameSubject() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass', 'valt_system_function',
            'The function that is used as the MergeProxiesBecause__PropertyInstancesSpecifySameSubject() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the MergeProxiesBecause__PropertyInstancesSpecifySameSubject() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the UpdateProxyReferencesIn__Value() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the UpdateProxyReferencesIn__Value() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the UpdateProxyReferencesIn__Value() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_UpdateProxyReferencesIn__ValueF_propertyClass', 'valt_system_function',
            'The function that is used as the UpdateProxyReferencesIn__Value() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the UpdateProxyReferencesIn__Value() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass', 'valt_system_string',
            'The path to the Python module file that contains the ProxiesWith__ValueNotSignificantlyDifferentFrom() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass', 'valt_system_string',
            'The name of the Python module that contains the ProxiesWith__ValueNotSignificantlyDifferentFrom() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass', 'valt_system_string',
            'The name of the function that is used as the ProxiesWith__ValueNotSignificantlyDifferentFrom() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass', 'valt_system_function',
            'The function that is used as the ProxiesWith__ValueNotSignificantlyDifferentFrom() component of the implementation of this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that is used as the ProxiesWith__ValueNotSignificantlyDifferentFrom() component of the implementation of this property class.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyClassObject_propertyClass', 'valt_system_propertyClassObject',
            'The Versavant PropertyClass object that represents this property class.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_proxiesKilled_propertyClass', 'valt_system_setOfStrings',
            'A dictionary of the proxies in this topic map that have been merged out of existence (killed) because they had instances of this property (this SIP) and the values of those instances were regarded as indicating the same subject.  Keys are proxy identifiers (proxyIds: decimal integers with two leading zeroes); values are Pythonic None.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_overheadDict_propertyClass', 'valt_system_dict',
            'This dictionary is where the implementation of this property class keeps records about the instances.  The manner of use of this dictionary is unconstrained by Versavant.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyClassProcOperations_propertyClass', 'valt_system_dict',
            'A dictionary of the merging operations that have been demanded by instances of the property class.  Keys are processing operation IDs; values are Versavant ProcOperation objects')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_propertyInstancesMerged_propertyClass', 'valt_system_listOfProperties',
            'List of property instances (Versavant PropertyInstance objects) that have been created by merging operations demanded by instances of the property class',
            Merge__PropertyValuesFArgString = 'topicMap = topicMap, propertyClass = propertyClass, proxyList = proxiesByPropertyName[ propertyName]')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'sipc_system_originalPopulationTask', 'valt_system_string',
            'The name of the original population task which is the subject of this proxy.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_origPopTaskDesc_originalPopulationTask', 'valt_system_string',
            'A string that describes this original population task.  It was passed as an argument to registerOriginalPopulationTask().')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTaskFMF_originalPopulationTask', 'valt_system_string',
            'The path to the Python module file that contains the function that implements this original population task.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTaskFMN_originalPopulationTask', 'valt_system_string',
            'The name of the Python module that contains the function that implements this original population task.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTaskFN_originalPopulationTask', 'valt_system_string',
            'The name of the function that implements this original population task.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTaskF_originalPopulationTask', 'valt_system_function',
            'The function that implements this original population task.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTaskFArgString_originalPopulationTask', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that implements this original population task.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_originalPopulationTaskProcOperations_originalPopulationTask', 'valt_system_dict',
            'Dictionary of processing operations done as a result of executing this original population task.  Keys are processing operation IDs; values are Versavant ProcOperation objects.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'sipc_system_conferralRule', 'valt_system_string',
            'A string that uniquely identifies the conferral rule which is the subject of this proxy.  The string has two fields: the first field is the name of the TMA that defined the conferral rule, and the second field is the name of the conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleName_conferralRule', 'valt_system_string',
            'The name of this conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_confRuleDesc_conferralRule', 'valt_system_string',
            'A string that describes this conferral rule, declared in a <Desc> element in the TMA config file.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleTMAName_conferralRule', 'valt_system_string',
            'The name of the TMA that defined this conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleProcOperations_conferralRule', 'valt_system_dict',
            'A dictionary of the processing operations that have occurred during executions of this conferral rule.  Keys are processing operation IDs; values are Versavant ProcOperation objects')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleFMF_conferralRule', 'valt_system_string',
            'The path to the Python module file that contains the function that implements this conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleFMN_conferralRule', 'valt_system_string',
            'The name of the Python module that contains the function that implements this conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleFN_conferralRule', 'valt_system_string',
            'The name of the function that implements this conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleF_conferralRule', 'valt_system_function',
            'The function that implements this conferral rule.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleFArgString_conferralRule', 'valt_system_string',
            'Extra arguments, if any, that will be passed to the function that implements this conferral rule.')

        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleTriggerRoles_conferralRule', 'valt_system_dict',
            'Dictionary of the roles that can be played in triggering the operation of this conferral rule.  Keys are conferral rule trigger role names; value is an integer specifying the number of times that a given property instance (or its descendants by merger) can trigger the conferral rule (normally 1).')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleValueSourceRoles_conferralRule', 'valt_system_dict',
            'Dictionary of the roles that property values can play in calculating the values of properties conferred by operations of this conferral rule.  Keys are conferral rule value source names; value is Pythonic None.')
        self.writeBootstrapCodeForSystemPropertyClassProxy( vsv, bFO, 'opc_system_conferralRuleObject_conferralRule', 'valt_system_conferralRuleObject',
            'The Versavant ConferralRule object that represents this conferral rule.')
        

        bFO.write( '%ssys.path.remove( \'%s\')\n' % ( ' '*0, vsv.systemAppDirPath))

        #######################################################################
        ## execute bootstrap code for value type and property class proxies ##
        #######################################################################

        bFO.close()
        bFO = file( vsv.systemBootstrapCodeFilePath, 'r')
        exec( bFO)
        bFO.close()
        
     
        ##############################
        ## cleanup after bootstrap: ##
        ##############################

        bootstrapSIPClassDictKeysInOrder = [
            self.sipc_system_originalPopulationTask_PNK,
            self.sipc_system_topicMap_PNK,
            self.sipc_system_TMAName_PNK,
            self.sipc_system_valueType_PNK,
            self.sipc_system_propertyClass_PNK,
            self.sipc_system_conferralRule_PNK,
            ]

        bootstrapSIPClassDict = {}
        for bootstrapSIPClassDictKey in bootstrapSIPClassDictKeysInOrder:
            bootstrapSIPClassDict[ bootstrapSIPClassDictKey] = []

        proxyIds = self.proxies.keys()
        proxyIds.sort()
        proxyIdsCopy = proxyIds[:]
        for proxyId in proxyIds:
            proxy = self.proxies[ proxyId]
            for propertyKey in proxy.propertyInstances:
                if propertyKey in bootstrapSIPClassDict:
                    bootstrapSIPClassDict[ propertyKey].append( proxy)
                    proxyIdsCopy.remove( proxyId)
        if len( proxyIdsCopy):
            traceback.print_stack()
            errMsg( 'Bootstrap cleanup incomplete.  Remaining proxyIds: "%s"' % ( proxyIdsCopy))
            sys.exit( 1)

                ######################################################################
                ## Enter all property values into the overheadDict propertyInstances of ##
                ## the proxies of their respective property classes, and regularize ##
                ## the Audit objects, etc.                                          ##
                ######################################################################

        for bootstrapSIPClassDictKey in bootstrapSIPClassDictKeysInOrder:
            for proxy in bootstrapSIPClassDict[ bootstrapSIPClassDictKey]:
                propertyKeys = proxy.propertyInstances.keys()
                propertyKeys.sort()
                for propertyKey in propertyKeys:
                    propertyInstance = proxy.propertyInstances[ propertyKey]
                    addPropInstanceToOverheadDictFunction = \
                                                      propertyInstance.propertyClassProxies[ 0].propertyInstances[ self.opc_system_Add__PropToOverheadDictF_propertyClass_PNK]._value
                    addPropInstanceToOverheadDictFunction( vsv, propertyInstance, propertyInstance.propertyClassProxies[ 0].propertyInstances[ self.opc_system_overheadDict_propertyClass_PNK]._value)

                    self.bootstrapProcOperation.propertyValuesThatWereSet[ propertyInstance.propertyInstanceKey] = propertyInstance._value

                ###############################################################
                ## connect propertyClass objects to propertyInstance objects ##
                ## and connect the bootstrap procOperation.
                ###############################################################

        for proxyId in self.proxies:
            proxy = self.proxies[ proxyId]
            for propertyInstanceKey in proxy.propertyInstances:
                propertyInstance = proxy.propertyInstances[ propertyInstanceKey]
                if not propertyInstance.propertyClass:
                    propertyInstance.propertyClass = self.TMAs[ propertyInstance.TMAName].propertyClasses[ propertyInstance.propertyClassName]
                self.originalPopulationTasks[ vsv.systemBootstrapOriginalPopulationTaskName].procOperations[ propertyInstance.procOperation.procOperationID] = propertyInstance.procOperation
                propertyInstance.procOperation.procSpecObject = propertyInstance.topicMap.originalPopulationTasks[ vsv.systemBootstrapOriginalPopulationTaskName]
                

##         propertyInstanceKeys = self.propertyInstances.keys()
##         propertyInstanceKeys.sort()
##         for propertyInstanceKey in propertyInstanceKeys:
##             propertyInstance = self.propertyInstances[ propertyInstanceKey]

##             if not propertyInstance.propertyClass:
##                 propertyInstance.propertyClass = self.TMAs[ propertyInstance.TMAName].propertyClasses[ propertyInstance.propertyClassName]

##             self.originalPopulationTasks[ vsv.systemBootstrapOriginalPopulationTaskName].procOperations[ propertyInstance.procOperation.procOperationID] = propertyInstance.procOperation

##             propertyInstance.procOperation.procSpecObject = propertyInstance.topicMap.originalPopulationTasks[ vsv.systemBootstrapOriginalPopulationTaskName]

                ################################################
                ## set all propertyClass.valueType attributes ##
                ################################################

        TMA = self.TMAs[ vsv.systemTMAName]
        propertyClassNames = TMA.propertyClasses.keys()
        propertyClassNames.sort()
        for propertyClassName in propertyClassNames:
            propertyClass = TMA.propertyClasses[ propertyClassName]
            propertyClass.valueType = TMA.valueTypes[ propertyClass.valueTypeName]

                ##############################################################################
                ## Set the TMAsWithSIPsInThisProxy attribute of each proxy.         ## 
                ## Also record the proxies that were created in the .proxiesThatWereCreated ##
                ## attribute of the system bootstrap ProcOperation object, and record in    ##
                ## each proxy the fact that the system bootstrap ProcOperation created it.  ##
                ##############################################################################

        proxyIdList = self.proxies.keys()
        proxyIdList.sort( cmpStringsAsIntegers)
        for proxyId in proxyIdList:
            proxy = self.proxies[ proxyId]

            self.bootstrapProcOperation.proxiesThatWereCreated[ proxy.proxyId] = proxy
            proxy.procOperationThatCreatedThisProxy = self.bootstrapProcOperation

            for propertyInstanceInProxyKey in proxy.propertyInstances:
                propertyInstance = proxy.propertyInstances[ propertyInstanceInProxyKey]
                if vsv.propertyInstanceIsSIP( propertyInstance):
                    if proxy.TMAsWithSIPsInThisProxy.has_key( propertyInstance.TMAName):
                        traceback.print_stack()
                        errMsg( 'Proxy %s already has an SIP governed by TMA "%s"' % ( proxyId, propertyInstance.TMAName))
                        sys.exit( 1)
                    else:
                        proxy.TMAsWithSIPsInThisProxy[ propertyInstance.TMAName] = propertyInstance.propertyClass.propertyClassName

        ## set some system TMA proxy properties correctly
        self.opi_system_propertyClassSequence_TMAName_app__system._value = self.TMAs[ vsv.systemTMAName].propertyClassSequence
        self.opi_system_propertyClasses_TMAName_app__system._value = self.TMAs[ vsv.systemTMAName].propertyClasses
        self.opi_system_valueTypes_TMAName_app__system._value = self.TMAs[ vsv.systemTMAName].valueTypes
        self.opi_system_conferralRules_TMAName_app__system._value = self.TMAs[ vsv.systemTMAName].conferralRules

        ## set some miscellaneous stuff
        self.originalPopulationTaskSequence.append( vsv.systemBootstrapOriginalPopulationTaskName)
        
        if sendDebugMessages:
            sys.stdout.write( 'done.\n')

    #######################################################
    def writeBootstrapCodeForSystemValueTypeProxy( self, vsv,
            bFO,             ## bootstrap (code) File Object
            VTProxyName,    ## name of value type proxy
            VTDesc = '',    ## description of the value type
            **args
                            ## keyword args:
                            ## ValueIsNotOfType__FArgString
                            ## InstanceOf__ValueTypeToXMLContentStringFArgString
                            ## XMLContentStringToInstanceOf__ValueTypeFArgString
        ):

        if args.has_key( 'ValueIsNotOfType__FArgString'):
            ValueIsNotOfType__FArgString = args[ 'ValueIsNotOfType__FArgString']
        else:
            ValueIsNotOfType__FArgString = ''
            
        if args.has_key( 'InstanceOf__ValueTypeToXMLContentStringFArgString'):
            InstanceOf__ValueTypeToXMLContentStringFArgString = args[ 'InstanceOf__ValueTypeToXMLContentStringFArgString']
        else:
            InstanceOf__ValueTypeToXMLContentStringFArgString = ''
            
        if args.has_key( 'XMLContentStringToInstanceOf__ValueTypeFArgString'):
            XMLContentStringToInstanceOf__ValueTypeFArgString = args[ 'XMLContentStringToInstanceOf__ValueTypeFArgString']
        else:
            XMLContentStringToInstanceOf__ValueTypeFArgString = ''
            
        headerString = '## self.%s - property instances ##' % ( VTProxyName)
        bFO.write( '%s%s\n' % ( ' '*0, '#'*len( headerString)))
        bFO.write( '%s%s\n' % ( ' '*0, headerString))
        bFO.write( '%s%s\n' % ( ' '*0, '#'*len( headerString)))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.sipc_system_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.sipi_system_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.sipc_system_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.sipi_system_valueType_%s._value = self.%s_VALTNK\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s## instance of self.opc_system_valueTypeTMAName_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_valueTypeTMAName_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_valueTypeTMAName_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_valueTypeTMAName_valueType_%s._value = vsv.systemTMAName\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_valueTypeName_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_valueTypeName_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_valueTypeName_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_valueTypeName_valueType_%s._value = self.%s_VALTN\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_VTDesc_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_VTDesc_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_VTDesc_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_VTDesc_valueType_%s._value = \'%s\'\n' % ( ' '*0, VTProxyName, VTDesc))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsNotOfType__FMF_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FMF_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FMF_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FMF_valueType_%s._value = vsv.systemAppValueTypeImplementationsFilePath\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsNotOfType__FMN_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FMN_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FMN_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FMN_valueType_%s._value = vsv.systemAppValueTypesModuleName\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsNotOfType__FN_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FN_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FN_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FN_valueType_%s._value = \'ValueIsNotOfType_%s_\' %s ( self.%s_VALTN)\n' % ( ' '*0, VTProxyName, '%s', '%', VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsNotOfType__F_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__F_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsNotOfType__F_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_ValueIsNotOfType__F_valueType_%s._value = %s.%s\' %s ( self.opi_system_ValueIsNotOfType__FMN_valueType_%s._value, self.opi_system_ValueIsNotOfType__FN_valueType_%s._value)\n' % ( ' '*0, VTProxyName, '%s', '%s', '%', VTProxyName, VTProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsNotOfType__FArgString_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FArgString_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsNotOfType__FArgString_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsNotOfType__FArgString_valueType_%s._value = \'%s\'\n' % ( ' '*0, VTProxyName, ValueIsNotOfType__FArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_%s._value = vsv.systemAppValueTypeImplementationsFilePath\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_%s._value = vsv.systemAppValueTypesModuleName\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_%s._value = \'InstanceOf_%s_ValueTypeToXMLContentString\' %s ( self.%s_VALTN)\n' % ( ' '*0, VTProxyName, '%s', '%', VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_%s._value = %s.%s\' %s ( self.opi_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_%s._value, self.opi_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_%s._value)\n' % ( ' '*0, VTProxyName, '%s', '%s', '%', VTProxyName, VTProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_%s._value = \'%s\'\n' % ( ' '*0, VTProxyName, InstanceOf__ValueTypeToXMLContentStringFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_%s._value = vsv.systemAppValueTypeImplementationsFilePath\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_%s._value = vsv.systemAppValueTypesModuleName\n' % ( ' '*0, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_%s._value = \'XMLContentStringToInstanceOf_%s_ValueType\' %s ( self.%s_VALTN)\n' % ( ' '*0, VTProxyName, '%s', '%', VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_%s._value = %s.%s\' %s ( self.opi_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_%s._value, self.opi_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_%s._value)\n' % ( ' '*0, VTProxyName, '%s', '%s', '%', VTProxyName, VTProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, VTProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_%s._value = \'%s\'\n' % ( ' '*0, VTProxyName, XMLContentStringToInstanceOf__ValueTypeFArgString))
        bFO.write( '%s\n' % ( ' '*0))




    #######################################################
    def writeBootstrapCodeForSystemPropertyClassProxy( self, vsv,
            bFO,             ## bootstrap (code) File Object
            PCProxyName,   ## name of property class proxy
            VTProxyName,    ## name of value type proxy
            PCDesc = '',    ## description of the property class
            **args                                           
                           ## Keyword args:
                           ## Add__PropToOverheadDictFArgString
                           ## Remove__PropFromOverheadDictFArgString
                           ## ValueIsInvalidFor__PropertyFArgString
                           ## Merge__PropertyValuesFArgString
                           ## ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString
                           ## ContextOf__PropertyIsInvalidFArgString
                           ## MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString
                           ## UpdateProxyReferencesIn__ValueFArgString
                           ## ProxiesWith__ValueNotSignificantlyDifferentFromFArgString
        ):

        if args.has_key( 'Add__PropToOverheadDictFArgString'):
            Add__PropToOverheadDictFArgString = args[ 'Add__PropToOverheadDictFArgString']
        else:
            Add__PropToOverheadDictFArgString = ''
            
        if args.has_key( 'Remove__PropFromOverheadDictFArgString'):
            Remove__PropFromOverheadDictFArgString = args[ 'Remove__PropFromOverheadDictFArgString']
        else:
            Remove__PropFromOverheadDictFArgString = ''

        if args.has_key( 'ValueIsInvalidFor__PropertyFArgString'):
            ValueIsInvalidFor__PropertyFArgString = args[ 'ValueIsInvalidFor__PropertyFArgString']
        else:
            ValueIsInvalidFor__PropertyFArgString = ''

        if args.has_key( 'Merge__PropertyValuesFArgString'):
            Merge__PropertyValuesFArgString = args[ 'Merge__PropertyValuesFArgString']
        else:
            Merge__PropertyValuesFArgString = ''

        if args.has_key( 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString'):
            ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString = args[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString']
        else:
            ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString = ''

        if args.has_key( 'ContextOf__PropertyIsInvalidFArgString'):
            ContextOf__PropertyIsInvalidFArgString = args[ 'ContextOf__PropertyIsInvalidFArgString']
        else:
            ContextOf__PropertyIsInvalidFArgString = ''

        if args.has_key( 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString'):
            MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString = args[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString']
        else:
            MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString = ''

        if args.has_key( 'UpdateProxyReferencesIn__ValueFArgString'):
            UpdateProxyReferencesIn__ValueFArgString = args[ 'UpdateProxyReferencesIn__ValueFArgString']
        else:
            UpdateProxyReferencesIn__ValueFArgString = ''

        if args.has_key( 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString'):
            ProxiesWith__ValueNotSignificantlyDifferentFromFArgString = args[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString']
        else:
            ProxiesWith__ValueNotSignificantlyDifferentFromFArgString = ''

        headerString = '## self.%s - property instances ##' % ( PCProxyName)
        bFO.write( '%s%s\n' % ( ' '*0, '#'*len( headerString)))
        bFO.write( '%s%s\n' % ( ' '*0, headerString))
        bFO.write( '%s%s\n' % ( ' '*0, '#'*len( headerString)))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.sipc_system_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.sipi_system_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.sipc_system_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.sipi_system_propertyClass_%s._value = self.%s_PNK\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s## instance of self.opc_system_propertyClassTMAName_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassTMAName_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_propertyClassTMAName_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassTMAName_propertyClass_%s._value = vsv.systemTMAName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_propertyClassName_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassName_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_propertyClassName_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassName_propertyClass_%s._value = self.%s_PCN\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_PCDesc_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_PCDesc_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_PCDesc_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_PCDesc_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, PCDesc))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_PCValueType_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_PCValueType_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_PCValueType_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_PCValueType_propertyClass_%s._value = self.%s_VALTN\n' % ( ' '*0, PCProxyName, VTProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Add__PropToOverheadDictFMF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Add__PropToOverheadDictFMN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Add__PropToOverheadDictFN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFN_propertyClass_%s._value = \'Add_%s_PropToOverheadDict\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Add__PropToOverheadDictF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_Add__PropToOverheadDictF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_Add__PropToOverheadDictFMN_propertyClass_%s._value, self.opi_system_Add__PropToOverheadDictFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Add__PropToOverheadDictFArgString_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Add__PropToOverheadDictFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, Add__PropToOverheadDictFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Remove__PropFromOverheadDictFN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFN_propertyClass_%s._value = \'Remove_%s_PropFromOverheadDict\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Remove__PropFromOverheadDictF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_Remove__PropFromOverheadDictF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_Remove__PropFromOverheadDictFMN_propertyClass_%s._value, self.opi_system_Remove__PropFromOverheadDictFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Remove__PropFromOverheadDictFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, Remove__PropFromOverheadDictFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFN_propertyClass_%s._value = \'ValueIsInvalidFor_%s_Property\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_ValueIsInvalidFor__PropertyF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_ValueIsInvalidFor__PropertyFMN_propertyClass_%s._value, self.opi_system_ValueIsInvalidFor__PropertyFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, ValueIsInvalidFor__PropertyFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Merge__PropertyValuesFMF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Merge__PropertyValuesFMN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Merge__PropertyValuesFN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFN_propertyClass_%s._value = \'Merge_%s_PropertyValues\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Merge__PropertyValuesF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Merge__PropertyValuesF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_Merge__PropertyValuesF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_Merge__PropertyValuesFMN_propertyClass_%s._value, self.opi_system_Merge__PropertyValuesFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_Merge__PropertyValuesFArgString_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_Merge__PropertyValuesFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_Merge__PropertyValuesFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, Merge__PropertyValuesFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_%s._value = \'ValuesOf_%s_PropertyInstancesAreSignificantlyDifferent\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_%s._value, self.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFN_propertyClass_%s._value = \'ContextOf_%s_PropertyIsInvalid\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sexecStr = \'self.opi_system_ContextOf__PropertyIsInvalidF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_ContextOf__PropertyIsInvalidFMN_propertyClass_%s._value, self.opi_system_ContextOf__PropertyIsInvalidFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
        bFO.write( '%sexec( execStr)\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s## instance of self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, ContextOf__PropertyIsInvalidFArgString))
        bFO.write( '%s\n' % ( ' '*0))

        if PCProxyName.startswith( 'sip'):  ## i.e., if the property class being bootstrapped is an SIP

            bFO.write( '%s## instance of self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_%s._value = \'MergeProxiesBecause_%s_PropertyInstancesSpecifySameSubject\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sexecStr = \'self.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_%s._value, self.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
            bFO.write( '%sexec( execStr)\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString))
            bFO.write( '%s\n' % ( ' '*0))


            bFO.write( '%s## instance of self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_%s._value = vsv.systemAppPropertyClassImplementationsFilePath\n' % ( ' '*0, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_%s._value = vsv.systemAppPropertyClassesModuleName\n' % ( ' '*0, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_%s._value = \'MergeProxiesBecause_%s_PropertyInstancesSpecifySameSubject\' %s ( self.%s_PCN)\n' % ( ' '*0, PCProxyName, '%s', '%', PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sexecStr = \'self.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_%s._value = %s.%s\' %s ( self.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_%s._value, self.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_%s._value)\n' % ( ' '*0, PCProxyName, '%s', '%s', '%', PCProxyName, PCProxyName))
            bFO.write( '%sexec( execStr)\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_%s._value = \'%s\'\n' % ( ' '*0, PCProxyName, ProxiesWith__ValueNotSignificantlyDifferentFromFArgString))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s## instance of self.opc_system_proxiesKilled_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_proxiesKilled_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_proxiesKilled_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_proxiesKilled_propertyClass_%s._value = {}\n' % ( ' '*0, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))

            bFO.write( '%s ## instance of self.opc_system_propertyInstancesMerged_propertyClass\n' % ( ' '*0))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_propertyInstancesMerged_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_propertyInstancesMerged_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))
            bFO.write( '%s    ## record the value\n' % ( ' '*0))
            bFO.write( '%sself.opi_system_propertyInstancesMerged_propertyClass_%s._value = []\n' % ( ' '*0, PCProxyName))
            bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s ## instance of self.opc_system_propertyClassProcOperations_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassProcOperations_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_propertyClassProcOperations_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassProcOperations_propertyClass_%s._value = {}\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s ## instance of self.opc_system_propertyClassObject_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassObject_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_propertyClassObject_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_propertyClassObject_propertyClass_%s._value = None\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))

        bFO.write( '%s ## instance of self.opc_system_overheadDict_propertyClass\n' % ( ' '*0))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## create the property instance:\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_overheadDict_propertyClass_%s = vsv.PropertyInstance( vsv, self.%s.proxyId, vsv.systemTMAName, self.opc_system_overheadDict_propertyClass_PCN, TMObject = self, procOperation = self.bootstrapProcOperation)\n' % ( ' '*0, PCProxyName, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))
        bFO.write( '%s    ## record the value\n' % ( ' '*0))
        bFO.write( '%sself.opi_system_overheadDict_propertyClass_%s._value = {}\n' % ( ' '*0, PCProxyName))
        bFO.write( '%s\n' % ( ' '*0))


    #######################################################
    def propertyInstanceFromPropertyKey3( self, vsv, propertyInstanceKey):
        proxyId, TMAName, propertyClassName = vsv.parsePropertyKey3( propertyInstanceKey)
        if not proxyId:
            traceback.print_stack()
            errMsg('Bad propertyInstanceKey: "%s"' % ( propertyInstanceKey))
            sys.exit( 1)
        return self.proxies[ proxyId].propertyInstances[ vsv.catKey( TMAName, propertyClassName)]

##     #######################################################
##     def getPropertyInstance( self, propertyInstanceKey):
## 	## Given a propertyKey3 (a 3-field property instance
## 	## identifier), return a copy of the corresponding
## 	## PropertyInstance object on the propertyInstanceShelf)
	
##     #######################################################
##     def setPropertyInstance( self, propertyInstanceKey, propertyInstance):
## 	## Given a propertyKey3 (a 3-field property instance
## 	## identifier) and a PropertyInstance object, put the
## 	## PropertyInstance object on the propertyInstanceShelf.

##     #######################################################
##     def getProxyObject( self, proxyId):
## 	## Given a proxyId, return a copy of the specified ProxyObject
## 	## object on the proxyObjectShelf.
	
##     #######################################################
##     def setProxyObject( self, proxyId, proxyObject):
## 	## Given a proxyId and a ProxyObject object, put the
## 	## ProxyObject object on the proxyObjectShelf.
	
##     #######################################################
##     def getProcOperation( self, procOperationId):
## 	## Given a procOperationId, return a copy of the
## 	## ProcOperation object from the procOperationShelf.
	
##     #######################################################
##     def setProcOperation( self, procOperationId, procOperation):
## 	## Given a procOperationId and a ProcOperation object, put the
## 	## ProcOperation object on the procOperationShelf.
	

#######################################################
class ValueType:
    def __init__( self,
                  vsv,
                  topicMap,
                  TMA,
                  valueTypeName,
                  VTDesc,

                  ValueIsNotOfType__FMF,
                  ValueIsNotOfType__FMN,
                  ValueIsNotOfType__FN,
                  ValueIsNotOfType__F,
                  ValueIsNotOfType__FArgString,

                  InstanceOf__ValueTypeToXMLContentStringFMF,
                  InstanceOf__ValueTypeToXMLContentStringFMN,
                  InstanceOf__ValueTypeToXMLContentStringFN,
                  InstanceOf__ValueTypeToXMLContentStringF,
                  InstanceOf__ValueTypeToXMLContentStringFArgString,

                  XMLContentStringToInstanceOf__ValueTypeFMF,
                  XMLContentStringToInstanceOf__ValueTypeFMN,
                  XMLContentStringToInstanceOf__ValueTypeFN,
                  XMLContentStringToInstanceOf__ValueTypeF,
                  XMLContentStringToInstanceOf__ValueTypeFArgString

                  ):
        self.ObjectClass = 'ValueType'
        self.topicMap = topicMap  ## topicMap object
        self.TMA = TMA  ## TMA object
        self.valueTypeName = valueTypeName
        self.VTDesc = VTDesc

        self.ValueIsNotOfType__FMF = ValueIsNotOfType__FMF
        self.ValueIsNotOfType__FMN = ValueIsNotOfType__FMN
        self.ValueIsNotOfType__FN = ValueIsNotOfType__FN
        self.ValueIsNotOfType__F = ValueIsNotOfType__F
        self.ValueIsNotOfType__FArgString = ValueIsNotOfType__FArgString

        self.InstanceOf__ValueTypeToXMLContentStringFMF = InstanceOf__ValueTypeToXMLContentStringFMF
        self.InstanceOf__ValueTypeToXMLContentStringFMN = InstanceOf__ValueTypeToXMLContentStringFMN
        self.InstanceOf__ValueTypeToXMLContentStringFN = InstanceOf__ValueTypeToXMLContentStringFN
        self.InstanceOf__ValueTypeToXMLContentStringF = InstanceOf__ValueTypeToXMLContentStringF
        self.InstanceOf__ValueTypeToXMLContentStringFArgString = InstanceOf__ValueTypeToXMLContentStringFArgString

        self.XMLContentStringToInstanceOf__ValueTypeFMF = XMLContentStringToInstanceOf__ValueTypeFMF
        self.XMLContentStringToInstanceOf__ValueTypeFMN = XMLContentStringToInstanceOf__ValueTypeFMN
        self.XMLContentStringToInstanceOf__ValueTypeFN = XMLContentStringToInstanceOf__ValueTypeFN
        self.XMLContentStringToInstanceOf__ValueTypeF = XMLContentStringToInstanceOf__ValueTypeF
        self.XMLContentStringToInstanceOf__ValueTypeFArgString = XMLContentStringToInstanceOf__ValueTypeFArgString

        self.valueTypeProxies = None

        if TMA.valueTypes.has_key( valueTypeName):
            traceback.print_stack()
            errMsg( 'Value type "%s" already exists.' % ( valueTypeName))
            sys.exit( 1)
        TMA.valueTypes[ valueTypeName] = self

#######################################################
class Versavant:
    """
An invocation of Versavant; a Versavant session.
    """

    #######################################################
    def __init__(self, VsvCacheDir = None, **keywordArgs):

        global vsv  ## need this in order to use the HTTP server
        vsv = self

        self.ObjectClass = 'Versavant'

        self.vsvrevision = cvsRevision  ## set at the top of this file
        self.version = self.vsvrevision.split()[1]
	
	self.keywordArgs = keywordArgs

	if not self.keywordArgs.has_key( 'suppressLicenseMessage'):
            stdMsg( NOTICE % self.version)

        self.startTime = time.time()  ## Invocation time.

        self.pyModuleNameFixRE = re.compile('(.+)(\.[Pp][Yy][Cc]?$)')
                                      ## used in moduleImporter()

        self.extractTopicMapNameFromVsvUrlPythonExpressionRE = re.compile( '(^\.topicMaps\[ *\')([^\']+)(\'.*$)')
                                      ## used in the HTTP server to determine what topic map we're looking at

        self.pythonAtHexAddressRE = re.compile( '(^.+)( instance at 0[Xx][0-9A-Fa-f]+)(.*$)')

        self.extractInfoFromPythonReprRE = re.compile( '(^<)([^\.]+)(\.)([^ ]+)( instance at 0x)([A-Fa-f0-9]+)(>$)')
            ## takes, e.g., '<versavant.ProcOperation at 0x123>', after which
            ## group( 2) is the module name ('versavant')
            ## group( 4) is the class name ('ProcOperation')
            ## group( 6) is the unadorned hex address ('123')
        tmp = self.extractInfoFromPythonReprRE.match( '%s' % ( self))
        
        self.versavantModuleName = tmp.group( 2)
        

        if hasattr( os, 'uname'):
            self.hostName = os.uname()[1]
        else:
            self.hostName = 'NoHostname'

        self.errMsg = errMsg  ## error message function
        self.dbgMsg = dbgMsg  ## debug message function
        self.stdMsg = stdMsg  ## standard message function

        self.readmodule_ex = pyclbr.readmodule_ex

        self.systemTMAName = 'Vsys'
                       ## the name of the Versavant TMA that
                       ## defines the propertyInstances of the subject
                       ## proxies used internally by Versavant.
                                   
        self.systemBootstrapCodeFileName = 'vsvBootstrapCode.py'
                       ## the name of the file in which bootstrap code
                       ## will be written for later exec-ing

        self.vsvModuleName = 'versavant'
        self.VersavantExecDirPath = os.path.dirname( sys.modules[ self.vsvModuleName].__file__)

        self.systemAppDirName = 'VsysTMA'
        self.systemAppDirPath = os.path.abspath( os.path.join( self.VersavantExecDirPath, self.systemAppDirName))
                       ## directory containing the system app implementation

        self.nameOfDirForDefaultFunctions = 'Lib'
        self.nameOfFileForDefaultFunctions = 'defaults.py'
        self.pathToDefaultFunctionsModuleFile = os.path.abspath( os.path.join( self.VersavantExecDirPath, self.nameOfDirForDefaultFunctions, self.nameOfFileForDefaultFunctions))
        

        self.defaultVsvCacheDirName = 'VsvCache'
        self.defaultVsvCacheDir = os.path.join( self.VersavantExecDirPath, self.defaultVsvCacheDirName)
                       ## A directory that, as a side-effect of
                       ## Versavant processing, will contain one
                       ## directory per topic map.  In that directory
                       ## are directories named for the TMAs in use in
                       ## that topic map, and in those are the modules
                       ## of the TMA implementations.  This default
                       ## can be overridden by users in calls to
                       ## self.newTopicMap().  A topic map's TMA cache starts as an empty
                       ## directory whenever newTopicMap() is called.

        self.systemBootstrapCodeFilePath = None
                       ## the path of the file in which bootstrap code
                       ## will be written for later exec-ing.  

        self.systemAppValueTypesFileName = 'ValueTypes.py'
        self.systemAppValueTypesFilePath = os.path.join( self.systemAppDirPath, 
                          self.systemAppValueTypesFileName)
        self.systemAppValueTypesModuleName = None

        self.systemAppPropertyClassesFileName = 'PropertyClasses.py'
        self.systemAppPropertyClassesFilePath = os.path.join( self.systemAppDirPath,
                          self.systemAppPropertyClassesFileName)
        self.systemAppPropertyClassesModuleName = None


        self.propertyValueObjectsDict = {}

        if VsvCacheDir:
            self.VsvCacheDir = VsvCacheDir
        else:
            self.VsvCacheDir = self.defaultVsvCacheDir
        self.VsvCacheDir = os.path.abspath( self.VsvCacheDir)
        if not os.path.isdir( self.VsvCacheDir):
            os.makedirs( self.VsvCacheDir)
        if os.path.exists( self.VsvCacheDir):
            shutil.rmtree( self.VsvCacheDir)  ## clean it out
        os.mkdir( self.VsvCacheDir)
        
        self.systemAppCacheDir = os.path.join( self.VsvCacheDir, self.systemTMAName)
        os.mkdir( self.systemAppCacheDir)

        self.systemAppValueTypeImplementationsFilePath = os.path.join( self.systemAppCacheDir, '%s_%s' % ( self.systemTMAName, self.systemAppValueTypesFileName))
        shutil.copyfile( self.systemAppValueTypesFilePath, self.systemAppValueTypeImplementationsFilePath)
        self.systemAppValueTypesModuleName = \
            self.moduleImporter( self.systemAppValueTypeImplementationsFilePath)

        self.systemAppPropertyClassImplementationsFilePath = os.path.join( self.systemAppCacheDir, '%s_%s' % ( self.systemTMAName, self.systemAppPropertyClassesFileName))
        shutil.copyfile( self.systemAppPropertyClassesFilePath, self.systemAppPropertyClassImplementationsFilePath)
        self.systemAppPropertyClassesModuleName = \
            self.moduleImporter( self.systemAppPropertyClassImplementationsFilePath)

        savePathList = []
        for path in sys.path:
            savePathList.append( sys.path.pop())
        for path in savePathList:
            if path != self.VersavantExecDirPath:
                sys.path.append( path)

        self.DTD_A_FileName = 'versavant-A.dtd'
        self.DTD_A_FilePath = os.path.join( self.VersavantExecDirPath, self.DTD_A_FileName)
        
        self.fieldSeparator = fieldSeparator
                       ## Internal fieldname separator string for
                       ## names of propertyInstances of subject proxies,
                       ## e.g.: VSVAppName<separator>PropertyName
                       ## Neither the beginning nor the ending character
                       ## can appear in a VSVAppname, and the ending
                       ## character cannot appear in a PropertyName

        self.propertyNameRE = propertyNameRE
                       ## This regular expression parses property names.

        self.propertyInstanceKeyRE = propertyInstanceKeyRE
                       ## This regular expression parses property names.

        self.proxyOrPropertyLinkStr = proxyOrPropertyLinkStr

        self.VSVOBJECTCommandForServer = 'VSVOBJECT'
        self.STOPSERVINGCommandForServer = 'STOPSERVING'
        self.ALLPROXIESCommandForServer = 'ALLPROXIES'
        self.NONSYSTEMPROXIESCommandForServer = 'NONSYSTEMPROXIES'
        self.LIVEPROXIESCommandForServer = 'LIVEPROXIES'
        self.LIVENONSYSTEMPROXIESCommandForServer = 'LIVENONSYSTEMPROXIES'
        self.AUDITVALUESOURCESCommandForServer = 'AUDITVALUESOURCES'
        self.AuditValueSourcesRE = re.compile( '(^%s)(%s)(.+$)' % ( self.AUDITVALUESOURCESCommandForServer, self.fieldSeparator))
        self.AUDITDEPENDENTVALUESCommandForServer = 'AUDITDEPENDENTVALUES'
        self.AuditDependentValuesRE = re.compile( '(^%s)(%s)(.+$)' % ( self.AUDITDEPENDENTVALUESCommandForServer, self.fieldSeparator))


        self.SAMPLEMODEModeArgForServer = 'SAMPLEMODE'
        self.NOSAMPLEMODEModeArgForServer = 'NOSAMPLEMODE'
        self.SAMPLEMODE = False

        self.THUMBNAILMODEModeArgForServer = 'THUMBNAILMODE'
        self.NOTHUMBNAILMODEModeArgForServer = 'NOTHUMBNAILMODE'
        self.THUMBNAILMODE = False

        self.HEXADDRESSMODEModeArgForServer = 'HEXADDRESSMODE'
        self.NOHEXADDRESSMODEModeArgForServer = 'NOHEXADDRESSMODE'
        self.HEXADDRESSMODE = False

        self.writeHttpMessage = False

        self.systemBootstrapOriginalPopulationTaskName = 'systemBootstrap'

        self.proxyIdDesc = 'subject proxy identifier'

        self.topicMaps = {}
                       ## Dictionary of the TM objects.  The keys
                       ## are TMnames; the values are
                       ## instances of class TopicMap.

        self.topicMapProxyIds = {}
                       ## Dictionary of the proxies of the all Topic
                       ## Maps.  The keys are TMnames;
                       ## the values are proxyIds.

        self.topicMapProxies = {}
                       ## Dictionary of the proxies of the all Topic
                       ## Maps.  The keys are topic map names;
                       ## the values are ProxyObject objects.

        self.proxies = {}      ## All the subject proxies in *all* topicMaps are
                                      ## here (both "living" and "dead").  The keys
                                      ## are proxyIds and the values are instances
                                      ## of class ProxyObject

        self.VsysAttributeDescriptionDict = {


            ## ConferralRule

            'ConferralRule.ObjectClass':

                'name of this Versavant object class',
            
            'ConferralRule.TMA':

                'TMA object for the TMA that defines this conferral rule',
            
            'ConferralRule.conferralRuleDesc':

                'description of this conferral rule from the TMA configuration file',
            
            'ConferralRule.conferralRuleF':

                'loaded, executable function that implements this conferral rule',
            
            'ConferralRule.conferralRuleFArgString':

                'extra args, if any, to be passed to the function that implements this conferral rule',
            
            'ConferralRule.conferralRuleFMF':

                'path to file containing conferral rule function',
            
            'ConferralRule.conferralRuleFMN':

                'name of module containing conferral rule function',
            
            'ConferralRule.conferralRuleFN':

                'name of function that implements this conferral rule',
            
            'ConferralRule.conferralRuleName':

                'unique name of this conferral rule (unique within this TMA)',
            
            'ConferralRule.conferralRuleProxies':

                'list of proxies whose subject is this conferral rule',
            
            'ConferralRule.conferralRuleProxyIds':

                'list of IDs of proxies whose subject is this conferral rule',
            
            'ConferralRule.conferralRuleTriggerRoles':

                'keys are names of conferral trigger-roles; each value is the number of times a single property instance (or its heirs-by-merger) can play this role and trigger the conferral rule',
            
            'ConferralRule.conferralRuleValueSourceRoles':

                'keys are names of conferral value-source-roles; each value is Pythonic None',

            'ConferralRule.procOperations':

                'auditable processing operations of this conferral rule',
            
            'ConferralRule.procSpecName':

                'name of conferral rule; duplicates the conferralRuleName attribute',
            
            'ConferralRule.topicMap':

                'TopicMap object for the topic map governed by the TMA that defines this conferral rule',



            'OriginalPopulationTask.ObjectClass':

                'name of this Versavant object class',
            
            'OriginalPopulationTask.oPTProxies':

                'proxies of this original population task',
            
            'OriginalPopulationTask.oPTProxyIds':

                'Ids of proxies of this original population task',
            
            'OriginalPopulationTask.origPopTaskDesc':

                'description of this original population task',
            
            'OriginalPopulationTask.originalPopulationTaskF':

                'loaded, executable function that implements this original population task',
            
            'OriginalPopulationTask.originalPopulationTaskFArgString':

                'extra args, if any, to be passed to the function that implements this original population task',
            
            'OriginalPopulationTask.originalPopulationTaskFMF':

                'path to file containing original population task function',
            
            'OriginalPopulationTask.originalPopulationTaskFMN':

                'name of module containing original population task function',
            
            'OriginalPopulationTask.originalPopulationTaskFN':

                'name of function that implements this original population task',
            
            'OriginalPopulationTask.originalPopulationTaskName':

                'unique name of the original population task (unique within this topic map)',
            
            'OriginalPopulationTask.procOperations':

                'auditable processing operations executed by this original population task',
            
            'OriginalPopulationTask.procSpecName':

                'name of task; duplicates the originalPopulationTaskName attribute',
            
            'OriginalPopulationTask.topicMap':

                'TopicMap object for the topic map in which this original population task is registered',
            
            'OriginalPopulationTask.topicMapName':

                'name of the topic map in which this original population task is registered',
            

            ## ProcOperation

            'ProcOperation.ObjectClass':

                'name of this Versavant object class',
            
            'ProcOperation.description':

                'description of the processing operation represented by this object',
            
            'ProcOperation.procOperationID':

                'unique ID of this processing operation (unique within this Versavant session)',
            
            'ProcOperation.procSpecObject':

                'Object that served as the template for this processing operation, an instance of one of 3 Versavant object classes: OriginalPopulationTask, ConferralRule (for conferral operations), or PropertyClass (for merging operations).',
            
            'ProcOperation.propertyValuesThatWereSet':

                'keys are \'property instance keys\'; values are the values of those property instances',
            
            'ProcOperation.proxiesThatWereCreated':

                'keys are proxy IDs; each value is a Versavant ProxyObject object',
            
            'ProcOperation.topicMap':

                'TopicMap object for the topic map affected by this processing operation',
            
            'ProcOperation.triggers':

                '(Conferral operations only:) keys are trigger-role names; each value is the key of a triggering property instance.',
            
            'ProcOperation.valueSources':

                '(Conferral operations only:) keys are value-source-role names; each value is the key of a property instance whose value was a factor in the calculation of the property values that were conferred.',


            ## PropertyClass

            'PropertyClass.Add__PropToOverheadDictF':

                'loaded, executable function called when registering new instances of this property class',
            
            'PropertyClass.Add__PropToOverheadDictFArgString':

                'extra args, if any, passed to function called when registering new instances of this property class',
            
            'PropertyClass.Add__PropToOverheadDictFMF':

                'path to file containing function called when registering new instances of this property class',
            
            'PropertyClass.Add__PropToOverheadDictFMN':

                'name of module containing function called when registering new instances of this property class',
            
            'PropertyClass.Add__PropToOverheadDictFN':

                'name of function called when registering new instances of this property class',
            
            'PropertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF':

                'loaded, executable function called when killing (merging) existing instances of this property class',            

            'PropertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString':

                'extra args, if any, passed to function called when killing (merging) existing instances of this property class (SIPs only)',

            'PropertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF':

                'path to file containing function called when killing (merging) existing instances of this property class (SIPs only)',

            'PropertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN':

                'name of module containing function called when killing (merging) existing instances of this property class (SIPs only)',

            'PropertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN':

                'name of function called when killing (merging) existing instances of this property class (SIPs only)',

            'PropertyClass.Merge__PropertyValuesF':

                'loaded, executable function called when merging the values of instances of this property class',

            'PropertyClass.Merge__PropertyValuesFArgString':

                'extra args, if any, passed to function called when merging the values of instances of this property class',                        

            'PropertyClass.Merge__PropertyValuesFMF':

                'path to file containing function called when merging the values of instances of this property class',                        

            'PropertyClass.Merge__PropertyValuesFMN':

                'name of module containing function called when merging the values of instances of this property class',                        

            'PropertyClass.Merge__PropertyValuesFN':

                'name of function called when merging the values of instances of this property class',                        

            'PropertyClass.ObjectClass':

                'name of this Versavant object class',
            
            'PropertyClass.PCDesc':

                'description of this property class (from the TMA\'s config file)',
            
            'PropertyClass.UpdateProxyReferencesIn__ValueF':

                'loaded, executable function called when updating references in property values to proxies that have been merged out of existence (killed)',                                    

            'PropertyClass.UpdateProxyReferencesIn__ValueFArgString':

                'extra args, if any, passed to function called when updating references in property values to proxies that have been merged out of existence (killed)',                                    

            'PropertyClass.UpdateProxyReferencesIn__ValueFMF':

                'path to file containing function called when updating references in property values to proxies that have been merged out of existence (killed)',                                    

            'PropertyClass.UpdateProxyReferencesIn__ValueFMN':

                'name of module containing function called when updating references in property values to proxies that have been merged out of existence (killed)',                                    

            'PropertyClass.UpdateProxyReferencesIn__ValueFN':

                'name of function called when updating references in property values to proxies that have been merged out of existence (killed)',                                    

            'PropertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromF':

                'loaded, executable function called when querying for instances of this property class whose values \'match\' some value',                                    

            'PropertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFArgString':

                'extra args, if any, passed to function called when querying for instances of this property class whose values \'match\' some value',                                    

            'PropertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFMF':

                'path to file containing function called when querying for instances of this property class whose values \'match\' some value',                                    

            'PropertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFMN':

                'name of module containing function called when querying for instances of this property class whose values \'match\' some value',                                    

            'PropertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFN':

                'name of function called when querying for instances of this property class whose values \'match\' some value',                                    

            'PropertyClass.ContextOf__PropertyIsInvalidF':

                'loaded, executable function called when checking the proxies, etc., in which instances of this property class appear',                                                

            'PropertyClass.ContextOf__PropertyIsInvalidFArgString':

                'extra args, if any, passed to function called when checking the proxies, etc., in which instances of this property class appear',                                                

            'PropertyClass.ContextOf__PropertyIsInvalidFMF':

                'path to file containing function called when checking the proxies, etc., in which instances of this property class appear',                                                

            'PropertyClass.ContextOf__PropertyIsInvalidFMN':

                'name of module containing function called when checking the proxies, etc., in which instances of this property class appear',                                                

            'PropertyClass.ContextOf__PropertyIsInvalidFN':

                'name of function called when checking the proxies, etc., in which instances of this property class appear',                                                

            'PropertyClass.Remove__PropFromOverheadDictF':

                'loaded, executable function called when killing existing instances of this property class (\'merging them out of existence\')',                                                            

            'PropertyClass.Remove__PropFromOverheadDictFArgString':

                'extra args, if any, passed to function called when killing existing instances of this property class (\'merging them out of existence\')',                                                            

            'PropertyClass.Remove__PropFromOverheadDictFMF':

                'path to file containing function called when killing existing instances of this property class (\'merging them out of existence\')',                                                            

            'PropertyClass.Remove__PropFromOverheadDictFMN':

                'name of module containing function called when killing existing instances of this property class (\'merging them out of existence\')',                                                            

            'PropertyClass.Remove__PropFromOverheadDictFN':

                'name of function called when killing existing instances of this property class (\'merging them out of existence\')',                                                            

            'PropertyClass.TMA':

                'TMA object for the TMA that defines this property class',
            
            'PropertyClass.ValueIsInvalidFor__PropertyF':

                'loaded, executable function called when checking the value of an instance of this property class',                                                                        

            'PropertyClass.ValueIsInvalidFor__PropertyFArgString':

                'extra args, if any, passed to function called when checking the value of an instance of this property class',                                                                        

            'PropertyClass.ValueIsInvalidFor__PropertyFMF':

                'path to file containing function called when checking the value of an instance of this property class',                                                                        

            'PropertyClass.ValueIsInvalidFor__PropertyFMN':

                'name of module containing function called when checking the value of an instance of this property class',                                                                        

            'PropertyClass.ValueIsInvalidFor__PropertyFN':

                'name of function called when checking the value of an instance of this property class',                                                                        

            'PropertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentF':

                'loaded, executable function called when checking to see whether the values of two instances of this property class are significantly different',                                                                                    

            'PropertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString':

                'extra args, if any, passed to function called when checking to see whether the values of two instances of this property class are significantly different',                                                                                    

            'PropertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF':

                'path to file containing function called when checking to see whether the values of two instances of this property class are significantly different',                                                                                    

            'PropertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN':

                'name of module containing function called when checking to see whether the values of two instances of this property class are significantly different',                                                                                    

            'PropertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFN':

                'name of function called when checking to see whether the values of two instances of this property class are significantly different',                                                                                    

            'PropertyClass.overheadDict':

                'dictionary reserved for the implementation of the property class to store data about the instances of the property class',
            
            'PropertyClass.procOperations':

                'auditable processing (merging) operations demanded by this property class (SIPs only)',
            
            'PropertyClass.procSpecName':

                'name of property class; duplicates the propertyClassName attribute',
            
            'PropertyClass.propertyClassName':

                'unique name of this property class (unique within this TMA)',
            
            'PropertyClass.propertyClassProxies':

                'proxies of this property class',
            
            'PropertyClass.propertyClassProxyIds':

                'IDs of proxies of this property class',
            
            'PropertyClass.propertyInstancesMerged':

                'PropertyInstance objects for property instances that have been created by merging operations demanded by instances of this property class (SIPs only)',
            
            'PropertyClass.proxiesKilled':

                'keys are IDs of proxies that have been killed by merging operations demanded by instances of this property class (SIPs only); values are ProxyObject instances',
            
            'PropertyClass.topicMap':

                'TopicMap object for the topic map governed by the TMA that defines this property class',
            
            'PropertyClass.valueType':

                'ValueType object for the value type of all instances of this property class',
            
            'PropertyClass.valueTypeName':

                'name of the value type of all instances of this property class',
            
            ## PropertyInstance

            'PropertyInstance.ObjectClass':

                'name of this Versavant ObjectClass',
            
            'PropertyInstance.TMAName':

                'name of the TMA that defines the property class of which this property is an instance',
            
            'PropertyInstance._value':

                'the stored value of this property instance',
            
            'PropertyInstance.conferralTriggerAncestry':

                'Looks backward.  Keys are TMAName%sConferralRuleName%sTriggerRoleName, values are dicts in which the keys are processing operation IDs, and the values are ProcOperation objects' % ( vsv.fieldSeparator, vsv.fieldSeparator),
            
            'PropertyInstance.conferralsTriggered':

                'Looks forward.  Keys are TMAName%sConferralRuleName%sTriggerRoleName, values are dicts in which the keys are processing operation IDs, and the values are ProcOperation objects' % ( vsv.fieldSeparator, vsv.fieldSeparator),
            
            'PropertyInstance.dependentPropertyInstances':

                'keys are \'property instance keys\' of properties whose values depend on the value of this property; values of keys are lists of ProcOperation objects',
            
            'PropertyInstance.hashablePropertyValue':

                'hashable representation of the value of this property.  Optional and significant only to property classes that use it.',
            
            'PropertyInstance.listOfIdsOfReferencedProxies':

                'list of the ids of the proxies referenced by the value',
            
            'PropertyInstance.procOperation':

                'ProcOperation object for the processing operation that resulted in the creation of this property instance',
            
            'PropertyInstance.propertyClass':

                'PropertyClass object for the property class of which this property is an instance',
            
            'PropertyInstance.propertyClassName':

                'Name of the property class of which this property is an instance',
            
            'PropertyInstance.propertyClassProxies':

                'proxies for the property class of this property instance',
            
            'PropertyInstance.propertyClassProxyIds':

                'IDs of the proxies for the property class of this property instance',
            
            'PropertyInstance.propertyInstanceInProxyKey':

                'key for this property instance used in its containing ProxyObject\'s, propertyInstances dictionary',
            
            'PropertyInstance.propertyInstanceKey':

                'key for this property instance used in its containing topic map',
            
            'PropertyInstance.proxy':

                'ProxyObject for the subject proxy in which the property instance represented by this PropertyInstance object appears',
            
            'PropertyInstance.proxyId':

                'ID of the subject proxy in which the property instance represented by this PropertyInstance object appears',
            
            'PropertyInstance.topicMap':

                'TopicMap object for the topic map in which this property instance appears',
            
            'PropertyInstance.topicMapName':

                'Name of the topic map in which this property instance appears',
            
            'PropertyInstance.valueUpdates':

            'List of changes made to the proxy references in the value of the property.  Each item is a triple: the old value, the new value, and the processing operation object.',
            


            ## ProxyObject

            'ProxyObject.ObjectClass':

                'name of this Versavant object class',
            
            'ProxyObject.TMAsWithSIPsInThisProxy':

                'keys are TMA names; each value is the name of the SIP class of which an instance appears in this proxy',
            
            'ProxyObject.forwardTo':

                'If value is Pythonic None, this proxy is living.  Otherwise, the value is the ProxyObject for the proxy into which this proxy was merged.',
            
            'ProxyObject.procOperationThatCreatedThisProxy':

                'ProcOperation object for the processing operation that created this proxy.',
            
            'ProxyObject.propertyInstances':

                'keys are proxyID%spropertyClassName; values are PropertyInstance objects' % ( vsv.fieldSeparator),
            
            'ProxyObject.proxyId':

                'ID of this proxy.  Proxy IDs always begin with 2 zeroes.',
            
            'ProxyObject.topicMap':

                'TopicMap object for the topic map in which this proxy appears',
            
            'ProxyObject.topicMapName':

                'name of the topic map in which this proxy appears',
            

            ## TMA

            'TMA.ObjectClass':

                'name of this Versavant object class',
            
            'TMA.TMADesc':

                'description of this TMA (from the TMA\'s config file)',
            
            'TMA.TMAName':

                'session-specific name given to this TMA via loadTMA() or importXMLTopicMap()',
            
            'TMA.TMAProxies':

                'list of proxies whose subject is this TMA (Topic Map Application)',
            
            'TMA.TMAProxyIds':

                'list of IDs of proxies whose subject is this TMA (Topic Map Application)',
            
            'TMA.conferralRuleSequence':

                'list of names of conferral rules in the order in which they were registered',
            
            'TMA.conferralRules':

                'keys are conferral rule names; values are Versavant ConferralRule objects',
            
            'TMA.propertyClassSequence':

                'list of names of property classes in the order in which they were registered',
            
            'TMA.propertyClasses':

                'keys are property class names; values are Versavant PropertyClass objects',
            
            'TMA.pythonModules':

                'keys are names of Python modules that implement this TMA; values are their filepaths as cached',
            
            'TMA.tmaConfigFilePath':

                'filepath of the XML configuration file that defines this TMA',
            
            'TMA.topicMap':

                'TopicMap object for the topic map governed by this TMA',
            
            'TMA.valueTypes':

                'keys are value type names; values are Versavant ValueType objects',

            
            ## TopicMap


            'TopicMap.ObjectClass':

                'name of this Versavant object class',
            
            'TopicMap.TMASequence':

                'list of names of loaded TMAs in the order in which they were loaded and will be processed',
            
            'TopicMap.TMAs':

                'keys are names of loaded TMAs; values are TMA objects',
            
            'TopicMap.TMDesc':

                'descriptive string passed to newTopicMap(), if any, when this topic map was created',
            
            'TopicMap.bootstrapProcOperation':

                'auditable processing operation that boostrapped this topic map into existence',
            
            'TopicMap.originalPopulationTaskSequence':

                'list of names of original population tasks in the order in which they were registered',
            
            'TopicMap.originalPopulationTasks':

                'keys are original population task names; values are OriginalPopulationTask objects',
            
            'TopicMap.procOperations':

                'keys are processing operation identifiers; values are ProcOperation objects',
            
            'TopicMap.propertyInstances':

                'keys are \'property instance keys\'; values are PropertyInstance objects',
            
            'TopicMap.proxies':

                'keys are \'proxy IDs\'; values are ProxyObject objects',
            
            'TopicMap.referencedProxiesDict':

                'keys are the IDs of proxies referenced in the values of properties; values are dicts whose keys are propertyInstanceKeys of the referencing properties',

            'TopicMap.topicMapName':

                'name of this topic map, unique in this session',
            
            'TopicMap.topicMapProxies':

                'list of proxies whose subject is this topic map',
            
            'TopicMap.topicMapProxyIds':

                'list of IDs of proxies whose subject is this topic map',

            'ValueType.InstanceOf__ValueTypeToXMLContentStringFArgString':

                'extra args, if any, passed to function called when exporting the value of an instance of this value type as a string in the content of an XML element',
            
            'ValueType.InstanceOf__ValueTypeToXMLContentStringFMF':

                'path to file containing function called when exporting the value of an instance of this value type as a string in the content of an XML element',
            
            'ValueType.InstanceOf__ValueTypeToXMLContentStringFMN':

                'name of module containing function called when exporting the value of an instance of this value type as a string in the content of an XML element',
            
            'ValueType.InstanceOf__ValueTypeToXMLContentStringFN':

                'name of function called when exporting the value of an instance of this value type as a string in the content of an XML element',
            
            'ValueType.ObjectClass':

                'name of this Versavant object class',
            
            'ValueType.TMA':

                'TMA object for the TMA that defines this value type',
            
            'ValueType.VTDesc':

                'description of this value type (from the TMA\'s config file)',
            
            'ValueType.ValueIsNotOfType__F':

                'loaded, executable function called when checking whether an instance of this value type conforms to the type',
            
            'ValueType.ValueIsNotOfType__FArgString':

                'extra args, if any, passed to function called when checking whether an instance of this value type conforms to the type',
            
            'ValueType.ValueIsNotOfType__FMF':

                'path to file containing function called when checking whether an instance of this value type conforms to the type',
            
            'ValueType.ValueIsNotOfType__FMN':

                'name of module containing function called when checking whether an instance of this value type conforms to the type',
            
            'ValueType.ValueIsNotOfType__FN':

                'name of function called when checking whether an instance of this value type conforms to the type',
            
            'ValueType.XMLContentStringToInstanceOf__ValueTypeF':

                'loaded, executable function called when importing the value of an instance of this value type from a string that is the content of an XML element',
            
            'ValueType.XMLContentStringToInstanceOf__ValueTypeFArgString':

                'extra args, if any, passed to function called when importing the value of an instance of this value type from a string that is the content of an XML element',
            
            'ValueType.XMLContentStringToInstanceOf__ValueTypeFMF':

                'path to file containing function called when importing the value of an instance of this value type from a string that is the content of an XML element',
            
            'ValueType.XMLContentStringToInstanceOf__ValueTypeFMN':

                'name of module containing function called when importing the value of an instance of this value type from a string that is the content of an XML element',
            
            'ValueType.XMLContentStringToInstanceOf__ValueTypeFN':

                'name of function called when importing the value of an instance of this value type from a string that is the content of an XML element',
            
            'ValueType.topicMap':

                'TopicMap object for the topic map governed by the TMA that defines this value type',
            
            'ValueType.valueTypeName':

                'unique name of this value type (unique with this TMA)',
            
            'ValueType.valueTypeProxies':

                'proxies of this value type',
            
            'ValueType.valueTypeProxyIds':

                'IDs of proxies of this property class'
            
            }

        self.proxyCount = 0     ## no proxies yet
        self.proxyStrZeroFill = 2
        self.proxyIdStrValidatorRE = re.compile('(^0{%d}[0-9]+$)' % ( self.proxyStrZeroFill))

        self.procOperationCount = 0
        self.procOperationIDValidatorRE = re.compile('^(\*ProcOp)([0-9]+)(\*)$')

        self.vsvUrl = vsvUrl
        
        self.defaultConferralRuleRoleTriggeringLimit = 10

        self.nowImportingFromModuleFileName = None

        self.currentProcOperation = None
                              ## This is set just before doing any setPropertyValue() or
                              ## newPropertyInstance() calls, and unset (set to None) just afterwards.

        self.currentTopicMapHoldingDict = None  ## used by importTopicMap()

        self.nowBrowsingTopicMapName = None  ## used by the HTTP server to remember which topic map we're in.

        self.thumbnailStringValueLengthLimit = 30

        self.moduleFilePathToCacheDirNames = {}
            ## keys are original module file paths; values are lists of the cache directories in which
            ## the files have been cached
        self.cachedModuleFilePathToModuleFilePath = {}
            ## keys are the paths to the files as cached; value is the original module file path

        self.firstImportedProxyId = None  ## used by XMLContentStringToInstanceOf__ValueType() functions for translating proxyIds from those that were
                                          ## exported to those that will be used in the imported-into topic map.
        self.nowImporting = False  ## registers whether we're importing or not.

    ########################
    ## SUPPORTING CLASSES ##
    ########################
        self.TMA = TMA
        self.ConferralRule = ConferralRule
        self.OriginalPopulationTask = OriginalPopulationTask
        self.ProcOperation = ProcOperation
        self.PropertyClass = PropertyClass
        self.PropertyInstance = PropertyInstance
        self.ProxyObject = ProxyObject
        self.TopicMap = TopicMap
        self.ValueType = ValueType





    #######################################################
    def addNewProxyReferencesToReferencedProxiesDict( self, propertyInstance):
        ## called by Add_..() functions of property classes of properties that contain
        ## proxy references, in order to register, at the topic map level, the fact
        ## that the property instance's value contains references to proxies, so
        ## that these references can be updated when the referenced proxies die.

        topicMap = propertyInstance.topicMap
        referencedProxiesDict = topicMap.referencedProxiesDict
        listOfIdsOfReferencedProxies = propertyInstance.listOfIdsOfReferencedProxies
        propertyInstanceKey = propertyInstance.propertyInstanceKey

        for proxyId in listOfIdsOfReferencedProxies:
            proxy = self.isProxyId( proxyId, topicMap)
            if not proxy:
                if self.nowImporting:
                    if referencedProxiesDict.has_key( proxyId):
                        referencedProxiesDict[ proxyId][ propertyInstanceKey] = None
                    else:
                        referencedProxiesDict[ proxyId] = { propertyInstanceKey: None}  ## do it anyway!
                else:
                    traceback.print_stack()
                    errMsg( '"%s" is not a proxyId; "%s".listOfIdsOfReferencedProxies = "%s"' % ( proxyId, propertyInstanceKey, listOfIdsOfReferencedProxies))
                    sys.exit( 1)
            elif proxy.forwardTo:
                traceback.print_stack()
                errMsg( '"%s" is the proxyId of a dead proxy; "%s".listOfIdsOfReferencedProxies = "%s"' % ( proxyId, propertyInstanceKey, listOfIdsOfReferencedProxies))
                sys.exit( 1)
            elif referencedProxiesDict.has_key( proxyId):
                if referencedProxiesDict[ proxyId].has_key( propertyInstanceKey):
                    errMsg( 'It is already known that %s contains a reference to %s' % (
                        self.catKey( topicMap.topicMapName, propertyInstanceKey), proxyId))
                    sys.exit( 1)
                else:
                    referencedProxiesDict[ proxyId][ propertyInstanceKey] = None
            else:
                referencedProxiesDict[ proxyId] = { propertyInstanceKey: None}

    #######################################################
    def removeOldProxyReferencesFromReferencedProxiesDict( self, propertyInstance):
        ## reverse of addNewProxyReferencesToReferencedProxiesDict()
        topicMap = propertyInstance.topicMap
        referencedProxiesDict = topicMap.referencedProxiesDict
        listOfIdsOfReferencedProxies = propertyInstance.listOfIdsOfReferencedProxies
        propertyInstanceKey = propertyInstance.propertyInstanceKey

        for proxyId in listOfIdsOfReferencedProxies:
            if referencedProxiesDict.has_key( proxyId):
                if referencedProxiesDict[ proxyId].has_key( propertyInstanceKey):
                    del referencedProxiesDict[ proxyId][ propertyInstanceKey]
                    if not len( referencedProxiesDict[ proxyId]):  ## no more references
                        del referencedProxiesDict[ proxyId]
                else:
                    traceback.print_stack()
                    errMsg( 'There is no record in referencedProxiesDict that %s contains a reference to %s' % (
                        self.catKey( topicMap.topicMapName, propertyInstanceKey), proxyId))
                    sys.exit( 1)  ## FIXME: need to look into this some more
            else:
                traceback.print_stack()
                errMsg( 'There is no record in referencedProxiesDict of any reference to %s in topic map "%s"; property: "%s"' % (
                    proxyId, topicMap.topicMapName, propertyInstance.propertyInstanceKey))
                sys.exit( 1)

    #######################################################
    def merge( self, topicMapNameOrObject):
        ## Merge, confer, and check everything in sight.
        if isinstance( topicMapNameOrObject, types.StringType):
            topicMap = self.topicMaps[ topicMapNameOrObject]
        else:
            topicMap = topicMapNameOrObject

        if sendDebugMessages:
            sys.stdout.write( 'merging topic map "%s"... ' % ( topicMap.topicMapName))

        conferralOccurred = overallMergeWasSignificant = True
        while conferralOccurred or overallMergeWasSignificant:
            overallMergeWasSignificant = self.mergeOnce( topicMapNameOrObject)
            conferralOccurred = self.conferOnce( topicMapNameOrObject)
        self.checkLiveProxies( topicMapNameOrObject)

        if sendDebugMessages:
            sys.stdout.write( 'done.\n')


    #######################################################
    def catKey( self, *stringArgs):
        ## concatenate the arguments, putting the field separator between them.
        returnString = stringArgs[ 0]
        for sa in stringArgs[ 1:]:
            returnString = '%s%s%s' % ( returnString, self.fieldSeparator, sa)
        return returnString

    #######################################################
    def checkOneProxy( self, proxyOrProxyId):
        ## check the specified proxy to be sure that:
        ## (1) it has at least one SIP
        ## (2) it doesn't have more than one SIP per TMA
        ## (3) all of the ContextOf__PropertyIsInvalid() functions return False
        ## (4) all of the ValueIsNotOfType__() functions return False
        ## (5) all of the ValueIsInvalidFor__Property() functions return False

        if isinstance( proxyOrProxyId, types.StringType):
            if self.proxies.has_key( proxyOrProxyId):
                proxy = self.proxies[ proxyOrProxyId]
        elif isinstance( proxyOrProxyId, types.InstanceType):
            if hasattr( proxyOrProxyId, 'ObjectClass'):
                if proxyOrProxyId.ObjectClass == 'ProxyObject':
                    proxy = proxyOrProxyId
                else:
                    traceback.print_stack()
                    errMsg( 'argument ("%s") is neither a proxy nor a proxyId' % ( proxyOrProxyId))
                    sys.exit( 1)
            else:
                traceback.print_stack()
                errMsg( 'argument ("%s") is neither a proxy nor a proxyId' % ( proxyOrProxyId))
                sys.exit( 1)
        else:
            traceback.print_stack()
            errMsg( 'argument ("%s") is neither a proxy nor a proxyId' % ( proxyOrProxyId))
            sys.exit( 1)

        TMANameDict = {}
        contextCheckFunctionDict = {}
        foundSIP = False
        foundError = False
        for propertyInstanceKey in proxy.propertyInstances:
            propertyInstance = proxy.propertyInstances[ propertyInstanceKey]
            propertyClass = propertyInstance.propertyClass
            propertyValue = propertyInstance._value

            ## Here we check propertyInstance._value
            if propertyClass.valueType.ValueIsNotOfType__FArgString:
                execStr = 'valueIsNotOfType = propertyClass.valueType.ValueIsNotOfType__F( self, propertyValue, propertyClass, propertyInstance, %s)' % ( propertyClass.valueType.ValueIsNotOfType__FArgString)
                exec( execStr)
            else:
                valueIsNotOfType = propertyClass.valueType.ValueIsNotOfType__F( self, propertyValue, propertyClass, propertyInstance)
            if valueIsNotOfType:
                traceback.print_stack()
                errMsg( 'propertyValue "%s" reported invalid for value type "%s" by function %s() in %s. (propertyClassName = "%s"; proxyId = "%s")' % (
                    propertyValue,
                    propertyClass.valueTypeName,
                    propertyClass.valueType.ValueIsNotOfType__FN,
                    propertyClass.valueType.ValueIsNotOfType__FMF,
                    propertyClass.propertyClassName,
                    propertyInstance.proxy.proxyId
                    ))
                foundError = True

            if propertyClass.ValueIsInvalidFor__PropertyFN:
                if propertyClass.ValueIsInvalidFor__PropertyFArgString:
                    execStr = 'valueIsInvalid = propertyClass.ValueIsInvalidFor__PropertyF( self, propertyValue, propertyClass, propertyInstance, %s)' % ( propertyClass.ValueIsInvalidFor__PropertyFArgString)
                    exec( execStr)
                else:
                    valueIsInvalid = propertyClass.ValueIsInvalidFor__PropertyF( self, propertyValue, propertyClass, propertyInstance)
                if valueIsInvalid:
                    traceback.print_stack()
                    errMsg( 'property value "%s" reported invalid for instance of property class "%s" by function %s() in %s.  (proxyId = "%s")' % (
                        propertyValue,
                        propertyClass.propertyClassName,
                        propertyClass.ValueIsInvalidFor__PropertyFN,
                        propertyClass.ValueIsInvalidFor__PropertyFMF,
                        propertyInstance.proxy.proxyId
                        ))
                    foundError = True

            if self.propertyInstanceIsSIP( propertyInstance):
                foundSIP = True
                TMAName = propertyInstance.TMAName
                propertyClassName = propertyInstance.propertyClassName
                if TMANameDict.has_key( TMAName):
                    TMANameDict[ TMAName].append( propertyClassName)
                else:
                    TMANameDict[ TMAName] = [ propertyClassName]
            if propertyClass.ContextOf__PropertyIsInvalidFN:
                contextCheckFunctionKey = self.catKey( propertyClass.ContextOf__PropertyIsInvalidFMN,
                                                     propertyClass.ContextOf__PropertyIsInvalidFN,
                                                     propertyClass.ContextOf__PropertyIsInvalidFArgString)
                if not contextCheckFunctionDict.has_key( contextCheckFunctionKey):
                    contextCheckFunctionDict[ contextCheckFunctionKey] = None  ## so we don't do this redundantly
                    if propertyClass.ContextOf__PropertyIsInvalidFArgString:
                        execStr = 'errorReport = propertyClass.ContextOf__PropertyIsInvalidF( self, propertyInstance, %s)' % ( propertyClass.ContextOf__PropertyIsInvalidFArgString)
                        exec( execStr)
                    else:
                        errorReport = propertyClass.ContextOf__PropertyIsInvalidF( self, propertyInstance)
                    if errorReport:
                        traceback.print_stack()
                        errMsg( 'Context in which "%s" property appears (proxy %s) is invalid: %s%s' % ( propertyInstanceKey, proxy.proxyId, errorReport, self.showProxy( proxy)))
                        foundError = True

        if not foundSIP:
            traceback.print_stack()
            errMsg( 'Proxy %s has no SIP instances.  Every proxy must have at least one SIP (Subject Identity Property) instance.' % ( proxy.proxyId))
            foundError = True
        for TMAName in TMANameDict:
            if len( TMANameDict[ TMAName]) > 1:
                traceback.print_stack()
                errMsg( 'Proxy %s has multiple SIP instances (%s) for TMA "%s"  No proxy can have more than one SIP (Subject Identity Property) that is governed by a single Topic Map Application (TMA)' % ( proxy.proxyId, TMANameDict[ TMAName], TMAName))
                foundError = True

        if foundError:
            sys.exit( 1)
            
        del TMANameDict
        del contextCheckFunctionDict

    #######################################################
    def checkLiveProxies( self, topicMapNameOrObject):
        if isinstance( topicMapNameOrObject, types.StringType):
            topicMap = self.topicMaps[ topicMapNameOrObject]
        else:
            topicMap = topicMapNameOrObject

        subjectProxyIdList = topicMap.proxies.keys()
        subjectProxyIdList.sort( cmpStringsAsIntegers)
        for proxyId in subjectProxyIdList:
            proxy = topicMap.proxies[ proxyId]
            if not proxy.forwardTo:
                self.checkOneProxy( proxy)

     

    #######################################################
    def cPickleDumpObjectAsXMLContentString( self, value):
        return pickleStringXMLEscapify( cPickle.dumps( value))

    #######################################################
    def cPickleLoadObjectFromXMLContentString( self, string):
        return cPickle.loads( pickleStringXMLUnescapify( string))


    #######################################################
    def conferralMayBeSignificant( self,

        conferralRule, ## The conferralRule object.

        triggers,      ## A dictionary in which the keys are triggering role
                       ## names; the value of each key is a propertyInstanceKey
                       ## (which refers to the property instance that is playing
                       ## the triggering role).

        valueSources): ## A dictionary in which the keys are
                       ## calculational input ("value source") role
                       ## names; the value of each key is a
                       ## propertyInstanceKey.

        ## Conferral rule implementations call this function in order
        ## to find out whether they should go ahead and perform a
        ## conferral operation.  This function returns True if the
        ## conferral operation should be performed, and False if
        ## there's no reason to perform the conferral.  

        ## Together, the "conferralRule", "triggers" and
        ## "valueSources" arguments to this function constitute a
        ## "proposed conferral operation".  It is this function's job
        ## to approve or disapprove that proposal.

        ## Note: Every property instance object has a dictionary of conferral
        ## rules, called conferralsTriggered. Keys are
        ## TMAName,,conferralRuleName,,triggeringRole; the value of each
        ## is a dictionary.  The keys in that dictionary are procOperationIDs; the
        ## value of each key is a procOperation object.

        topicMap = conferralRule.topicMap
        conferralRuleName = conferralRule.conferralRuleName
        TMARuleKey = self.catKey( conferralRule.TMA.TMAName, conferralRuleName)

        # check valueSources, record roles
        for roleName in valueSources:
            if not conferralRule.conferralRuleValueSourceRoles.has_key( roleName):
                if self.nameIsBad( roleName):
                    traceback.print_stack()
                    errMsg( 'Cannot name a conferral rule value source role "%s".  %s' % ( roleName, self.nameIsBad( roleName)))
                    sys.exit( 1)
                conferralRule.conferralRuleValueSourceRoles[ roleName] = None

            propertyInstanceKey = valueSources[ roleName]
            if not self.isPropertyInstanceKey( propertyInstanceKey, conferralRule.topicMap):
                traceback.print_stack()
                errMsg( 'Supposed value source property instance reference is not a property instance key: "%s"' % ( propertyInstanceKey))
                sys.exit( 1)
            propertyInstance = topicMap.propertyInstanceFromPropertyKey3( vsv, propertyInstanceKey)

            if propertyInstance.proxy.forwardTo:
                traceback.print_stack()
                errMsg(
'Property instance (%s) is dead, but conferral rule "%s" of \n\
TMA "%s" is attempting to use it as a player of value \n\
source role "%s".  Property instances of dead proxies are not \n\
permitted to serve as value sources of conferrals; it would not make sense. \n\
Perhaps the overheadDict data for property class "%s" \n\
is corrupt?' % ( propertyInstance.propertyInstanceKey,
                 conferralRule.conferralRuleName,
                 conferralRule.TMA.TMAName,
                 roleName,
                 self.catKey( propertyInstance.TMAName, propertyInstance.propertyClass.propertyClassName)))
                sys.exit( 1)

        ## The first task is to discover which procOperations the
        ## triggers (or their merge ancestors) have in common.

        procOperationsTally = {}
        for roleName in triggers:
            if not conferralRule.conferralRuleTriggerRoles.has_key( roleName):
                if self.nameIsBad( roleName):
                    traceback.print_stack()
                    errMsg( 'Cannot name a conferral rule triggering role "%s".  %s' % ( roleName, self.nameIsBad( roleName)))
                    sys.exit( 1)
                conferralRule.conferralRuleTriggerRoles[ roleName] = vsv.defaultConferralRuleRoleTriggeringLimit

            propertyInstanceKey = triggers[ roleName]
            if not self.isPropertyInstanceKey( propertyInstanceKey, conferralRule.topicMap):
                traceback.print_stack()
                errMsg( 'Supposed triggering property instance reference is not a property instance key: "%s"' % ( propertyInstanceKey))
                sys.exit( 1)
            propertyInstance = topicMap.propertyInstanceFromPropertyKey3( vsv, propertyInstanceKey)

            if propertyInstance.proxy.forwardTo:
                traceback.print_stack()
                errMsg(
'Property instance (%s) is dead, but conferral rule "%s" of \n\
TMA "%s" is attempting to use it as a player of conferral \n\
triggering role "%s".  Property instances of dead proxies are not \n\
permitted to trigger conferrals; it would not make sense. \n\
Perhaps the overheadDict data for property class "%s" \n\
is corrupt?' % ( propertyInstance.propertyInstanceKey,
                 conferralRule.conferralRuleName,
                 conferralRule.TMA.TMAName,
                 roleName,
                 self.catKey( propertyInstance.TMAName, propertyInstance.propertyClass.propertyClassName)))
                sys.exit( 1)

            triggeredConferralKey = self.catKey( TMARuleKey, roleName)

            conferralsTriggered = propertyInstance.conferralsTriggered
            if not conferralsTriggered.has_key( triggeredConferralKey):
                self.currentProcOperation = ProcOperation( topicMap, 'conferral rule "%s"' % ( conferralRuleName), conferralRule)
                return True  ## conferral should occur; no need to look further.
            for procOperationID in conferralsTriggered[ triggeredConferralKey]:
                if procOperationsTally.has_key( procOperationID):
                    procOperationsTally[ procOperationID] += 1
                else:
                    procOperationsTally[ procOperationID] = 1
                    
        for oldProcOperationID in procOperationsTally:

            if procOperationsTally[ oldProcOperationID] == len( triggers):
                ## This procOperation looks like a possible reason not to
                ## confer; the roles were all played by the same property
                ## instances or their merge ancestors.

                    ## Having created a list of procOperations in which each
                    ## triggering property instance, or any of its ancestors,
                    ## played the same role in the same conferral rule, we check
                    ## each one until either we find one that makes it definitely
                    ## unnecessary to run the conferral rule again, in which case
                    ## we return False, or we run out of procOperations to check,
                    ## in which case we return True.

                oldProcOperation = conferralRule.procOperations[ oldProcOperationID]
                oldValueSources = oldProcOperation.valueSources

                foundDifference = False
                for roleName in oldValueSources:

                    oldPropertyInstanceKey = oldValueSources[ roleName]
                    newPropertyInstanceKey = valueSources[ roleName]
                    if oldPropertyInstanceKey == newPropertyInstanceKey:
                        continue  ## no need to compare their values if they are the same property instance!

                    propertyInstance1 = oldPropertyInstance = topicMap.propertyInstanceFromPropertyKey3( vsv, oldPropertyInstanceKey)
                    propertyInstance2 = newPropertyInstance = topicMap.propertyInstanceFromPropertyKey3( vsv, newPropertyInstanceKey)
                    ## propertyInstance1 and propertyInstance2 are just a convenience to be used by keyword args that may be
                    ## passed to ValuesOf__PropertyInstancesAreSignificantlyDifferent() functions.  Even though
                    ## they do not appear to be used in this code, they are useful in TMA implementations.  LEAVE THEM HERE!

                    ## If the two properties are not instances of the same class, that's a significant difference.
                    if ( ( oldPropertyInstance.TMAName != newPropertyInstance.TMAName) or
                         ( oldPropertyInstance.propertyClassName != oldPropertyInstance.propertyClassName)):
                        foundDifference = True
                        break

                    ## In order to determine whether it's unnecessary to do the
                    ## conferral rule again, we check the valueSources of
                    ## the proposed conferral against the valueSources of
                    ## the one that was already done.  If none of them are
                    ## significantly different (as determined by the appropriate
                    ## ValuesOf__PropertyInstancesAreSignificantlyDifferent()
                    ## function), we return False.

                    if oldPropertyInstance.propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString:
                        execStr = 'valuesAreDifferent = oldPropertyInstance.propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentF( self, oldPropertyInstance._value, newPropertyInstance._value, %s)' % ( oldPropertyInstance.propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString)
                        exec( execStr)
                    else:
                        valuesAreDifferent = oldPropertyInstance.propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentF( self, oldPropertyInstance._value, newPropertyInstance._value)

                    if valuesAreDifferent:
                        foundDifference = True
                        break

                if not foundDifference:
                    self.currentProcOperation = None
                    return False
                        ## conferral should not be done; the proposed
                        ## procOperation would have no significant
                        ## effect

        self.currentProcOperation = ProcOperation( topicMap, 'conferral rule "%s"' % ( conferralRuleName), conferralRule)
        return True

    #######################################################
    def conferOnce( self, topicMapNameOrObject):
        ## Do a single confer cycle on the specified topic map.
        if isinstance( topicMapNameOrObject, types.StringType):
            topicMap = self.topicMaps[ topicMapNameOrObject]
        else:
            topicMap = topicMapNameOrObject

        self.conferralOccurred = False  ## will be set to True if any conferral rule actually sets any property values

        for TMAName in topicMap.TMASequence:
            TMA = topicMap.TMAs[ TMAName]
            for conferralRuleName in TMA.conferralRuleSequence:
                conferralRule = TMA.conferralRules[ conferralRuleName]
                if conferralRule.conferralRuleFArgString:
                    execStr = 'conferralRule.conferralRuleF( self, conferralRule, %s)' % ( conferralRule.conferralRuleFArgString)
                    exec( execStr)
                else:
                    conferralRule.conferralRuleF( self, conferralRule)
                self.currentProcOperation = None

        return self.conferralOccurred

    #######################################################
    def exportXMLTopicMap( self,
                           topicMapNameOrObject,
                           outputFilePathOrObject,
                           DTD = 'A',
                           legalNotice = '',  ## legal notice regarding this topic map.  String will be included in the output file
                                              ## surrounded by SGML comment markup (i.e.,  <!-- legal notice here -->  ).
                           **args
                               ## keywords:
                               ## 'exportSystemProxies' ## True: export proxies for system nitty-gritty even though it's redundant and silly to do so
                                                        ## default is False
                           ):

        if args.has_key( 'exportSystemProxies'):
            exportSystemProxies = args[ 'exportSystemProxies']
        else:
            exportSystemProxies = False

        if isinstance( topicMapNameOrObject, types.StringType):
            topicMap = self.topicMaps[ topicMapNameOrObject]
        else:
            topicMap = topicMapNameOrObject
        if isinstance( outputFilePathOrObject, types.FileType):
            outputFile = outputFilePathOrObject
        else:
            outputFilePath = os.path.expanduser( outputFilePathOrObject)
            outputFilePath = os.path.expandvars( outputFilePath)
            outputFilePath = os.path.abspath( outputFilePath)
            outputFile = file( outputFilePath, 'w')

        if DTD == 'A':

            self.checkLiveProxies( topicMap)  ## This check is actually optional, but I don't trust people to do it before exporting.  Why nag?

            if hasattr( vsv, 'IoMapsDict'):
                del vsv.IoMapsDict
            tmaSpecificIODicts = {}
            vsv.IoMapsDict = { 'ProxyIds.mem2xml': {},    ## keys will be internal proxy id ints, values will be ints of ProxyObject element unique identifiers in xml
                              'ProxyIds.xml2mem': {},     ## reverse: keys will be ProxyObject element unique id ints used in xml, values will be internal proxy ids
                              'TMAs': tmaSpecificIODicts
                            }
            for TMAName in topicMap.TMAs:
                tmaSpecificIODicts[ TMAName] = {
                    ## (anything)              ## Each TMA implementation's
                                               ## InstanceOf__ValueTypeToXMLContentString()
                                               ## functions may write on the (otherwise empty) vsv.IoMapsDict[
                                               ## (TMA name)] dictionary, and its
                                               ## XMLContentStringToInstanceOf__ValueType()
                                               ## functions may read from it.
                    }

            subjectProxyElementCount = 0       ## Current element id  (A leading letter 'o' character will be prepended so it will be a legit SGML name.)

            dtdFile = file( self.DTD_A_FilePath, 'r')
            dtdFileLines = dtdFile.readlines()
            dtdFile.close()
            dtdVersionRE = re.compile( '(^\s*VersavantTopicMapDTDVersion\s+CDATA\s+")([^"]+)("\s+$)')
            dtdVersionString = ''
            for dtdFileLine in dtdFileLines:
                dtdVersionMO = dtdVersionRE.match( dtdFileLine)
                if dtdVersionMO:
                    dtdVersionString = dtdVersionMO.group( 2)
                    break
            if not dtdVersionString:
                errMsg( 'No DTD version number could be found in %s' % ( self.DTD_A_FilePath))
                sys.exit( 1)
            del dtdFileLines

            outputFile.write( '<?xml version="1.0" encoding="ASCII"?>\n')
            if legalNotice:
                outputFile.write( '\n<!--\n%s\n-->\n\n' % ( legalNotice))
            outputFile.write( '<!DOCTYPE VersavantTopicMap SYSTEM "http://www.versavant.org/dtds/Versavant-%s.dtd">\n' % ( dtdVersionString))
            pythonVersionList = sys.version.split()
            outputFile.write( '<VersavantTopicMap\n\
    TopicMapName="%s"\n\
    VersavantTopicMapDTDVersion="%s"\n\
    OSPathSeparator="%s"\n\
    PythonVersion="%s"\n\
    VersavantVersion="%s"\n\
    VersavantSystemTMAName="%s"\n' % (
                topicMap.topicMapName,
                dtdVersionString,
                os.sep,
                pythonVersionList[ 0],
                vsv.version,
                vsv.systemTMAName))

            TMANameList = topicMap.TMAs.keys()
            TMANameList.sort()
            exportableTMADict = {}

            for TMAName in TMANameList:
                TMA = topicMap.TMAs[ TMAName]
                outputFile.write( '\n\n%s><VersavantTMA AppNm="%s"\n' % ( ' '*2, TMA.TMAName))
                if TMA.TMAName == vsv.systemTMAName:
                    configFileString = self.cPickleDumpObjectAsXMLContentString( '')
                else:
                    configFO = file( TMA.tmaConfigFilePath, 'r')
                    configFileString = self.cPickleDumpObjectAsXMLContentString( configFO.read())
                    configFO.close()
                outputFile.write( '\n%s><TMAConfigFile ConfSrcPath="%s">%s</TMAConfigFile\n' % ( ' '*4,
                                                                                                 os.path.basename( TMA.tmaConfigFilePath),
                                                                                                 configFileString))

                pythonModules = TMA.pythonModules
                pythonModuleNameList = pythonModules.keys()
                pythonModuleNameList.sort()
                exportableTMADict[ TMAName] = exportablePythonModuleDict = {}
                for pythonModuleName in pythonModuleNameList:

                    pythonModuleFileName = os.path.basename( pythonModules[ pythonModuleName])
                    ignoreLeadingCharacterCount = len( TMAName) + 1  ## +1 because of the '_' between the tma name and the original file name.
                    exportablePythonModuleName = pythonModuleName[ ignoreLeadingCharacterCount:]
                    exportablePythonModuleFileName = pythonModuleFileName[ ignoreLeadingCharacterCount:]
                    exportablePythonModuleDict[ pythonModuleName] = [ exportablePythonModuleName, exportablePythonModuleFileName]

                    moduleFO = file( pythonModules[ pythonModuleName], 'r')
                    moduleFileString = self.cPickleDumpObjectAsXMLContentString( moduleFO.read())
                    moduleFO.close()

                    outputFile.write( '\n%s><TMAModule ModName="%s" ModSrcFileName="%s">%s</TMAModule\n' % ( ' '*4, exportablePythonModuleName, exportablePythonModuleFileName, moduleFileString))
                outputFile.write( '\n%s></VersavantTMA\n' % ( ' '*2))

            outputFile.write( '\n')  ## leave extra space before starting the subject proxies

            proxyIdList = topicMap.proxies.keys()
            proxyIdList.sort( cmpStringsAsIntegers)
            for proxyId in proxyIdList:
                proxy = topicMap.proxies[ proxyId]
                if proxy.forwardTo: continue  ## no dead proxies
                if proxy.propertyInstances.has_key( topicMap.sipc_system_topicMap_PNK): continue  ## we don't export the proxies of the topic map
                if proxy.propertyInstances.has_key( topicMap.sipc_system_originalPopulationTask_PNK): continue ## we don't export the original population task information, either

                if not exportSystemProxies:
                    ## The purpose of the below code is to prevent the unnecessary exportation of proxies for the nitty
                    ## gritty of the Versavant system TMA (Vsys).  Such proxies have no purpose in the exported topic map document
                    ## UNLESS they have non-Vsys properties.  If they do have such properties, the below
                    ## code makes sure they will be exported regardless of the value of exportSystemProxies.
                    TMANameList = []
                    thisTMAName = None
                    for propertyKey2 in proxy.propertyInstances:
                        a, p = self.parsePropertyKey2( propertyKey2)
                        if a not in TMANameList:
                            TMANameList.append( a)
                        if propertyKey2 in [ topicMap.sipc_system_TMAName_PNK,
                                             topicMap.opc_system_valueTypeTMAName_valueType_PNK,
                                             topicMap.opc_system_propertyClassTMAName_propertyClass_PNK,
                                             topicMap.opc_system_conferralRuleTMAName_conferralRule_PNK]:
                            thisTMAName = proxy.propertyInstances[ propertyKey2]._value
                    if len( TMANameList) == 1 and TMANameList[ 0] == self.systemTMAName and thisTMAName == self.systemTMAName : continue


                subjectProxyElementCount += 1
                outputFile.write( '\n%s><ProxyObject id="o%s" proxyId="%s"\n' % ( ' '*2, subjectProxyElementCount, proxyId))
                vsv.IoMapsDict[ 'ProxyIds.mem2xml'][ int( proxy.proxyId)] = subjectProxyElementCount
                vsv.IoMapsDict[ 'ProxyIds.xml2mem'][ subjectProxyElementCount] = int( proxy.proxyId)

                propertyKey2List = propertyKey2Sort( proxy)
                for propertyKey2 in propertyKey2List:
                    TMAName, propertyClassName = self.parsePropertyKey2( propertyKey2)
                    valueType = topicMap.TMAs[ TMAName].propertyClasses[ propertyClassName].valueType
                    propertyInstance = proxy.propertyInstances[ propertyKey2]
                    tempPropertyValue = propertyInstance._value  ## So we can lie a little in the interchangeable XML topic map.  
                    if TMAName == self.systemTMAName:
                        if propertyClassName.endswith( 'FMF') or propertyClassName.endswith( 'FMN'):
                            if proxy.propertyInstances.has_key( topicMap.opc_system_propertyClassTMAName_propertyClass_PNK):
                                thisTMAName = proxy.propertyInstances[ topicMap.opc_system_propertyClassTMAName_propertyClass_PNK]._value
                            elif proxy.propertyInstances.has_key( topicMap.opc_system_valueTypeTMAName_valueType_PNK):
                                thisTMAName = proxy.propertyInstances[ topicMap.opc_system_valueTypeTMAName_valueType_PNK]._value
                            elif proxy.propertyInstances.has_key( topicMap.opc_system_conferralRuleTMAName_conferralRule_PNK):
                                thisTMAName = proxy.propertyInstances[ topicMap.opc_system_conferralRuleTMAName_conferralRule_PNK]._value
                            else:
                                errMsg( 'internal Versavant error.  propertyClassName == "%s"  %s' % ( propertyClassName, proxy.propertyInstances))
                                sys.exit( 1)
                            
                            if propertyClassName.endswith( 'FMF'):
                                tempPropertyValue = os.path.basename( tempPropertyValue)
                            tempPropertyValue = tempPropertyValue[ len( thisTMAName) + 1:]  ## remove the leading TMAName and '_' character.
                                                     ## thus the XML topic map reflects the "greater truth" of the original file name of the implementation.

                        elif propertyClassName == topicMap.opc_system_tmaConfigFilePath_TMAName_PCN:
                            tempPropertyValue = os.path.basename( tempPropertyValue)
                                                     ## thus the XML topic map reflects the file name without the absolute path information.  The path is of purely
                                                     ## session-specific interest anyway.


                    savePropertyValue = propertyInstance._value  ## lie about the value, briefly, so we can export the basename without the whole path
                    propertyInstance._value = tempPropertyValue

##                     dbgMsg( 'now pickling %s' % ( propertyInstance.propertyInstanceKey))

                    if valueType.InstanceOf__ValueTypeToXMLContentStringFArgString:
                        execStr = 'pickleString = valueType.InstanceOf__ValueTypeToXMLContentStringF( self, propertyInstance, %s)' % (
                            valueType.InstanceOf__ValueTypeToXMLContentStringFArgString)
                        exec( execStr)
                    else:
                        pickleString = valueType.InstanceOf__ValueTypeToXMLContentStringF( self, propertyInstance)
                    propertyInstance._value = savePropertyValue  ## stop lying about the value

                    if self.propertyInstanceIsSIP( propertyInstance):
                        SIPStr = ' IsSIP="Y"'
                    else:
                        SIPStr = ' IsSIP="N"'

                    outputFile.write( '%s><Property PAppNm="%s" PClass="%s"%s>%s</Property\n' % (
                        ' '*4,
                        TMAName,
                        propertyClassName,
                        SIPStr,
                        pickleString))

                outputFile.write( '%s></ProxyObject\n' % ( ' '*2))

            outputFile.write( '\n%s><IoMapsDict>%s</IoMapsDict\n' % ( ' '*2, vsv.cPickleDumpObjectAsXMLContentString( vsv.IoMapsDict)))

            outputFile.write( '></VersavantTopicMap>\n')
            outputFile.close()            
        else:  ## unknown DTD
            errMsg( 'DTD "%s" unknown.' % ( DTD))
            sys.exit (1)
            

    #######################################################
    def importXMLTopicMap( self,

                           topicMapName,  ## name of existing TopicMap into which
                                          ## the XML topic map will be imported

                           inputFilePathOrObject,  ## the XML topic map

                           origPopTaskName,  ## the name to be used as the original population task that is this importation

                           TMANameMap = {},
                           DTD = 'A'):


        self.nowImporting = True

        topicMap = self.isTopicMapName( topicMapName)
        if not topicMap:
            errMsg( 'There is no topic map named "%s"' % ( topicMapName))
            sys.exit( 1)

        if isinstance( inputFilePathOrObject, types.FileType):
            inputFileObject = inputFilePathOrObject
            inputFilePath = inputFileObject.name
        else:
            inputFilePath = os.path.abspath( os.path.expandvars( os.path.expanduser( inputFilePathOrObject)))
            inputFileObject = file( inputFilePath, 'r')

        if sendDebugMessages:
            sys.stdout.write( 'importing topic map file "%s" into topic map "%s"... ' % ( inputFilePath, topicMapName))

        ## check map-to names to be sure they can be used
        for mapFromName in TMANameMap:
            if self.nameIsBad( TMANameMap[ mapFromName]):
                errMsg( 'map-to TMA name "%s" cannot be used.  %s' % ( TMANameMap[ mapFromName], self.nameIsBad( TMANameMap[ mapFromName])))
                sys.exit( 1)


        if DTD == 'A':
            parser = xml.parsers.expat.ParserCreate( 'ASCII')
            parser.StartElementHandler = start_element_DTD_A
            parser.EndElementHandler = end_element_DTD_A
            parser.CharacterDataHandler = char_data_DTD_A

            if hasattr( self, 'currentTopicMapHoldingDict'):
                del self.currentTopicMapHoldingDict
            self.currentTopicMapHoldingDict = { 'openElementsStack': [],
                                                'TMAs': {},
                                                'proxies': [],
                                                'topicMapFilePathBeingImported': inputFilePath,
                                                'nameOfTopicMapBeingImportedInto': topicMapName,
                                                'topicMapObjectBeingImportedInto': topicMap,
                                                'TMANameMap': TMANameMap}

            oPTObject = self.registerOriginalPopulationTask( topicMapName, '', '', origPopTaskName, 'import "%s"' % ( inputFilePath), '', importation=True)
            self.currentProcOperation = ProcOperation( self.topicMaps[ topicMapName], 'importing topic map document "%s"' % ( oPTObject.originalPopulationTaskName), oPTObject)
            parser.ParseFile( inputFileObject)

            inputFileObject.close()


            if not TMANameMap.has_key( vsv.currentTopicMapHoldingDict[ 'VersavantSystemTMAName']):
                TMANameMap[ vsv.currentTopicMapHoldingDict[ 'VersavantSystemTMAName']] = vsv.systemTMAName
                     ## by default, map the imported topic map's system TMA to the imported-into topic map's system TMA

            for workingTMAName in vsv.currentTopicMapHoldingDict[ 'TMAs']:
                if not TMANameMap.has_key( workingTMAName):
                    TMANameMap[ workingTMAName] = workingTMAName   ## save trouble later; just always look up the TMA name

            ## OK, so now the whole topic map to be imported is in
            ## self.currentTopicMapHoldingDict, which is arranged as follows:

            ## [ 'topicMapFilePathBeingImported']   ## path of XML topic map that was imported
            ## [ 'VersavantTopicMapDTDVersion']     ## version number of DTD
            ## [ 'VersavantSystemTMAName']  ## name of system TMA when the topic map was exported; probably 'VersavantSystem'
            ## [ 'OSPathSeparator']                 ## path separator, e.g. '/' or '\'
            ## [ 'TopicMapName']                    ## name of the topic map when it was exported
            ## [ 'PythonVersion']                   ## Version of Python used to export the topic map
            ## [ 'VersavantVersion']                ## Version of Versavant used to export the topic map

            ## [ 'IoMapsDict']                      ## The IoMapsDict, arranged as follows:
            ## [ 'IoMapsDict'][ 'ProxyIds.mem2xml'] ## Dict. Keys are integers of subject proxy ids as in memory before exporting.  Values are integers of
                                                    ##    unique identifiers of ProxyObject elements (these have a leading letter 'o'  in xml which should be ignored)
            ## [ 'IoMapsDict'][ 'ProxyIds.xml2mem'] ## Reverse of the above.
            ## [ 'IoMapsDict'][ 'TMAs'][ (TMA name)] ## Dict reserved for I/O purposes for private use by a TMA.  The (TMA name) is the TMA name
                                                             ## as imported, after possibly being tweaked by the TMANameMap argument to this function, and
                                                             ## not necessarily as originally exported.

            ## [ 'proxies']                  ## List of dictionaries, each of which is a subject proxy represented as a dictionary of properties.
                                                    ## Keys are the usual propertyKey2 format found in all subject proxies.
                                                    ## values are dictionaries; the keys are 'value' and 'IsSIP'

            ## [ 'proxies'][ 'id']           ## Element id in XML, as an integer.  First subject proxy element is always 1, the second 2, etc.
            ## [ 'proxies'][ 'proxyId']      ## Original proxyId before proxy was exported, as an integer.
            ## [ 'proxies'][ (index value)][ (propertyKey2)][ 'IsSIP']
                                                    ## Value is either 'Y' or 'N'.
            ## [ 'proxies'][ (index value)][ (propertyKey2)][ 'value']
                                                    ## Value is an actual property value, unpickled and ready to use,
                                                    ## except that for some system properties, such as functions and dicts, the value is Pythonic None.

            ## [ 'TMAs']                            ## Dictionary.  Keys are TMA names, with any TMA name substitution due to the TMANameMap argument
                                                    ## to importXMLTopicMap() already having taken effect.  Values are dictionaries.
            ## [ 'TMAs'][ (TMA name)][ 'fileTMAName']  ## The name of the TMA as original exported to the XML topic map.
            ## [ 'TMAs'][ (TMA name)][ 'ConfSrcPath']  ## The path to the configuration file of this TMA when the XML topic map was exported.  (not very useful)
            ## [ 'TMAs'][ (TMA name)][ 'TMAConfigFile']  ## The contents of the configuration file of this TMA when the XML topic map was exported. (a string)
            ## [ 'TMAs'][ (TMA name)][ 'modules']      ## Dictionary.  Keys are Python module names.  Values are dictionaries.
            ## [ 'TMAs'][ (TMA name)][ 'modules'][ (module name)][ 'ModSrcFileName']  ## path to module file when the XML topic map was exported.  See whether .pyc
            ## [ 'TMAs'][ (TMA name)][ 'modules'][ (module name)][ 'software']    ## The content of the module file.
            ## [ 'TMAs'][ (TMA name)][ 'TMAProxies']                              ## value is a list of proxyIndex values of proxies with "TMAName" SIPs
            ## [ 'TMAs'][ (TMA name)][ 'valueTypes'][ (value type name)]          ## value is a list of proxyIndex values of proxies with "valueType" SIPs
            ## [ 'TMAs'][ (TMA name)][ 'propertyClasses'][ (property class name)] ## value is a list of proxyIndex values of proxies with "propertyClass" SIPs
            ## [ 'TMAs'][ (TMA name)][ 'conferralRules'][ (conferral rule name)]  ## value is a list of proxyIndex values of proxies with "conferralRule" SIPs

            ## The below process will add:
            ## [ 'TMAs'][ (TMA name)][ 'localConfSrcPath']  ## The path to the TMA's configuration file after importation

            ## Now let's actually import all the above into the living topic map we're working on.


            ## We'll start with the TMA implementations: the config files
            ## (which will be ignored; they are purely documentary,
            ## showing how the TMA was originally assembled), and the
            ## Python modules in which the value type, property class, and
            ## conferral rules are implemented.  The latter will take full
            ## effect after importation *UNLESS* they already exist in the
            ## TMA cache directory and are different from those
            ## pre-existing files.  In that case, they will be copied to a
            ## NOT_USED subdirectory of the directory in which they would
            ## otherwise have been placed, so they can be examined and
            ## recovered if necessary.

            TMANameList = self.currentTopicMapHoldingDict[ 'TMAs'].keys()
            TMANameList.sort()
            for workingTMAName in TMANameList:
                TMAToImport = self.currentTopicMapHoldingDict[ 'TMAs'][ workingTMAName]
                thisVsvCacheDirPath = os.path.join( self.VsvCacheDir, workingTMAName)
                if not os.path.isdir( thisVsvCacheDirPath):
                    os.mkdir( thisVsvCacheDirPath)
                if thisVsvCacheDirPath not in sys.path:
                    sys.path.append( thisVsvCacheDirPath)

                    ## write the configuration file to disk
                if TMAToImport[ 'ConfSrcPath']:
                    originalConfigFileBaseName = TMAToImport[ 'ConfSrcPath']
                    localConfSrcPath = TMAToImport[ 'localConfSrcPath'] = os.path.join( thisVsvCacheDirPath, originalConfigFileBaseName)
                    if os.path.exists( localConfSrcPath):
                        backupDirPath = os.path.join( thisVsvCacheDirPath, 'NOT_USED')
                        if not os.path.isdir( backupDirPath):
                            os.mkdir( backupDirPath)
                        backupBaseName = self.currentTopicMapHoldingDict[ 'topicMapFilePathBeingImported'].replace( os.sep, ',')
                        backupBaseName = backupBaseName.replace( ':', ',')  ## the : is because of MSWindows
                        backupConfSrcPath = os.path.join( backupDirPath, '%s-not_used_from-%s' % ( originalConfigFileBaseName, backupBaseName))  
                        backupConfSrcFO = file( backupConfSrcPath, 'w')
                        backupConfSrcFO.write( TMAToImport[ 'TMAConfigFile'])
                        backupConfSrcFO.close()
                        if not self.textFilesAreEquivalent( localConfSrcPath, backupConfSrcPath):  # if they are different
                            errMsg( 'Warning: Not overwriting existing configuration file ("%s") for TMA "%s"; writing backup file "%s" instead, which is somehow different.' % ( localConfSrcPath, workingTMAName, backupConfSrcPath))
                        else:
                            os.remove( backupConfSrcPath)
                    else:
                        confSrcFO = file( localConfSrcPath, 'w')
                        confSrcFO.write( TMAToImport[ 'TMAConfigFile'])
                        confSrcFO.close()

                    ## write the modules to disk
                moduleNameList = TMAToImport[ 'modules'].keys()
                moduleNameList.sort()
                for moduleName in moduleNameList:
                    thisModule = TMAToImport[ 'modules'][ moduleName]

                        ## write the module to disk
                    thisModule[ 'localModuleName'] = '%s_%s' % ( workingTMAName.replace( ' ', '_'), moduleName)                     ## prepend the TMA name and a '_' to avoid module name conflicts
                    moduleBaseName                 = '%s_%s' % ( workingTMAName.replace( ' ', '_'), thisModule[ 'ModSrcFileName'])  ## prepend the TMA name and a '_' to avoid module name conflicts
                    localModuleSrcPath = thisModule[ 'localModuleSrcPath'] = os.path.join( thisVsvCacheDirPath, moduleBaseName)
                    if os.path.exists( localModuleSrcPath):
                        backupDirPath = os.path.join( thisVsvCacheDirPath, 'NOT_USED')
                        if not os.path.isdir( backupDirPath):
                            os.mkdir( backupDirPath)
                        backupBaseName = self.currentTopicMapHoldingDict[ 'topicMapFilePathBeingImported'].replace( os.sep, ',')
                        backupBaseName = backupBaseName.replace( ':', ',')
                        backupModuleSrcPath = os.path.join( backupDirPath, '%s-not-used-from-%s' % ( moduleBaseName, backupBaseName))
                        backupModuleSrcFO = file( backupModuleSrcPath, 'w')
                        backupModuleSrcFO.write( thisModule[ 'software'])
                        backupModuleSrcFO.close()
                        if not self.textFilesAreEquivalent( localModuleSrcPath, backupModuleSrcPath):  # if they are different
                            errMsg( 'Warning: Not overwriting existing module file ("%s") for TMA "%s"; writing backup file "%s" instead, which is somehow different.' % ( localModuleSrcPath, workingTMAName, backupModuleSrcPath))
                        else:
                            os.remove( backupModuleSrcPath)
                    else:
                        moduleSrcFO = file( localModuleSrcPath, 'w')
                        moduleSrcFO.write( thisModule[ 'software'])
                        moduleSrcFO.close()


            ## register the TMAs
            TMANameList = self.currentTopicMapHoldingDict[ 'TMAs'].keys()
            TMANameList.sort()
            for workingTMAName in TMANameList:
                thisImportableTMA = self.currentTopicMapHoldingDict[ 'TMAs'][ workingTMAName]
                thisVsvCacheDirPath = os.path.join( self.VsvCacheDir, workingTMAName)
                lastConferralRulesDict = lastPropertyClassesDict = lastPythonModulesDict = lastValueTypesDict = None
                TMAExists = topicMap.TMAs.has_key( workingTMAName)
                for TMAProxyIndex in thisImportableTMA[ 'TMAProxies']:
                    thisImportableProxy = self.currentTopicMapHoldingDict[ 'proxies'][ TMAProxyIndex]
                    TMANameSIPValue = thisImportableProxy[ topicMap.sipc_system_TMAName_PNK][ 'value'] = TMANameMap[ thisImportableProxy[ topicMap.sipc_system_TMAName_PNK][ 'value']]
                    proxy = self.newProxyObject( topicMap)
                    for propertyKey2 in thisImportableProxy:
                        TMAName, propertyClassName = self.parsePropertyKey2( propertyKey2)

                        if TMAName == self.systemTMAName:
                            ## we'll get the other properties later, in
                            ## the mass importation step.  Right now, we
                            ## need to get the TMAs registered, so that mass importation can happen at all.

                            if propertyClassName == topicMap.sipc_system_TMAName_PCN:
                                pass
                                ## There is no call to newPropertyInstance() here because it must be called after all the other properties have been
                                ## added to the proxy.

                            elif propertyClassName == topicMap.opc_system_tmaConfigFilePath_TMAName_PCN:
                                thisImportableProxy[ propertyKey2][ 'value'] = thisImportableTMA[ 'localConfSrcPath']
                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_tmaConfigFilePath_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            elif propertyClassName == topicMap.opc_system_TMADesc_TMAName_PCN:
                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_TMADesc_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            elif propertyClassName == topicMap.opc_system_TMAObject_TMAName_PCN:
                                if TMAExists:
                                    thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ TMANameSIPValue]
                                    self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_TMAObject_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])
                                else:
                                    TMAObjectPropertyKey2 = propertyKey2
                                    TMAObjectProperty = self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_TMAObject_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'], dontSetPropertyValue = True)

                            elif propertyClassName == topicMap.opc_system_conferralRules_TMAName_PCN:
                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_conferralRules_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            elif propertyClassName == topicMap.opc_system_propertyClasses_TMAName_PCN:
                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_propertyClasses_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            elif propertyClassName == topicMap.opc_system_propertyClassSequence_TMAName_PCN:
                                if TMAExists:
                                    thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ TMANameSIPValue].propertyClassSequence
                                       ## the early bird gets the worm

                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_propertyClassSequence_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            elif propertyClassName == topicMap.opc_system_pythonModules_TMAName_PCN:
                                if TMAExists:
                                    thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ TMANameSIPValue].pythonModules
                                else:
                                    if lastPythonModulesDict:
                                        thisImportableProxy[ propertyKey2][ 'value'] = lastPythonModulesDict
                                    else:
                                        thisImportableProxy[ propertyKey2][ 'value'] = lastPythonModulesDict = {}
                                        for pyModuleName in thisImportableTMA[ 'modules']:
                                            lastPythonModulesDict[ thisImportableTMA[ 'modules'][ pyModuleName][ 'localModuleName']] = thisImportableTMA[ 'modules'][ pyModuleName][ 'localModuleSrcPath']
                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_pythonModules_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            elif propertyClassName == topicMap.opc_system_valueTypes_TMAName_PCN:
                                self.newPropertyInstance( proxy, self.systemTMAName, topicMap.opc_system_valueTypes_TMAName_PCN, thisImportableProxy[ propertyKey2][ 'value'])

                            else:
                                errMsg( 'Warning: Property class "%s" is not known to this XML topic map importer to be in the "%s" TMA; not tweaking it, and not regarding it as necessary for TMA registration.' % ( propertyClassName, vsv.systemTMAName))

                    if workingTMAName != TMANameSIPValue:
                        errMsg( 'internal Versavant error.  TMAName == "%s"; self.systemTMAName == "%s", workingTMAName == "%s"; TMANameSIPValue == "%s"' % ( TMAName, self.systemTMAName, workingTMAName, TMANameSIPValue))
                        sys.exit( 1)

                    self.newPropertyInstance( proxy, self.systemTMAName, topicMap.sipc_system_TMAName_PCN, workingTMAName)  ## doing this will register the TMA; this is the SIP, and its Add_... function will do the registering.
                    if not TMAExists:
                        TMAObjectProperty._value = thisImportableProxy[ TMAObjectPropertyKey2][ 'value'] = topicMap.TMAs[ TMANameSIPValue]

                ## register the value types
                valueTypeNameList = thisImportableTMA[ 'valueTypes'].keys()
                valueTypeNameList.sort()
                for valueTypeName in valueTypeNameList:
                    thisValueType = thisImportableTMA[ 'valueTypes'][ valueTypeName]
                    for TMAProxyIndex in thisValueType:
                        thisImportableProxy = self.currentTopicMapHoldingDict[ 'proxies'][ TMAProxyIndex]
                        definingTMAName, definedValueTypeName = self.parsePropertyKey2( thisImportableProxy[ self.catKey( self.systemTMAName, topicMap.sipc_system_valueType_PCN)][ 'value'])
                        definingTMAName = TMANameMap[ definingTMAName]

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN,
                            topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN,
                            topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN,
                            topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_ValueIsNotOfType__FMF_valueType_PCN,
                            topicMap.opc_system_ValueIsNotOfType__FMN_valueType_PCN,
                            topicMap.opc_system_ValueIsNotOfType__FN_valueType_PCN,
                            topicMap.opc_system_ValueIsNotOfType__F_valueType_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN,
                            topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN,
                            topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN,
                            topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN)

                        proxy = self.newProxyObject( topicMap)
                        for propertyKey2 in thisImportableProxy:
                            TMAName, propertyClassName = self.parsePropertyKey2( propertyKey2)

                            if TMAName == self.systemTMAName:
                                ## we'll get the other properties later, in
                                ## the mass importation step.  Right now, we
                                ## need to get the TMAs registered, so that mass importation can happen at all.

                                if propertyClassName == topicMap.sipc_system_valueType_PCN:
                                    valueTypeNameSIPValue = thisImportableProxy[ propertyKey2][ 'value'] = \
                                        self.catKey( definingTMAName, definedValueTypeName)
                                        ## There is no call to newPropertyInstance() here because it must be called after all the other properties have been
                                        ## added to the proxy.

                                elif propertyClassName in [
                                    topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN,
                                    topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PCN,
                                    topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN,
                                    topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN,
                                    topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN,
                                    topicMap.opc_system_ValueIsNotOfType__F_valueType_PCN,
                                    topicMap.opc_system_ValueIsNotOfType__FArgString_valueType_PCN,
                                    topicMap.opc_system_ValueIsNotOfType__FMF_valueType_PCN,
                                    topicMap.opc_system_ValueIsNotOfType__FMN_valueType_PCN,
                                    topicMap.opc_system_ValueIsNotOfType__FN_valueType_PCN,
                                    topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN,
                                    topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PCN,
                                    topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN,
                                    topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN,
                                    topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN,
                                    topicMap.opc_system_valueTypeName_valueType_PCN,
                                    topicMap.opc_system_VTDesc_valueType_PCN
                                    ]:

                                    if thisImportableProxy[ propertyKey2][ 'value'] == None:
                                        self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'], dontSetPropertyValue = True)
                                    else:
                                        self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_valueTypeTMAName_valueType_PCN:
                                    thisImportableProxy[ propertyKey2][ 'value'] = definingTMAName
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                else:
                                    errMsg( 'Warning: Property class "%s" is not known to this XML topic map importer to be in the "%s" TMA; not tweaking it, and not regarding it as necessary for TMA registration.' % ( propertyClassName, vsv.systemTMAName))

                        self.newPropertyInstance( proxy, self.systemTMAName, topicMap.sipc_system_valueType_PCN, valueTypeNameSIPValue)
                            ## doing this will register the value type; this is the SIP, and its Add_... function will do the registering.

                ## register the property classes
                propertyClassNameList = thisImportableTMA[ 'propertyClasses'].keys()
                propertyClassNameList.sort()
                for propertyClassName in propertyClassNameList:
                    thisPropertyClass = thisImportableTMA[ 'propertyClasses'][ propertyClassName]
                    lastOverheadDict = lastProxiesKilledDict = lastPropertyInstancesMergedList = lastProcOperationsDict = None
                    for TMAProxyIndex in thisPropertyClass:
                        thisImportableProxy = self.currentTopicMapHoldingDict[ 'proxies'][ TMAProxyIndex]
                        definingTMAName, definedPropertyClassName = self.parsePropertyKey2( thisImportableProxy[ self.catKey( self.systemTMAName, topicMap.sipc_system_propertyClass_PCN)][ 'value'])
                        definingTMAName = TMANameMap[ definingTMAName]

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN,
                            topicMap.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN,
                            topicMap.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN,
                            topicMap.opc_system_Add__PropToOverheadDictF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN,
                            topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN,
                            topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN,
                            topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN,
                            topicMap.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN,
                            topicMap.opc_system_Merge__PropertyValuesFN_propertyClass_PCN,
                            topicMap.opc_system_Merge__PropertyValuesF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN,
                            topicMap.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PCN,
                            topicMap.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PCN,
                            topicMap.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN,
                            topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN,
                            topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN,
                            topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN,
                            topicMap.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN,
                            topicMap.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN,
                            topicMap.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN,
                            topicMap.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN,
                            topicMap.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN,
                            topicMap.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN,
                            topicMap.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN,
                            topicMap.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN,
                            topicMap.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN)

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN,
                            topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN,
                            topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN,
                            topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN)

                        proxy = self.newProxyObject( topicMap)
                        for propertyKey2 in thisImportableProxy:
                            TMAName, propertyClassName = self.parsePropertyKey2( propertyKey2)

                            if TMAName == self.systemTMAName:
                                ## we'll get the other properties later, in
                                ## the mass importation step.  Right now, we
                                ## need to get the TMAs registered, so that mass importation can happen at all.

                                if propertyClassName == topicMap.sipc_system_propertyClass_PCN:
                                    propertyClassNameSIPValue = thisImportableProxy[ propertyKey2][ 'value'] = \
                                        self.catKey( definingTMAName, definedPropertyClassName)
                                        ## There is no call to newPropertyInstance() here because it must be called after all the other properties have been
                                        ## added to the proxy.

                                elif propertyClassName in [
                                    topicMap.opc_system_PCValueType_propertyClass_PCN,
                                    topicMap.opc_system_Add__PropToOverheadDictF_propertyClass_PCN,
                                    topicMap.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PCN,
                                    topicMap.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN,
                                    topicMap.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN,
                                    topicMap.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN,
                                    topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN,
                                    topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PCN,
                                    topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN,
                                    topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN,
                                    topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN,
                                    topicMap.opc_system_Merge__PropertyValuesF_propertyClass_PCN,
                                    topicMap.opc_system_Merge__PropertyValuesFArgString_propertyClass_PCN,
                                    topicMap.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN,
                                    topicMap.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN,
                                    topicMap.opc_system_Merge__PropertyValuesFN_propertyClass_PCN,
                                    topicMap.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PCN,
                                    topicMap.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass_PCN,
                                    topicMap.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN,
                                    topicMap.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PCN,
                                    topicMap.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PCN,
                                    topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN,
                                    topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PCN,
                                    topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN,
                                    topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN,
                                    topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN,
                                    topicMap.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN,
                                    topicMap.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PCN,
                                    topicMap.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN,
                                    topicMap.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN,
                                    topicMap.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN,
                                    topicMap.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN,
                                    topicMap.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PCN,
                                    topicMap.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN,
                                    topicMap.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN,
                                    topicMap.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN,
                                    topicMap.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN,
                                    topicMap.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PCN,
                                    topicMap.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN,
                                    topicMap.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN,
                                    topicMap.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN,
                                    topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN,
                                    topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PCN,
                                    topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN,
                                    topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN,
                                    topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN,
                                    topicMap.opc_system_propertyClassName_propertyClass_PCN,
                                    topicMap.opc_system_PCDesc_propertyClass_PCN
                                    ]:
                                    
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_overheadDict_propertyClass_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].propertyClasses[ definedPropertyClassName].overheadDict
                                    else:
                                        if lastOverheadDict:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastOverheadDict
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastOverheadDict = {}
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_propertyClassTMAName_propertyClass_PCN:
                                    thisImportableProxy[ propertyKey2][ 'value'] = definingTMAName
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_propertyClassObject_propertyClass_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].propertyClasses[ definedPropertyClassName]
                                        self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])
                                    else:
                                        propertyClassObjectPropertyKey2 = propertyKey2
                                        propertyClassObjectProperty = self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'], dontSetPropertyValue = True)

                                elif propertyClassName == topicMap.opc_system_propertyClassProcOperations_propertyClass_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].propertyClasses[ definedPropertyClassName].procOperations
                                    else:
                                        if lastProcOperationsDict:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastProcOperationsDict
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = {}
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_propertyInstancesMerged_propertyClass_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].propertyClasses[ definedPropertyClassName].propertyInstancesMerged
                                    else:
                                        if lastPropertyInstancesMergedList:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastPropertyInstancesMergedList
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastPropertyInstancesMergedList = []  ## to keep the value type checker from complaining
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_proxiesKilled_propertyClass_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].propertyClasses[ definedPropertyClassName].proxiesKilled
                                    else:
                                        if lastProxiesKilledDict:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastProxiesKilledDict
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastProxiesKilledDict = {}  ## to keep the value type checker from complaining

                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                else:
                                    errMsg( 'Warning: Property class "%s" is not known to this XML topic map importer to be in the "%s" TMA; not tweaking it, and not regarding it as necessary for TMA registration.' % ( propertyClassName, vsv.systemTMAName))

                        self.newPropertyInstance( proxy, self.systemTMAName, topicMap.sipc_system_propertyClass_PCN, propertyClassNameSIPValue)
                            ## doing this will register the value type; this is the SIP, and its Add_... function will do the registering.
                        if not TMAExists:
                            propertyClassObjectProperty._value = thisImportableProxy[ propertyClassObjectPropertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].propertyClasses[ definedPropertyClassName]

                ## register the conferral rules
                conferralRuleNameList = thisImportableTMA[ 'conferralRules'].keys()
                conferralRuleNameList.sort()
                for conferralRuleName in conferralRuleNameList:
                    thisConferralRule = thisImportableTMA[ 'conferralRules'][ conferralRuleName]
                    lastConferralRuleProcOperationsDict = lastConferralRuleTriggerRolesDict = lastConferralRuleValueSourcesDict = None
                    for TMAProxyIndex in thisConferralRule:
                        thisImportableProxy = self.currentTopicMapHoldingDict[ 'proxies'][ TMAProxyIndex]
                        definingTMAName, definedConferralRuleName = self.parsePropertyKey2( thisImportableProxy[ self.catKey( self.systemTMAName, topicMap.sipc_system_conferralRule_PCN)][ 'value'])
                        definingTMAName = TMANameMap[ definingTMAName]

                        self.preProcessFunctionProperties(
                            topicMap,
                            thisVsvCacheDirPath,
                            thisImportableProxy,
                            workingTMAName,
                            topicMap.opc_system_conferralRuleFMF_conferralRule_PCN,
                            topicMap.opc_system_conferralRuleFMN_conferralRule_PCN,
                            topicMap.opc_system_conferralRuleFN_conferralRule_PCN,
                            topicMap.opc_system_conferralRuleF_conferralRule_PCN)

                        proxy = self.newProxyObject( topicMap)
                        for propertyKey2 in thisImportableProxy:
                            TMAName, propertyClassName = self.parsePropertyKey2( propertyKey2)

                            if TMAName == self.systemTMAName:
                                ## we'll get the other properties later, in
                                ## the mass importation step.  Right now, we
                                ## need to get the TMAs registered, so that mass importation can happen at all.

                                if propertyClassName == topicMap.sipc_system_conferralRule_PCN:
                                    conferralRuleNameSIPValue = thisImportableProxy[ propertyKey2][ 'value'] = \
                                        self.catKey( definingTMAName, definedConferralRuleName)
                                        ## There is no call to newPropertyInstance() here because it must be called after all the other properties have been
                                        ## added to the proxy.

                                elif propertyClassName == topicMap.opc_system_conferralRuleTMAName_conferralRule_PCN:
                                    thisImportableProxy[ propertyKey2][ 'value'] = definingTMAName
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName in [
                                    topicMap.opc_system_conferralRuleF_conferralRule_PCN,
                                    topicMap.opc_system_conferralRuleFArgString_conferralRule_PCN,
                                    topicMap.opc_system_conferralRuleFMF_conferralRule_PCN,
                                    topicMap.opc_system_conferralRuleFMN_conferralRule_PCN,
                                    topicMap.opc_system_conferralRuleFN_conferralRule_PCN,
                                    topicMap.opc_system_conferralRuleName_conferralRule_PCN,
                                    topicMap.opc_system_confRuleDesc_conferralRule_PCN
                                    ]:
                                    
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_conferralRuleObject_conferralRule_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].conferralRules[ definedConferralRuleName]
                                        self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])
                                    else:
                                        conferralRuleObjectPropertyKey2 = propertyKey2
                                        conferralRuleObjectProperty = self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'], dontSetPropertyValue = True)

                                elif propertyClassName == topicMap.opc_system_conferralRuleProcOperations_conferralRule_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].conferralRules[ definedConferralRuleName].procOperations
                                    else:
                                        if lastConferralRuleProcOperationsDict:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastConferralRuleProcOperationsDict
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastConferralRuleProcOperationsDict = {}
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_conferralRuleTriggerRoles_conferralRule_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].conferralRules[ definedConferralRuleName].conferralRuleTriggerRoles
                                    else:
                                        if lastConferralRuleTriggerRolesDict:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastConferralRuleTriggerRolesDict
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastConferralRuleTriggerRolesDict = {}
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                elif propertyClassName == topicMap.opc_system_conferralRuleValueSourceRoles_conferralRule_PCN:
                                    if TMAExists:
                                        thisImportableProxy[ propertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].conferralRules[ definedConferralRuleName].conferralRuleValueSourceRoles
                                    else:
                                        if lastConferralRuleValueSourcesDict:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastConferralRuleValueSourcesDict
                                        else:
                                            thisImportableProxy[ propertyKey2][ 'value'] = lastConferralRuleValueSourcesDict = {}
                                    self.newPropertyInstance( proxy, self.systemTMAName, propertyClassName, thisImportableProxy[ propertyKey2][ 'value'])

                                else:
                                    errMsg( 'Warning: Property class "%s" is not known to this XML topic map importer to be in the "%s" TMA; not tweaking it, and not regarding it as necessary for TMA registration.' % ( propertyClassName, vsv.systemTMAName))

                        self.newPropertyInstance( proxy, self.systemTMAName, topicMap.sipc_system_conferralRule_PCN, conferralRuleNameSIPValue)
                            ## doing this will register the value type; this is the SIP, and its Add_... function will do the registering.
                        if not TMAExists:
                            conferralRuleObjectProperty._value = thisImportableProxy[ conferralRuleObjectPropertyKey2][ 'value'] = topicMap.TMAs[ definingTMAName].conferralRules[ definedConferralRuleName]


            ## import the proxies
            self.firstImportedProxyId = vsv.proxyCount + 1  ## this is for use by implementations of XMLContentStringToInstanceOf__ValueType() functions.  Leave it!
            for proxyDict in self.currentTopicMapHoldingDict[ 'proxies']:
                proxy = self.newProxyObject()
                propertyKeyList = proxyDict.keys()
                propertyKeyList.sort( cmpPropertyKeys2)
                SIPKeyList = []
                OPKeyList = []
                for propertyKey in propertyKeyList:
                    if propertyKey == 'proxyId':
                        setattr( proxy, 'idInImportedTopicMap', '00%s' % ( proxyDict[ propertyKey]))
                    elif propertyKey == 'id':
                        setattr( proxy, 'elementIdInImportedXMLTopicMap', 'o%s' % ( proxyDict[ propertyKey]))
                    elif proxyDict[ propertyKey][ 'IsSIP'] == 'Y':
                        SIPKeyList.append( propertyKey)
                    else:
                        OPKeyList.append( propertyKey)
                OPKeyList.extend( SIPKeyList)  ## Now OPKeyList is misnamed; it's a single list of all keys, with all the SIP keys at the end of it.
                for propertyKey in OPKeyList:
                    TMAName, propertyClassName = self.parsePropertyKey2( propertyKey)
                    
###
                    if proxy.proxyId == '00181' and propertyClassName == 'BookAuthors':
                        pass
###                
                    if TMAName == vsv.systemTMAName:
                        propertyValue = proxyDict[ propertyKey][ 'value']   ## can't run XMLContentStringToInstanceOf__ValueType() on it again; done already
                    else:
                        propertyClass = topicMap.TMAs[ TMAName].propertyClasses[ propertyClassName]
                        valueType = propertyClass.valueType
                        if valueType.XMLContentStringToInstanceOf__ValueTypeFArgString:
                            execStr = 'propertyValue = valueType.XMLContentStringToInstanceOf__ValueTypeF( vsv, proxyDict[ propertyKey][ \'value\'], propertyClass, %s)' % ( valueType.XMLContentStringToInstanceOf__ValueTypeFArgString)
                            exec( execStr)
                        else:
                            propertyValue = valueType.XMLContentStringToInstanceOf__ValueTypeF( vsv, proxyDict[ propertyKey][ 'value'], propertyClass)

                    if propertyValue == None:
                        self.newPropertyInstance( proxy, TMAName, propertyClassName, propertyValue, dontSetPropertyValue = True)
                    else:
                        self.newPropertyInstance( proxy, TMAName, propertyClassName, propertyValue)

            self.currentProcOperation = None

        else:
            errMsg( 'DTD "%s" unknown.' % ( DTD))
            sys.exit( 1)

        self.nowImporting = False
        self.firstImportedProxyId = None
        if sendDebugMessages:
            sys.stdout.write( 'done.\n')


    #######################################################
    def textFilesAreEquivalent( self, path1, path2):
        f1 = open( path1, 'r')
        f2 = open( path2, 'r')
        while True:
            l1 = f1.readline()
            l2 = f2.readline()
            if l1.rstrip() != l2.rstrip():  ## ignore record-end characters
                return False
            else:  ## they are equal
                if ( not len( l1)) and ( not len( l2)):
                    return True
                elif ( not len( l1)) or ( not len( l2)):
                    return False

    #######################################################
    def preProcessFunctionProperties( self,
        topicMap,                                      
        thisVsvCacheDirPath,
        thisImportableProxy,
        thisTMAName,                                      
        FMFPropertyClassName,
        FMNPropertyClassName,
        FNPropertyClassName,
        FPropertyClassName):

        FMFPropertyKey = self.catKey( self.systemTMAName, FMFPropertyClassName)
        FMNPropertyKey = self.catKey( self.systemTMAName, FMNPropertyClassName)
        FNPropertyKey = self.catKey( self.systemTMAName, FNPropertyClassName)
        FPropertyKey = self.catKey( self.systemTMAName, FPropertyClassName)

        if not thisImportableProxy.has_key( FMFPropertyKey):
            if FMFPropertyClassName not in [
                                             topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN,
                                             topicMap.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN,
                                             topicMap.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN,
                                             topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN,
                                             topicMap.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN]:
                errMsg( 'No instance of property class "%s" found in thisImportableProxy' % ( FMFPropertyClassName))
                sys.exit( 1)
            return

        moduleFileName = '%s_%s' % ( thisTMAName.replace( ' ', '_'), thisImportableProxy[ FMFPropertyKey][ 'value'])
        moduleFilePath = thisImportableProxy[ FMFPropertyKey][ 'value'] = \
            os.path.join( thisVsvCacheDirPath, moduleFileName)

        importableModuleName = thisImportableProxy[ FMNPropertyKey][ 'value'] = self.moduleImporter( moduleFilePath)

        functionName = thisImportableProxy[ FNPropertyKey][ 'value']

        if not self.readmodule_ex( importableModuleName).has_key( functionName):
            traceback.print_stack()
            errMsg( 'function "%s" does not exist in module "%s".' % ( functionName, moduleFilePath))
            sys.exit( 1)
        execStr = 'import %s\nthisImportableProxy[ FPropertyKey][ \'value\'] = %s.%s\n' % ( importableModuleName, importableModuleName, functionName)
        exec execStr
                    
                
    #######################################################
    def isTMAName( self, topicMapName, TMAName):
        if self.topicMaps.has_key( topicMapName):
            if self.topicMaps[ topicMapName].TMAs.has_key( TMAName):
                return True
        return False

    #######################################################
    def isPropertyClassName( self, topicMapName, TMAName, propertyClassName):
        if self.topicMaps.has_key( topicMapName):
            if self.topicMaps[ topicMapName].TMAs.has_key( TMAName):
                TMA = self.topicMaps[ topicMapName].TMAs[ TMAName]
                if TMA.propertyClasses.has_key( propertyClassName):
                    return True
        return False

    #######################################################
    def inspect( self, **args):

        """ Launch a browser connected to a "Versavant http server"
        capable of serving up the topicMaps in browsable form.  The
        startingUrlBody will be the string after
        "http://[host]:[port]/" in the URL that the browser will be
        requesting first.  If you pass a proxy object or proxyId,
        the starting URL will point at that proxy.

        """

        ## keyword args:

        ## topicMapName           ## the name of the topic map
        ## topicMap               ## TopicMap object
        ## proxyId                ## proxy Id
        ## proxy                  ## ProxyObject object
        ## propertyInstanceKey    ## property instance key
        ## propertyInstance       ## PropertyInstance object

        ## showHexAddresses       ## True or False  (default False)
        ## showSamples            ## True or False  (default False)
        ## showThumbnails         ## True or False  (default False)

        vsv.HEXADDRESSMODE = vsv.SAMPLEMODE = vsv.THUMBNAILMODE = True
        topicMapName = topicMap = proxyId = proxy = propertyInstanceKey = propertyInstance = proxyListRequest = None
        for argKey in args:
            if argKey == 'showHexAddresses':
                if args[ argKey] == True or args[ argKey] == 'True':
                    vsv.HEXADDRESSMODE = True
                elif args[ argKey] == False or args[ argKey] == 'False':
                    vsv.HEXADDRESSMODE = False
            elif argKey == 'showSamples':
                if args[ argKey] == True or args[ argKey] == 'True':
                    vsv.SAMPLEMODE = True
                elif args[ argKey] == False or args[ argKey] == 'False':
                    vsv.SAMPLEMODE = False
            elif argKey == 'showThumbnails':
                if args[ argKey] == True or args[ argKey] == 'True':
                    vsv.THUMBNAILMODE = True
                elif args[ argKey] == False or args[ argKey] == 'False':
                    vsv.THUMBNAILMODE = False
            elif argKey == 'showProxies':
                if args[ argKey] == 'all':
                    proxyListRequest = 'ALLPROXIES'
                elif args[ argKey] == 'nonSystem':
                    proxyListRequest = 'NONSYSTEMPROXIES'
                elif args[ argKey] == 'live':
                    proxyListRequest = 'LIVEPROXIES'
                elif args[ argKey] == 'liveNonSystem':
                    proxyListRequest = 'LIVENONSYSTEMPROXIES'
                else:
                    traceback.print_stack()
                    vsv.errMsg( 'Bad value for "%s" keyword argument: "%s"' % ( argKey, args[ argKey]))
                    sys.exit( 1)
            elif argKey == 'topicMapName':
                topicMapName = args[ argKey]
            elif argKey == 'topicMap':
                topicMap = args[ argKey]
            elif argKey == 'proxyId':
                proxyId = args[ argKey]
            elif argKey == 'proxy':
                proxy = args[ argKey]
            elif argKey == 'propertyInstanceKey':
                propertyInstanceKey = args[ argKey]
            elif argKey == 'propertyInstance':
                propertyInstance = args[ argKey]
            elif argKey == 'writeHttpMessage':
                vsv.writeHttpMessage = args[ argKey]
            else:
                errMsg( 'Unrecognized keyword argument passed to inspect() function: "%s"' % ( args[ argKey]))
                sys.exit( 1)
                    

        if topicMap and not proxyListRequest:
            proxyListRequest = 'LIVENONSYSTEMPROXIES'

        if propertyInstance:
            startingUrlBody = vsv.catKey( pythonExpressionUrlEscapify( propertyInstance.topicMap.topicMapName),
                                          pythonExpressionUrlEscapify( propertyInstance.proxy.proxyId),
                                          pythonExpressionUrlEscapify( propertyInstance.TMAName),
                                          pythonExpressionUrlEscapify( propertyInstance.propertyClass.propertyClassName))
        elif propertyInstanceKey:
            proxyId, TMAName, propertyClassName = self.parsePropertyKey3( propertyInstanceKey)
            proxy = vsv.isProxyId( proxyId)
            if not proxy:
                vsv.errMsg( 'propertyInstanceKey "%s" is not valid' % ( propertyInstanceKey))
                sys.exit( 1)
            startingUrlBody = vsv.catKey( pythonExpressionUrlEscapify( proxy.topicMap.topicMapName),
                                          pythonExpressionUrlEscapify( proxy.proxyId),
                                          pythonExpressionUrlEscapify( TMAName),
                                          pythonExpressionUrlEscapify( propertyClassName))
        elif proxy:
            startingUrlBody = vsv.catKey( pythonExpressionUrlEscapify( proxy.topicMap.topicMapName),
                                          pythonExpressionUrlEscapify( proxy.proxyId))
        elif proxyId:
            proxy = vsv.isProxyId( proxyId)
            if not proxy:
                vsv.errMsg( 'proxyId "%s" is not valid' % ( proxyId))
                sys.exit( 1)
            startingUrlBody = vsv.catKey( pythonExpressionUrlEscapify( proxy.topicMap.topicMapName),
                                          pythonExpressionUrlEscapify( proxy.proxyId))

        elif proxyListRequest:
            if not ( topicMap or topicMapName):
                vsv.errMsg( 'If the "showProxies" keyword is used, either the "topicMap" or "topicMapName" keyword must also be used.')
                sys.exit( 1)
            if topicMap:                
                startingUrlBody = vsv.catKey( proxyListRequest, pythonExpressionUrlEscapify( topicMap.topicMapName))
            else:
                startingUrlBody = vsv.catKey( proxyListRequest, pythonExpressionUrlEscapify( topicMapName))

        elif topicMap:
            startingUrlBody = pythonExpressionUrlEscapify( topicMap.topicMapName)

        elif topicMapName:
            startingUrlBody = pythonExpressionUrlEscapify( topicMapName)

        else:
            startingUrlBody = ''

        httpd = makeLocalServer( self)
        if sendDebugMessages:
            print 'Now serving at %s' % ( self.vsvUrl( startingUrlBody))

    ###
        if vsv.hostName == 'bruno' or vsv.hostName == 'lazarus':
            os.system( 'mozilla %s &' % ( self.vsvUrl( startingUrlBody)))
        else:
            import webbrowser
            webbrowser.open_new( self.vsvUrl( startingUrlBody))  ## null string; start with list of topicMaps
            ## the above is annoying under Knoppix because it launches two windows instead of one!
    ###

        self.stop_serving = False
        while not self.stop_serving:
            httpd.handle_request()

        del httpd

        ## horrible kludge below to kill the browser
        if vsv.hostName == 'bruno' or vsv.hostName == 'lazarus':
            str = 'kill -1 `ps ax | grep \'%s\' | gawk \'{ split( $0, args, " "); if ( ! index( $0, "grep")) print args[ 1]}\'`' % ( self.vsvUrl( startingUrlBody)[:10])
            ###
            ## os.system( 'ps ax')
            ## print 'killstring = "%s"' % ( str)
            ###
            os.system( str)
            ### if this says "kill: usage: kill...", it's because you already had Mozilla running


    #######################################################
    def isProcOperationID( self, maybeProcOperationID):
        if self.procOperationIDValidatorRE.match( maybeProcOperationID):
            for topicMapName in self.topicMaps:
                if self.topicMaps[ topicMapName].procOperations.has_key( maybeProcOperationID):
                    return self.topicMaps[ topicMapName].procOperations[ maybeProcOperationID]
        return None

    #######################################################
    def isPropertyInProxy( self, topicMapName, proxyId, TMAName, propertyClassName):
        if self.topicMaps.has_key( topicMapName):
            topicMap = self.topicMaps[ topicMapName]
            if topicMap.TMAs.has_key( TMAName):
                TMA = topicMap.TMAs[ TMAName]
                if TMA.propertyClasses.has_key( propertyClassName):
                    if topicMap.proxies.has_key( proxyId):
                        propertyKey = self.catKey( TMAName, propertyClassName)
                        proxy = topicMap.proxies[ proxyId]
                        if proxy.propertyInstances.has_key( propertyKey):
                            return True
        return False



    #######################################################
    def isPropertyInstanceKey( self, key, topicMap = None):
        proxyId, TMAName, propertyClassName = self.parsePropertyKey3( key)
        proxy = self.isProxyId( proxyId)
        if not proxy:
            return False
        if topicMap == None:
            topicMap = proxy.topicMap
        if not topicMap.proxies.has_key( proxyId):
            return False
        if not topicMap.TMAs.has_key( TMAName):
            return False
        if not topicMap.TMAs[ TMAName].propertyClasses.has_key( propertyClassName):
            return False
        if not topicMap.proxies[ proxyId].propertyInstances.has_key( self.catKey( TMAName, propertyClassName)):
            return False
        return True

    #######################################################
    def looksLikeProxyId( self, string):
        if proxyIdLookalikeRE.match( string):
            return True, proxyIdLookalikeREString
        return False

    #######################################################
    def isProxyId( self, supposedProxyId, topicMap = None):
        if not isinstance( supposedProxyId, types.StringType):
            return False
        if topicMap:
            if topicMap.proxies.has_key( supposedProxyId):
                return topicMap.proxies[ supposedProxyId]
        else:
            for topicMapName in vsv.topicMaps:
                if vsv.topicMaps[ topicMapName].proxies.has_key( supposedProxyId):
                    return vsv.topicMaps[ topicMapName].proxies[ supposedProxyId]
        return False


    #######################################################
    def isTopicMapName( self, name):
        if self.topicMaps.has_key( name):
            return self.topicMaps[ name]
        return False


    #######################################################
    def liveProxy( self, proxy):
        ## return a live proxy, given a living or dead one
        while True:
            if not proxy.forwardTo:
                return proxy
            proxy = proxy.forwardTo


    #######################################################
    def propertiesContainingProxyId( self, topicMapName, proxyId):
        ## for debugging.  Returns a dictionary of propertyInstanceKeys of properties whose values, according to the
        ## .listOfIdsOfReferencedProxies attribute of each propertyInstance object, refer to a certain proxyId.
        topicMap = vsv.topicMaps[ topicMapName]
        allProxiesIdList = topicMap.proxies.keys()
        allProxiesIdList.sort()
        piKeyDict = {}
        for thisProxyId in allProxiesIdList:
            thisProxy = topicMap.proxies[ thisProxyId]
            thisPropertyKeyList = thisProxy.propertyInstances.keys()
            thisPropertyKeyList.sort()
            for thisPropertyKey in thisPropertyKeyList:
                thisProperty = thisProxy.propertyInstances[ thisPropertyKey]
                if proxyId in thisProperty.listOfIdsOfReferencedProxies:
                    piKeyDict[  thisProperty.propertyInstanceKey] = thisProperty
                break
        return piKeyDict

    #######################################################
    def proxyListFromProxyXList( self, proxyXList, propertyClass):

        ## Given a list of proxyIds, or a list of
        ## propertyInstanceKeys, or a list of ProxyObject objects, or
        ## a list of PropertyInstance objects, return a list of
        ## ProxyObject objects, and check to be sure they are all
        ## alive.  (If they aren't, the property class's overheadDict
        ## implementation is broken.)

        topicMap = propertyClass.topicMap

        proxyList = []

        if isinstance( proxyXList[ 0], types.StringType):
            ## it's either a proxyIdList or a propertyInstanceKeyList
            if topicMap.proxies.has_key( proxyXList[ 0]):
                proxyXListType = 'proxyIds'
                for proxyId in proxyXList:
                    if not proxyId in topicMap.proxies:
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    proxy = topicMap.proxies[ proxyId]
                    if not proxy.propertyInstances.has_key( self.catKey( propertyClass.TMA.TMAName, propertyClass.propertyClassName)):
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    proxyList.append( proxy)
                    if proxy.forwardTo:
                        traceback.print_stack()
                        errMsg( 'Proxy %s is dead!' % ( proxy.proxyId))
                        sys.exit( 1)
            elif self.isPropertyInstanceKey( proxyXList[ 0], topicMap):
                proxyXListType = 'propertyInstanceKeys'
                for propertyInstanceKey in proxyXList:
                    proxyId, TMAName, propertyClassName = self.parsePropertyKey3( key)
                    if not topicMap.proxies.has_key( proxyId):
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    if not topicMap.TMAs.has_key( TMAName):
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    if not topicMap.TMAs[ TMAName].propertyClasses.has_key( propertyClassName):
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    if propertyClass.TMA.TMAName != TMAName:
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    if propertyClass.propertyClassName != propertyClassName:
                        traceback.print_stack()
                        errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                        sys.exit( 1)
                    proxy = topicMap.proxies[ proxyId]
                    proxyList.append( proxy)
                    if proxy.forwardTo:
                        traceback.print_stack()
                        errMsg( 'Proxy %s is dead!' % ( proxy.proxyId))
                        sys.exit( 1)
            else:
                traceback.print_stack()
                errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                sys.exit( 1)
        elif isinstance( proxyXList[ 0], types.InstanceType):
            ## it's either a ProxyObject or a propertyInstance object
            if hasattr( proxyXList[ 0], 'ObjectClass'):
                if proxyXList[ 0].ObjectClass == 'ProxyObject':
                    proxyXListType = 'SubjectProxies'
                    for proxy in proxyXList:
                        if not proxy.propertyInstances.has_key( self.catKey( propertyClass.TMA.TMAName, propertyClass.propertyClassName)):
                            traceback.print_stack()
                            errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                            sys.exit( 1)
                        if not proxy.proxyId in topicMap.proxies:
                            traceback.print_stack()
                            errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                            sys.exit( 1)
                        proxyList.append( proxy)
                        if proxy.forwardTo:
                            traceback.print_stack()
                            errMsg( 'Proxy %s is dead!' % ( proxy.proxyId))
                            sys.exit( 1)
                elif proxyXList[ 0].ObjectClass == 'PropertyInstance':
                    proxyXListType = 'PropertyInstances'
                    for propertyInstance in proxyXList:
                        if id( topicMap) != id( propertyInstance.topicMap):
                            traceback.print_stack()
                            errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                            sys.exit( 1)
                        if id( propertyInstance.propertyClass) != id( propertyClass):
                            traceback.print_stack()
                            errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                            sys.exit( 1)
                        proxyList.append( propertyInstance.proxy)
                        if propertyInstance.proxy.forwardTo:
                            traceback.print_stack()
                            errMsg( 'Proxy %s is dead!' % ( propertyInstance.proxy.proxyId))
                            sys.exit( 1)
                else:
                    traceback.print_stack()
                    errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                    sys.exit( 1)
            else:
                traceback.print_stack()
                errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
                sys.exit( 1)
        else:
            traceback.print_stack()
            errMsg( 'Bad proxyXList: "%s"' % ( proxyXList))
            sys.exit( 1)

        return proxyList


    #######################################################
    def makeSnapshotOfHashables( self, dictForSnapshot, topicMapName):
        ## for BRUTAL debugging purposes
        topicMap = self.topicMaps[ topicMapName]
        topicMapProxiesDict = topicMap.proxies
        for proxyId in topicMapProxiesDict:
            proxy = topicMapProxiesDict[ proxyId]
            propertiesDict = proxy.propertyInstances
            for propertyKey2 in propertiesDict:
                property = propertiesDict[ propertyKey2]
                dictForSnapshot[ property.propertyInstanceKey] = property.hashablePropertyValue

    #######################################################
    def compareSnapshotsOfHashables( self, snapshot1, snapshot2, topicMapName):
        topicMap = vsv.topicMaps[ topicMapName]

        outString = ''
        ss1keys = snapshot1.keys()
        ss2keys = snapshot2.keys()
        ss1keys.sort( cmpPropertyKeys3)
        ss2keys.sort( cmpPropertyKeys3)
        ss1ctr = ss2ctr = 0
        while ss1ctr < len( ss1keys) or ss2ctr < len( ss2keys):
            if ss1ctr < len( ss1keys) and ss2ctr < len( ss2keys) and ss1keys[ ss1ctr] == ss2keys[ ss2ctr]:
                if not snapshot1[ ss1keys[ ss1ctr]] == snapshot2[ ss2keys[ ss2ctr]]:
                    outString = '%svalues of key %s differ: "%s" vs. "%s"\n' % ( outString, ss1keys[ ss1ctr], snapshot1[ ss1keys[ ss1ctr]], snapshot2[ ss2keys[ ss2ctr]])
                ss1ctr += 1
                ss2ctr += 1
            else:
                ss1ctr1 = ss1ctr + 1
                lastss1notmatched = None
                while ss1ctr1 < len( ss1keys):
                    if ss1keys[ ss1ctr1] == ss2keys[ ss2ctr]:
                        lastss1notmatched = ss1ctr1 - 1
                        breaknn
                    ss1ctr1 += 1
                if lastss1notmatched != None:
                    while ss1ctr <= lastss1notmatched and ss1ctr < len( ss1keys):
                        outString = '%sproperty not found in snapshot 2: %s\n' % ( outString, ss1keys[ ss1ctr])
                        ss1ctr += 1
                else:
                    ss2ctr1 = ss2ctr + 1
                    lastss2notmatched = None
                    while ss2ctr1 < len( ss2keys):
                        if ss1ctr < len( ss1keys) and ss2keys[ ss2ctr1] == ss1keys[ ss1ctr]:
                            lastss2notmatched = ss2ctr1 - 1
                            break
                        ss2ctr1 += 1
                    if lastss2notmatched != None:
                        while ss2ctr <= lastss2notmatched and ss2ctr < len( ss2keys):
                            outString = '%sproperty not found in snapshot 1: %s\n' % ( outString, ss2keys[ ss2ctr])
                            ss2ctr += 1
                if lastss1notmatched == None and lastss2notmatched == None:
                    while ss1ctr < len( ss1keys):
                        outString = '%sproperty not found in snapshot 2: %s\n' % ( outString, ss1keys[ ss1ctr])
                        ss1ctr += 1
                    while ss2ctr < len( ss2keys):
                        outString = '%sproperty not found in snapshot 1: %s\n' % ( outString, ss2keys[ ss2ctr])
                        ss2ctr += 1

        return outString

    #######################################################
    def mergeListOfProxies( self,
        ## Called by MergeProxiesBecause__...() functions in order to
        ## actually merge proxies.
        requestingPropertyClass,  ## PropertyClass object of
                                  ## property class whose instances
                                  ## are demanding this merge.
        proxyXList  ## list of either proxies, proxyIds, propertyInstances, or propertyInstanceKeys
        ):


        ## This function must NOT change proxyXList, except by calling Add__ and
        ## Remove__.  The presumption is that the content of proxyXList is a
        ## list of living proxies, no dead ones.  The overheadDict data should not
        ## contain references to dead proxies or their properties.  It is the
        ## property class implementation's responsibility to make sure that, when
        ## Remove__...() is called, removal of the dying proxy's
        ## property's value from the overheadDict data actually occurs.

        if not isinstance( proxyXList, types.ListType):
            traceback.print_stack()
            errMsg( 'ProxyXList is not a list.')
            sys.exit( 1)

        if len( proxyXList) < 2:
            return aSignificantMergeOccurred   ## nothing to do.  We shouldn't have been called in the first place.

        topicMap = requestingPropertyClass.topicMap

        liveProxyList = self.proxyListFromProxyXList( proxyXList, requestingPropertyClass)

        if len( liveProxyList) < 2:
            return aSignificantMergeOccurred ## nothing to do.

        newProxy = self.ProxyObject( topicMap.topicMapName)
            ## everything will be merged into this new proxy.


        ## We already know the proxies that will will be merged out of
        ## existence by this function, and we also know the proxy that
        ## will replace all of them.  So, now is the time to update all
        ## references to the dying proxies.  
        valueUpdateProcOperation = None
        for proxy in liveProxyList:
            dyingProxyId = proxy.proxyId
            if topicMap.referencedProxiesDict.has_key( dyingProxyId):
                referencingPropertiesDict = topicMap.referencedProxiesDict[ dyingProxyId]

                referencingPropertyInstanceKeys = referencingPropertiesDict.keys()
                for referencingPropertyInstanceKey in referencingPropertyInstanceKeys:
                    ## Looks like we're actually going to do
                    ## something, so get a ProcOperation to record
                    ## what we're doing, in this "proxy reference
                    ## update phase" of the merging process.
                    if not valueUpdateProcOperation:
                        valueUpdateProcOperation = ProcOperation(
                            topicMap, 'updating proxy references in property values before merging requested by property class "%s"' % (
                                self.catKey( requestingPropertyClass.TMA.TMAName, requestingPropertyClass.propertyClassName)), requestingPropertyClass)


                    ## Actually do the update
                    propertyInstance = topicMap.propertyInstanceFromPropertyKey3( self, referencingPropertyInstanceKey)

                    propertyClass = propertyInstance.propertyClass
                    if not propertyClass.UpdateProxyReferencesIn__ValueF:
                        errMsg( 'The value of property instance "%s" in topic map "%s" apparently contains proxy references, but its property class definition does not include an UpdateProxyReferencesIn__Value() function.' % (
                            propertyInstance.propertyInstanceKey,
                            propertyInstance.topicMap.topicMapName))
                        sys.exit( 1)
                        
                    if propertyClass.UpdateProxyReferencesIn__ValueFArgString:
                        execStr = 'propertyClass.UpdateProxyReferencesIn__ValueF( self, propertyInstance, dyingProxyId, newProxy.proxyId, %s)' % (
                            propertyClass.UpdateProxyReferencesIn__ValueFArgString)
                        exec( execStr)
                    else:
                        propertyClass.UpdateProxyReferencesIn__ValueF( self, propertyInstance, dyingProxyId, newProxy.proxyId)
                        
                    if dyingProxyId in propertyInstance.listOfIdsOfReferencedProxies:
                        vsv.errMsg( '%s.%s function in %s failed to replace dyingProxyId "%s" in value ("%s") of property "%s"' % (
                            propertyClass.UpdateProxyReferencesIn__ValueFMN,
                            propertyClass.UpdateProxyReferencesIn__ValueFN,
                            propertyClass.UpdateProxyReferencesIn__ValueFMF,
                            dyingProxyId,
                            propertyInstance._value,
                            propertyInstance.propertyInstanceKey
                            ))
                        sys.exit( 1)

                    if newProxy.proxyId not in propertyInstance.listOfIdsOfReferencedProxies:
                        vsv.errMsg( '%s.%s function in %s failed to replace dyingProxyId "%s" in value ("%s") of property "%s" with replacement proxyId "%s"' % (
                            propertyClass.UpdateProxyReferencesIn__ValueFMN,
                            propertyClass.UpdateProxyReferencesIn__ValueFN,
                            propertyClass.UpdateProxyReferencesIn__ValueFMF,
                            dyingProxyId,
                            propertyInstance._value,
                            propertyInstance.propertyInstanceKey,
                            newProxy.proxyId
                            ))
                        sys.exit( 1)

                    ## record the change to the property value in propertyInstance.valueUpdates
                    propertyInstance.valueUpdates.append( ( dyingProxyId, newProxy.proxyId, valueUpdateProcOperation.procOperationID))

                    ## record the change to the property value in the ProcOperation object
                    valueUpdateProcOperation.propertyValuesThatWereSet[ propertyInstance.propertyInstanceKey] = propertyInstance._value

            ## There is no need to delete the record for the dying proxy from topicMap.referencedProxiesDict;
            ## it will have been done already by removeOldProxyReferencesFromReferencedProxiesDict().


        ## Make a dictionary (proxiesByPropertyName) whose keys are the union
        ## of all the property classes in all of the proxies to be merged.
        ## The value of each key is the list of proxies
        ## that exhibit instances of that property class.
        proxiesByPropertyName = {}
        for proxy in liveProxyList:

            if proxy.forwardTo:
                traceback.print_stack()
                errMsg( 'Dead proxies cannot be merged, and proxy "%s" is dead.  Is the overheadDict data for property class "%s" corrupt?' % (
                    proxy.proxyId,
                    self.catKey( requestingPropertyClass.TMA.TMAName, requestingPropertyClass.propertyClassName)))
                sys.exit( 1)
                
            for propertyName in proxy.propertyInstances:
                if propertyName in proxiesByPropertyName:
                    proxiesByPropertyName[ propertyName].append( proxy)
                else:
                    proxiesByPropertyName[ propertyName] = [ proxy]

        for propertyName in proxiesByPropertyName:

            procOperation = ProcOperation( topicMap, 'merging requested by property class "%s"' % ( self.catKey( requestingPropertyClass.TMA.TMAName, requestingPropertyClass.propertyClassName)), requestingPropertyClass)

            TMAName, propertyClassName = self.parsePropertyKey2( propertyName)
            propertyClass = topicMap.TMAs[ TMAName].propertyClasses[ propertyClassName]


            buildingPropertyInstance = \
                PropertyInstance( self, newProxy.proxyId, TMAName, propertyClassName, procOperation = procOperation)
            buildingTriggeredConferrals = buildingPropertyInstance.conferralsTriggered

            requestingPropertyClass.propertyInstancesMerged.append( buildingPropertyInstance)

            ## Get the first of the proxies that has an instance of
            ## the property class.
            propertyInstance = proxiesByPropertyName[ propertyName][ 0].propertyInstances[ propertyName]
            workingValue = propertyInstance._value
            workingValueSourceListOfPropertyInstances = [ propertyInstance]

                ## record this first instance of the property class as
                ## a property value source for the new property
                ## instance in newProxy
            valueSources = [ propertyInstance.propertyInstanceKey]

            conferralsTriggered = propertyInstance.conferralsTriggered
            for triggeredConferralKey in conferralsTriggered:
                for procOperationID in conferralsTriggered[ triggeredConferralKey]:
                    if not buildingTriggeredConferrals.has_key( triggeredConferralKey):
                        buildingTriggeredConferrals[ triggeredConferralKey] = { procOperationID: conferralsTriggered[ triggeredConferralKey][ procOperationID]}
                    else:
                        buildingTriggeredConferrals[ triggeredConferralKey][ procOperationID] = conferralsTriggered[ triggeredConferralKey][ procOperationID]
                            
                ## record the procOperation object (in this case, a
                ## PropertyClass object) as the reason for making the
                ## new property instance a dependentPropertyInstance
            if propertyInstance.dependentPropertyInstances.has_key( buildingPropertyInstance.propertyInstanceKey):
                propertyInstance.dependentPropertyInstances[ buildingPropertyInstance.propertyInstanceKey],append( buildingPropertyInstance.procOperation)
            else:
                propertyInstance.dependentPropertyInstances[ buildingPropertyInstance.propertyInstanceKey] = [ buildingPropertyInstance.procOperation]

                    ## Remove the old value and proxyId from the overheadDict data
            if propertyClass.Remove__PropFromOverheadDictFArgString:
                execStr = 'propertyClass.Remove__PropFromOverheadDictF( self, propertyInstance, propertyInstance.propertyClass.overheadDict, %s)' % ( propertyClass.Remove__PropFromOverheadDictFArgString)
                exec( execStr)
            else:
                propertyClass.Remove__PropFromOverheadDictF( self, propertyInstance, propertyInstance.propertyClass.overheadDict)                    


            ## Merge the value with values of the instances of the same property class in each of the rest of the proxies in the list
            ## Note: there may be only one proxy that has an instance of a given property class, in which case the following loop
            ## is not executed.
            for proxyToMerge in proxiesByPropertyName[ propertyName][ 1:]:
                propertyInstance = proxyToMerge.propertyInstances[ propertyName]
                valueSources.append( propertyInstance.propertyInstanceKey)

                conferralsTriggered = propertyInstance.conferralsTriggered
                for triggeredConferralKey in conferralsTriggered:
                    for procOperationID in conferralsTriggered[ triggeredConferralKey]:
                        if not buildingTriggeredConferrals.has_key( triggeredConferralKey):
                            buildingTriggeredConferrals[ triggeredConferralKey] = { procOperationID: conferralsTriggered[ triggeredConferralKey][ procOperationID]}
                        else:
                            buildingTriggeredConferrals[ triggeredConferralKey][ procOperationID] = conferralsTriggered[ triggeredConferralKey][ procOperationID]


                if propertyInstance.dependentPropertyInstances.has_key( buildingPropertyInstance.propertyInstanceKey):
                    propertyInstance.dependentPropertyInstances[ buildingPropertyInstance.propertyInstanceKey],append( buildingPropertyInstance.procOperation)
                else:
                    propertyInstance.dependentPropertyInstances[ buildingPropertyInstance.propertyInstanceKey] = [ buildingPropertyInstance.procOperation]

                    ## Remove the old value and proxyId from the overheadDict data
                if propertyClass.Remove__PropFromOverheadDictFArgString:
                    execStr = 'propertyClass.Remove__PropFromOverheadDictF( self, propertyInstance, propertyInstance.propertyClass.overheadDict, %s)' % ( propertyClass.Remove__PropFromOverheadDictFArgString)
                    exec( execStr)
                else:
                    propertyClass.Remove__PropFromOverheadDictF( self, propertyInstance, propertyInstance.propertyClass.overheadDict)                    

                propertyInstanceToMerge = proxyToMerge.propertyInstances[ propertyName]

                    ## Get the new property value as "mergedPropertyValue"
                if propertyClass.Merge__PropertyValuesFArgString:
                    execStr = 'mergedPropertyValue = propertyClass.Merge__PropertyValuesF( self, workingValue, propertyInstanceToMerge._value, %s)' % ( propertyClass.Merge__PropertyValuesFArgString)
                    exec( execStr)
                else:
                    mergedPropertyValue = propertyClass.Merge__PropertyValuesF( self, workingValue, propertyInstanceToMerge._value)

                if mergedPropertyValue == None:  ## supposed to be Pythonic None if merge was unsuccessful
                    traceback.print_stack()
                    proxyIdList = []
                    proxyDisplayString = ''
                    for proxy in proxiesByPropertyName[ propertyName]:
                        proxyIdList.append( proxy.proxyId)  ## this is just for error reporting
                        proxyDisplayString = '%s%s' % ( proxyDisplayString, self.showProxy( proxy))
                     
                    workingValueSourceList = []
                    for xpinst in workValueSourceListOfPropertyInstances:
                        workingValueSourceList.append( xpinst.propertyInstanceKey)

                    errMsg( '\nMerger of values of instances of "%s" property class\n  in proxies "%s"\n  was reported unsuccessful by function %s() in %s.\n\nvalue1 = "%s"\n(%s)\n\nvalue2 = "%s"\n(%s)\n%s\n' % (
                        propertyClass.propertyClassName,
                        proxyIdList,
                        propertyClass.Merge__PropertyValuesFN,
                        propertyClass.Merge__PropertyValuesFMF,
                        workingValue,
                        workingValueSourceList,
                        propertyInstanceToMerge._value,
                        propertyInstanceToMerge.propertyInstanceKey,
                        proxyDisplayString))
                    sys.exit( 1)

                workingValue = mergedPropertyValue  ## get ready for next iteration of this loop.
                                                    ## After this loop, workingValue is
                                                    ## what should be used as the merged
                                                    ## property value.
                workingValueSourceListOfPropertyInstances.append( propertyInstanceToMerge)

            if not self.overallMergeWasSignificant:  ## if we already know the merge was significant, there's no need to look further
                mergeWasSignificantForThisPropertyClass = True
                for proxyToMerge in proxiesByPropertyName[ propertyName]:
                    propertyInstance1 = propertyInstanceToMerge = proxyToMerge.propertyInstances[ propertyName]
                    propertyInstance2 = None  ## oddly enough, because workingValue is not really the value of any property instance, at least not yet
                    ## propertyInstance1 and propertyInstance2 are just a convenience to be used by keyword args that may be
                    ## passed to ValuesOf__PropertyInstancesAreSignificantlyDifferent() functions.  Even though
                    ## they do not appear to be used in this code, they are useful in TMA implementations.  LEAVE THEM HERE!

                    if propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString:
                        execStr = 'mergeWasSignificant = propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentF( self, propertyInstanceToMerge._value, workingValue, %s)' % ( propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString)
                        exec( execStr)
                    else:
                        mergeWasSignificant = propertyClass.ValuesOf__PropertyInstancesAreSignificantlyDifferentF( self, propertyInstanceToMerge._value, workingValue)
                    if not mergeWasSignificant:
                        mergeWasSignificantForThisPropertyClass = False
                        break

                if mergeWasSignificantForThisPropertyClass:
                    self.overallMergeWasSignificant = True

            procOperation.procSpecObject = propertyClass
            self.currentProcOperation = procOperation
            if not self.currentProcOperation.proxiesThatWereCreated.has_key( newProxy.proxyId):
                self.currentProcOperation.proxiesThatWereCreated[ newProxy.proxyId] = newProxy
            self.setPropertyValue( buildingPropertyInstance, vsv.versaCopy( workingValue), None, valueSources)
            self.currentProcOperation = None
            

        ## kill the old proxies; all their propertyInstances have now been merged into newproxy
        for proxy in liveProxyList:
            proxy.forwardTo = newProxy
            requestingPropertyClass.proxiesKilled[ proxy.proxyId] = proxy

    #######################################################
    def mergeOnce( self, topicMapNameOrObject):
        ## Do a single merge cycle on the named topic map.
        if isinstance( topicMapNameOrObject, types.StringType):
            topicMap = self.topicMaps[ topicMapNameOrObject]
        else:
            topicMap = topicMapNameOrObject


        self.overallMergeWasSignificant = False
            ## This will be set to true by mergeListOfProxies(),
            ## called by the user-defined
            ## MergeProxiesBecause... function, if any significant
            ## merges occur.

        for TMAName in topicMap.TMASequence:
            TMA = topicMap.TMAs[ TMAName]
            for propertyClassName in TMA.propertyClassSequence:
                propertyClass = TMA.propertyClasses[ propertyClassName]
                if propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF:
                    if propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString:
                        execStr = 'propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF( self, propertyClass, %s)' % ( propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString)
                        exec( execStr)
                    else:
                        propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF( self, propertyClass)

        return vsv.overallMergeWasSignificant

    #######################################################
    def moduleImporter( self, codeFileToImport):
        ## given a path to a file, import the corresponding Python module

        thisMatchObject = self.pyModuleNameFixRE.search( codeFileToImport)
        fullImportablePathNoPy = thisMatchObject.group(1)
        importableModuleName = os.path.basename( fullImportablePathNoPy)
        if sys.modules.has_key( importableModuleName):
            existingModuleSourceFile = sys.modules[importableModuleName].__file__
            thisMatchObject = self.pyModuleNameFixRE.search( existingModuleSourceFile)
            fullExistingPathNoPy = thisMatchObject.group(1)
            if fullExistingPathNoPy != fullImportablePathNoPy:
                traceback.print_stack()
                errMsg( 'Module name conflict.  \
Module name "%s" has already been imported from "%s", \
and now we are trying to import it from "%s".  sys.path == "%s"' %
                    ( importableModuleName, existingModuleSourceFile,
                      codeFileToImport, sys.path))
                sys.exit(1)
        else:
            importFromDir = os.path.dirname(codeFileToImport)
            if not importFromDir in sys.path:
                savePathList = []
                for path in sys.path:
                    savePathList.append( sys.path.pop())
                sys.path.append( importFromDir)
                sys.path.extend( savePathList)
                exec('import %s' % importableModuleName)
                ## sys.path.remove( importFromDir)
            else:
                exec('import %s' % importableModuleName)

        return importableModuleName

    #######################################################
    def nameIsBad( self, nameToCheck):
        ## Check the names of topic maps, topic map applications (TMAs), property classes, value types,
        ## conferral rules, conferral rule role names, and original population tasks.

        if badNameCharsRE.search( nameToCheck):
            return 'Name contains bad characters.  Regular expression search %s must fail.' % badNameCharsStr
        if not len( nameToCheck):
            return 'Name must have some characters in it.'
        if self.proxyIdStrValidatorRE.match( nameToCheck):
            return 'Name could be mistaken for a proxyId.'
        if self.procOperationIDValidatorRE.match( nameToCheck):
            return 'Name could be mistaken for a procOperation ID.'
        if self.fieldSeparator in nameToCheck:
            return 'Name contains the field separator string ("%s")' % ( self.fieldSeparator)
        if nameToCheck[ 0] == self.fieldSeparator[ len( self.fieldSeparator) - 1]:
            return 'Name begins with the same character that the field separator string ("%s") ends with.' % ( self.fieldSeparator)
        if nameToCheck[ len( nameToCheck) - 1] == self.fieldSeparator[ 0]:
            return 'Name ends with the same character that the field separator string ("%s") begins with.' % ( self.fieldSeparator)
        return ''

    #######################################################
    def loadTMA( self, topicMapName, TMAName, requestedTmaConfigFilePath):
        ## Load a TMA into a topic map, making it one of the
        ## TMAs that govern the topic map, and also putting
        ## proxies in the topic map for the TMA and each of
        ## its value types, property classes, and conferral rules.

        if self.topicMaps.has_key( topicMapName):
            topicMap = self.topicMaps[ topicMapName]
        else:
            traceback.print_stack()
            errMsg( 'No such topic map: "%s".' % ( topicMapName))
            sys.exit( 1)

        if topicMap.TMAs.has_key( TMAName):
            traceback.print_stack()
            errMsg( 'A TMA named "%s" already exists in topic map "%s".' % ( TMAName, topicMap.topicMapName))
            sys.exit( 1)

        if self.nameIsBad( TMAName):
            traceback.print_stack()
            errMsg( 'Cannot name a TMA "%s".  %s' % ( TMAName, self.nameIsBad( TMAName)))
            sys.exit( 1)

        tmaConfigFilePath = requestedTmaConfigFilePath.replace( '${VSVEXECDIR}', self.VersavantExecDirPath)
        tmaConfigFilePath = os.path.abspath( os.path.expandvars( os.path.expanduser( tmaConfigFilePath)))
        if not os.path.isfile( tmaConfigFilePath):
            traceback.print_stack()
            errMsg( 'tmaConfigFilePath "%s" does not exist.  You asked for "%s", and your working directory is "%s"' % ( tmaConfigFilePath, requestedTmaConfigFilePath, os.path.abspath( '.')))
            sys.exit( 1)
        try:
            configFileObject = open( tmaConfigFilePath, 'r')
        except:
            traceback.print_stack()
            errMsg( 'Could not open TMA configuration file "%s".' % ( tmaConfigFilePath))
            sys.exit( 1)
        configFileObject.close()

        ## Copy the config file to the TMA cache.  It has no purpose
        ## being there, really, but, as Ralph Waldo Emerson says,
        ## "Foolish consistency is the hobgoblin of small minds."
        cachedAppDirPath = os.path.join( self.VsvCacheDir, TMAName)
        if not os.path.isdir( cachedAppDirPath):
            os.mkdir( cachedAppDirPath)
        cachedTmaConfigFilePath = os.path.join( cachedAppDirPath, os.path.basename( tmaConfigFilePath))
        shutil.copyfile( tmaConfigFilePath, cachedTmaConfigFilePath)
        
        parser = xml.parsers.expat.ParserCreate( 'ASCII')
        parser.StartElementHandler = start_element_tmaConfigFile
        parser.EndElementHandler = end_element_tmaConfigFile
        parser.CharacterDataHandler = char_data_tmaConfigFile

        if hasattr( self, 'currentTMAConfigFileHoldingDict'):
            del self.currentTMAConfigFileHoldingDict
        self.currentTMAConfigFileHoldingDict = {
                                                 'tmaConfigFilePath': tmaConfigFilePath,
                                                 'cachedTmaConfigFilePath': cachedTmaConfigFilePath,
                                                 'TMAName': TMAName,
                                                 'openElementsStack': [],
                                                 'currentValueTypeDict': None,
                                                 'currentPropertyClassDict': None,
                                                 'currentConferralRuleDict': None,
                                                 'valueTypes': {},
                                                 'valueTypeSequence': [],     ## list of value type names in the order in which they appear in the config file
                                                 'propertyClasses': {},
                                                 'propertyClassSequence': [], ## list of property class names in the order in which they appear in the config file
                                                 'conferralRules': {},
                                                 'conferralRuleSequence': []  ## list of conferral rule names in the order in which they appear in the config file
                                               }

        configFileObject = open( cachedTmaConfigFilePath, 'r')
        parser.ParseFile( configFileObject)
        configFileObject.close()

        ## OK, now that we've parsed the config file, we have its contents in self.currentTMAConfigFileHoldingDict, which is organized as follows:

        ## [ 'TMADesc'] == description of the TMA (<Desc> child of document element (<VersavantTMA>))

        ## [ 'valueTypes'][ (value type name)][ 'valueTypeName'] == name of the value type (again)
        ## [ 'valueTypes'][ (value type name)][ 'valueTypeDesc'] == description of the value type

        ## [ 'valueTypes'][ (value type name)][ 'ValueIsNotOfType__FN']  == name of function in that file (None if unspecified)
        ## [ 'valueTypes'][ (value type name)][ 'ValueIsNotOfType__FArgString']  == extra args string to be passed to the function

        ## [ 'valueTypes'][ (value type name)][ 'InstanceOf__ValueTypeToXMLContentStringFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'valueTypes'][ (value type name)][ 'InstanceOf__ValueTypeToXMLContentStringFN']  == name of function in that file (None if unspecified)
        ## [ 'valueTypes'][ (value type name)][ 'InstanceOf__ValueTypeToXMLContentStringFArgString']  == extra args string to be passed to the function

        ## [ 'valueTypes'][ (value type name)][ 'XMLContentStringToInstanceOf__ValueTypeFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'valueTypes'][ (value type name)][ 'XMLContentStringToInstanceOf__ValueTypeFN']  == name of function in that file (None if unspecified)
        ## [ 'valueTypes'][ (value type name)][ 'XMLContentStringToInstanceOf__ValueTypeFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'propertyClassName'] == name of the property class
        ## [ 'propertyClasses'][ (property class name)][ 'valueTypeName'] == name of the value type of all values of instances of this property class

        ## [ 'propertyClasses'][ (property class name)][ 'Add__PropToOverheadDictFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'Add__PropToOverheadDictFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'Add__PropToOverheadDictFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'Remove__PropFromOverheadDictFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'Remove__PropFromOverheadDictFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'Remove__PropFromOverheadDictFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'ValueIsInvalidFor__PropertyFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'ValueIsInvalidFor__PropertyFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'ValueIsInvalidFor__PropertyFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'Merge__PropertyValuesFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'Merge__PropertyValuesFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'Merge__PropertyValuesFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'ContextOf__PropertyIsInvalidFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'ContextOf__PropertyIsInvalidFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'ContextOf__PropertyIsInvalidFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString']  == extra args string to be passed to the function

        ## [ 'propertyClasses'][ (property class name)][ 'UpdateProxyReferencesIn__ValueFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'propertyClasses'][ (property class name)][ 'UpdateProxyReferencesIn__ValueFN']  == name of function in that file (None if unspecified)
        ## [ 'propertyClasses'][ (property class name)][ 'UpdateProxyReferencesIn__ValueFArgString']  == extra args string to be passed to the function


        ## [ 'conferralRules'][ (conferral rule name)][ 'conferralRuleName'] == name of the conferral rule (again)
        ## [ 'conferralRules'][ (conferral rule name)][ 'conferralRuleFMF'] == path to .py or .pyc file (None if unspecified by the config file)
        ## [ 'conferralRules'][ (conferral rule name)][ 'conferralRuleFN']  == name of function in that file (None if unspecified)
        ## [ 'conferralRules'][ (conferral rule name)][ 'conferralRuleFArgString']  == extra args string to be passed to the function


        self.currentProcOperation = ProcOperation( topicMap, 'loading TMA "%s"' % ( TMAName), topicMap.originalPopulationTasks[ self.systemBootstrapOriginalPopulationTaskName])

        ## Now reify the new TMA.  "Reify it" means "create a proxy for it".
        TMAProxy = self.newProxyObject( topicMapName)
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_tmaConfigFilePath_TMAName_PCN, cachedTmaConfigFilePath)
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_TMADesc_TMAName_PCN, self.currentTMAConfigFileHoldingDict[ 'TMADesc'])
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_valueTypes_TMAName_PCN, None, dontSetPropertyValue = True)
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_propertyClasses_TMAName_PCN, None, dontSetPropertyValue = True)
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRules_TMAName_PCN, None, dontSetPropertyValue = True)
        pythonModules = {}
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_pythonModules_TMAName_PCN, pythonModules)  ## empty dict
        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.opc_system_TMAObject_TMAName_PCN, None, dontSetPropertyValue = True)
            ## The TMA object will be made the value in the
            ## Add_ overheadDict function that will be called when the
            ## SIP class is instantiated; meantime the value is None,
            ## meaning the property hasn't been given a value yet.

        self.newPropertyInstance( TMAProxy.proxyId, self.systemTMAName, topicMap.sipc_system_TMAName_PCN, TMAName)
        ## Must instantiate the SIP class last, so the Add_ function will have all the propertyInstances it needs to work with

        ## Having made the above call, the TMA object now exists in topicMap.TMAs[ (TMAName)].
        TMA = topicMap.TMAs[ TMAName]

        ## Now register the value types, property classes, and
        ## conferral rules, in that order, but within each of those
        ## three categories, register them in the order in which they
        ## were declared in the TMA config file.

        for valueTypeName in self.currentTMAConfigFileHoldingDict[ 'valueTypeSequence']:
            
            if self.nameIsBad( valueTypeName):
                traceback.print_stack()
                errMsg( 'Cannot name a value type "%s".  %s' % ( valueTypeName, self.nameIsBad( valueTypeName)))
                sys.exit( 1)

            valueTypeDict = self.currentTMAConfigFileHoldingDict[ 'valueTypes'][ valueTypeName]

            ## register ValueIsNotOfType__()
            if not valueTypeDict[ 'ValueIsNotOfType__FN']:
                print 'Warning: No ValueIsNotOfType__() function is registered for value type "%s" in TMA "%s".  Using the default, which will accept any kind of value.  Not recommended!' % ( valueTypeName, TMAName)
                valueTypeDict[ 'ValueIsNotOfType__FMF'] = self.pathToDefaultFunctionsModuleFile
                valueTypeDict[ 'ValueIsNotOfType__FN'] = 'DefaultValueIsNotOfType__'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']

            valueTypeDict[ 'cachedValueIsNotOfType__FMF'], \
                  valueTypeDict[ 'ValueIsNotOfType__FMN'], \
                  valueTypeDict[ 'ValueIsNotOfType__F'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    valueTypeDict[ 'ValueIsNotOfType__FMF'],
                    valueTypeDict[ 'ValueIsNotOfType__FN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )


            ## Register InstanceOf__ValueTypeToXMLContentString()
            if not valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFN']:
                valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFMF'] = self.pathToDefaultFunctionsModuleFile
                valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFN'] = 'DefaultInstanceOf__ValueTypeToXMLContentString'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']

            valueTypeDict[ 'cachedInstanceOf__ValueTypeToXMLContentStringFMF'], \
                  valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFMN'], \
                  valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFMF'],
                    valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )


            ## Register XMLContentStringToInstanceOf__ValueType()
          
            if not valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFN']:
                valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFMF'] = self.pathToDefaultFunctionsModuleFile
                valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFN'] = 'DefaultXMLContentStringToInstanceOf__ValueType'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']

            valueTypeDict[ 'cachedXMLContentStringToInstanceOf__ValueTypeFMF'], \
                  valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFMN'], \
                  valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFMF'],
                    valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )

            ## Reify the new value type.
            proxy = self.newProxyObject( topicMapName)

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_valueTypeName_valueType_PCN, valueTypeName)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_valueTypeTMAName_valueType_PCN, TMAName)

            if valueTypeDict[ 'valueTypeDesc']:
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_VTDesc_valueType_PCN, valueTypeDict[ 'valueTypeDesc'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsNotOfType__FMF_valueType_PCN, valueTypeDict[ 'cachedValueIsNotOfType__FMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsNotOfType__FMN_valueType_PCN, valueTypeDict[ 'ValueIsNotOfType__FMN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsNotOfType__FN_valueType_PCN, valueTypeDict[ 'ValueIsNotOfType__FN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsNotOfType__F_valueType_PCN, valueTypeDict[ 'ValueIsNotOfType__F'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsNotOfType__FArgString_valueType_PCN, valueTypeDict[ 'ValueIsNotOfType__FArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFMF_valueType_PCN, valueTypeDict[ 'cachedInstanceOf__ValueTypeToXMLContentStringFMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFMN_valueType_PCN, valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFMN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFN_valueType_PCN, valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringF_valueType_PCN, valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_InstanceOf__ValueTypeToXMLContentStringFArgString_valueType_PCN, valueTypeDict[ 'InstanceOf__ValueTypeToXMLContentStringFArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFMF_valueType_PCN, valueTypeDict[ 'cachedXMLContentStringToInstanceOf__ValueTypeFMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFMN_valueType_PCN, valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFMN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFN_valueType_PCN, valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeF_valueType_PCN, valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_XMLContentStringToInstanceOf__ValueTypeFArgString_valueType_PCN, valueTypeDict[ 'XMLContentStringToInstanceOf__ValueTypeFArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.sipc_system_valueType_PCN, self.catKey( TMAName, valueTypeName))  ## This one MUST be done last.

        for propertyClassName in self.currentTMAConfigFileHoldingDict[ 'propertyClassSequence']:
            
            if self.nameIsBad( propertyClassName):
                traceback.print_stack()
                errMsg( 'Cannot name a value type "%s".  %s' % ( propertyClassName, self.nameIsBad( propertyClassName)))
                sys.exit( 1)

            propertyClassDict = self.currentTMAConfigFileHoldingDict[ 'propertyClasses'][ propertyClassName]

            if not TMA.valueTypes.has_key( propertyClassDict[ 'valueTypeName']):
                errMsg( 'No value type named "%s" has been declared.  (Attempting to register property class "%s" in TMA "%s").' % ( propertyClassDict[ 'valueTypeName'], propertyClassName, TMAName))
                sys.exit( 1)

            ## Register Add__PropToOverheadDict()
            if not propertyClassDict[ 'Add__PropToOverheadDictFN']:
                propertyClassDict[ 'Add__PropToOverheadDictFMF'] = self.pathToDefaultFunctionsModuleFile
                propertyClassDict[ 'Add__PropToOverheadDictFN'] = 'DefaultAdd__PropToOverheadDict'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']

            propertyClassDict[ 'cachedAdd__PropToOverheadDictFMF'], \
                  propertyClassDict[ 'Add__PropToOverheadDictFMN'], \
                  propertyClassDict[ 'Add__PropToOverheadDictF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    propertyClassDict[ 'Add__PropToOverheadDictFMF'],
                    propertyClassDict[ 'Add__PropToOverheadDictFN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )

            ## Register Remove__PropFromOverheadDict()
            if not propertyClassDict[ 'Remove__PropFromOverheadDictFN']:
                propertyClassDict[ 'Remove__PropFromOverheadDictFMF'] = self.pathToDefaultFunctionsModuleFile
                propertyClassDict[ 'Remove__PropFromOverheadDictFN'] = 'DefaultRemove__PropFromOverheadDict'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']

            propertyClassDict[ 'cachedRemove__PropFromOverheadDictFMF'], \
                  propertyClassDict[ 'Remove__PropFromOverheadDictFMN'], \
                  propertyClassDict[ 'Remove__PropFromOverheadDictF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    propertyClassDict[ 'Remove__PropFromOverheadDictFMF'],
                    propertyClassDict[ 'Remove__PropFromOverheadDictFN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )

            ## Register ValueIsInvalidFor__Property()
            if propertyClassDict[ 'ValueIsInvalidFor__PropertyFN']:
                propertyClassDict[ 'cachedValueIsInvalidFor__PropertyFMF'], \
                      propertyClassDict[ 'ValueIsInvalidFor__PropertyFMN'], \
                      propertyClassDict[ 'ValueIsInvalidFor__PropertyF'] = \
                    self.registerFunction( 
                        os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                        propertyClassDict[ 'ValueIsInvalidFor__PropertyFMF'],
                        propertyClassDict[ 'ValueIsInvalidFor__PropertyFN'],
                        TMAName,
                        tmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                        pythonModules = pythonModules
                    )
            else:  ## No default for this one.  In the absence of one, the system just doesn't do the check, that's all.
                pass
                ## print 'Warning: No ValueIsInvalidFor__Property() function is registered for property class "%s" in TMA "%s".' % ( propertyClassName, TMAName)

            ## Register Merge__PropertyValues()
            if not propertyClassDict[ 'Merge__PropertyValuesFN']:
                propertyClassDict[ 'Merge__PropertyValuesFMF'] = self.pathToDefaultFunctionsModuleFile
                propertyClassDict[ 'Merge__PropertyValuesFN'] = 'DefaultMerge__PropertyValues'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']
                ## The default simply returns value1, and ignores value2.

            propertyClassDict[ 'cachedMerge__PropertyValuesFMF'], \
                  propertyClassDict[ 'Merge__PropertyValuesFNM'], \
                  propertyClassDict[ 'Merge__PropertyValuesF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    propertyClassDict[ 'Merge__PropertyValuesFMF'],
                    propertyClassDict[ 'Merge__PropertyValuesFN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )

            ## Register ValuesOf__PropertyInstancesAreSignificantlyDifferent()
            if not propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN']:
                propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'] = self.pathToDefaultFunctionsModuleFile
                propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN'] = 'DefaultValuesOf__PropertyInstancesAreSignificantlyDifferent'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']
                ## The default says they're significantly different if they're not equal/identical.

            propertyClassDict[ 'cachedValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'], \
                  propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN'], \
                  propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentF'] = \
                    self.registerFunction( 
                        os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                        propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'],
                        propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN'],
                        TMAName,
                        tmaConfigFilePath = regTmaConfigFilePath,
                        pythonModules = pythonModules
                    )

            ## Register ContextOf__PropertyIsInvalid
            if propertyClassDict[ 'ContextOf__PropertyIsInvalidFN']:
                propertyClassDict[ 'cachedContextOf__PropertyIsInvalidFMF'], \
                      propertyClassDict[ 'ContextOf__PropertyIsInvalidFMN'], \
                      propertyClassDict[ 'ContextOf__PropertyIsInvalidF'] = \
                    self.registerFunction( 
                        os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                        propertyClassDict[ 'ContextOf__PropertyIsInvalidFMF'],
                        propertyClassDict[ 'ContextOf__PropertyIsInvalidFN'],
                        TMAName,
                        tmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                        pythonModules = pythonModules
                    )
            ## No default.  The check is not simply not run (see function checkOneProxy()).  The
            ## basic checks on all proxies will still be done (does it
            ## have an SIP, etc.)


            ## Register UpdateProxyReferencesIn__Value
            if propertyClassDict[ 'UpdateProxyReferencesIn__ValueFN']:
                propertyClassDict[ 'cachedUpdateProxyReferencesIn__ValueFMF'], \
                      propertyClassDict[ 'UpdateProxyReferencesIn__ValueFMN'], \
                      propertyClassDict[ 'UpdateProxyReferencesIn__ValueF'] = \
                    self.registerFunction( 
                        os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                        propertyClassDict[ 'UpdateProxyReferencesIn__ValueFMF'],
                        propertyClassDict[ 'UpdateProxyReferencesIn__ValueFN'],
                        TMAName,
                        tmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                        pythonModules = pythonModules
                    )
            ## No default.  If there were a default, it would mean
            ## that for all property classes, the values of all their
            ## instances may contain proxy references.


            ## Register MergeProxiesBecause__PropertyInstancesSpecifySameSubject()
            if propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN']: ## i.e., if this is an SIP
                propertyClassDict[ 'cachedMergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'], \
                      propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN'], \
                      propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF'] = \
                    self.registerFunction( 
                        os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                        propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'],
                        propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN'],
                        TMAName,
                        tmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                        pythonModules = pythonModules
                    )
            ## No default.  If there were a default, all properties would have to be SIPs.

            ## Register ProxiesWith__ValueNotSignificantlyDifferentFrom()
            if not propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN']:
                propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMF'] = self.pathToDefaultFunctionsModuleFile
                propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN'] = 'DefaultProxiesWith__ValueNotSignificantlyDifferentFrom'
                regTmaConfigFilePath = ''
            else:
                regTmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']
                ## default works with other defaults

            propertyClassDict[ 'cachedProxiesWith__ValueNotSignificantlyDifferentFromFMF'], \
            propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMN'], \
            propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMF'],
                    propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN'],
                    TMAName,
                    tmaConfigFilePath = regTmaConfigFilePath,
                    pythonModules = pythonModules
                )

            ## Reify the new property class:

            proxy = self.newProxyObject( topicMapName)

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_propertyClassTMAName_propertyClass_PCN, TMAName)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_propertyClassName_propertyClass_PCN, propertyClassName)

            if propertyClassDict[ 'propertyClassDesc']:
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_PCDesc_propertyClass_PCN, propertyClassDict[ 'propertyClassDesc'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_PCValueType_propertyClass_PCN, propertyClassDict[ 'valueTypeName'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Add__PropToOverheadDictFMF_propertyClass_PCN, propertyClassDict[ 'cachedAdd__PropToOverheadDictFMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Add__PropToOverheadDictFMN_propertyClass_PCN, propertyClassDict[ 'Add__PropToOverheadDictFMN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Add__PropToOverheadDictFN_propertyClass_PCN, propertyClassDict[ 'Add__PropToOverheadDictFN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Add__PropToOverheadDictF_propertyClass_PCN, propertyClassDict[ 'Add__PropToOverheadDictF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Add__PropToOverheadDictFArgString_propertyClass_PCN, propertyClassDict[ 'Add__PropToOverheadDictFArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Remove__PropFromOverheadDictFMF_propertyClass_PCN, propertyClassDict[ 'cachedRemove__PropFromOverheadDictFMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Remove__PropFromOverheadDictFMN_propertyClass_PCN, propertyClassDict[ 'Remove__PropFromOverheadDictFMN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Remove__PropFromOverheadDictFN_propertyClass_PCN, propertyClassDict[ 'Remove__PropFromOverheadDictFN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Remove__PropFromOverheadDictF_propertyClass_PCN, propertyClassDict[ 'Remove__PropFromOverheadDictF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Remove__PropFromOverheadDictFArgString_propertyClass_PCN, propertyClassDict[ 'Remove__PropFromOverheadDictFArgString'])

            if propertyClassDict[ 'ValueIsInvalidFor__PropertyFN']:
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsInvalidFor__PropertyFMF_propertyClass_PCN, propertyClassDict[ 'cachedValueIsInvalidFor__PropertyFMF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsInvalidFor__PropertyFMN_propertyClass_PCN, propertyClassDict[ 'ValueIsInvalidFor__PropertyFMN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsInvalidFor__PropertyFN_propertyClass_PCN, propertyClassDict[ 'ValueIsInvalidFor__PropertyFN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsInvalidFor__PropertyF_propertyClass_PCN, propertyClassDict[ 'ValueIsInvalidFor__PropertyF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValueIsInvalidFor__PropertyFArgString_propertyClass_PCN, propertyClassDict[ 'ValueIsInvalidFor__PropertyFArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Merge__PropertyValuesFMF_propertyClass_PCN, propertyClassDict[ 'cachedMerge__PropertyValuesFMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Merge__PropertyValuesFMN_propertyClass_PCN, propertyClassDict[ 'Merge__PropertyValuesFNM'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Merge__PropertyValuesFN_propertyClass_PCN, propertyClassDict[ 'Merge__PropertyValuesFN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Merge__PropertyValuesF_propertyClass_PCN, propertyClassDict[ 'Merge__PropertyValuesF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_Merge__PropertyValuesFArgString_propertyClass_PCN, propertyClassDict[ 'Merge__PropertyValuesFArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMF_propertyClass_PCN, propertyClassDict[ 'cachedValuesOf__PropertyInstancesAreSignificantlyDifferentFMF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN_propertyClass_PCN, propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFMN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFN_propertyClass_PCN, propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFN'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentF_propertyClass_PCN, propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentF'])
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString_propertyClass_PCN, propertyClassDict[ 'ValuesOf__PropertyInstancesAreSignificantlyDifferentFArgString'])

            if propertyClassDict[ 'ContextOf__PropertyIsInvalidFN']:
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ContextOf__PropertyIsInvalidFMF_propertyClass_PCN, propertyClassDict[ 'cachedContextOf__PropertyIsInvalidFMF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ContextOf__PropertyIsInvalidFMN_propertyClass_PCN, propertyClassDict[ 'ContextOf__PropertyIsInvalidFMN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ContextOf__PropertyIsInvalidFN_propertyClass_PCN, propertyClassDict[ 'ContextOf__PropertyIsInvalidFN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ContextOf__PropertyIsInvalidF_propertyClass_PCN, propertyClassDict[ 'ContextOf__PropertyIsInvalidF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ContextOf__PropertyIsInvalidFArgString_propertyClass_PCN, propertyClassDict[ 'ContextOf__PropertyIsInvalidFArgString'])

            if propertyClassDict[ 'UpdateProxyReferencesIn__ValueFN']:
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_UpdateProxyReferencesIn__ValueFMF_propertyClass_PCN, propertyClassDict[ 'cachedUpdateProxyReferencesIn__ValueFMF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_UpdateProxyReferencesIn__ValueFMN_propertyClass_PCN, propertyClassDict[ 'UpdateProxyReferencesIn__ValueFMN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_UpdateProxyReferencesIn__ValueFN_propertyClass_PCN, propertyClassDict[ 'UpdateProxyReferencesIn__ValueFN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_UpdateProxyReferencesIn__ValueF_propertyClass_PCN, propertyClassDict[ 'UpdateProxyReferencesIn__ValueF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_UpdateProxyReferencesIn__ValueFArgString_propertyClass_PCN, propertyClassDict[ 'UpdateProxyReferencesIn__ValueFArgString'])

            if propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN']: ## i.e., if this is an SIP
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF_propertyClass_PCN, propertyClassDict[ 'cachedMergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN_propertyClass_PCN, propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFMN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN_propertyClass_PCN, propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF_propertyClass_PCN, propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString_propertyClass_PCN, propertyClassDict[ 'MergeProxiesBecause__PropertyInstancesSpecifySameSubjectFArgString'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_proxiesKilled_propertyClass_PCN, {})
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_propertyInstancesMerged_propertyClass_PCN, [])

            if propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN']:
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMF_propertyClass_PCN, propertyClassDict[ 'cachedProxiesWith__ValueNotSignificantlyDifferentFromFMF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFMN_propertyClass_PCN, propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFMN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFN_propertyClass_PCN, propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFN'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromF_propertyClass_PCN, propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromF'])
                self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_ProxiesWith__ValueNotSignificantlyDifferentFromFArgString_propertyClass_PCN, propertyClassDict[ 'ProxiesWith__ValueNotSignificantlyDifferentFromFArgString'])

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_propertyClassObject_propertyClass_PCN, None, dontSetPropertyValue = True)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_overheadDict_propertyClass_PCN, {})
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_propertyClassProcOperations_propertyClass_PCN, {})

            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.sipc_system_propertyClass_PCN, self.catKey( TMAName, propertyClassName))  ## This one MUST be done last.

        ## Finally, register the conferral rules
        for conferralRuleName in self.currentTMAConfigFileHoldingDict[ 'conferralRuleSequence']:
            
            if self.nameIsBad( conferralRuleName):
                traceback.print_stack()
                errMsg( 'Cannot name a conferral rule "%s".  %s' % ( conferralRuleName, self.nameIsBad( conferralRuleName)))
                sys.exit( 1)

            conferralRuleDict = self.currentTMAConfigFileHoldingDict[ 'conferralRules'][ conferralRuleName]

            conferralRuleDict[ 'cachedConferralRuleFMF'], \
                  conferralRuleDict[ 'ConferralRuleFMN'], \
                  conferralRuleDict[ 'ConferralRuleF'] = \
                self.registerFunction( 
                    os.path.dirname( self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath']),
                    conferralRuleDict[ 'conferralRuleFMF'],
                    conferralRuleDict[ 'conferralRuleFN'],
                    TMAName,
                    tmaConfigFilePath = self.currentTMAConfigFileHoldingDict[ 'tmaConfigFilePath'],
                    pythonModules = pythonModules
                )

            conferralRuleProxy = self.newProxyObject( topicMapName)

            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleName_conferralRule_PCN, conferralRuleName)
            if conferralRuleDict[ 'conferralRuleDesc']:
                self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_confRuleDesc_conferralRule_PCN, conferralRuleDict[ 'conferralRuleDesc'])
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleTMAName_conferralRule_PCN, TMAName)
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleProcOperations_conferralRule_PCN, {})
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleFMF_conferralRule_PCN, conferralRuleDict[ 'cachedConferralRuleFMF'])
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleFMN_conferralRule_PCN, conferralRuleDict[ 'ConferralRuleFMN'])
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleFN_conferralRule_PCN, conferralRuleDict[ 'conferralRuleFN'])
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleF_conferralRule_PCN, conferralRuleDict[ 'ConferralRuleF'])
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleFArgString_conferralRule_PCN, conferralRuleDict[ 'conferralRuleFArgString'])
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleTriggerRoles_conferralRule_PCN, {})
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleValueSourceRoles_conferralRule_PCN, {})
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.opc_system_conferralRuleObject_conferralRule_PCN, None, dontSetPropertyValue = True)
            ## the ConferralRule object will be made the value in the
            ## Add_ overheadDict function; meantime None, meaning the
            ## property hasn't been given a value yet.
            self.newPropertyInstance( conferralRuleProxy.proxyId, self.systemTMAName, topicMap.sipc_system_conferralRule_PCN, self.catKey( TMAName, conferralRuleName))
            ## The above one must be done last, so that the Add_ function will be playing with a full deck.

        self.currentProcOperation = None

        return TMA

    #######################################################
    def newPropertyInstance( self,
        proxyOrProxyId,     ## proxy or ID of proxy to attach this property to
        TMANameOrObject,     ## name of the TMA of new property instance
        propertyClassNameOrObject,   ## name of the class of new property instance
        propertyValue,       ## the value to give to the property instance
                        
            ## what follows is auditing info
        triggers = None,

                              ## If self.currentProcOperation.procSpecObject is an
                              ## OriginalPopulationTask or PropertyClass object,
                              ## this is Pythonic None.  If
                              ## self.currentProcOperation.procSpecObject is a Conferral Rule,
                              ## this is a dictionary in which the keys are role
                              ## names (each role is triggering, as opposed to
                              ## calculational), and the value of each key is a
                              ## list of propertyInstanceKeys.

        valueSources = None,

                              ## If self.currentProcOperation.procSpecObject is an
                              ## OriginalPopulationTask object, this is Pythonic
                              ## None.  If self.currentProcOperation.procSpecObject is a
                              ## PropertyClass object, this is a list of
                              ## property instance keys.  If
                              ## self.currentProcOperation.procSpecObject is a Conferral Rule,
                              ## this is a dictionary in which the keys are role
                              ## names (each role is calculational, as opposed
                              ## to triggering), and the value of each key is a
                              ## list of propertyInstanceKeys.

        **argDict            ## keywords:
                             ## 'dontSetPropertyValue' (= anything)
                             ##   means don't set the property value

                             ## 'merged'  (merged property instance values)

                             ## 'trigger'  (triggering property instances)
                             ##    a dict whose keys are conferral-triggering role names
                             ##    and whose values are lists of propertyInstanceKeys

                             ## 'calc'  (property instance values used as inputs to
                             ##          conferred value calculation)
                             ##    a dict whose keys are conferred-value-calculation role names
                             ##    and whose values are lists of propertyInstanceKeys
        ):

        if isinstance( proxyOrProxyId, types.StringType):
            proxyId = proxyOrProxyId
            if not self.proxies.has_key( proxyId):
                traceback.print_stack()
                errMsg( 'bad proxyId: "%s"' % ( proxyId))
                sys.exit( 1)
            proxy = self.proxies[ proxyId]
        elif isinstance( proxyOrProxyId, types.InstanceType):
            proxy = proxyOrProxyId
            if not hasattr( proxy, 'ObjectClass'):
                traceback.print_stack()
                errMsg( 'bad proxyOrProxyId argument: "%s"' % ( proxyOrProxyId))
                sys.exit( 1)
            if proxy.ObjectClass != 'ProxyObject':
                traceback.print_stack()
                errMsg( 'bad proxyOrProxyId argument: "%s"' % ( proxyOrProxyId))
                sys.exit( 1)
            proxyId = proxy.proxyId
        else:
            traceback.print_stack()
            errMsg( 'bad proxyOrProxyId argument: "%s"' % ( proxyOrProxyId))
            sys.exit( 1)

        topicMap = proxy.topicMap

        if isinstance( TMANameOrObject, types.StringType):
            TMAName = TMANameOrObject
            if not topicMap.TMAs.has_key( TMAName):
                traceback.print_stack()
                errMsg( 'No TMA named "%s" has been loaded.' % ( TMANameOrObject))
                sys.exit( 1)
            TMA = topicMap.TMAs[ TMAName]
        elif isinstance( TMANameOrObject, types.InstanceType):
            TMA = TMANameOrObject
            if not hasattr( TMA, 'ObjectClass'):
                traceback.print_stack()
                errMsg( 'bad TMANameOrObject argument: "%s"' % ( TMANameOrObject))
                sys.exit( 1)
            if TMA.ObjectClass != 'TMA':
                traceback.print_stack()
                errMsg( 'bad TMANameOrObject argument: "%s"' % ( TMANameOrObject))
                sys.exit( 1)
            TMAName = TMA.TMAName
            if not topicMap.TMAs.has_key( TMAName):
                traceback.print_stack()
                errMsg( 'bad TMANameOrObject argument: "%s"' % ( TMANameOrObject))
                sys.exit( 1)
        else:
            traceback.print_stack()
            errMsg( 'bad TMANameOrObject argument: "%s"' % ( TMANameOrObject))
            sys.exit( 1)

        if isinstance( propertyClassNameOrObject, types.StringType):
            propertyClassName = propertyClassNameOrObject
            if not TMA.propertyClasses.has_key( propertyClassName):
                traceback.print_stack()
                errMsg( 'bad propertyClassNameOrObject argument; there is no "%s" property class in TMA "%s".' % ( propertyClassNameOrObject, TMA.TMAName))
                sys.exit( 1)
            propertyClass = TMA.propertyClasses[ propertyClassName]
        elif isinstance( propertyClassNameOrObject, types.InstanceType):
            propertyClass = propertyClassNameOrObject
            if not hasattr( propertyClass, 'ObjectClass'):
                traceback.print_stack()
                errMsg( 'bad propertyClassNameOrObject argument: "%s"' % ( propertyClassNameOrObject))
                sys.exit( 1)
            if propertyClass.ObjectClass != 'PropertyClass':
                traceback.print_stack()
                errMsg( 'bad propertyClassNameOrObject argument: "%s"' % ( propertyClassNameOrObject))
                sys.exit( 1)
            propertyClassName = propertyClass.propertyClassName
            if not TMA.propertyClasses.has_key( propertyClassName):
                traceback.print_stack()
                errMsg( 'bad propertyClassNameOrObject argument: "%s"' % ( propertyClassNameOrObject))
                sys.exit( 1)
        else:
            traceback.print_stack()
            errMsg( 'bad propertyClassNameOrObject argument: "%s"' % ( propertyClassNameOrObject))
            sys.exit( 1)


        propertyInstance = PropertyInstance( self, proxyId, TMAName, propertyClassName)
        propertyInstance.procOperation = self.currentProcOperation

        if not argDict.has_key( 'dontSetPropertyValue'):
            if propertyClass.valueType.ValueIsNotOfType__FArgString:
                execStr = 'valueIsNotOfType = propertyClass.valueType.ValueIsNotOfType__F( self, propertyValue, propertyClass, propertyInstance, %s)' % ( propertyClass.valueType.ValueIsNotOfType__FArgString)
                exec( execStr)
            else:
                valueIsNotOfType = propertyClass.valueType.ValueIsNotOfType__F( self, propertyValue, propertyClass, propertyInstance)
            if valueIsNotOfType:
                traceback.print_stack()
                errMsg( 'property value "%s" reported invalid for value type "%s" by function %s() in %s. (The name of the property class is "%s".)  %s' % (
                    propertyValue,
                    propertyClass.valueTypeName,
                    propertyClass.valueType.ValueIsNotOfType__FN,
                    propertyClass.valueType.ValueIsNotOfType__FMF,
                    propertyClassName,
                    self.showProxy( proxy)))
                sys.exit( 1)

            if propertyClass.ValueIsInvalidFor__PropertyFN:
                if propertyClass.ValueIsInvalidFor__PropertyFArgString:
                    execStr = 'valueIsInvalid = propertyClass.ValueIsInvalidFor__PropertyF( self, propertyValue, propertyClass, propertyInstance, %s)' % ( propertyClass.ValueIsInvalidFor__PropertyFArgString)
                    exec( execStr)
                else:
                    valueIsInvalid = propertyClass.ValueIsInvalidFor__PropertyF( self, propertyValue, propertyClass, propertyInstance)
                if valueIsInvalid:
                    traceback.print_stack()
                    errMsg( 'property value "%s" reported invalid for instance of property class "%s" by function %s() in %s.' % (
                        propertyValue,
                        propertyClassName,
                        propertyClass.ValueIsInvalidFor__PropertyFN,
                        propertyClass.ValueIsInvalidFor__PropertyFMF))
                    sys.exit( 1)

            procSpecObject = self.currentProcOperation.procSpecObject
            if not hasattr( procSpecObject, 'ObjectClass'):
                traceback.print_stack()
                errMsg( 'bad procSpecObject: "%s".  If this is \'None\', you\'re probably trying to call newPropertyInstance() outside of an original population task function.  First register the original population task function using registerOriginalPopulationTask(), then call populate() to invoke that function.' % ( procSpecObject))
                sys.exit( 1)

            self.setPropertyValue( propertyInstance, propertyValue, triggers, valueSources)

        return propertyInstance

    #######################################################
    def newProxyObject( self, topicMapNameOrObject = None):
        ## TMA implementations and originalPopulationTask implementations
        ## should call this function, not ProxyObject(), in order to
        ## manufacture subject proxies.
        if not self.currentProcOperation:
            traceback.print_stack()
            errMsg( 'Calls to newProxyObject() can only be made within registered original population task functions that have been launched via a call to populate(), or within registered conferral rule functions that have been called by Versavant.')
            sys.exit( 1)
        if isinstance( topicMapNameOrObject, types.StringType):
            topicMapName = topicMapNameOrObject
            if not self.isTopicMapName( topicMapName):
                traceback.print_stack()
                errMsg( 'string passed as argument to newProxyObject() (%s) is not a topic map name.' % ( topicMapName))
                sys.exit( 1)
        elif topicMapNameOrObject == None:
            topicMapName = self.currentProcOperation.topicMap.topicMapName
        elif hasattr( topicMapNameOrObject, 'ObjectClass'):
            if topicMapNameOrObject.ObjectClass == 'TopicMap':
                topicMapName = topicMapNameOrObject.topicMapName
            else:
                traceback.print_stack()
                errMsg( 'object passed to newProxyObject() (%s) is not a TopicMap object' % ( topicMapNameOrObject))
                sys.exit( 1)
        else:
            traceback.print_stack()
            errMsg( 'argument passed to newProxyObject() (%s) is neither a TopicMap object nor the name of a known topic map' % ( topicMapNameOrObject))
            sys.exit( 1)

        proxy = self.ProxyObject( topicMapName)
        self.currentProcOperation.proxiesThatWereCreated[ proxy.proxyId] = proxy
        proxy.procOperationThatCreatedThisProxy = self.currentProcOperation

        return proxy

    #######################################################
    def newTopicMap( self,
                     topicMapName,  ## name of the topic map; must be unique in this session
                     TMDesc = '',  ## any string, presumably documenting what this topic map is about, etc.
                   ):  
        ## Versavant users should call this function when they want to manufacture a topic map.
        if self.nameIsBad( topicMapName):
            traceback.print_stack()
            errMsg( 'Cannot name a topic map "%s".  %s' % ( topicMapName, self.nameIsBad( topicMapName)))
            sys.exit( 1)

        self.TopicMap( self, topicMapName, TMDesc)

    #######################################################
    def parsePropertyKey2( self, propertyName):
        """
    Given a property name, return a duple that is the
    TMA name and the property class name.
        """
        propertyNameMatchObject = propertyNameRE.match( propertyName)
        try:
            return propertyNameMatchObject.group( 1), propertyNameMatchObject.group( 2)
        except:
            return None, None

    #######################################################
    def parsePropertyKey3( self, propertyInstanceKey):
        """
    Given a property instance key, return a triple that is the
    proxyId, the TMA name and the property class name.
        """
        propertyInstanceKeyMatchObject = propertyInstanceKeyRE.match( propertyInstanceKey)
        try:
            return propertyInstanceKeyMatchObject.group( 1), propertyInstanceKeyMatchObject.group( 2), propertyInstanceKeyMatchObject.group( 3)
        except:
            return None, None, None

    #######################################################
    def parsePropertyKey4( self, propertyAddress):
        """
    Given a property instance address, return a quadruple that is the
    topic map name, the proxyId, the TMA name and the property class name.
        """
        propertyAddressMatchObject = propertyAddressRE.match( propertyAddress)
        try:
            return propertyAddressMatchObject.group( 1), propertyAddressMatchObject.group( 2), propertyAddressMatchObject.group( 3), propertyAddressMatchObject.group( 4)
        except:
            return None, None, None, None

    #######################################################
    def populate( self, oPTObject):
        ## Versavant users call this function in order to launch a population task
        ## that has been registered via registerOriginalPopulationTask().
        self.currentProcOperation = ProcOperation( oPTObject.topicMap, 'executing original population task "%s"' % ( oPTObject.originalPopulationTaskName), oPTObject)

        if oPTObject.originalPopulationTaskFArgString:
            execStr = 'import %s\n%s.%s( self, oPTObject, %s)' % ( oPTObject.originalPopulationTaskFMN, oPTObject.originalPopulationTaskFMN, oPTObject.originalPopulationTaskFN, oPTObject.originalPopulationTaskFArgString)
        else:
            execStr = 'import %s\n%s.%s( self, oPTObject)' % ( oPTObject.originalPopulationTaskFMN, oPTObject.originalPopulationTaskFMN, oPTObject.originalPopulationTaskFN)
        exec( execStr)
        oPTObject.topicMap.originalPopulationTaskSequence.append( oPTObject.originalPopulationTaskName)

        self.currentProcOperation = None

    #######################################################
    def propertyInstanceFromPropertyAddress( self, propertyAddress):
        topicMapName, proxyId, TMAName, propertyClassName = self.parsePropertyKey4( propertyAddress)
        try:
            return self.topicMaps[ topicMapName].proxies[ proxyId].propertyInstances[ self.catKey( TMAName, propertyClassName)]
        except:
            pass

    #######################################################
    def propertyInstanceFromPropertyInstanceKey( self, propertyInstanceKey):
        proxyId, TMAName, propertyClassName = self.parsePropertyKey3( propertyInstanceKey)
        try:
            return self.proxies[ proxyId].propertyInstances[ self.catKey( TMAName, propertyClassName)]
        except:
            pass

    #######################################################
    def SIPOfProxy( self, proxy):
        for propertyInstanceKey in proxy.propertyInstances:
            propertyInstance = proxy.propertyInstances[ propertyInstanceKey]
            if self.propertyInstanceIsSIP( propertyInstance):
                return propertyInstance
        return None

    #######################################################
    def propertyInstanceIsSIP( self, propertyInstance):

        if propertyInstance.propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF:
            return True
        return False

    #######################################################
    def proxyIdFromInteger( self, integer):
        integerString = '%d' % integer
        return integerString.zfill( len( integerString) + vsv.proxyStrZeroFill)

    #######################################################
    def livingProxiesWithMatchingPropertyValue( self,
                          topicMapNameOrObject,
                          TMANameOrObject,
                          propertyClassNameOrObject,
                          propertyValue):
        ## Return a list of the living proxies whose subject would be
        ## regarded as the same as the subject of a mythical proxy
        ## that has an instance of propertyClass with value propertyValue.  In
        ## other words, this function implements a TMA-neutral,
        ## Versavant-wide, uniform query-by-subject capability.

        ## Implemented by the proxiesWithMatchingValueOf__Property()
        ## method of each property class.  The meaning of "matching"
        ## is revealed by the implementation of the particular
        ## function.  When implementing these functions for SIP
        ## classes, PLEASE make them work in a way that is consistent
        ## with the philosophy that recognizes subject sameness, and
        ## that determines whether two values are significantly
        ## different.  In any given SIP class, all three should
        ## reflect exactly the same philosophy.
        
        if isinstance( topicMapNameOrObject, types.StringType):
            if self.topicMaps.has_key( topicMapNameOrObject):
                topicMap = self.topicMaps[ topicMapNameOrObject]
            else:
                errMsg( '"%s" is not the name of a topic map.' % ( topicMapNameOrObject))
                sys.exit( 1)
        else:
            if isinstance( topicMapNameOrObject, types.InstanceType):
                topicMap = topicMapNameOrObject
                if not topicMap.ObjectClass == 'TopicMap':
                    errMsg( '"%s" is neither a TopicMap object nor the name of a topic map.' % ( topicMap))
                    sys.exit( 1)
            else:
                errMsg( '"%s" is neither a TopicMap object nor the name of a topic map.' % ( topicMap))
                sys.exit( 1)

        if isinstance( TMANameOrObject, types.StringType):
            if topicMap.TMAs.has_key( TMANameOrObject):
                TMA = topicMap.TMAs[ TMANameOrObject]
                if not TMA.ObjectClass == 'TMA':
                    errMsg( '"%s" is neither a TMA object nor the name of a TMA.' % ( TMANameOrObject))
                    sys.exit( 1)
            else:
                errMsg( '"%s" is not the name of a TMA in topic map %s.' % ( TMANameOrObject, topicMap.topicMapName))
                sys.exit( 1)
        else:
            if isinstance( TMANameOrObject, types.InstanceType):
                TMA = TMANameOrObject
                if not TMA.ObjectClass == 'TMA':
                    errMsg( '"%s" is neither a TMA object nor the name of a TMA.' % ( TMA))
                    sys.exit( 1)
                if TMA.topicMap.topicMapName != topicMap.topicMapName:
                    errMsg( 'The TMA object is not a TMA in topic map "%s"; it is a TMA in topic map "%s"!' % ( topicMap.topicMapName, TMA.topicMap.topicMapName))
                    sys.exit( 1)
            else:
                errMsg( '"%s" is neither a TMA object nor the name of a TMA.' % ( TMANameOrObject))
                sys.exit( 1)


        if isinstance( propertyClassNameOrObject, types.StringType):
            if TMA.propertyClasses.has_key( propertyClassNameOrObject):
                propertyClass = TMA.propertyClasses[ propertyClassNameOrObject]
                if not propertyClass.ObjectClass == 'PropertyClass':
                    errMsg( '"%s" is neither a PropertyClass object nor the name of a property class.' % ( propertyClassNameOrObject))
                    sys.exit( 1)
            else:
                errMsg( '"%s" is not the name of a property class in TMA "%s" in topic map "%s".' % ( propertyClassNameOrObject, TMA.TMAName, topicMap.topicMapName))
                sys.exit( 1)
        else:
            if isinstance( propertyClassNameOrObject, types.InstanceType):
                propertyClass = propertyClassNameOrObject
                if not propertyClass.ObjectClass == 'propertyClass':
                    errMsg( '"%s" is neither a PropertyClass object nor the name of a property class.' % ( propertyClass))
                    sys.exit( 1)
                if propertyClass.propertyClassName not in TMA.propertyClasses:
                    errMsg( 'The PropertyClass object is not a property class in topic map "%s", TMA "%s"' % ( topicMap.topicMapName, TMA.TMAName))
                    sys.exit( 1)
            else:
                errMsg( '"%s" is neither a PropertyClass object nor the name of a property class.' % ( propertyClassNameOrObject))
                sys.exit( 1)

##         if isinstance( propertyClassNameOrObject, types.StringType):
##             propertyClass = TMA.propertyClasses[ propertyClassNameOrObject]
##         else:
##             propertyClass = propertyClassNameOrObject

        if not propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF:
            errMsg( 'Property class "%s" is not an SIP.' % ( propertyClass.propertyClassName))
            sys.exit( 1)

        if propertyClass.valueType.ValueIsNotOfType__FArgString:
            execStr = 'valueIsNotOfType = propertyClass.valueType.ValueIsNotOfType__F( self, propertyValue, propertyClass, None, %s)' % ( propertyClass.valueType.ValueIsNotOfType__FArgString)
            exec( execStr)
        else:
            valueIsNotOfType = propertyClass.valueType.ValueIsNotOfType__F( self, propertyValue, propertyClass, None)
        if valueIsNotOfType:
            traceback.print_stack()
            errMsg( 'property value "%s" reported invalid for value type "%s" by function %s() in %s. (propertyClassName = "%s")' % (
                propertyValue,
                propertyClass.valueTypeName,
                propertyClass.valueType.ValueIsNotOfType__FN,
                propertyClass.valueType.ValueIsNotOfType__FMF,
                propertyClass.propertyClassName
                ))
            sys.exit( 1)

        if propertyClass.ValueIsInvalidFor__PropertyFN:
            if propertyClass.ValueIsInvalidFor__PropertyFArgString:
                execStr = 'valueIsInvalid = propertyClass.ValueIsInvalidFor__PropertyF( self, propertyValue, propertyClass, None, %s)' % ( propertyClass.ValueIsInvalidFor__PropertyFArgString)
                exec( execStr)
            else:
                valueIsInvalid = propertyClass.ValueIsInvalidFor__PropertyF( self, propertyValue, propertyClass, None)
            if valueIsInvalid:
                traceback.print_stack()
                errMsg( 'property value "%s" reported invalid for instance of property class "%s" by function %s() in %s.' % (
                    propertyValue,
                    propertyClass.propertyClassName,
                    propertyClass.ValueIsInvalidFor__PropertyFN,
                    propertyClass.ValueIsInvalidFor__PropertyFMF
                    ))
                sys.exit( 1)

        if not propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromF:
            errMsg( 'Implementation of property class "%s" does not have a \'ProxiesWith__ValueNotSignificantlyDifferentFrom\' function.' % ( propertyClass.propertyClassName))
            sys.exit( 1)

        if propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFArgString:
            execStr = 'proxyXList = propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromF( self, propertyClass, propertyValue, %s)' % ( propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFArgString)
            exec( execStr)
        else:
            proxyXList = propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromF( self, propertyClass, propertyValue)

        if not isinstance( proxyXList, types.ListType):
            traceback.print_stack()
            errMsg( 'Function %s in file %s did not return a list.' % ( propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFN, propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFMF))
            sys.exit( 1)

        if not len( proxyXList):
            return []  ## nothing matched
        else:
            return self.proxyListFromProxyXList( proxyXList, propertyClass)

        
    #######################################################
    def registerOriginalPopulationTask( self,
        topicMapName,  ## name of topic map to register this OPT in
        moduleFileName,  ## .py or .pyc file containing the OPT function
        originalPopulationTaskFN,  ## OPT function name
        taskName,  ## unique name being given to this population task
        origPopTaskDesc = '',  ## description of the original population task
        argString = '',  ## optional bunch of args to pass to the OPT function
                         ## (exec'ed verbatim).
        **args
        ):

        if self.nameIsBad( taskName):
            traceback.print_stack()
            errMsg( 'Cannot name an original population task "%s".  %s' % ( taskName, self.nameIsBad( taskName)))
            sys.exit( 1)

        ## Is the topicMapName good?
        if self.topicMaps.has_key( topicMapName):
            topicMap = self.topicMaps[ topicMapName]
        else:
            traceback.print_stack()
            errMsg( 'No such topic map: "%s".' % ( topicMapName))
            sys.exit( 1)
        
        if topicMap.originalPopulationTasks.has_key( taskName):
            traceback.print_stack()
            errMsg( 'There is already an originalPopulationTask registered \
in topic map "%s" whose name is "%s".' % ( topicMapName, taskName))
            sys.exit( 1)


        if not args.has_key( 'importation'):   ## if this is not an importation of an interchangeable Topic Map
            ## Below checks moduleFileName

            cachedModuleFilePath, originalPopulationTaskFMN, originalPopulationTaskF = \
                self.registerFunction(
                    os.path.abspath( '.'),
                    moduleFileName,
                    originalPopulationTaskFN,
                    taskName
                )

        self.currentProcOperation = ProcOperation( topicMap, 'registering original population task "%s"' % ( taskName), topicMap.originalPopulationTasks[ vsv.systemBootstrapOriginalPopulationTaskName])

        proxy = self.newProxyObject( topicMapName)
        if not args.has_key( 'importation'):
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_originalPopulationTaskFMF_originalPopulationTask_PCN, cachedModuleFilePath)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_originalPopulationTaskFMN_originalPopulationTask_PCN, originalPopulationTaskFMN)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_originalPopulationTaskFN_originalPopulationTask_PCN, originalPopulationTaskFN)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_originalPopulationTaskF_originalPopulationTask_PCN, originalPopulationTaskF)
            self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_originalPopulationTaskFArgString_originalPopulationTask_PCN, argString)
        self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_originalPopulationTaskProcOperations_originalPopulationTask_PCN, {})
        self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.opc_system_origPopTaskDesc_originalPopulationTask_PCN, origPopTaskDesc)

        self.newPropertyInstance( proxy.proxyId, self.systemTMAName, topicMap.sipc_system_originalPopulationTask_PCN, taskName)
        ## The above one must go last: it's the SIP and its
        ## implementation handles the overhead of creating the
        ## OriginalPopulationTask object.

        self.currentProcOperation = None

        return topicMap.originalPopulationTasks[ taskName]

    #######################################################
    def registerFunction( self,
                          defaultDirectory,         ## directory to which moduleFilePath is relative, if moduleFilePath is not absolute
                          moduleFilePathAsPassed,   ## path to module file containing function, as passed
                          functionName,     ## name of function
                          cacheDirName,     ## name of directory in which to cache the module.  Either a TMA name or an OPT name.
                          **args
                                            ## keyword args:
                                            ## tmaConfigFilePath ## the path to the TMA's config file, if caller is loadTMA()
                                            ## pythonModules  ## dictionary in which to record the modules names and their ACTUAL CACHED paths
                          ):
        """helper function for loadTMA()"""
        
        
        


        if args.has_key( 'tmaConfigFilePath'):
            tmaConfigFilePath = args[ 'tmaConfigFilePath']
        else:
            tmaConfigFilePath = None

        moduleFilePathAsPassed = moduleFilePathAsPassed.replace( '${VSVEXECDIR}', self.VersavantExecDirPath)
        moduleFilePath = os.path.expandvars( os.path.expanduser( moduleFilePathAsPassed))
        if not moduleFilePath.startswith("%s" % os.sep):
            moduleFilePath = os.path.join( defaultDirectory, moduleFilePath)
        if not os.path.isfile( moduleFilePath):
            traceback.print_stack()
            if tmaConfigFilePath:
                errMsg( 'Error in configuration file "%s": module file "%s" does not exist.' % (
                    tmaConfigFilePath,
                    moduleFilePath))
            else:
                errMsg( 'Cannot register functions in file "%s"; it doesn\'t exist.' % ( moduleFilePath))
            sys.exit( 1)

        identicalFileNameCounter = 0
        while True:
            identicalFileNameCounter += 1
            cachedModuleDirPath = os.path.join( self.VsvCacheDir, cacheDirName)
            cachedModuleFilePath = os.path.join( cachedModuleDirPath, '%s_%03d_%s' % ( cacheDirName.replace( ' ', '_'), identicalFileNameCounter, os.path.basename( moduleFilePath)))

            if not os.path.isdir( cachedModuleDirPath):
                os.mkdir( cachedModuleDirPath)

            if not self.moduleFilePathToCacheDirNames.has_key( moduleFilePath):  ## if this module file has not been cached already
                if not cachedModuleFilePath in self.cachedModuleFilePathToModuleFilePath:
                    shutil.copyfile( moduleFilePath, cachedModuleFilePath)
                    self.moduleFilePathToCacheDirNames[ moduleFilePath] = [ cacheDirName]
                    self.cachedModuleFilePathToModuleFilePath[ cachedModuleFilePath] = moduleFilePath
                    break
                ## else: we repeat the loop until we find a name for this file that hasn't already been used.
            else:  ## this module file path has been cached already, but was it already cached in the right directory?
                if cacheDirName in self.moduleFilePathToCacheDirNames[ moduleFilePath]:
                    if self.cachedModuleFilePathToModuleFilePath.has_key( cachedModuleFilePath):
                        if self.cachedModuleFilePathToModuleFilePath[ cachedModuleFilePath] == moduleFilePath:
                            break  ## This is the good one that already exists.
                else:
                    if not cachedModuleFilePath in self.cachedModuleFilePathToModuleFilePath:  ## wait for one that doesn't exist yet
                        shutil.copyfile( moduleFilePath, cachedModuleFilePath)
                        self.moduleFilePathToCacheDirNames[ moduleFilePath].append( cacheDirName)
                        self.cachedModuleFilePathToModuleFilePath[ cachedModuleFilePath] = moduleFilePath
                        break

        ## Below checks function
        importableModuleName = self.moduleImporter( cachedModuleFilePath)
        if not self.readmodule_ex( importableModuleName).has_key( functionName):
            traceback.print_stack()
            if args.has_key( 'tmaConfigFilePath'):
                errMsg( 'Error in configuration file "%s": function "%s" does not exist in module "%s".'
                    % ( args[ 'tmaConfigFilePath'],
                        functionName, moduleFilePath))
            else:
                errMsg( 'Function "%s" cannot be imported from module file "%s"' % ( functionName, moduleFilePath))
            sys.exit( 1)
        execStr = 'import %s\nactualFunction = %s.%s\n' % ( importableModuleName, importableModuleName, functionName)
        exec execStr

        if args.has_key( 'pythonModules'):
            args[ 'pythonModules'][ importableModuleName] = cachedModuleFilePath

        return cachedModuleFilePath, importableModuleName, actualFunction

    #######################################################
    def setPropertyValue( self,
                          propertyInstance,
                              ## propertyInstance object whose ._value will be set

                          propertyValue,
                              ## the value to set the ._value attribute to

                          triggers = None,
                              ## If self.currentProcOperation.procSpecObject is an OriginalPopulationTask or PropertyClass
                              ## object, this is Pythonic None.  If self.currentProcOperation.procSpecObject is a Conferral
                              ## Rule, this is a dictionary in which the keys are role names (each
                              ## role is triggering, as opposed to calculational), and the value of
                              ## each key is a list of propertyInstanceKeys.

                          valueSources = None
                              ## If self.currentProcOperation.procSpecObject is an OriginalPopulationTask object, this is
                              ## Pythonic None.  If self.currentProcOperation.procSpecObject is a PropertyClass object, this
                              ## is a list of property instance keys.  If self.currentProcOperation.procSpecObject is a
                              ## Conferral Rule, this is a dictionary in which the keys are role
                              ## names (each role is calculational, as opposed to triggering), and
                              ## the value of each key is a list of propertyInstanceKeys.

                          ):

        if propertyValue == None:
            traceback.print_stack()
            errMsg( 'Cannot set property value to None; None means the value has not been set.\n%s' % ( propertyInstance))
            sys.exit( 1)

        if propertyInstance._value != None:
            traceback.print_stack()
            errMsg( 'Property instance\'s value has already been set.\n%s' % ( propertyInstance))
            sys.exit( 1)

        topicMap = propertyInstance.topicMap

        if not self.currentProcOperation:
            traceback.print_stack()
            errMsg( 'No current ProcOperation object. \n\
Look at the traceback stack information printed above.  If you see an \n\
original population task implementation in the stack, the problem is \n\
probably that you are calling that function directly, instead of via \n\
Versavant\'s populate() function.  If you see a conferral rule \n\
implementation in the stack, your error may be that your conferral \n\
rule implementation is trying to do a conferral without first calling \n\
conferralMayBeSignificant(), or it is ignoring \n\
conferralMayBeSignificant()\'s report that there is no point in doing \n\
a conferral, and it is attempting to do the conferral \n\
anyway.')
            sys.exit( 1)

        if propertyInstance.proxy.proxyId not in self.currentProcOperation.proxiesThatWereCreated:
            traceback.print_stack()
            errMsg( 'You\'re \n\
trying to set the value of a property instance \n\
(%s) that appears in a \n\
proxy (%s) that was created as part of processing operation "%s", \n\
not this processing operation ("%s"). \n\
Versavant does not allow you to set the values of property instances \n\
in proxies that were not created as part of the same processing \n\
operation (if it did, its auditing records would be considerably \n\
harder to understand).  One way to fix this problem is to change your code for \n\
%s "%s" so that it creates \n\
a new proxy that has the same subject as proxy %s, \n\
and set its property instances however you like.  At merge \n\
time (when you call Versavant\'s merge() function), this new proxy \n\
will be merged with proxy %s, creating a new proxy that will have the \n\
combination of property instances that you want.' % (
    propertyInstance.propertyInstanceKey,
    propertyInstance.proxy.proxyId,
    propertyInstance.proxy.procOperationThatCreatedThisProxy.procOperationID,
    self.currentProcOperation.procOperationID,
    self.currentProcOperation.procSpecObject.ObjectClass,
    self.currentProcOperation.procSpecObject.procSpecName,
    propertyInstance.proxy.proxyId,
    propertyInstance.proxy.proxyId
    ))
            sys.exit( 1)

        currentProcSpec = self.currentProcOperation.procSpecObject
        if currentProcSpec.ObjectClass == 'OriginalPopulationTask':
            if valueSources != None or triggers != None:
                traceback.print_stack()
                errMsg( 'If we\'re in an original population task function (the vsv.currentProcSpec is an OriginalPopulationTask), then the valueSources and triggers arguments to newPropertyInstance() should either be omitted or both be Pythonic None.')
                sys.exit( 1)

        elif currentProcSpec.ObjectClass == 'PropertyClass':

            if ( not isinstance( valueSources, types.ListType)) or triggers != None:
                traceback.print_stack()
                errMsg( 'If the currentProcSpec is a PropertyClass, then the valueSources argument should be a list and the triggers argument should be Pythonic None.')
                sys.exit( 1)

            if len( valueSources) < 1:
                traceback.print_stack()
                errMsg( 'Since the currentProcSpec is a PropertyClass, the valueSources argument should be a list that is not empty.')
                sys.exit( 1)

            for propertyInstanceKey in valueSources:
                if not self.isPropertyInstanceKey( propertyInstanceKey, topicMap):
                    traceback.print_stack()
                    errMsg( 'Bad propertyInstanceKey key (%s) in list passed as valueSources argument.' % ( propertyInstanceKey))
                    sys.exit( 1)

        elif currentProcSpec.ObjectClass == 'ConferralRule':
            if ( not isinstance( valueSources, types.DictType)) or ( not isinstance( triggers, types.DictType)):
                traceback.print_stack()
                errMsg( 'If the currentProcSpec is a ConferralRule, then the valueSources argument and the triggers argument should both be non-empty dictionaries.  triggers == "%s";  valueSources == "%s"' % ( triggers, valueSources))
                sys.exit( 1)
            if len( valueSources) < 1 or len( triggers) < 1:
                traceback.print_stack()
                errMsg( 'If the currentProcSpec is a ConferralRule, then the dictionaries passed as the valueSources argument and the triggers arguments cannot be empty.')
                sys.exit( 1)

            ## check valueSources
            valueSourceCount = 0
            for roleName in valueSources:
                propertyInstanceKey = valueSources[ roleName]
                valueSourceCount += 1
                if not self.isPropertyInstanceKey( propertyInstanceKey, topicMap):
                    traceback.print_stack()
                    errMsg( 'Bad propertyInstanceKey key (%s) in valueSources[ \'%s\'] ' % ( propertyInstanceKey, roleName))
                    sys.exit( 1)
            if valueSourceCount == 0:
                traceback.print_stack()
                errMsg( 'No value sources in valueSources!')
                sys.exit( 1)


            ## check triggers
            triggerCount = 0
            for roleName in triggers:
                propertyInstanceKey = triggers[ roleName]
                triggerCount += 1
                if not self.isPropertyInstanceKey( propertyInstanceKey, topicMap):
                    traceback.print_stack()
                    errMsg( 'Bad propertyInstanceKey key (%s) in triggers[ \'%s\'] ' % ( propertyInstanceKey, roleName))
                    sys.exit( 1)
            if triggerCount == 0:
                traceback.print_stack()
                errMsg( 'No triggers!')
                sys.exit( 1)

            ## TMA modularity enforcement
            if propertyInstance.propertyClass.TMA.TMAName != currentProcSpec.TMA.TMAName:
                ## Conferral rules are not allowed to instantiate the property classes of other TMAs, unless
                ## both of the following conditions are met: (1) they are SIPs, and (2) they indicate the same subjects
                ## as SIP instances that already exist in the topic map.  This rule keeps TMAs from messing up each other's
                ## logic, while still supporting the possibility of "bridging TMAs" -- TMAs whose conferral rules cause
                ## heterogeneously-defined subject proxies to merge.

                ## Is the property instance an SIP?
                if not propertyInstance.propertyClass.MergeProxiesBecause__PropertyInstancesSpecifySameSubjectF:
                    errMsg( '\
Error in conferral rule "%s" of TMA "%s": Attempting to add an \
instance of property class "%s" of TMA "%s", which is not an SIP.  \
Conferral rules can confer the properties of other TMAs, but only \
if those properties are SIPs, and only if they indicate the same \
subjects as SIPs that already exist elsewhere in the topic map. \
This preserves the modularity of TMAs and therefore protects and \
enhances the value of your topic map.  To avoid this constraint \
and to create property instances of multiple TMAs freely, use an \
original population task, not a conferral rule. \
' % (
                        currentProcSpec.conferralRuleName,
                        currentProcSpec.TMA.TMAName,
                        propertyInstance.propertyClass.propertyClassName,
                        propertyInstance.propertyClass.TMA.TMAName))
                    sys.exit( 1)

                ## Does another SIP of the same class already indicate the same subject?
                if propertyInstance.propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFArgString:
                    execStr = 'returnValue = propertyInstance.propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromF( vsv, propertyInstance.propertyClass, propertyValue, %s)' % ( propertyInstance.propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromFArgString)
                    exec( execStr)
                else:
                    returnValue = propertyInstance.propertyClass.ProxiesWith__ValueNotSignificantlyDifferentFromF( vsv, propertyInstance.propertyClass, propertyValue)

                if not returnValue:
                    errMsg( '\
Error in conferral rule "%s" of TMA "%s": Attempting to add an \
instance of property class "%s" of TMA "%s".  \
Conferral rules can confer the properties of other TMAs, but only \
if those properties are SIPs (this one is), and only if they indicate the same \
subjects as SIPs that already exist elsewhere in the topic map (no such SIPs already exist). \
This constraint preserves the modularity of TMAs and therefore protects and \
enhances the value of TMAs, and therefore of your topic map.  To avoid this constraint \
and to create property instances of multiple TMAs freely, use an \
original population task, not a conferral rule. The value you were \
attempting to set was "%s". \
' % (
                        currentProcSpec.conferralRuleName,
                        currentProcSpec.TMA.TMAName,
                        propertyInstance.propertyClass.propertyClassName,
                        propertyInstance.propertyClass.TMA.TMAName,
                        propertyValue))
                    self.inspect( topicMap = propertyInstance.topicMap, showProxies = 'liveNonSystem')
                    sys.exit( 1)
            
                
                for equivalentProxyOrProxyId in returnValue:
                    if isinstance( equivalentProxyOrProxyId, types.StringType):
                        proxy = vsv.isProxyId( equivalentProxyOrProxyId, topicMap)
                    else:
                        proxy = equivalentProxyOrProxyId
                    existingPropertyInstance = proxy.propertyInstances[ propertyInstance.propertyInstanceInProxyKey]
                    if id( propertyValue) == id( existingPropertyInstance._value):
                        traceback.print_stack()
                        errMsg( '\
Error in conferral rule "%s" of TMA "%s": \
Attempting to add an instance of property class \
"%s" of TMA "%s", \
whose value is exactly the same object (as opposed to being a copy of \
that object, which would be perfectly OK) as the value of an \
already-existing property, "%s". \
Conferral rules can confer the properties of other TMAs, but only if \
those properties are SIPs (this one is), and only if they indicate the \
same subjects as SIPs that already exist elsewhere in the topic map \
(this one does), and only if their values are *copies* of those \
values.  They cannot be the same objects.  If they were allowed to be the same objects, there would be a \
strong possibility that the integrity of the governing TMA\'s \
record-keeping would be compromised, especially (but not exclusively) \
in cases where the SIP values contain proxyIds (proxy references). \
This error message is designed to preserve the modularity of all \
TMAs, and therefore of your topic maps.  To avoid this error \
message, write your conferral rule so that it *copies* the SIP value, \
rather than making a reference to it.  For values that are objects, \
you can use "copy.copy()".  For strings, you can use "\'%%s\' %% \
(value)".  The value you were attempting \
to set was "%s".\
' % (
                            currentProcSpec.conferralRuleName,
                            currentProcSpec.TMA.TMAName,
                            propertyInstance.propertyClass.propertyClassName,
                            propertyInstance.propertyClass.TMA.TMAName,
                            existingPropertyInstance.propertyInstanceKey,
                            propertyValue))
                        self.inspect( topicMap = propertyInstance.topicMap, showProxies = 'liveNonSystem')
                        sys.exit( 1)

        else:
            traceback.print_stack()
            errMsg( 'currentProcSpec argument is of inappropriate class (%s)' % ( currentProcSpec.ObjectClass))
            sys.exit( 1)
            

        ## check to see if this object is already the value of another property, anywhere
        if propertyInstance.TMAName != self.systemTMAName:
            if id( propertyValue) in self.propertyValueObjectsDict:
                traceback.print_stack()
                self.errMsg( 'Attempting to set value of property %s to the same object that is already the value of property %s.  You must use a copy; you cannot use the same object' % ( 
                    self.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey),
                    self.propertyValueObjectsDict[ id( propertyValue)],
                                 ))
                sys.exit( 1)

        ## record the value
        propertyInstance.procOperation = procOperation = self.currentProcOperation
        procOperation.valueSources = valueSources
        procOperation.triggers = triggers
        procOperation.propertyValuesThatWereSet[ propertyInstance.propertyInstanceKey] = \
            propertyInstance._value = propertyValue
        self.propertyValueObjectsDict[ id( propertyValue)] = self.catKey( propertyInstance.topicMap.topicMapName, propertyInstance.propertyInstanceKey)
        procOperationID = procOperation.procOperationID

        if currentProcSpec.ObjectClass == 'ConferralRule':
            conferralRule = currentProcSpec  ## this is just so you can read this code!

            ## set dependentPropertyInstances of valueSources properties
            for roleName in valueSources:
                propertyInstanceKey = valueSources[ roleName]

                dependentPropertyInstancesDict = topicMap.propertyInstanceFromPropertyKey3( vsv, propertyInstanceKey).dependentPropertyInstances
                if dependentPropertyInstancesDict.has_key( propertyInstance.propertyInstanceKey):
                    dependentPropertyInstancesDict[ propertyInstance.propertyInstanceKey].append( procOperation)
                else:
                    dependentPropertyInstancesDict[ propertyInstance.propertyInstanceKey] = [ procOperation]

            TMARuleKey = self.catKey( conferralRule.TMA.TMAName, conferralRule.conferralRuleName)
            conferralTriggerAncestry = propertyInstance.conferralTriggerAncestry

            for roleName in triggers:

                ## set conferralsTriggered attribute of each triggering property instance
#                triggeringPropertyInstance = topicMap.propertyInstances[ triggers[ roleName]]
                triggeringPropertyInstance = topicMap.propertyInstanceFromPropertyKey3( vsv, triggers[ roleName])
                conferralsTriggered = triggeringPropertyInstance.conferralsTriggered

                triggeredConferralKey = self.catKey( TMARuleKey, roleName)

                if conferralsTriggered.has_key( triggeredConferralKey):
                    conferralsTriggered[ triggeredConferralKey][ procOperationID] = procOperation
                else:
                    conferralsTriggered[ triggeredConferralKey] = { procOperationID: procOperation}

                ## set conferralTriggerAncestry attribute of this property instance
                for triggeredConferral in conferralsTriggered:
                    if not conferralTriggerAncestry.has_key( triggeredConferral):
                        conferralTriggerAncestry[ triggeredConferral] = {}
                    for procOperationID in conferralsTriggered[ triggeredConferral]:
                        conferralTriggerAncestry[ triggeredConferral][ procOperationID] = conferralsTriggered[ triggeredConferral][ procOperationID]
                oldConferralTriggerAncestry = triggeringPropertyInstance.conferralTriggerAncestry
                for oldConferralTriggerRoleKey in oldConferralTriggerAncestry:
                    if not conferralTriggerAncestry.has_key( oldConferralTriggerRoleKey):
                        conferralTriggerAncestry[ oldConferralTriggerRoleKey] = {}
                    for procOperationID in oldConferralTriggerAncestry[ oldConferralTriggerRoleKey]:
                        conferralTriggerAncestry[ oldConferralTriggerRoleKey][ procOperationID] = oldConferralTriggerAncestry[ oldConferralTriggerRoleKey][ procOperationID]

                if len( conferralTriggerAncestry[ triggeredConferralKey]) > conferralRule.conferralRuleTriggerRoles[ roleName]:
                    traceback.print_stack()
                    errMsg(
'Property instance "%s" and/or its conferral ancestors has played conferral \
triggering role "%s" in operations of conferral rule "%s" %d times, which is \
more than the limit of %d times.  You may have a condition in which this \
conferral rule is triggering itself, or in which this conferral rule triggers \
one or more other conferral rules whose operations trigger this conferral rule \
again, thus creating an endless chain of conferrals.  Or you may need to set the \
limit for this role to a higher value in the configuration file for TMA "%s" ("%s"). \
(The default limit is %d.)' % (
    propertyInstance.propertyInstanceKey,
    roleName,
    conferralRule.conferralRuleName,
    len( conferralTriggerAncestry[ triggeredConferralKey]),
    conferralRule.conferralRuleTriggerRoles[ roleName],
    conferralRule.TMA.TMAName,
    conferralRule.TMA.tmaConfigFilePath,
    self.defaultConferralRuleRoleTriggeringLimit))
                    self.inspect( topicMap = propertyInstance.topicMap, propertyInstanceKey = propertyInstance.propertyInstanceKey)
                    sys.exit( 1)

            self.conferralOccurred = True

        ## call Add__PropToOverheadDict function
        addPropInstanceToOverheadDictFunction = propertyInstance.propertyClass.Add__PropToOverheadDictF
        if propertyInstance.propertyClass.Add__PropToOverheadDictFArgString:
            execStr = 'addPropInstanceToOverheadDictFunction( self, propertyInstance, vsv.proxies[ propertyInstance.propertyClassProxyIds[ 0]].propertyInstances[ propertyInstance.topicMap.opc_system_overheadDict_propertyClass_PNK]._value, %s)' % ( propertyInstance.propertyClass.Add__PropToOverheadDictFArgString)
            exec( execStr)
        else:
            addPropInstanceToOverheadDictFunction( self, propertyInstance, vsv.proxies[ propertyInstance.propertyClassProxyIds[ 0]].propertyInstances[ propertyInstance.topicMap.opc_system_overheadDict_propertyClass_PNK]._value)


    #######################################################
    def showLiveNonSystemProxies( self, tmName):
        message = ''
        proxyIdList = vsv.topicMaps[ tmName].proxies.keys()
        proxyIdList.sort( cmpStringsAsIntegers)
        for proxyId in proxyIdList:
            proxy = vsv.topicMaps[ tmName].proxies[ proxyId]

            if not proxy.forwardTo:
                if len( proxy.TMAsWithSIPsInThisProxy) < 1:
                    message = message + vsv.showProxy( proxy)
                elif len( proxy.TMAsWithSIPsInThisProxy) == 1:
                    if proxy.TMAsWithSIPsInThisProxy.keys()[ 0] != vsv.systemTMAName:
                        message = message + vsv.showProxy( proxy)
                else: ## len( proxy.TMAsWithSIPsInThisProxy) > 1 
                    message = message + vsv.showProxy( proxy)
        return message
    #######################################################
    def showProxy( self, proxyOrProxyId):

        if isinstance( proxyOrProxyId, types.StringType):
            proxy = self.isProxyId( proxyOrProxyId)
        else:
            proxy = proxyOrProxyId

        message = '\nproxyId == %s\n' % ( proxy.proxyId)

        propertyKey2List = propertyKey2Sort( proxy)
        for propertyKey2 in propertyKey2List:
            property = proxy.propertyInstances[ propertyKey2]
            if vsv.propertyInstanceIsSIP( property):
                sipOrOpStr = '(SIP)'
            else:
                sipOrOpStr = '(OP)'
            message = message + '%-5.5s %35.35s   %-70s\n' % (
               sipOrOpStr,
               propertyKey2,
               self.showValue( property._value)
               )
        return message

    #######################################################
    def showValue( self, value):
        message = ''
        if isinstance( value, types.InstanceType):
            if hasattr( value, 'ObjectClass'):
                message = message+'(%s at 0x%x)' % (
                    value.ObjectClass,
                    id( value)
                    )
            else:
                message = message+'(instance at 0x%x of unknown class)' % (
                    id( value))
        elif isinstance( value, types.StringType):
            message = message + '(String:) \'%s\'' % ( value)
        elif isinstance( value, types.NoneType):
            message = message + '(Pythonic None)'
        elif isinstance( value, types.ListType):
            if len( value) == 0:
                message = message + '[] (empty list at 0x%x)' % ( id( value))
            elif len( value) == 1:
                message = message + '[ %s] (list at 0x%x)' % ( self.showValue( value[ 0]), id( value))
            else:
                message = message + '(%d-item list at 0x%x)' % ( len( value), id( value))

        elif isinstance( value, types.TupleType):
            if len( value) == 0:
                message = message + '[] (empty tuple at 0x%x)' % ( id( value))
            elif len( value) == 1:
                message = message + '( %s) (tuple at 0x%x)' % ( self.showValue( value[ 0]), id( value))
            else:
                message = message + '(%d-member tuple at 0x%x)' % ( len( value), id( value))

        elif isinstance( value, types.DictType):
            message = message + '(%d-key dictionary at 0x%x)' % (
                len( value),
                id( value))
        elif isinstance( value, types.FunctionType):
            message = message + '(Function %s() in module %s)' % ( value.func_name, value.__module__)
        elif isinstance( value, types.MethodType):
            message = message + '(Method %s() in module %s)' % ( value.func_name, value.__module__)
        else:
            message = message + '%s' % ( value)

        return message
        
    def versaCopy( self, value):
        ## return a copy of whatever the hell it is
        if isinstance( value, types.InstanceType):
            return copy.copy( value)
        elif isinstance( value, types.StringType):
            return '%s' % ( value)
        elif isinstance( value, types.ListType):
            return value[:]
        elif isinstance( value, types.TupleType):
            return value[:]
        elif isinstance( value, types.DictType):
            return value.copy()
        elif isinstance( value, types.NoneType):
            return None
        elif isinstance( value, types.FunctionType):
            return value
        else:
            traceback.print_stack()
            errMsg( 'Don\'t know how to copy this type: %s.', type( value))
            sys.exit( 1)


#######################################################
def main():

    vsv = Versavant()
    vsv.newTopicMap( 'TestTM', 'nothing to say about it')
    vsv.inspect( '')


#######################################################
if __name__ == "__main__":
    main()


