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 FilesCustomization 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 ScriptBased 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
# Utility function to export project and cust file
if projectName == "None":
print "No project specified, exiting deployment"
if customizationFile == "None":
print "No customization file specified, exiting"
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)
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);
print "Cust file for " + projectName + " exported"
adminUser = sys.argv
adminPassword = sys.argv
adminUrl = sys.argv
projectName = sys.argv
exportJar = sys.argv
customizationFile = sys.argv
passphrase = "your-passphrase"
connect(adminUser, adminPassword, adminUrl)
print "Unexpected error: ", sys.exc_info()