Date Created: Thu 19-Feb-2009

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


    Advanced listing of Server using Jython in WebSphere 7

    def convertToList( inlist ):
    outlist = []
    if (len(inlist) > 0):
    if (inlist[0] == '[' and inlist[len(inlist) - 1] == ']'):
    # Special checking when the config name contain space
    if (inlist[1] == "\"" and inlist[len(inlist)-2] == "\""):
    clist = inlist[1:len(inlist) -1].split(")\" ")
    else:
    clist = inlist[1:len(inlist) - 1].split(" ")
    #endIf
    else:
    clist = inlist.split(java.lang.System.getProperty("line.separator"))
    #endIf

    for elem in clist:
    elem = elem.rstrip();
    if (len(elem) > 0):
    if (elem[0] == "\"" and elem[len(elem) -1] != "\""):
    elem = elem+")\""
    #endIf
    outlist.append(elem)
    #endIf
    #endFor
    #endIf
    return outlist
    #endDef


    # List servers with specified server type
    servers = AdminTask.listServers('[-serverType APPLICATION_SERVER ]')
    # Convert Jython string to list
    servers = AdminUtilities.convertToList(servers)

    # Loop through each server in server list
    newServerList = []
    for aServer in servers:
    # Obtain server and node names
    sname = aServer[0:aServer.find("(")]
    print "Server name="+sname+"\n"
    print sname
    nname = aServer[aServer.find("nodes/")+6:aServer.find("servers/")-1]
    print "Node name="+nname+"\n"
    # Retrieve the server config id
    sid = AdminConfig.getid("/Node:"+nname+"/Server:"+sname)
    print "Server id="+sid+"\n"
    if (newServerList .count(sid) <= 0):
    newServerList .append(sid)
    #endFor
    print newServerList

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories