Showing posts with label Fusion Middleware 11g. Show all posts
Showing posts with label Fusion Middleware 11g. Show all posts

Wednesday, August 13, 2014

Create Service Bus Customization File using WLST

For one of our Oracle Fusion Middleware projects we had the requirement that the IT Ops activities should be scripted as much as possible. These activities included things like packaging, deploying, and automated testing of Service Bus projects, SOA Composites, and BPM processes. One of the more challenging tasks to script was to create and extract the runtime configuration of services deployed on Oracle Service Bus 11g using customization files. There seems to be no WLST feature readily available for this purpose. Based on some resources that all contained part of the solution, we were able to construct a WLST script for this purpose which you can find in this blog.

This blog briefly explains the use of customization files, how to create a customization file using the Service Bus Console, includes the WLST script to execute this task, and provides a brief conclusion.

Customization Files

Customization files are XML files that contain the configuration of Service Bus resources and projects. Examples of such configurations are Service URIs, JCA settings, Retry Settings, and so on. Customization files provide a convenient way to apply environment-specific configuration during deployment. You can both apply, as well as create and extract the runtime configuration of Service Bus resources and projects into customization files using the Service Bus Console.

Creating customization file using the Service Bus Console

Read more about customization files in the Oracle Fusion Middleware Administrator's Guide for Oracle Service Bus.

WLST Script

Based on the following resources a WLST script can be created to export an OSB project including its customization file from a runtime environment:


The WLST script is as follows:

from java.io import FileOutputStream
from java.util import Collections

from com.bea.wli.config import Ref
from com.bea.wli.config.mbeans import ConfigMBean 
from com.bea.wli.sb.util import EnvValueTypes

import sys

#==================================================
# Utility function to export project and cust file
#==================================================
def exportProject():
    try:

        if projectName == "None":
            print "No project specified, exiting deployment"
            exit(exitcode=-1)

        if customizationFile == "None":
            print "No customization file specified, exiting"
            exit(exitcode=-1)

        ALSBConfigurationMBean = findService("ALSBConfiguration", "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfigurationMBean found"
        
        configMBean = JMX.newMBeanProxy(mbs, ObjectName.getInstance("com.bea:Name=Config.XBus Kernel,Type=com.bea.wli.config.mbeans.ConfigMBean"), ConfigMBean)
        print "ConfigMBean found"

        # Get reference to OSB project        
        ref = Ref.makeProjectRef(projectName);
        collection = Collections.singleton(ref)
        
        # Export OSB project JAR            
        print "Export JAR for OSB project:", projectName
        
        theBytes = ALSBConfigurationMBean.exportProjects(collection, passphrase)
        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        
        print "Project " + projectName + " exported"

        # Export OSB customization file
        print "Export customization file for:", projectName
        
        theBytes = configMBean.createCustomizationFile(collection, EnvValueTypes.ENV_VALUE_TYPES);
        out = FileOutputStream(customizationFile);
        out.write(theBytes);
        out.close();
                        
        print "Cust file for " + projectName + " exported"
    except:
        raise

try:
    
    adminUser         = sys.argv[1]  
    adminPassword     = sys.argv[2]  
    adminUrl          = sys.argv[3]   
    projectName       = sys.argv[4]
    exportJar         = sys.argv[5]
    customizationFile = sys.argv[6]    
    passphrase        = "your-passphrase"
    
    connect(adminUser, adminPassword, adminUrl) 
    domainRuntime()
    exportProject()

except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise

Conclusion

WLST provides a very powerful and comprehensive scripting environment for Oracle Fusion Middleware products. While most administration and management features can be accessed and executed through WLST, some of the features that are available through IDEs or consoles are not (easily) available through WLST and require a workaround or some research. One of these examples was shown in this blog.

Tuesday, October 22, 2013

Nordic OTN Tour 2013

This year I am part of the team that is presenting at the Nordic OTN Tour 2013. It covers three countries: Sweden, Denmark and Norway and is organized by the local user groups. Tim Hall, Mike Dietrich, Sten Vesterli and me are presenting on Database and Middleware in all countries.

Sweden, October 22nd

Today we presented in Stockholm. The program can be found on their website.

It was an interesting day, both from a Middleware perspective and from a Database perspective. The user group decided to plan two parallel tracks; the sessions about Middleware in the morning and Database sessions in the afternoon. Because of this, the Middleware sessions were competing with each other and the Database sessions were competing with each other. From that perspective it would have been nicer to have a Middleware track and a Database track running in parallel. The advantage of the Orcan approach however, is that Database people will attend the Middleware sessions that they might otherwise have skipped.




Denmark, October 23rd

The programs are not exactly the same in all three countries. In Denmark there are three parallel tracks, and instead of talking about using Oracle Fusion Middleware 11g to realize a SOA, I will talk about Oracle BPM Suite. The program can be found on the website of the Danish user group. Apart from the people that were at the Swedish day, there are a number of other speakers in Copenhagen:

  • Rasmus Knappe
  • Jørgen Christian Olsen
  • Gordon Flemming
  • Lars Bo Vanting 



Norway, October 24th

The last day is in Oslo. In Norway there are two parallel tracks, like in Sweden. I will do the same presentations: Overview of Oracle SOA Suite 11g and Creating SOA with Oracle Fusion Middleware 11g.

The same team is doing the presentations. In addition there are a few Norwegian speakers as well:

  • Trond Brenna
  • Harald Eri and Bjørn Dag Johansen
The agenda is published here

All in all a very interesting tour, I look forward to meeting the different user groups and spend time with the other ACE Director and talk about Oracle stuff all day ;)