Saturday, June 23, 2012

Oracle SOA11g/AIA Deployment of Shared Artifacts on MDS Using ANT (Another Neat Tool)

Shared metadata is deployed to the SOA Infrastructure on the application server as a JAR file. The JAR file should contain all the resources to share. In Oracle JDeveloper, you can create a JAR profile for creating a shared artifacts archive.
All shared metadata is deployed to an existing SOA Infrastructure partition on the server. This metadata is deployed under the /apps namespace. For example, if you have a MyProject/xsd/MySchema.xsd file in the JAR file, then this file is deployed under the /apps namespace on the server. When you refer to this artifact in Oracle JDeveloper using a SOA-MDS connection, the URL becomes oramds:/apps/MyProject/xsd/MySchema.xsd.

Shared Meta Data artifacts can also be deployed using ANT and using the JDeveloper seeded ANT scripts.



Steps to deployment using ANT

  • Build a project using JDeVeloper. Call it AIAArtifacts. Make sure you include ANT in the project


  • The sample scripts use ANT-Contrib tasks. Ensure that the ANT-Contrib is included in the JDeveloper ANT lib folder. 
  • Create build.properties as shown in the code below
build.properties

jdev.bindir=C:/jdev115/jdeveloper/bin
jdev.mywork=C:/AIA_SRC/projects/AIAArtifacts/AIAArtifacts
mywork=C:/AIA_SRC/projects/AIAArtifacts/AIAArtifacts 
#temp 
tmp.output.dir=C:/temp/ 

 
mds.repository=C:/temp/MDS_Load/soa-seed
#add directories to the AIA_MDS path if others
#mds.applications=sample
mds.applications=AIAMetaData
mds.undeploy=false
 
deployment.plan.environment=dev
 
prod.serverURL=http://192.11.44.27:8001
prod.overwrite=true
prod.user=weblogic
prod.password=welcome1
prod.forceDefault=true

dev.serverURL=
http://192.11.44.27:8001
dev.overwrite=true
dev.user=weblogic
dev.password=
welcome1
dev.forceDefault=true

  • Create the build.xml as shown below.
build.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="AIADeployAll" default="deployMDS">
    <property environment="env"/>
    <property file="build.properties"/>
    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
        <classpath>
            <pathelement location="C:/oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar"/>
        </classpath>
    </taskdef>
    <import file="${jdev.bindir}/ant-sca-deploy.xml"/>
   
    <target name="Publish Fault Policies XML to MDS">
        <delete dir="${mds.repository}"/>
        <copy file="${jdev.mywork}/AIAMetaData/faultPolicies/${deployment.plan.environment}/fault-policies.xml"
              todir="${mds.repository}/AIAMetaData/faultPolicies/"/>  
        <echo>deploy Fault Policies XML to MDS</echo>
        <foreach list="${mds.applications}" param="mds.application"
                 target="deployMDSApplication" inheritall="true"
                 inheritrefs="false"/>
    </target>  
   
     <target name="PublishSampleWSDLToMDS">
        <delete dir="${mds.repository}"/>
        <copy file="${jdev.mywork}/AIAMetaData/AIAComponents/InfrastructureServiceLibrary/V1/wsdls/SampleService.wsdl"
              todir="${mds.repository}/AIAMetaData/AIAComponents/ApplicationConnectorServiceLibrary/V1/"/>  
        <echo>deploy Move File Service WSDL to MDS</echo>
        <foreach list="${mds.applications}" param="mds.application"
                 target="deployMDSApplication" inheritall="true"
                 inheritrefs="false"/>
    </target> 
   
     <target name="PublishSampleEBOToMDS">
        <delete dir="${mds.repository}"/>
        <copy file="${jdev.mywork}/AIAMetaData/AIAComponents/ApplicationObjectLibrary/V1/schemas/SampleEBO.xsd"
              todir="${mds.repository}/AIAMetaData/AIAComponents/ApplicationObjectLibrary/V1/schemas/"/>  
        <echo>deploy Move File Service WSDL to MDS</echo>
        <foreach list="${mds.applications}" param="mds.application"
                 target="deployMDSApplication" inheritall="true"
                 inheritrefs="false"/>
    </target>
   
    <target name="deployMDSApplication">
        <echo>deploy MDS application ${mds.application}</echo>
        <echo>remove and create local MDS temp</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>
        <propertycopy name="deploy.serverURL"
                      from="${deployment.plan.environment}.serverURL"/>
        <propertycopy name="deploy.overwrite"
                      from="${deployment.plan.environment}.overwrite"/>
        <propertycopy name="deploy.user"
                      from="${deployment.plan.environment}.user"/>
        <propertycopy name="deploy.password"
                      from="${deployment.plan.environment}.password"/>
        <propertycopy name="deploy.forceDefault"
                      from="${deployment.plan.environment}.forceDefault"/>
        <echo>deploy MDS app</echo>
        <echo>deploy on ${deploy.serverURL} with user ${deploy.user}</echo>
        <echo>deploy sarFile ${mds.deploy.dir}/${mds.application}_mds.zip</echo>
        <antcall target="deploy" inheritall="false">
            <param name="wl_home" value="${wl_home}"/>
            <param name="oracle.home" value="${oracle.home}"/>
            <param name="serverURL" value="${deploy.serverURL}"/>
            <param name="user" value="${deploy.user}"/>
            <param name="password" value="${deploy.password}"/>
            <param name="overwrite" value="${deploy.overwrite}"/>
            <param name="forceDefault" value="${deploy.forceDefault}"/>
            <param name="sarLocation"
                   value="${mds.deploy.dir}/${mds.application}_mds.zip"/>
        </antcall>
    </target>
</project>


  • Run the ANT script from within JDeveloper, by right-clicking on build.xml and choosing the target.
 
 

########

0 comments: