def main(): myLogger = MyLogger(LOGFILE="/tmp/StopAllRunnableProcesses.log", STDOUT=True, DEBUG=True) adminObject = AdminClient(logger=myLogger, hostname="dilabvirt31-v1", cellName='cellA') try: myclient = adminObject.createSOAPDefault() results = adminObject.getResults() # adminObject.logResults( results ) except Exception as e: myLogger.logIt("main(): " + str(e) + "\n") myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise # Endtry mycell = "ServicesA" mynodeName = "node_ServicesA_01" myserver = "as_wdt_01" myappName = "DamnSchappettEA" mycluster = "cl_ServicesA_a" rc = False # scope = "Cell=" + str( mycell ) + ":Node=" + str( mynodeName ) + ":Cluster=" + str( mycluster ) + ":Server=" + str( myserver ) # scope = "Cell=" + str( mycell ) + ":Node=" + str( mynodeName ) + ":Server=" + str( myserver ) configService = ConfigService(adminClient=myclient, logger=myLogger) myStopAllRunnableProcesses = StopAllRunnableProcesses(adminObject, configService, logger=myLogger) threadList = [] for mythread in range(0, 3): current = StopAllRunnableProcesses(adminObject, configService, threadName='thread' + str(mythread), logger=myLogger) threadList.append(current) current.start() # Endfor for mythread in threadList: mythread.join() myLogger.logIt("main(): " + str(mythread) + "\n") # Endfor myStopAllRunnableProcesses.closeMe() adminObject.closeMe()
myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise #Endtry cellName = "ServicesA" nodeName = "node_ServicesA_01" serverName = "as_ServicesA_a01" clusterName = "cl_ServicesA_a" jdbcProvider = "OracleJdbcDriverXA" dataSource = "ForOracleXAJF" template = "DataSoure_ora_6" myscope = "Node=" + nodeName + ":Server=" + serverName #myscope = "Node=" + nodeName + ":ServerIndex:ServerEntry=" + serverName configService = ConfigService(adminClient=myclient, logger=myLogger) templateListManager = TemplateListManager(configService, type="ApplicationServer", logger=myLogger) myApplicationClassLoaderPolicyManager = ApplicationClassLoaderPolicyManager( adminObject, configService, templateListManager, scope=myscope, logger=myLogger) for mylist in myApplicationClassLoaderPolicyManager.attributesList: myApplicationClassLoaderPolicyManager.deepLogOfAttributes(mylist) #Endfor for mylist in myApplicationClassLoaderPolicyManager.attributesList: myApplicationClassLoaderPolicyManager.deepPrintOfAttributes(mylist)
myLogger.logIt( "main(): Started...\n" ) try: myclient = adminObject.createSOAPDefault() results = adminObject.getResults() #adminObject.logResults( results ) except Exception, e: myLogger.logIt( "main(): " + str(e) + "\n" ) myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise #Endtry cellName = "ServicesA" nodeName = "node_ServicesA_01" serverName = "as_was7test_01" clusterName = "cl_was7test_a" configService = ConfigService( adminClient=myclient, logger=myLogger ) #myTemplateListManager = TemplateListManager( configService, type="JAASAuthData", logger=myLogger) #myTemplateListManager = TemplateListManager( configService, type="DataSource", logger=myLogger) #myTemplateListManager = TemplateListManager( configService, type="JDBCProvider", logger=myLogger) #myTemplateListManager = TemplateListManager( configService, type="J2EEResourceProperty", logger=myLogger) #myTemplateListManager = TemplateListManager( configService, type="J2CResourceAdapter", logger=myLogger) #myTemplateListManager = TemplateListManager( configService, type="NamedEndPoint", logger=myLogger) myTemplateListManager = TemplateListManager( configService, type="Property", logger=myLogger) #templateList = myTemplateListManager.getTemplatesList() #for template in templateList: # configDataId = myTemplateListManager.configService.configServiceHelper.getConfigDataId( template ) # myLogger.logIt( "main(): configDataId=" + str( configDataId ) + "\n" ) ##Endif myTemplateListManager.logTemplatesList()
myclient = adminObject.createSOAPDefault() results = adminObject.getResults() #adminObject.logResults( results ) except Exception, e: myLogger.logIt("main(): " + str(e) + "\n") myLogger.logIt( "main(): Unable to connect to the AdminClient(). Make sure that the WebSphere Server Manager is running.\n" ) raise #Endtry cellName = "ServicesA" nodeName = "node_ServicesA_01" serverName = "as_was7test_01" clusterName = "cl_was7test_a" configService = ConfigService(adminClient=myclient, logger=myLogger) myJDBCResourceManager = JDBCResourceManager(adminObject, configService, scope="Cell=ServicesA", logger=myLogger) attrNames = myJDBCResourceManager.getAttributeNames() myresults = myJDBCResourceManager.getJDBCAttributesList() #rIndex = 0 #for rowAttrList in myresults: # #myLogger.logIt( "main(): rowAttrList=" + str( rowAttrList ) + "\n" ) # for myAttr in rowAttrList: # k = myAttr.getName() # v = myAttr.getValue() # myLogger.logIt( "main(): rIndex=" + str( rIndex ) + "-->" + str( k ) + "=" + str( v ) + "\n" ) # #Endfor
def doWork(): """Do all the real work for this program.""" rVal = True rc = 0 printInfo() wasAdminClient = AdminClient(hostname="dilabvirt31-v1", logger=CONFIG['logger']) myclient = wasAdminClient.createSOAPDefault() configService = ConfigService(adminClient=myclient, logger=CONFIG['logger']) session = Session() # query to get dmgr dmgr = configService.resolve(session, "Node=cell101N2:Server=as_cell101a_01")[0] # query to get the trace service component in dmgr. #pattern = configService.configServiceHelper.createObjectName( None, "TraceService" ) pattern = ConfigServiceHelper.createObjectName(None, "TraceService") traceService = ObjectName( configService.queryConfigObjects(session, dmgr, pattern, None)[0].toString()) # get the current dmgr's trace specification. trace = configService.getAttribute(session, traceService, "startupTraceSpecification") print "trace is " + str(trace) # set the dmgr's trace specification to new value. newTrace = String("*=all=enabled") #newTrace = String( "*=info" ) attrList = AttributeList() attrList.add(Attribute("startupTraceSpecification", newTrace)) configService.setAttributes(session, traceService, attrList) newTrace = String( configService.getAttribute(session, traceService, "startupTraceSpecification")) print "new trace is " + str(newTrace) ## save the chanage. configService.save(session, False) # set it back. #configService.configServiceHelper.setAttributeValue( attrList, "startupTraceSpecification", trace ) ConfigServiceHelper.setAttributeValue(attrList, "startupTraceSpecification", trace) configService.setAttributes(session, traceService, attrList) newTrace = configService.getAttribute(session, traceService, "startupTraceSpecification") print "trace is set back to " + str(newTrace) configService.save(session, False) configService.discard(session) return rc