Thursday, February 21, 2013

Oracle SOA 11.1.1.6/ Weblogic 10.3.6: WLST Scripts to List Composites by Partions

Oracle SOA 11.1.1.6/ Weblogic 10.3.6: WLST Scripts to List Composites by Partions


sca_listCompositesInPartition is an online script taht can be used to display the composites in a partition. This script needs to be run from  $FW_Middleware\Oracle_SOA1\common\bin\wlst.cmd.

The script is supported by a properties file and the .py file (The script file).

The properties file looks has the following properties.


userName=weblogic
passWord=password
wlsHost=localhost
adminServerListenPort=7001
partitionsToBeChecked=default,partion1,partition2,partition3

The script itself is:

from java.io import FileInputStream
import re
import tempfile
propInputStream = FileInputStream("MonitorCompositesState.properties")
configProps = Properties()
configProps.load(propInputStream)

print '=============================================='
print '  COMPOSITE STATES WITH RESPECT TO PARTITIONS '
print '=============================================='
connect(configProps.get("userName"),configProps.get("passWord"),'t3://'+configProps.get("wlsHost")+':'+configProps.get("adminServerListenPort"))
splits=String(configProps.get("partitionsToBeChecked")).split(",")
for splitPartitionName in splits:
    print 'All the composites in partition:',splitPartitionName
    listcompos=sca_listCompositesInPartition(configProps.get("wlsHost"), configProps.get("adminServerListenPort"), configProps.get("userName"),configProps.get("passWord"),splitPartitionName) 
print '=============================================='
print''


1 comment:

  1. Thanks it was helpful. Similarly i am trying to create a python script to import partners and policies to OAM. I want to add exception handling to it. Below is my code snippet:

    def conn():
    try:
    connect(userConfigFile=UCF, userKeyFile=UKF, url='t3://localhost:7001')
    except Exception,e:
    print ' CONNECTION FAILED. Please check the connection details',
    print e
    dumpStack()

    def importMe():
    conn()

    try:
    importPartners(pathTempOAMPartnerFile=IMPORT_DIR_POLICY)
    print 'Partners imported successfully'
    except Exception as e:
    print 'Partners failed'
    sys.exit(1)

    if __name__== "main":
    importMe()

    The issue is if the directory path(location from where to import) does not exist then the function importPartners(pathTempOAMPartnerFile=IMPORT_DIR_POLICY) should throw and exception and go to exception block. However it is not happening. It just throws the exception move to next statement.
    Is it like we cannot handle exceptions for custom WLST commands ? Any help on this will be much appreciated

    Regards,
    Amit

    ReplyDelete

ForgeRock IAM : OpenDS (Open Directory Server). Importing LDIF files

The most efficient method of importing LDIF data is to take the OpenDJ server offline. Alternatively, you can schedule a task to import the ...