|
|
|
Starta
Action : was.starta (Category : was, Name : starta, By : kikonf)
Complete Name : was.starta.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 starta plugin : Start one Application The following shows the main Source Code File for the Action : was.starta 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 Starta(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') self.startApplication(scope_attrs.application, node, server, indent=indent) elif server_type=='as': isStarted=self.startApplication(scope_attrs.application, node, server, indent=indent) def startApplication(self, application, node, server, indent=None): self_funct='startApplication' verbose('Process Server MBean retreiving.', 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()) # Recuperer : Valeur de l'exception et la Mimer ds clause Except !!! AdminControl.invoke(ps, 'startApplication', application) try: AdminControl.invoke(ps, 'startApplication', application) except: etype, evalue=sys.exc_info()[:2] return True def verbose(self, name): verbose('Application:' + name + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
Trademarks :
|