Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Creating Jython scripts from MC-CLI recordings

It is useful to create Jython scripts on the basis of MC-CLI recordings if a sequence of actions such as, for example, an inbound configuration for multiple proxies, is to be repeated in the same way. You obtain the template for scripts of this type by executing the required actions for a proxy in the Management Console and then outputting the MC-CLI recording for this proxy to a file. This script can then be easily adapted for other proxies and be used for their configuration.

Format of the recording file

Recording files are saved under <MC_home>/cli-rec.

The recording contains a script header with comments, import instructions, the start call for the Management Console session and the assignment of proxy/cluster-specific variables. This is followed by the MC-CLI calls of the recorded actions. If the recording is output to a file, there is also a footer with comment lines relating to the possible end-of-script. The recording, possibly after undergoing minor adaptations, is therefore an executable Jython script.


Example

The shutdown timer for the proxy Test001 is set to 3 minutes via the Management Console. The recording is written to a file at the end of the session. The recording file under the console home directory has the name 2018-06-18.01-45.ProxyID.0.py and contains the following entries:

''' MC-CLI Recording for
BeanConnect Management Console BeanConnect V6.5A00 2018-04-21-0607
'''
import BcAdminCommunicationService
import BcAdminEisPartner
import BcAdminInboundMsgEndpoint
import BcAdminInboundService
import BcAdminInboundUser
import BcAdminLu62Gateway
import BcAdminMain
import BcAdminOutboundCommEndpoint
import BcAdminOutboundService
import BcAdminProxy
import BcAdminProxyCluster
import BcAdminRA
import BcAdminTodo 
import com.fujitsu.ts.jca.tools.mc.cli.BcObjectException           as BcObjectException
import com.fujitsu.ts.jca.tools.mc.cli.BcParameterException        as BcParameterException
import com.fujitsu.ts.jca.tools.mc.cli.BcToolException             as BcToolException
import com.fujitsu.ts.jca.tools.mc.cli.BcObjectType                as BcObjectType
import com.fujitsu.ts.jca.tools.mc.cli.BcDef                       as BcDef
''' init BC console for command line interface '''
consoleHome = "C:\\BeanConnect\\V6.5A00\\Console"
BcAdminMain.init(console_home=consoleHome)

1.

''' end of statements for start of MC session '''

2.

''' record start date/time: 2018-06-18:01-39 '''
''' MC-CLI record file for Proxy Test001 '''


''' assign proxy object '''
proxy_name = "Test001"
proxy_obj  = BcAdminProxy.getObject(proxy_name)

3.

''' proxy context menu "Edit Properties" ''' 
''' or button "Edit" in table "BeanConnect Proxies" '''
proxy_dicn = BcAdminProxy.getProperties(proxy_obj)

4.

''' proxy dialog "Edit Properties" exit with "OK" '''
proxy_dicn_new = {}
proxy_dicn_new["timer.shutdown-time.min"] = "3"
BcAdminProxy.modifyProperties(proxy_obj,proxy_dicn_new)

5.

''' proxy context menu "Save/Restart" - "Save Proxy" ''' 
result = BcAdminProxy.perform(proxy_obj,BcDef.ACTION_SAVE)
''' TODO: analyze result '''
''' end of BeanConnect Management Console session '''
''' don't forget to save your changes! '''
''' close BC Management Console '''
BcAdminMain.close(False)

6.

Explanation:

  1. Start of the standard header. This is written for all recordings.

  2. End of the standard header.

  3. Start of the session-specific recording for the proxy Test001.

  4. The proxy's properties are read in (via the Edit Properties property sheet).

  5. Modification of shutdown timer.

  6. The changes are saved.