Wednesday, December 15, 2010

WebLogic Scripting Tool Tip – relax the syntax with the easy button

This blog was originally posted on when I worked for Oracle.

s0105150_sc7[1] I stumbled on to this feature in WLST tonight called easeSyntax. Apparently it’s a hidden feature that one of the WebLogic support engineers blogged about that allows you to simplify the commands in the interactive mode to have fewer parentheses and quotes. For example, see how some of the commands instead of typing “ls()” I can type '”ls” or “cd(“/somepath”)” can become “cd /somepath”. It’s not going to save the world, but it will help cut down on some extra typing.

The example I was researching when stumbling into this was for how to print the runtime status of deployed application named “hello” on the “AdminServer”. See the below output.

wls:/base_domain/domainConfig> easeSyntax()


You have chosen to ease syntax for some WLST commands.

However, the easy syntax should be strictly used in

interactive mode. Easy syntax will not function properly in

script mode and when used in loops. You can still use the

regular jython syntax although you have opted for easy


Use easeSyntax to turn this off.

Use help(easeSyntax) for commands that support easy syntax

wls:/base_domain/domainConfig> domainRuntime


wls:/base_domain/domainRuntime> ls

dr--   AppRuntimeStateRuntime

dr--   CoherenceServerLifeCycleRuntimes

dr--   ConsoleRuntime

dr--   DeployerRuntime

dr--   DeploymentManager

dr--   DomainServices

dr--   LogRuntime

dr--   MessageDrivenControlEJBRuntime

dr--   MigratableServiceCoordinatorRuntime

dr--   MigrationDataRuntimes

dr--   PolicySubjectManagerRuntime

dr--   SNMPAgentRuntime

dr--   ServerLifeCycleRuntimes

dr--   ServerRuntimes

dr--   ServerServices

dr--   ServiceMigrationDataRuntimes


-r--   ActivationTime                               Wed Dec 15 22:37:02 PST 2010

-r--   MessageDrivenControlEJBRuntime               null

-r--   MigrationDataRuntimes                        null

-r--   Name                                         base_domain

-rw-   Parent                                       null

-r--   ServiceMigrationDataRuntimes                 null

-r--   Type                                         DomainRuntime


-r-x   preDeregister                                Void :

-r-x   restartSystemResource                        Void : WebLogicMBean(


wls:/base_domain/domainRuntime> cd AppRuntimeStateRuntime/AppRuntimeStateRuntime

wls:/base_domain/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> ls


-r--   ApplicationIds                               java.lang.String[active-cache#1.0@1.0, coherence-web-spi#, coherence#3.

-r--   Name                                         AppRuntimeStateRuntime

-r--   Type                                         AppRuntimeStateRuntime


-r-x   getCurrentState                              String : String(appid),String(moduleid),String(subModuleId),String(target)

-r-x   getCurrentState                              String : String(appid),String(moduleid),String(target)

-r-x   getCurrentState                              String : String(appid),String(target)

-r-x   getIntendedState                             String : String(appid)

-r-x   getIntendedState                             String : String(appid),String(target)

-r-x   getModuleIds                                 String[] : String(appid)

-r-x   getModuleTargets                             String[] : String(appid),String(moduleid)

-r-x   getModuleTargets                             String[] : String(appid),String(moduleid),String(subModuleId)

-r-x   getModuleType                                String : String(appid),String(moduleid)

-r-x   getRetireTimeMillis                          Long : String(appid)

-r-x   getRetireTimeoutSeconds                      Integer : String(appid)

-r-x   getSubmoduleIds                              String[] : String(appid),String(moduleid)

-r-x   isActiveVersion                              Boolean : String(appid)

-r-x   isAdminMode                                  Boolean : String(appid),String(java.lang.String)

-r-x   preDeregister                                Void :


wls:/base_domain/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> cmo.getCurrentState('hello','AdminServer')


wls:/base_domain/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> cd /