Oracle SOA Suite 11g - Common adf-config.xml to deploy all the composites to different environments through ANT.
The common adf-config.xml file can be used to deploy all the composites instead of using the adf-config file from the individual composite applications.
The adf-config file configurations can be changed at runtime through ant script to deploy the composites to different environments.
By this approach, we can reduce the maintenance of individual adf-config files also by using the same adf-config file the composites can be deployed to different environments.
1. Copy.adf folder from any of the Composite application to the common location.
2. Change the contents of the adf-config.xml with below contents (change the file according to your requirement.)
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:adf="http://xmlns.oracle.com/adf/config/properties" xmlns:config="http://xmlns.oracle.com/bc4j/configuration" xmlns:sec="http://xmlns.oracle.com/adf/security/config">
<adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
<defaults useBindVarsForViewCriteriaLiterals="true"/>
<startup>
<amconfig-overrides>
<config:Database jbo.locking.mode="optimistic"/>
</amconfig-overrides>
</startup>
</adf-adfm-config>
<sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
</sec:adf-security-child>
<adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
<mds-config xmlns="http://xmlns.oracle.com/mds/config">
<persistence-config>
<metadata-namespaces>
<namespace metadata-store-usage="mstore-usage_2" path="/apps/EAIMetaData"/>
<namespace metadata-store-usage="mstore-usage_3" path="/soa/shared"/>
</metadata-namespaces>
<metadata-store-usages>
<metadata-store-usage id="mstore-usage_2">
<metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
<property name="jdbc-userid" value="@db.user@"/>
<property name="jdbc-password" value="@db.password@"/>
<property name="jdbc-url" value="@db.url@"/>
<property name="partition-name" value="@partition@"/>
</metadata-store>
</metadata-store-usage>
<metadata-store-usage id="mstore-usage_3">
<metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
<property name="jdbc-userid" value="@db.user@"/>
<property name="jdbc-password" value="@db.password@"/>
<property name="jdbc-url" value="@db.url@"/>
<property name="partition-name" value="@partition@"/>
</metadata-store>
</metadata-store-usage>
</metadata-store-usages>
</persistence-config>
</mds-config>
</adf-mds-config>
</adf-config>
<adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:adf="http://xmlns.oracle.com/adf/config/properties" xmlns:config="http://xmlns.oracle.com/bc4j/configuration" xmlns:sec="http://xmlns.oracle.com/adf/security/config">
<adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
<defaults useBindVarsForViewCriteriaLiterals="true"/>
<startup>
<amconfig-overrides>
<config:Database jbo.locking.mode="optimistic"/>
</amconfig-overrides>
</startup>
</adf-adfm-config>
<sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
</sec:adf-security-child>
<adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
<mds-config xmlns="http://xmlns.oracle.com/mds/config">
<persistence-config>
<metadata-namespaces>
<namespace metadata-store-usage="mstore-usage_2" path="/apps/EAIMetaData"/>
<namespace metadata-store-usage="mstore-usage_3" path="/soa/shared"/>
</metadata-namespaces>
<metadata-store-usages>
<metadata-store-usage id="mstore-usage_2">
<metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
<property name="jdbc-userid" value="@db.user@"/>
<property name="jdbc-password" value="@db.password@"/>
<property name="jdbc-url" value="@db.url@"/>
<property name="partition-name" value="@partition@"/>
</metadata-store>
</metadata-store-usage>
<metadata-store-usage id="mstore-usage_3">
<metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
<property name="jdbc-userid" value="@db.user@"/>
<property name="jdbc-password" value="@db.password@"/>
<property name="jdbc-url" value="@db.url@"/>
<property name="partition-name" value="@partition@"/>
</metadata-store>
</metadata-store-usage>
</metadata-store-usages>
</persistence-config>
</mds-config>
</adf-mds-config>
</adf-config>
3. Create a Build.properties file for each environment and specify the MDS details as mentioned below.
Build.properties
soa.partition=soa-infra
db.user=SOA_MDS
db.password=xxxx
db.url= jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1525))(ADDRESS=(PROTOCOL=tcp)(HOST=host2)(PORT=1525)))(CONNECT_DATA=(SERVICE_NAME=EAIDB14A)))
4. Replace the tokens with the environment actual value during deployment in adf-config.xml file.
The below Ant script can be used to replace the tokens.
adfconfigbasedir should be changed to the parent folder where the .adf folder is copied.
<loadproperties srcFile="build.properties"/><replace dir="${ adfconfigbasedir }/ .adf/ META-INF" token="@db.user@" value="${db.user}">
<include name="adf-config.xml"/>
</replace>
<replace dir="${ adfconfigbasedir }/ .adf/META-INF" token="@db.password@" value="${db.password}">
<include name="adf-config.xml"/>
</replace>
<replace dir="${ adfconfigbasedir }/ .adf/META-INF" token="@db.url@" value="${db.url}">
<include name="adf-config.xml"/>
</replace>
<replace dir="${adfconfigbasedir}/ .adf/META-INF" token="@partition@" value="${soa. partition }">
<include name="adf-config.xml"/>
</replace>
5. Set the scac.application.home to the adfconfigbasedir during the deployment of the composites.The common adf-config.xml file will be used to deploy all the composites.
Hi..
ReplyDeleteI want to make it point to FILE instead of another database store.
Any idea how to do that?
<?xml version="1.0" encoding="windows-1252" ?>
Delete<adf-config xmlns="http://xmlns.oracle.com/adf/config"
xmlns:config="http://xmlns.oracle.com/bc4j/configuration"
xmlns:adf="http://xmlns.oracle.com/adf/config/properties"
xmlns:sec="http://xmlns.oracle.com/adf/security/config">
<adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
<adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
<mds-config xmlns="http://xmlns.oracle.com/mds/config">
<persistence-config>
<metadata-namespaces>
<namespace metadata-store-usage="mstore-usage_1" path="/soa/shared"/>
</metadata-namespaces>
<metadata-store-usages>
<metadata-store-usage id="mstore-usage_1">
<metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
<property value="${oracle.home}/integration"
name="metadata-path"/>
<property value="seed" name="partition-name"/>
</metadata-store>
</metadata-store-usage>
</metadata-store-usages>
</persistence-config>
</mds-config>
</adf-mds-config>
</adf-config>
If the parent folder path(parent folder path to /soa/shared) is common across all the environments then better you can hard code the metadata-path
if the parent path is different across environments then tokenize the metadata-path like <property value="@filepath@" name="metadata-path"/>
and replace this token at runtime based on the environment.
Regards
Albin I