The Oracle Service Bus provides a number of deployment
options using the following tools:
- Eclipse IDE
- OSB Web console
- Scripting via Weblogic Language Scripting Tool (WLST)
The Eclipse IDE allows the users to build and deploy OSB projects directly from source or to directly deploy a SBConfig jar file to the target Instance
The OSB Web Console allows the import of the SBConfig Jar file into the target environment or the code can be directly updated within the target Instance.
However once you step out of the development cycle the preferred approach is using the WLST/Java scripting, to ensure a consistent deployment across different environments (ie: system test, Integration test, ect).For this the deployment team are generally provided with a pre-build SBConfig Jar file, containing all the OSB projects to be deployed.
Within my last project we had a situation where the offshore development environments did not reflect the final state at the customer site. The development environment contained a single OSB instance that supported all the services, however the onsite model split these across three separate OSB Instances, thus we needed to selectively deploy the OSB projects across the different instances from a single SBConfig Jar File.
Oracle provides an API for the ALSBImportOperation, this allows us to set an indicator as to how the import operation should be handled for a nominated resource. Using this API we were able to navigate through the default deployment plan for the SBConfig Jar file and flag the projects that we did not want within the selected OSB domain with a skip option, effectively removing them from the deployment plan.
Please Note the following is not a complete scripts, this sub section has been provided for demonstration purposes only.
A command line parameter is passed into the script that
provides a list of OSB Projects to be deployed.
(ie. SOURCE_PROJECT_NAME=<OsbProject>,<OsbProject>,<OsbProject>,<OsbProject> )
sourceProjectNameList = SOURCE_PROJECT_NAME.split(',')
if not errorInProcessing:
sbJarFiles = glob.glob(global_variables.CONFIGURATION_DIRECTORY + "/*.jar" )
sbJarFiles.sort()
for configurationFile in sbJarFiles:
# Process ALSB Configuration File
# Read ALSB Configuration File into Buffer
f = open(configurationFile,"rb" )
print "Reading ALSB configuration file: " + configurationFile + "..."
buffer = f.read()
f.close()
# Upload ALSB Configuration File
print "Uploading ALSB configuration file..."
alsbSession.uploadJarFile(buffer)
# Then get the default import plan and modify the plan if required
print "Importing ALSB configuration file..."
jarInfo = alsbSession.getImportJarInfo()
#Get the Import Plan from the SB Config Jar
importPlan = jarInfo.getDefaultImportPlan()
#Get the Operations from the ImportPlan
operations = importPlan.getOperations()
operationsKeySet = operations.keySet()
for operationKey in operationsKeySet:
alsbOperation = operations.get(operationKey)
#Get the Project Name from the Operation Reference
operationProjectName = alsbOperation.getRef().getProjectName();
# If the Operation Project Name is not in the Source Project Name List
# Mark the operation to be skiped.
if not (operationProjectName in sourceProjectNameList):
System.out.println('Skiping operation for project ' + operationProjectName )
alsbOperation.setSkip()
result = alsbSession.importUploaded(importPlan)
if result.getFailed().size() > 0:
errorInProcessing = true
break
else:
SESSION_DESCRIPTION = "Automated SB Deployment: " + java.io.File(configurationFile).getName()
buffer = None