A short Article on CMO’s — WLST variables

WLST, CMO’s and Built-in Variables

CMO is the WLST in built variable. These are like our JAVA keywords having a dedicated meaning and functionality. CMO stands for Current Management Object. While programming in WLST we can use cmo to point the current MBean (object) instance you are navigating into. The cmo value is changed when we navigate to different hierarchy of MBeans under different MBean trees in WebLogic (except jndi tree). Please refer the following example on the same:-

…………………..

………………..

connect(username, password, url)

edit()

startEdit()

cd(‘/Servers/server1’)

s1=cmo

cd(‘/Servers/server2’)

s2=cmo

print ‘Listenport of server1 -> ‘ + s1.getListenPort()

print ‘Listenport of server2 -> ‘ + s2.getListenPort()

…………………..

………………..

On observing above we can conclude that cmo can be used for invoking operations on the respective MBean object.

Similar to CMO, we have many other WLST in-built variables helping us to make the WLST programming simple and efficient. Following is the link listing all these attributes:

http://download.oracle.com/docs/cd/E12839_01/web.1111/e13813/reference.htm#i1003217

For example, we have the storeUserConfig() to Create a user configuration file and an associated key file.

Note: Make sure that in your WLST variables you don’t store any of your own information. If you do so then WLST will overwrite these variables during your interaction like connect, startEdit etc. Hence, make sure you understand these WLST variables, use them in your scripts, do not use them to store your information and be comfortable with the WLST programming.

2 comments

Comments are closed.