Who these scripts are designed for:
- Developers who want an automated approach to deploy/undeploy/manage code
- App Admins who want to manage code from a Windows-based operating system
What you can do with the scripts:
- Deploy multiple composites using a single Ant command
- Undeploy multiple composites using a single Ant command
- Start multiple composites using a single Ant command
- Stop multiple composites using a single Ant command
- List deployed composites
- Tokenize and detokenize code
- Import artifacts (XSDs, DVMs, WSDLs, fault policies) to the MDS
- Export the entire MDS (for backup or browsing purposes)
To see how these scripts work, check out:
One-time Setup and Configuration
1. Download ant_soa11g_windows.zip from here
2. Unzip ant_soa11g_windows.zip to your local c:\ drive (it should exist as c:\ant)
3. Edit setEnvironmentVars.bat and modify the following:
CODE_FOLDER <-- top-level directory where your code exists (e.g., c:\ant\code)4. Edit soa-environment.properties and modify only the following variables:
ORACLE_HOME <-- directory of JDev 11g (e.g., c:\jdev11g)
JAVA_HOME <-- ensure that the JDK path is correct
wn.bea.home=C:/jdev11g <-- directory of JDev 11g (similar to ORACLE_HOME above)5. Double-click on winInstall.bat so that it copies the necessary JARs to the appropriate directories
tmp.output.dir=c:/ant/temp <-- temp directory for MDS generation, default is c:\ant\temp
local.mds.repository=c:/ant/apps <-- location of local MDS copy (for MDS imports)
local.mds.export=c:/ant/apps.backup <-- location of local MDS backup folder (for MDS exports)
6. For every SOA Suite 11g environment, create the following 3 files.
For example, if you have a DEV, TEST, and PROD environments, then create the following 9 files:
7. Edit all soa-build-*.properties and soa-token-*.properties files and modify the following:The ant_soa11g_windows.zip file includes samples for a DEV environment, so just make copies of those files for your other environments.soa-build-dev.propertiessoa-build-test.propertiessoa-build-prod.propertiessoa-cfgplan-dev.xmlsoa-cfgplan-test.xmlsoa-cfgplan-prod.xmlsoa-token-dev.propertiessoa-token-test.propertiessoa-token-prod.properties
USERNAME <-- weblogic username (e.g., 'weblogic')PASSWORD <-- weblogic passwordSOAHOST <-- hostname or IP address of SOA Suite 11g serverSOAPORT <-- port for the soa_server1 managed server (e.g., 8001)DBUSERNAME <-- MDS database username (e.g., 'dev_mds')DBPASSWORD <-- MDS database passwordDBHOST <-- database hostDBPORT <-- database portDBSID <-- database name
Deploy, Undeploy, Start, Stop, and Detokenize Composites
1. Define the CustomProcessList.txt (see Define the Custom Process List below)
2. Open a command prompt window and type the following
cd c:\antcall setEnvironmentVars.batcall ant -f build.soa.xml <target> -Dtargetenv=<env>
Where <target> is deployComposites, undeployComposites, startComposites, stopComposites, or detokenizeComposites. This will loop through and perform the action against all the composites listed in the CustomProcessList.txt file.
Where <env> is your dev, test, or whatever environments you configured earlier.
List Composites
1. Open a command prompt window and type the following
cd c:\antcall setEnvironmentVars.batcall ant -f build.soa.xml listComposites -Dtargetenv=<env>
Where <env> is your dev, test, or whatever environments you configured earlier.
Export MDS
1. Open a command prompt window and type the following
cd c:\antcall setEnvironmentVars.batcall ant -f build.soa.xml exportMDS -Dtargetenv=<env>
Where <env> is your dev, test, or whatever environments you configured earlier.
2. The export file will be saved to c:\ant\apps.backup in the format of MDSbackup.<env>.YYYY-MM-DD-HHMI.jar (e.g., MDSbackup.dev.2011-01-20_1140.jar)
Import Artifacts to MDS
1. Define the CustomMDSList.txt (see Define the Custom MDS List below)
2. Add all the schemas, WSDLs, DVMs, fault policies, to the c:\ant\apps\<application> directory.
For example:
c:\ant\apps\App1MetaData\dvm\Currency.dvm3. Open a command prompt window and type the following
c:\ant\apps\App1MetaData\dvm\Country.dvm
c:\ant\apps\App1MetaData\config\fault-bindings.xml
c:\ant\apps\App1MetaData\config\fault-policies.xml
c:\ant\apps\App1MetaData\schemas\shared\Types.xsd
c:\ant\apps\App1MetaData\schemas\hr\Account.xsd
cd c:\antcall setEnvironmentVars.batcall ant -f build.soa.xml importMDS -Dtargetenv=<env>
Where <env> is your dev, test, or whatever environments you configured earlier.
Define the Custom Process List
Before using any of these Ant scripts that are related to code, you must create a CustomProcessList.txt file.
1. Create the c:\ant\CustomProcessList.txt file, using the following format:
<composite_name>,<partition>,<revision>,<default_composite>,<relative_directory_of_code>
For example, the file may look like this:
This says that there are 3 composites to loop through; HelloWorld1, HelloWorld2, and HelloWorld3. If deployed, the first 2 will be deployed to the 'default' partition and a revision of '1.0' while the last one will be deployed to the 'hello99' partition with a revision of '2.0'. The last composite will not be set as the default composite, designated by the value of 'false'.HelloWorld1,default,1.0,true,hrprojects\employees\HelloWorld1HelloWorld2,default,1.0,true,hrprojects\employees\HelloWorld2HelloWorld3,hello99,2.0,false,hrprojects\test\synchronize\HelloWorld3
The directory path shown is relative to the %CODE_FOLDER% environment variable set earlier. For example, if %CODE_FOLDER% is set to c:\ant\code, then the three projects above should exist in the following local directories:
c:\ant\code\hrprojects\employees\HelloWorld1c:\ant\code\hrprojects\employees\HelloWorld2c:\ant\code\hrprojects\test\synchronize\HelloWorld3
Define the Custom MDS List
Before using any of the Ant targets that are related to the MDS, you must create a CustomMDSList.txt file.
1. Create the c:\ant\CustomMDSList.txt file, using the following format:
<app_name>,false
For example, the file may look like this:
If you run the MDS import script, it will import the following local directory to its relative MDS directory as follows:App1MetaData,falseApp2MetaData,false
For example, you may have a combination of XSDs, DVMs, and fault policies as shown:c:\ant\apps\App1MetaData --> oramds:/apps/App1MetaDatac:\ant\apps\App2MetaData --> oramds:/apps/App2MetaData
When you run the MDS import script, because the CustomMDSList.txt file is referencing the local c:\ant\apps\App1MetaData directory, all files under that local directory will be imported to the MDS.c:\ant\apps\App1MetaData\dvm\Currency.dvmc:\ant\apps\App1MetaData\dvm\Country.dvmc:\ant\apps\App1MetaData\config\fault-bindings.xmlc:\ant\apps\App1MetaData\config\fault-policies.xmlc:\ant\apps\App1MetaData\schemas\shared\Types.xsdc:\ant\apps\App1MetaData\schemas\hr\Account.xsd
Adding Additional Tokens
The detokenizeComposites target loops through all code in your CustomProcessList.txt file, and detokenizes your code. For example, if your code has the following string @SOAServer@, the command below will replace it with whatever value is specified in the soa-token-*.properties file. This allows you to not hardcode values in your code.
If you want to add additional token variables, say @SomeEndpoint@, you must do the following:
1. Add the new token to the soa-token-*.properties file. For example:
SomeEndpoint = http://dev.ipnweb.com:77772. Edit build.soa.xml and add the token in two separate targets (detokenizeComposites and tokenizeComposites):
<replacefilter token="@SomeEndpoint@" value="${SomeEndpoint}"/>
<replacefilter token="${SomeEndpoint}" value="@SomeEndpoint@"/>
No comments:
Post a Comment