Monday, May 26, 2008

The build tool; deploy AIA / BPEL / ESB / Workflow / Java using ANT

Introduction
A few years ago, when Oracle had only the BPEL component, deployment was rather complex. Therefore I create my own build tool, replacing the obant tool and ignoring the existing build.xml files, supplied within your JDeveloper project.

Meanwhile, the tool has been extended during the implementation of projects. Every time, I was focussing that the tool should be independent of customer needs, making it generic.

Overview
In general development of BPEL processes is done via an IDE tools. These tools are:
  • Oracle JDeveloper 10g (http://www.oracle.com/technology/products/jdev)
  • obant tool.

The first product is a graphical tool to design and develop SOA components. The tool can also be used for compilation and deployment of a BPEL process for example. The obant tool is part of the BPEL software stack and can be used to compile and deploy a BPEL process. Combining these tools make is in general enough for designing and implementing BPEL applications.
It will be more complex if design and development must be done for various environments; developing new BPEL applications in development environment and fixing BPEL processes in a production environment.

Solution
The obant tool can compile from a current directory an ANT build.xml file. It will read the XML tags from this and interpret them. Oracle Jdeveloper generates this build.xml file when a new BPEL process is created. It is possible to extend this "build.xml" file with other ANT tasks. But this is not logical. When developing BPEL applications, it will result in many BPEL processes, each having it's own "build.xml" file.

A solution could be to have a general "build.xml" that is able to compile the BPEL processes.
A feature of the current obant tool, is that is only possible to use the core ANT tasks. It is not possible to use the optional tasks or even extend it with other tasks without changing the obant script.

The solution described in the next paragraphs will take this into account.

Functionality
The build tool covers the following features and can be easily change and extended to customer requirements:
  • Using full ANT tasks features, Ant 1.7 + Ant-Contrib tasks
  • Support of Multiple environments; Dev / Test / Acceptance / Production / ...
  • Compiling BPEL processes
  • Deploy BPEL processes
  • UnDeploy BPEL processes
  • Register ESB services
  • Unregister ESB services
  • Deploy AIA BPEL processes
  • Deploy AIA ESB services
  • Integration with SubServersion; download latests or tags
  • Stand-alone tool ; not depending on Oracle installation
  • Compile and Deploy Java programs
  • Supporting 'MakeAll'
  • Import XREF values
As shown in the list of functionalities, the build system is now able to deploy AIAESB services. Therefore the build system is extended with AIA functionality. This means that AIA specific libraries have been added to the 'lib' directory of the build system. The unix script, obbuild.sh, has been changed to add specific files.

Pre-Requirements AIA only
To deploy a complete set of AIA custom developed services or single ones, you must verify that you meet the following requirements. You must have correct file permissions for AIA:

To deploy an ESB service on the linux machine, as a non oracle owner is possible. The ANT script along with the ESB service, does need specific read/write settings.

Make user that the following directories and files are open for read/write, (recursively):

$AIA_HOME/bin/bsracces.log
$AIA_HOME/install
$AIA_HOME/install/scripts/bsrwsdl.properties
$ORACLE_HOME/Apache/Apache/htdocs/AIAComponents/
$ORACLE_HOME/bpel/domains/default/config/fault-bindings.xml
$ORACLE_HOME/bpel/domains/default/config/fault-policies/
$AIA_HOME/config/

Configuration
To use the build tool some configuration must be made. Most of all settings are located in properties files. Configure the build tool configuration file to prepare the deployment for this release. Edit the following file:

$BUILD_TOOL/build.env

In build.env, edit ANT_HOME and ANT_JAVA_EXTENSIONS, change the first part of the path to where the package was copied to ($BUILD_TOOL). Also change LOG_DIR in build.env, log files will go to this directory.

An example of this file is here

JAVA_HOME=/app/oracle/product/10.1.3/soa/jdk
ANT_HOME=/app/projects/svn/aia/src/tools/build/ant/lib/apache-ant-1.7.0
ANT_JAVA_EXTENSIONS=/app/projects/svn/aia/src/tools/build/ant/lib
LOG_DIR=/tmp/aia/svn_tmp/log
#
# AIA_HOME is needed for AIA Specific deployment
#
export AIA_HOME=/app/oracle/product/AIA2.0

Manual Deployment
To deploy a the AIA components manually the following steps should be executed in this sequence.

Download
Download the latest version of the AIA components. Example for SystemTest environment:

obbuild.sh -e test Download

Example for tag 2.0.23 being the current version for acceptance:

obbuild.sh -e acc Download 2.0.22

Promote
Promote is a task that does a find and replace on the source code. It was build for replacing endpoints but the tool can find and replace almost anything in source code.

Example; promote the existing download for the test environment

obbuild.sh -e test Promote

Note: it will use the file replace_test.properties to execute the find and replace.

The replace_.properties file is used for a general replacement of tokens
in BPEL projects. The file describes hoe tokens can be replaced in one or
all BPEL processes, ESB services.

Syntax:

find..name=[all|]
[all|]..find.value=
[all|]..replace.value=

Example:
Replace in all BPEL files localhost:9700 into 127.0.0.1:8888

find.1.name=all
all.1.find.value=localhost:9700
all.1.replace.value=localhost:8888


Example:
Replace in HellWorld bpel process the default domain and the hostname

find.1.name=HelloWorld
HelloWorld.1.find.value=localhost:9700
HelloWorld.1.replace.value=192.168.0.1:8888


find.2.name=HelloWorld
HelloWorld.2.find.value=/orabpel/default
HelloWorld.2.replace.value=/orabpel/systest


XSD files (AIA related)
The AIA environment is using static XSD files that are located on the application server in the directory:

$ORACLE_HOME/Apache/Apache/htdocs

Make sure that the latest version of the XSD files from SubVersion ($SVN_HOME/aia/xsd)are copied to this directory.

note: make sure the right privileges are applied on the server see

obbuild.sh DeployAIAXSD

A zip file is created with the XSD of AIA. You can now copy and unzip the file on the server.

Deploy generic ESB service
Note that before deploying the ESB service, the services will be undeployed. Based on the property file esb_guid.properties. The GUID is read from this file. If the ESB service exists in this property it will be undeployed. Maintain this file if any new ESB services are added to the system

Deploy each ESB service separately, if they exists. Example for Test environment:

obbuild.sh -e test DeployESB HelloWorldEBS

Deploy generic BPEL process
Deploy each BPEL process separately. Example for Test environment:

For example: Compile and Deploy Helloworld 1.0 to the default domain

obbuild.sh -e test Compile HelloWorld
obbuild.sh -e test DeployBPEL HelloWorld 1.0 default

For example: Compile and Deploy Helloworld 1.1 to the MyDomain domain

obbuild.sh -e prod Compile HelloWorld
obbuild.sh -e prod DeployBPEL HelloWorld 1.1 MyDomain

Deploy AIA ESB service
Note that before deploying the ESB service, it will be undeployed. Based on the property file esb_guid.properties. The GUID is read from this file. If the ESB service exists in this property it will be undeployed. Maintain this file if any new ESB services are added to the system

Deploy each AIA ESB service separately.

For example for Test environment:

obbuild.sh -e test DeployAIAESB SalesOrderEBS

Deploy AIA BPEL process
Deploy each AIA/BPEL process separately.

For example for Test environment:

obbuild.sh -e test CompileBPEL UpdateOrderSiebelProvImplABCS
obbuild.sh -e test DeployAIABPEL UpdateOrderCordysProvImplABCS 1.0 default

Deploy Java WebService
Deploy each Java process separately. Example for Test environment:

obbuild.sh -e test DeployJava HelloJavaWorld

Note: default-application.xml must be included in source code.

Automatic Deployment
To deploy the whole system at once, use the task 'MakeAll'.

obbuild.sh -e test MakeAll

Note: This target is using the 'makeall_test.properties' that describes the correct sequence of all the AIA components (Java, BPEL, and ESB) that will be built and deployed. The next table shows an example of the 'makeall.properties' file.

makeall.properties
#
# Java
#
java.make.100=HelloJavaWorld
#
# BPEL
#
bpel.make.200=HelloBPELWorld
bpel.make.210=HelloWorld
#
# AIA BPEL
#
aiabpel.make.300=HelloBPELWorldProvABCSImpl
aiabpel.make.310=HelloWorldProvABCSImpl
#
# AIA ESB
#
aiaesb.make.400=SalesOrderEBS
aiaesb.make.410=SalesOrderOrchastrationEBS

Command line interface
The command line interface of the obbuild tool is as follows:
obbuild.sh -?
obbuild.sh [-[hvtV] [-e environment] [-f build-file]
[-r replace-file] [task] [arg1] [arg2] .. [arg6]]


-h Shows this help
-V Show the version of this program
-t Show all the tasks in the build file
-e Select envirnonment property file,
default 'dev', reading dev.properties

-f Read a specific build file, default is build.xml
in current directory

-r Read a specific replacement file,
use for promoting BPEL process to other environments.

-v Show verbose output
task The task to be executed, default is main
arg1..6 Optional arguments passed to the build file
as properties ANT.ARG1..ANT.ARG6

The tasks the build tool can execute:
obbuild.sh -t
obbuild.sh: Tasks in ./build.xml
CompileBPEL - Compile one or all BPEL processes (
[arg=bpel-process-name] arg2=version])
Download - Download latest source code
[arg=version]
CreateWar - Create WAR file, containing all
the BPEL processes
[arg=war-filename]
CreateEar - Create BPEL ear file
[arg=ear_filename]
main - Default task
Promote - Find/Replace on one or more BPEL processes,
see replace.properties
DeployAIABPEL - Deploy one or all AIA BPEL processes to a
domain on a remote server
[arg1=[Bpel-process|all]
arg2=version arg3=domain]
DeployBPEL - Deploy one or all BPEL processes to a domain
on a remote server
[arg1=[Bpel-process|all]
arg2=version arg3=domain]
DeployESB - Deploy one or all ESB services to a system
on a remote server
[arg1=[ESB-process|all] [arg2=system]]
CompileJava - Compile Java files
[arg1=name of the application]
WARJava - Create WAR file from class files
[arg1=name of application]
EARJava - Create EAR file from WAR file
[arg1=name of application]
DeployJava - Deploy an EAR file to OC4J container
[arg1=name of the application]
MakeAll - Create a new set of the application
[arg1=[bpel/esb version] [arg2=BPEL domain]
[arg3=ESB-system]
DeployAIAESB - Deploy one or all AIA ESB services
to a system on a remote server
[arg1=[ESB-process|all] [arg2=system]]
SendMail - Send a mail
[arg1=to arg2=subject arg3=text]
DeployAIAXSD - Deploy the AIA XSD files: creating a ZIP files
UndeployBPEL - Undeploy a BPEL process
[arg1=processname [arg2=version] [arg3=domain]]
UndeployESB - Undeploy one or all ESB services to
a system on a remote server
[arg1=[ESB-process|all] [arg2=system]]


You can download the (old version) zip file here, the zip file is as is. No support from Oracle or myself.

Tuesday, May 20, 2008

KPN Gone live with Oracle AIA

It's always nice to be part of a project that goes live. But even more when news agencies making attention on it. This time the Dutch KPN telecommunication provider, implemented successfully a large project based Oracle Application Integration Architecture (Oracle AIA).

Read the full article on CNN.


Some background (dutch)