Tuesday, May 25, 2010

Getting all Object Type WebSphere 6 in python

Since it got me some while getting those few lines together, I'm putting it here.
All the object type available with the xml file where you can find them.
It's for wsadmin tools version 6.x

-----------

import sys
import re

saveout = sys.stdout
outfile = open('ConfigPropXML.txt', 'w')
sys.stdout = outfile

for type in AdminConfig.types().splitlines():
  XmlFile = []
  noDupes = []
  if AdminConfig.list( type ) != '':
    for AList in AdminConfig.list( type ).splitlines():
      expression = re.compile( r"\w*.xml" )
      p = expression.findall( AList )
      XmlFile.append( p )
    for i in XmlFile:
      if not noDupes.count(i):
        noDupes.append(i)
    print '[' + type + ']'
    print noDupes
    print ''
    print AdminConfig.attributes( type )
    print ''

# restore stdout
outfile.flush()
outfile.close()
sys.stdout = saveout

-----

Example:

[WebModuleDeployment]
[['deployment.xml']]

altDD String
applicationDeployment ApplicationDeployment@
classloader Classloader
classloaderMode ENUM(PARENT_FIRST, PARENT_LAST)
configs DeployedObjectConfig(ApplicationConfig, ModuleConfig, WebModuleConfig, EJBModuleConfiguration)*
deploymentId String
startingWeight int
targetMappings DeploymentTargetMapping*
uri String

1 comment:

voyance said...

Some talk too much without saying anything! Up to here I find that seeks clear and precise way bravo ...