To run the Jython debugger demo, complete the following steps:
# # (C) Copyright IBM Corp. 2004,2006 - All Rights Reserved. # DISCLAIMER: # The following source code is sample code created by IBM Corporation. # This sample code is not part of any standard IBM product and is provided # to you solely for the purpose of assisting you in the development of your # applications. The code is provided 'AS IS', without warranty or condition # of any kind. IBM shall not be liable for any damages arising out of your # use of the sample code, even if IBM has been advised of the possibility of # such damages. # # CHANGE HISTORY: # 2.0 (10feb2006) initial Jython version # # SUGGESTED DEBUGGER DEMO/TEST: # 1) Select Window > Preferences > General > Editors > Text Editors and select the Show line # numbers check box. Select OK. # 2) Set a breakpoint at line 35 ("apps=apps.split...") and verify the server is running. # 3) Right-click in the Jython editor and select DebugAs > AdministrativeScript, specifying this # program as its target and wait until the debugger stops at the breakpoint line. # 4) In the Debug view, select the STEP-OVER button and in the Variables View see how the "apps" # change into a List element # 5) Set breakpoint at line 59 ("state=displayServerInfo(wsadminNode)") # 6) Select the RESUME button and wait until the debugger stops at the new breakpoint line. # 7) Select the STEP-INTO button and then select the STEP-OVER button. The output is displayed # in ConsoleView) # 8) Select the STEP-RETURN button and wait until debugger stops at return. # 9) Select the STEP-OVER button to return, then select the RESUME button to run to completion. # 10) Repeat the demo, but target a remote WebSphere Application Server # (launch debugger with wsadmin parameters -host xx -port yy) # print "getting apps..." apps = AdminApp.list() apps = apps.split(java.lang.System.getProperty('line.separator')) print "contains apps:\n" for app in apps: print app print "\nApps done.\n" def displayServerInfo( wsadminNode): wsadminSvr = AdminControl.queryNames("node="+wsadminNode+",type=Server,*") print "svr="+wsadminSvr wsadminServer = AdminControl.getAttribute(wsadminSvr,"name") print "ServerName="+wsadminServer print "wsadminMgmt="+AdminControl.getAttribute(wsadminSvr, "processType") wsadminSvrId = AdminControl.getConfigId(wsadminSvr) print "svrId="+wsadminSvrId if(wsadminSvrId != 0): print "wsadminServerType="+AdminConfig.showAttribute(wsadminSvrId, "serverType") #endIf wsadminState = AdminControl.getAttribute(wsadminSvr, "state") return wsadminState #endDef wsadminNode = AdminControl.getNode() print "NodeName="+wsadminNode state = displayServerInfo(wsadminNode) print "state="+state print "\nDone.\n" #