In the Fusion Middleware 11g Oracle added a lot of ADF, MDS and Soa Suite Application MBeans. These MBeans have attributes and operations which you can set , get or invoke. So with these MBeans you can control ADF, MDS or a Soa composite. Off course you do the same in the FMW Enterprise Manager(EM) application but sometimes it can be better to script actions so you can garantee that your Acceptance or Production Weblogic are the same. So lets take a look add these FMW MBeans and play with these FMW Mbeans. First we need to go the EM application to get an overview. The EM has a nice MBeans Browser.

Here you get a list of the Application Defined MBeans. These MBeans can't be invoked with a specific WLST command.

For example we can select a Soa composite application.

Here we can see or change the attributes of this Composite Mbean, We can retrieve these attributes and some of them we can change when the Access of the attribute = RW

In the operation tab we can see the operation methods of this MBean. You also can invoke the operation in this EM application just by selecting the operation.

Now lets invoke these operations from WLST or rettrieve an attribute
We need to start WLST
cd FMW_HOME\wlserver_10.3\common\bin
wlst.cmd
connect('weblogic','weblogic1','t3://localhost:7001')
To stop WLST we can use
disconnect()
exit()
In the WLST windows after we are connected we can go the domainRuntime where the application MBeans are located.
domainRuntime()
Then we can lookup the MBean, the MBean can be seen in the MBean Browser ( above the atrributes & operations) For example
mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')
We can invoke for example the operation listRepositories, this operation has no parameters.
Type
repositories = mbs.invoke(mdsBean, 'listRepositories',None,None)
When the operation has parameters then we need to provide the parameters and the type of these parameters like this.
params = [Name]
sign = ['java.lang.String']
partitions = mbs.invoke(mdsBean, "listPartitions", params, sign)
To get an MBean attribute value we can use getAttribute
mdsObject = ObjectName(repository)
Name = mbs.getAttribute(mdsObject, 'Name')
Here is an example where I retrieve all the MDS repositories with the parttions.
domainRuntime()
mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')
print 'invoke listRepositories without parameters on mds bean'
repositories = mbs.invoke(mdsBean, 'listRepositories',None,None)
for repository in repositories:
mdsObject = ObjectName(repository)
Name = mbs.getAttribute(mdsObject, 'Name')
print 'mds repository object: ', Name
params = [Name]
sign = ['java.lang.String']
partitions = mbs.invoke(mdsBean, "listPartitions", params, sign)
for partition in partitions:
print 'partition: ', partition
or a Soa Suite example to get a list with all the deployed composites
domainRuntime()
soaBean = ObjectName('oracle.soa.config:Location=soa_server1,name=soa-infra,j2eeType=CompositeLifecycleConfig,Application=soa-infra')
print soaBean
composites = mbs.getAttribute(soaBean, 'DeployedComposites')
for composite in composites:
print 'composite: ',composite
Here an example to set a SOA Composite auditlevel to Development mode
# function to help locate a mbean(s)
# that match a specific name
def findMBean(prefix, name):
# get a listing of everything in the current directory
mydirs = ls(returnMap='true');
# we're going to use a regular expression for our test
pattern = java.util.regex.Pattern.compile(str(prefix) + str('.*name=') + str(name) + str('.*$'));
# loop through the listing
for mydir in mydirs:
x = java.lang.String(mydir);
matcher = pattern.matcher(x);
# if we find a match, add it to the found list
while matcher.find():
return x;
print 'starting the script ....'
username = 'weblogic'
password = 'weblogic1'
url='t3://localhost:7001'
connect(username,password,url)
custom();
cd('oracle.soa.config');
composite = findMBean('oracle.soa.config:partition=default,j2eeType=SCAComposite',
'"CallingComposite"');
print 'bean ' + str(composite);
cd( composite );
print 'path: ' + pwd();
params = jarray.array(['auditLevel','Development'],
java.lang.Object)
sign = jarray.array(['java.lang.String','java.lang.String'],
java.lang.String)
invoke('setProperty',
params,
sign);
disconnect();
The same but then in an other way
print 'starting the script ....'
username = 'weblogic'
password = 'weblogic1'
url='t3://localhost:7001'
connect(username,password,url)
domainRuntime()
helloworldComposite = ObjectName('oracle.soa.config:Location=AdminServer,partition=default,j2eeType=SCAComposite,revision=1.0,label=soa_d84546d1-22b0-496a-8b33-a5705caf19e6,Application=soa-infra,wsconfigtype=WebServicesConfig,name="Helloworld"')
print helloworldComposite
params = ['auditLevel','Development']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setProperty', params, sign)
print mbs.getAttribute(helloworldComposite, 'Properties')