Tuesday, 6 September 2011

MDS Deployment Scripts

In order to deploy a file to the MDS of any environment, you need to do the following :
  •  Edit Deploy.cmd, setting correct Middleware_Home, SOA_Home, ANT_HOME etc.
  • Go to build.properties and give the environment details : managed.server.host, managed.server.port, username, password, and mds.applications, which will be the folder inside MDS/seed/apps that will be recursively deployed on MDS.
  • If you want to undeploy the existing folder on MDS and then deploy the same(to clean up MDS folders), set the mds.undeploy parameter to true.
  • Run Deploy.cmd

Create MDSDeploymentScript folder. Create MDS and DeployMDS sub folders and copy below DJO_ONBASE_DEPLOY.sh file (for Linux environment), Deploy.cmd file (for windows environment) and build.properties file under MDSDeploymentScript folder.

DJO_ONBASE_DEPLOY.sh file (for Linux environment):
#! /bin/ksh
#
#- Property of DJ Orthopedic
#- All rights reserved.
#- File Name: DJO_ONBASE_DEPLOY.sh
#- Purpose    : Creates the required AQs Deploys the BPEL processes to target environment
#-
#- Usage: . DJO_ONBASE_DEPLOY.sh
#
#- =============================================================
#- Maintenance Log
#- =============================================================
#-
# ===============================================================
# Deployment of OnBase BPEL processes. Change the variables WLS_HOME and JAVA_HOME value w.r.t target environment’s SOA home directory
# ===============================================================
export WLS_HOME=/d01/oracle/products/11g/fmw
export ORACLE_SOA_HOME=${WLS_HOME}/Oracle_SOA1
export ANT_HOME=${WLS_HOME}/modules/org.apache.ant_1.7.1/
export JAVA_HOME=/d01/oracle/products/11g/fmw/jdk160_18
export PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}

echo "MDS Deployment"
deployMDS(){
ant -buildfile DeployMDS/build.xml -propertyfile  DeployMDS/build.properties
         }
deploy(){
                              ant -propertyfile build.properties
 }
deployMDS
echo "MDS Deployment Done... "
deploy

Deploy.cmd file (for windows environment):

set WLS_HOME=C:\Oracle\Middleware (you have to mention your WLS_HOME here)
set ORACLE_SOA_HOME=%WLS_HOME%\Oracle_SOA1
set ANT_HOME=%WLS_HOME%\modules\org.apache.ant_1.7.1\
set JAVA_HOME=C:\Java\jdk1.6.0_26 (you have to mention your JAVA_HOME here)

set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%

echo "MDS Deployment"
ant  -buildfile DeployMDS/build.xml -propertyfile build.properties unDeployMDS
echo "MDS Deployment Done... "
build.properties file:

#server information
managed.server.host=localhost   (you have to mention your SERVER.HOST value here)
managed.server.port=8001 (you have to mention your SERVER.PORT value here)

# User and credentials for the servers
server.user=weblogic (you have to mention your SERVER_USER here)
server.password=welcome1 (you have to mention your SERVER_PASSWORD here)

#MDS DEPLOYMENT RELATED PROPERTIES
mds.repository=../MDS/seed/apps/
mds.applications=FaultPolicies (you have to mention your policy file, which you want to deploy in the MDS)
mds.overwrite=true
mds.forceDefault=true

#set this to true if you want to undeploy the MDS folder and then deploy. For simple deployment, keep it false.
mds.undeploy=false

Create lib directory, temp directory, adf-config-file.seed file and build.xml file under DeployMDS folder inside the MDSDeploymentScript folder.

Download and copy the ant-contrib-1.0b3.jar File in the MDSDeploymentScript\DeployMDS\lib directory. Which is available in the below link: http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download.

Copy the Common_mds.jar at MDSDeploymentScript\DeployMDS\temp\Common directory.
Copy the OnBase_mds.jar at MDSDeploymentScript\DeployMDS\temp\OnBase directory.



adf-config-file.seed file:

<?xml version="1.0" encoding="windows-1252" ?>
<adf-config xmlns="http://xmlns.oracle.com/adf/config"
            xmlns:sec="http://xmlns.oracle.com/adf/security/config">
  <!-- jdeveloper client side mds settings -->
  <adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
    <mds-config xmlns="http://xmlns.oracle.com/mds/config">
      <persistence-config>
        <metadata-namespaces>
          <!-- shared namespace for soa artifacts, such as xsd / wsdl -->
          <namespace metadata-store-usage="mstore-usage_1" path="/soa/shared"/>
          <!-- customer namespace for sharing stuff -->
          <namespace metadata-store-usage="mstore-usage_1" path="/apps"/>
        </metadata-namespaces>
        <metadata-store-usages>
          <!-- default store, based on the current oracle.home sys env -->
          <metadata-store-usage id="mstore-usage_1">
            <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
              <property value="MDS_LOC"
                        name="metadata-path"/>
              <property value="seed" name="partition-name"/>
            </metadata-store>
          </metadata-store-usage>
        </metadata-store-usages>
      </persistence-config>
    </mds-config>
  </adf-mds-config>
  <sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
    <CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore"
                            credentialStoreLocation="../../src/META-INF/jps-config.xml"/>
  </sec:adf-security-child>
</adf-config>

build.xml file:

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="DeployAll" default="deployMDS">
 <property name="mds.serverURL"
           value="http://${managed.server.host}:${managed.server.port}"/>
 <property name="tmp.output.dir" value="${basedir}/temp"/>
 <property environment="env"/>
 <property name="oracle.home" value="${env.ORACLE_SOA_HOME}"/>
 <property name="wl_home" value="${env.WLS_HOME}/wlserver_10.3"/>
 <path id="library.MDS.Contrib">
  <pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar"/>
 </path>
 <taskdef resource="net/sf/antcontrib/antcontrib.properties">
  <classpath refid="library.MDS.Contrib"/>
 </taskdef>
 <import file="${oracle.home}/bin/ant-sca-deploy.xml"/>
 <target name="unDeployMDS">
  <echo>undeploy MDS</echo>
  <foreach list="${mds.applications}" param="mds.application"
           target="undeployMDSApplication" inheritall="true"
           inheritrefs="false"/>
 </target>
 <target name="deployMDS">
  <echo>undeploy and/or deploy MDS</echo>
  <if>
   <equals arg1="${mds.undeploy}" arg2="true"/>
   <then>
    <foreach list="${mds.applications}" param="mds.application"
             target="undeployMDSApplication" inheritall="true"
             inheritrefs="false"/>
   </then>
  </if>
  <foreach list="${mds.applications}" param="mds.application"
           target="deployMDSApplication" inheritall="true" inheritrefs="false"/>
 </target>
 <target name="deployMDSApplication">
  <echo>deploy MDS application ${mds.application}</echo>
  <property name="mds.deploy.dir" value="${tmp.output.dir}/${mds.application}"/>
  <delete dir="${mds.deploy.dir}"/>
  <mkdir dir="${mds.deploy.dir}"/>
  <echo>create zip from file MDS store</echo>
  <zip destfile="${mds.deploy.dir}/${mds.application}_mds.jar" compress="false">
   <fileset dir="${mds.repository}" includes="${mds.application}/**"/>
  </zip>
  <echo>create zip with MDS jar</echo>
  <zip destfile="${mds.deploy.dir}/${mds.application}_mds.zip" compress="false">
   <fileset dir="${mds.deploy.dir}" includes="*.jar"/>
  </zip>
  <echo>deploy MDS app</echo>
  <antcall target="deploy" inheritall="false">
   <param name="wl_home" value="${wl_home}"/>
   <param name="oracle.home" value="${oracle.home}"/>
   <param name="serverURL" value="${mds.serverURL}"/>
   <param name="user" value="${server.user}"/>
   <param name="password" value="${server.password}"/>
   <param name="overwrite" value="${mds.overwrite}"/>
   <param name="forceDefault" value="${mds.forceDefault}"/>
   <param name="sarLocation"
          value="${mds.deploy.dir}/${mds.application}_mds.zip"/>
  </antcall>
 </target>
 <target name="undeployMDSApplication">
  <echo>undeploy MDS application ${mds.application}</echo>
  <antcall target="removeSharedData" inheritall="false">
   <param name="wl_home" value="${wl_home}"/>
   <param name="oracle.home" value="${oracle.home}"/>
   <param name="serverURL" value="${mds.serverURL}"/>
   <param name="user" value="${server.user}"/>
   <param name="password" value="${server.password}"/>
   <param name="folderName" value="${mds.application}"/>
  </antcall>
 </target>
</project>

Copy below the fault-bindings.xml and fault-policies.xml file at MDSDeploymentScript\MDS\seed\apps\FaultPolicies folder.

Fault-bindings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1"
                     xmlns="http://schemas.oracle.com/bpel/faultpolicy"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

               <!--
            the faultpolicy mapping for the reference called
                CreditCardAuthorizationService, and PartnerSupplierService
        -->
               <reference faultPolicy="OrderBookingFaultPolicy">
                   <name>CreditCardAuthorizationService</name>
            <name>PartnerSupplierMediator</name>
               </reference>

</faultPolicyBindings>

Fault-policies.xml:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">

               <!-- Policy for the Orderbooking processor to allow recoverable faults to be handled manually -->
               <faultPolicy version="2.0.1" id="OrderBookingFaultPolicy"
                              xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                              xmlns:xs="http://www.w3.org/2001/XMLSchema"
                              xmlns="http://schemas.oracle.com/bpel/faultpolicy"
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                              <!-- This section describes fault conditions. Build more conditions with faultName, test and action -->
                              <Conditions>
                                             <!-- in case of a remote fault (e.g. disabled service) human intervention action is triggered -->
                                             <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:remoteFault">
                                                            <condition>
                                                                           <action ref="ora-human-intervention"/>
                                                            </condition>
                                             </faultName>
                                             <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:bindingFault">
                                                            <condition>
                                                                           <action ref="ora-rethrow-fault"/>
                                                            </condition>
                                             </faultName>
                              </Conditions>
                              <Actions>
                                             <!-- This action will attempt 8 retries at increasing intervals of 2, 4, 8, 16, 32, 64, 128, and 256 seconds. -->
                                             <Action id="ora-retry">
                                                            <retry>
                                                                           <retryCount>3</retryCount>
                                                                           <retryInterval>2</retryInterval>
                                                                           <retryFailureAction ref="ora-terminate"/>
                                                                           <exponentialBackoff/>
                                                            </retry>
                                             </Action>
                                             <!-- This is an action will cause a replay scope fault-->
                                             <Action id="ora-replay-scope">
                                                            <replayScope/>
                                             </Action>
                                             <!-- This is an action will bubble up the fault-->
                                             <Action id="ora-rethrow-fault">
                                                            <rethrowFault/>
                                             </Action>
                                             <!-- This is an action will mark the work item to be "pending recovery from console"-->
                                             <Action id="ora-human-intervention">
                                                            <humanIntervention/>
                                             </Action>
                                             <!-- This action will cause the instance to terminate-->
                                             <Action id="ora-terminate">
                                                            <abort/>
                                             </Action>
                              </Actions>
               </faultPolicy>

</faultPolicies>

1 comment:

  1. hi can you please tell me where can i find common-mds.jar and OnBase_mds.jar

    ReplyDelete