Skip navigation.

Marc Kelderman

Syndicate content
This blog is all about Oracle SOA related products; SCA, OSB, BPEL, BPM, Rules, Workflow.Marc Kelderman SOA Bloghttp://www.blogger.com/profile/13131001868435096782noreply@blogger.comBlogger170125
Updated: 2 hours 35 min ago

Changing SOA properties via WLST

Mon, 2016-03-14 08:30


Hereby a script to change some properties for SOA Suite. These are some generic settings such as:
  • soa-infra
  • AuditLevelGlobalTxMaxRetry
  • DisableCompositeSensors
  • DisableSpringSESensors
  • mediator
  • AuditLevel
  • bpel
  • AuditLevel
  • SyncMaxWaitTime
  • Recovery Schedule Config
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.management.Attribute;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.Query;
import javax.management.QueryExp;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.OpenDataException;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

connect('weblogic', 'Welcome1', 't3://myhost:7001')
domainRuntime()

#
# soa-infra
#
SOAInfraConfigobj = ObjectName('oracle.as.soainfra.config:Location=MS1,name=soa-infra,type=SoaInfraConfig,Application=soa-infra')

# Off, Production and Development
SOAattribute = Attribute('AuditLevel', 'Production')
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)

print '*** soa-infra: set AuditLevel', mbs.getAttribute(SOAInfraConfigobj, 'AuditLevel')

SOAattribute = Attribute('GlobalTxMaxRetry', 0)
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)
print '*** soa-infra: set GlobalTxMaxRetry', mbs.getAttribute(SOAInfraConfigobj, 'GlobalTxMaxRetry')

SOAattribute = Attribute('DisableCompositeSensors', true)
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)
print '*** soa-infra: set DisableCompositeSensors', mbs.getAttribute(SOAInfraConfigobj, 'DisableCompositeSensors')

SOAattribute = Attribute('DisableSpringSESensors', true)
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)
print '*** soa-infra: set DisableSpringSESensors', mbs.getAttribute(SOAInfraConfigobj, 'DisableSpringSESensors')

#
# Mediator
#
SOAInfraConfigobj = ObjectName('oracle.as.soainfra.config:Location=MS1,name=mediator,type=MediatorConfig,Application=soa-infra')

SOAattribute = Attribute('AuditLevel', 'Inherit')
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)
print '*** mediator: set AuditLevel', mbs.getAttribute(SOAInfraConfigobj, 'AuditLevel')

#
# BPEL
#

SOAInfraConfigobj = ObjectName('oracle.as.soainfra.config:Location=MS1,name=bpel,type=BPELConfig,Application=soa-infra')

SOAattribute = Attribute('SyncMaxWaitTime', 120)
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)

print '*** bpel: set SyncMaxWaitTime', mbs.getAttribute(SOAInfraConfigobj, 'SyncMaxWaitTime')

# AuditLevel
#   off: 0
#   inherit: 1
#   minimal: 2
#   production: 3
#   development: 4
#   onerror: 5

SOAattribute = Attribute('AuditLevel', 'production')
mbs.setAttribute(SOAInfraConfigobj, SOAattribute)
print '*** bpel: set AuditLevel', mbs.getAttribute(SOAInfraConfigobj, 'AuditLevel')

#javax.management.ObjectName
SOAInfraConfigobj = ObjectName('oracle.as.soainfra.config:Location=mwpton-MS1,name=bpel,type=BPELConfig,Application=soa-infra')

#javax.management.openmbean.CompositeDataSupport
rec_config_obj  = mbs.getAttribute(SOAInfraConfigobj, 'RecoveryConfig')

rec_keySet = rec_config_obj.getCompositeType().keySet()
rec_keys = rec_keySet.toArray()
rec_keyitems = [ rec_key for rec_key in rec_keys ]

#javax.management.openmbean.CompositeDataSupport
rec_cluster_obj = rec_config_obj.get('ClusterConfig')
rec_recurrr_obj = rec_config_obj.get('RecurringScheduleConfig')
rec_startup_obj = rec_config_obj.get('StartupScheduleConfig')

#
# StartupScheduleConfig
#
cnt = 0

# java.util.Collections.UnmodifiableSet
keySet = rec_startup_obj.getCompositeType().keySet()

# array
keys = keySet.toArray()

# list
keyitems = [ key for key in keys ]

# array
values = rec_startup_obj.getAll(keyitems)

for key in keys:
  if key == 'maxMessageRaiseSize':
    values[cnt] = 0
    print '*** bpel: set RecurringScheduleConfig:maxMessageRaiseSize ' + key + ' to value ' + str(values[cnt])
  cnt = cnt + 1

#javax.management.openmbean.CompositeDataSupport
new_rec_startup_obj = CompositeDataSupport(rec_startup_obj.getCompositeType(), keyitems, values)

#
# RecurringScheduleConfig
#
cnt = 0

keySet = rec_recurrr_obj.getCompositeType().keySet()
keys = keySet.toArray()
keyitems = [ key for key in keys ]
values = rec_recurrr_obj.getAll(keyitems)

for key in keys:
  if key == 'maxMessageRaiseSize':
    values[cnt] = 0
    print '*** bpel: set RecurringScheduleConfig:maxMessageRaiseSize ' + key + ' to value ' + str(values[cnt])
  if key == 'startWindowTime':
    values[cnt] = "00:00"
    print '*** bpel: set RecurringScheduleConfig:startWindowTime ' + key + ' to value ' + str(values[cnt])
  if key == 'stopWindowTime':
    values[cnt] = "00:00"
    print '*** bpel: set RecurringScheduleConfig:stopWindowTime ' + key + ' to value ' + str(values[cnt])
  cnt = cnt + 1

#javax.management.openmbean.CompositeDataSupport
new_rec_recurrr_obj = CompositeDataSupport(rec_recurrr_obj.getCompositeType(), keyitems, values)

pyMap = { "ClusterConfig":rec_cluster_obj, "RecurringScheduleConfig":new_rec_recurrr_obj, "StartupScheduleConfig":new_rec_startup_obj }
javaMap = java.util.HashMap()
for k in pyMap.keys():
  javaMap[k] = pyMap[k]

new_rec_config_obj = CompositeDataSupport(rec_config_obj.getCompositeType(), javaMap)

#javax.management.Attribute
SOAattribute = Attribute('RecoveryConfig', new_rec_config_obj)

mbs.setAttribute(SOAInfraConfigobj, SOAattribute)