cle_clock
Home > wikikonf >  wls/actions/by kikonf > crtcluster







Crtcluster

print

Action : wls.crtcluster   (Category : wls, Name : crtcluster, By : kikonf)
Complete Name : wls.crtcluster.by.kikonf
Version : 4.0        License : Modified BSD License

Purpose of the wls category :
Easy to customize. This category use in background the wlst command in jython mode, to drive WebLogic Server ® configuration.
You can use it to manage the whole WebLogic ® architecture.

Purpose of this crtcluster plugin : Creates a new cluster

The following shows the main Source Code File for the Action : wls.crtcluster

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.wls.tools import *



class Crtcluster(wlsAction):

    def extract(self, name=None, **keywords):
        self_funct='extract'
        self.verbose(name=name)
        indent=self.getIndent() + 3*' '
        
        if name!=None:cls=[name]
        else:
            cmo=cd('/')
            cls=cmo.getClusters()
            cls=[cl.getName() for cl in cls]
        
        for cname in cls:
            if name!=None and name==cname \
            or name==None:
                cmo=cd('/Clusters/' + cname)                
                verbose('Cluster:' + cname + ' retreiving.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
                crtcluster_node=self.newTop()
                if cmo.isWeblogicPluginEnabled():enable_plugin='true'
                else:enable_plugin='false'
                desc=cmo.getNotes()
                if desc==DESIGN_NOTICE:desc=None
                crtcluster_node.setAttrs(name=cname, enable_plugin=enable_plugin, desc=desc)
                verbose('Cluster:' + cname + ' retreived.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())

    def remove(self, no_name, no_name_no_prefix):
        crtcluster_node = self.getTop()        
        crtcluster_attrs = crtcluster_node.getAttrs()
        self.verbose(name=crtcluster_attrs.name)
        indent=self.getIndent() + 3*' '
        
        self.rmvCluster(crtcluster_attrs.name, indent=indent)
        
    def inject(self):
        self_funct='inject'
        crtcluster_node = self.getTop()        
        crtcluster_attrs = crtcluster_node.getAttrs()
        self.verbose(name=crtcluster_attrs.name)
        indent=self.getIndent() + 3*' '
        
        self.rmvCluster(crtcluster_attrs.name, indent=indent) #-- remove first

        verbose('Cluster:' + crtcluster_attrs.name + ' creating.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        cmo=cd('/')
        cmo.createCluster(crtcluster_attrs.name)
        cmo=cd('/Clusters/' + crtcluster_attrs.name)
        if crtcluster_attrs.desc==None:desc=DESIGN_NOTICE
        else:desc=crtcluster_attrs.desc
        cmo.setNotes(desc)
        cmo.setClusterMessagingMode('unicast')
        if crtcluster_attrs.enable_plugin=='true':cmo.setWeblogicPluginEnabled(True)
        verbose('Cluster:' + crtcluster_attrs.name + ' created.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
    def rmvCluster(self, name, indent=None):
        cmo=cd('/')
        cl=cmo.lookupCluster(name)
        # cl=getMBean('/Clusters/' + name)
        if cl==None:return

        verbose('Cluster:' + name + ' removing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile())
        editService.getConfigurationManager().removeReferencesToBean(cl)
        cmo=cd('/')
        cmo.destroyCluster(cl)        
        verbose('Cluster:' + name + ' removed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile())
        
    def verbose(self, name=None, logFile=None):
        if name!=None:verbose('Cluster:' + name + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent(), level=self.getVerbose(), ifLevel=2, indent=self.getIndent(), logFile=self.getLogFile())
        else:verbose('Clusters.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent(), logFile=self.getLogFile())
							
(Source: <KIKONF_INSTALLATION_DIR>/plugins/actions/wls/crtcluster/by/kikonf/crtcluster.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 :
  • "oracle", "Weblogic", "Weblogic Server", "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