# List WAS types that are currently instantiated in this cell
# The caller must provide the name of a WAS type
# as a ccommand line parameter
# Show the configured attributes for each type

import sys

def listConfigurationAttributeValues( name, kind ):
    raw = AdminConfig.showall(name)
    attributeList = raw.splitlines()
    print "     There are",len(attributeList),"attributes that you can configure for this",kind
    if  len(attributeList) > 0:
        print "     These values come from the XML files in some profile's config directory\n     The current runtime values for these attributes could very well be different"
    for x in attributeList:
        print "    - - - ->",x
    print "                         - - -\n"



if len(sys.argv) > 0:
    a = sys.argv[0]
    print "We are about to print out the complete object names of all the ",a," that are currently executing in this cell"

    alive = AdminControl.queryNames("type="+a+",*").splitlines()
    if len(alive ) > 0:
	   print "\nThere are",len(alive),a+("(s)"),"instantiated at this time"
	   for x in alive:
            print x
            id = AdminControl.getConfigId(x)
            if len(id) > 0:
                listConfigurationAttributeValues(id,a)
            else:
                print "ATTENTION:\nThis is a(n)",a,"that has no configuration ID\nYou can only modify its runtime characteristics\n"
    else:
        print "We don't have any",a,"instantiated"
else:
    print "[usage]  dumpAnything.py NameOfWASType"
AdminConfig.reset()
