cle_clock
Home > wikikonf >  was/actions/by kikonf > stopa







Stopa

print

Action : was.stopa   (Category : was, Name : stopa, By : kikonf)
Complete Name : was.stopa.by.kikonf
Version : 5.0        License : Modified BSD License

Purpose of the was category :
Easy to customize. This category use in background the wsadmin command in jython mode (through AdminConfig, AdminControl and AdminTask), to drive WebSphere Application Server ® configuration.
You can use it to manage the whole WebSphere ® architecture.

Purpose of this stopa plugin : Stop one Application

The following shows the main Source Code File for the Action : was.stopa

Toggle lines
##  Copyright (c) 2008, Patrick Germain Placidoux
##  All rights reserved.
##
##  This file is part of Kikonf Public Software.
##
##  Kikonf Public Software is released under the modified BSD License,
##  which should accompany it or any part of it in the file "COPYING".
##  If you do not have this file you can access the license 
##  through the WWW at http://www.kikonf.org/license/bsd/license.txt.
## 
##  Home: http://www.kikonf.org
##  Contact: kikonf@gmx.com



from actions.was.tools import *



class Stopa(wasAction):
    
    def run(self):
        self_funct='run'
        starta_node = self.getTop()        
        starta_attrs = starta_node.getAttrs()
        indent=self.getIndent() + 3*' '
        if not starta_node.hasNode('scope'):raise xception.kikonfActionSystemException(self, self_funct, 'Missing scope node,  scope node is required !')
        scope_attrs=starta_node.getNode('scope')[0].getAttrs()
        list_scope_attrs=rtvAppTargets(application=scope_attrs.application)
        self.verbose(scope_attrs.application)
        
        # list_scope_attrs: a list of dicts like that : [{'cluster': cluster, 'node': node, 'server': server, 'server_type':server_type}), ...]
        for srvs in list_scope_attrs:
            cluster, node, server, server_type=srvs['cluster'], srvs['node'], srvs['server'], srvs['server_type']
            if cluster!=None:
                verbose('ServerCluster retreiving.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
                c=AdminConfig.getid('/ServerCluster:' + cluster)        
                mbrs=split(AdminConfig.showAttribute(c, 'members'))
                
                for mbr in mbrs:
                    server=AdminConfig.showAttribute(mbr, 'memberName')
                    node=AdminConfig.showAttribute(mbr, 'nodeName')                    
                    isStarted=self.stopApplication(scope_attrs.application, node, server, indent=indent)
                    
            elif server_type=='as':
                
                isStarted=self.stopApplication(scope_attrs.application, node, server, indent=indent)
        
    def stopApplication(self, application, node, server, indent=None):
        self_funct='stopApplication'        
        verbose('Process Server MBean retreinving.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        ps = AdminControl.queryNames('cell=' + self.getCell() +',node=' + node + ',type=ApplicationManager,process=' + server + ',*')
        if ps=='':
            verbose('Server:' + server + '/node:' + node + ' is not started . Skipping !', level=self.getVerbose(), ifLevel=2, indent=indent)
            return False
        
        verbose('Process Server MBean invoking start:' + application + ', on Target:' + 'Server:' + server + '/node:' + node + '.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        try:
            AdminControl.invoke(ps, 'stopApplication', application)
        except:pass
        
        return True
        
    def verbose(self, name):
        verbose('Application:' + name + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
							
(Source: <KIKONF_INSTALLATION_DIR>/plugins/actions/was/stopa/by/kikonf/stopa.py)


  • Line 1 to 3 say something , say something , say something
  • Line 10 to 17 say something , say something , say something , say something , say something
  • Line 20 to 25 say something



Trademarks :
  • "IBM", "WebSphere", "WebSphere Aplication Server", "WAS" are registred trademarks of International Business Machines Corporation.
  • "Java" and "JVM" are a registred trademarks of Oracle and/or its affiliates.
  • Other names may be trademarks of their respective owners.

Copyright © 2011 - Patrick Placidoux, Hélène Malamoud