|
|
|
Wms
Action : was.wms (Category : was, Name : wms, By : kikonf)
Complete Name : was.wms.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 wms plugin : Creates a set of Worker Managers The following shows the main Source Code File for the Action : was.wms 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 Wms(wasAction): def extract(self, scope_attrs=None, name=None, prefix=None, **keywords): scope_id, scope_attrs, scope=self.getScope(scope_attrs=scope_attrs, indent=self.getIndent()) self.verbose(scope_attrs, name=name, prefix=prefix) indent=self.getIndent() + 3*' ' wms_node=self.newTop() # because in extract, this return a blank wms node. wms_node.setAttrs(prefix=prefix) # feeding it with attributes. mkNodeScope(wms_node, scope_attrs, isUnique=True) ## tag: scope verbose('WorkManagerInfo listing.', level=self.getVerbose(), ifLevel=4, indent=indent) wms=getStartByNameAsDict(split( AdminConfig.list('WorkManagerInfo', scope_id) )) for wname in wms.keys(): if prefix!=None and name!=None and wname==prefix + '_' + name \ or prefix==None and name!=None and wname==name \ or prefix!=None and name==None and wname.startswith(prefix) \ or prefix==None and name==None: work_managers=getShowAsDict(AdminConfig.show(wms[wname])) verbose('WorkManagerInfo:' + wname + ' listed.', level=self.getVerbose(), ifLevel=3, indent=indent) _name=wname if prefix!=None:_name=wname.split(prefix + '_')[1] if work_managers.has_key('description') and work_managers['description']!=None:desc=work_managers['description'][1:-1] else:desc=None if desc==DESIGN_NOTICE:desc=None wms_node.newNode('wm', name=_name, jndi_name=work_managers['jndiName'], max_threads=work_managers['maxThreads'], min_threads=work_managers['minThreads'], desc=desc) def remove(self, no_name, no_name_no_prefix): wms_node = self.getTop() wms_attrs = wms_node.getAttrs() scope_id, scope_attrs, scope=self.getScope(parent_node=wms_node, indent=self.getIndent()) #-- Retreives scope self.verbose(scope_attrs, prefix=wms_attrs.prefix) indent=self.getIndent() + 3*' ' # no_name/no_name_no_prefix prefix=wms_attrs.prefix if no_name_no_prefix:prefix=None if no_name_no_prefix or wms_attrs.prefix!=None: self.rmvWm(prefix=prefix, indent=indent) else: wms_nodes=wms_node.getNode('wm') for wm_node in wms_nodes: wm_attrs=wm_node.getAttrs() self.rmvWm(name=wm_attrs.name, indent=indent) def inject(self): self_funct='inject' wms_node = self.getTop() wms_attrs = wms_node.getAttrs() scope_id, scope_attrs, scope=self.getScope(parent_node=wms_node, indent=self.getIndent()) #-- Retreives scope self.verbose(scope_attrs, prefix=wms_attrs.prefix) indent=self.getIndent() + 3*' ' if wms_attrs.prefix!=None:self.rmvWm(prefix=wms_attrs.prefix, indent=indent) wms_nodes=wms_node.getNode('wm') for wm_node in wms_nodes: wm_attrs=wm_node.getAttrs() cmdvalues=[] # - name if wms_attrs.prefix==None:name=wm_attrs.name else:name=wms_attrs.prefix + '_' + wm_attrs.name if wms_attrs.prefix==None:self.rmvWm(name=name, indent=indent) cmdvalues.append(['name', name]) cmdvalues.append(['jndiName', wm_attrs.jndi_name]) cmdvalues.append(['maxThreads', wm_attrs.max_threads]) cmdvalues.append(['minThreads', wm_attrs.min_threads]) cmdvalues.append(['threadPriority', 5]) cmdvalues.append(['isGrowable', 'false']) if wm_attrs.desc!=None:cmdvalues.append(['description', wm_attrs.desc]) else:cmdvalues.append(['description', DESIGN_NOTICE]) verbose('WorkManagerProvider retreiving.', level=self.getVerbose(), ifLevel=4, indent=indent) wpv=AdminConfig.getid(self.getScopeCP() +'/WorkManagerProvider:WorkManagerProvider/') verbose('WorkManagerInfo:' + name + ' creating.', level=self.getVerbose(), ifLevel=4, indent=indent) AdminConfig.create("WorkManagerInfo", wpv, cmdvalues) verbose('WorkManagerInfo:' + name + ' created.', level=self.getVerbose(), ifLevel=3, indent=indent) def rmvWm(self, name=None, prefix=None, indent=None): scope_id, scope_attrs, scope=self.getScope() verbose('WorkManagerInfo listing.', level=self.getVerbose(), ifLevel=4, indent=indent) wms=getStartByNameAsDict(split( AdminConfig.list('WorkManagerInfo', scope_id) )) for wname in wms.keys(): if prefix!=None and wname.startswith(prefix) \ or prefix==None and name!=None and name==wname \ or prefix==None and name==None: verbose('WorkManagerInfo:' + wname + ' removing.', level=self.getVerbose(), ifLevel=4, indent=indent) AdminConfig.remove(wms[wname]) verbose('WorkManagerInfo:' + wname + ' removed.', level=self.getVerbose(), ifLevel=3, indent=indent) def verbose(self, scope_attrs, name=None, prefix=None): scope=str(scope_attrs).replace("'", '')[1:-1] if name!=None:verbose('WorkManagerInfo:' + name + ', at scope:' + scope + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent()) elif prefix!=None:verbose('WorkManagerInfos under prefix:' + prefix + ', at scope:' + scope + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent()) else:verbose('WorkManagerInfos at scope:' + scope + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
Trademarks :
|