<project name="MDSLifecycleLibrary" default="help" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<property name="PRODUCT_HOME" value="/u01/SOA11G/testmds"/>
<property name="modulename" value="SAP2-EBS2"/>
<property name="SOA_HOME" value="/u01/SOA11G/Middleware/Oracle_SOA1"/>
<target name="help">
ant -f MDSLifecycle.xml deployMDSArtifacts will deploy the MDS artifacts to the DB based MDS
ant -f MDSLifecycle.xml undeployMDSArtifacts will undeploy the MDS artifacts to the DB based MDS
</target>
<target name="deployMDSArtifacts">
<MDSLifeCycle Folder.Name="${modulename}"
WLS.Hostname="xxx.yyy.com"
WLS.Portnumber="8450"
WLS.UserName="weblogic"
WLS.User.Password="weblogic#1"
action="deploy"/>
</target>
<target name="undeployMDSArtifacts">
<MDSLifeCycle Folder.Name="${modulename}"
WLS.Hostname="xxx.yyy.com"
WLS.Portnumber="8450"
WLS.UserName="weblogic"
WLS.User.Password="weblogic#1"
action="undeploy"/>
</target>
<macrodef name="deployMDS">
<attribute name="Folder.Name"/>
<attribute name="WLS.Hostname"/>
<attribute name="WLS.Portnumber"/>
<attribute name="WLS.UserName"/>
<attribute name="WLS.User.Password"/>
<attribute name="MDS.JarFileName" default="MetaData.jar"/>
<attribute name="MDS.ZipFileName" default="MetaData.zip"/>
<attribute name="MDS.JarFile.Location"
default="${PRODUCT_HOME}/temporary/MDS"/>
<sequential>
<var name="currenttime" unset="true"/>
<tstamp>
<format property="currenttime" pattern="yyyyMMddHHmmss" locale="en,US"/>
</tstamp>
<delete dir="@{MDS.JarFile.Location}" failonerror="false"/>
<mkdir dir="@{MDS.JarFile.Location}/${currenttime}/@{Folder.Name}"/>
<copy todir="@{MDS.JarFile.Location}/${currenttime}/@{Folder.Name}">
<fileset dir="${PRODUCT_HOME}/MDS-Artifacts/@{Folder.Name}">
</fileset>
</copy>
<jar destfile="@{MDS.JarFile.Location}/@{MDS.JarFileName}"
basedir="@{MDS.JarFile.Location}/${currenttime}"
excludes="*.jpr, *.zip, *.jar, build.xml, **/*.db"/>
<delete file="@{MDS.JarFile.Location}/@{MDS.ZipFileName}"
failonerror="false"/>
<zip destfile="@{MDS.JarFile.Location}/@{MDS.ZipFileName}">
<fileset file="@{MDS.JarFile.Location}/@{MDS.JarFileName}"/>
</zip>
<ant antfile="${SOA_HOME}/bin/ant-sca-deploy.xml" target="deploy" dir="${SOA_HOME}/bin">
<property name="sarLocation"
value="@{MDS.JarFile.Location}/@{MDS.ZipFileName}"/>
<property name="serverURL"
value="http://@{WLS.Hostname}:@{WLS.Portnumber}"/>
<property name="user" value="@{WLS.UserName}"/>
<property name="password" value="@{WLS.User.Password}"/>
</ant>
<delete dir="@{MDS.JarFile.Location}"
failonerror="false"/>
</sequential>
</macrodef>
<macrodef name="undeployMDS">
<attribute name="Folder.Name"/>
<attribute name="WLS.Hostname"/>
<attribute name="WLS.Portnumber"/>
<attribute name="WLS.UserName"/>
<attribute name="WLS.User.Password"/>
<sequential>
<var name="folderName" unset="true"/>
<ant antfile="${SOA_HOME}/bin/ant-sca-deploy.xml" target="removeSharedData"
dir="${SOA_HOME}/bin">
<property name="folderName" value="@{Folder.Name}"/>
<property name="serverURL"
value="http://@{WLS.Hostname}:@{WLS.Portnumber}"/>
<property name="user" value="@{WLS.UserName}"/>
<property name="password" value="@{WLS.User.Password}"/>
</ant>
<sequential></sequential>
</sequential>
</macrodef>
<macrodef name="MDSLifeCycle">
<attribute name="Folder.Name"/>
<attribute name="WLS.Hostname"/>
<attribute name="WLS.Portnumber"/>
<attribute name="WLS.UserName"/>
<attribute name="WLS.User.Password"/>
<attribute name="MDS.JarFileName" default="MetaData.jar"/>
<attribute name="MDS.ZipFileName" default="MetaData.zip"/>
<attribute name="MDS.JarFile.Location"
default="${PRODUCT_HOME}/temporary/MDS"/>
<attribute name="action"/>
<sequential>
<if>
<equals arg1="@{action}" arg2="deploy"/>
<then>
<echo>Deploying content of @{Folder.Name} to server
http://@{WLS.Hostname}/@{WLS.Portnumber}</echo>
<deployMDS Folder.Name="@{Folder.Name}" WLS.Hostname="@{WLS.Hostname}"
WLS.Portnumber="@{WLS.Portnumber}"
WLS.UserName="@{WLS.UserName}"
WLS.User.Password="@{WLS.User.Password}"
MDS.JarFileName="@{MDS.JarFileName}"
MDS.ZipFileName="@{MDS.ZipFileName}"
MDS.JarFile.Location="@{MDS.JarFile.Location}"/>
<echo>Deployed content of @{Folder.Name} to server
http://@{WLS.Hostname}/@{WLS.Portnumber}</echo>
</then>
<elseif>
<equals arg1="@{action}" arg2="undeploy"/>
<then>
<echo>Undeploying content of @{Folder.Name} to server
http://@{WLS.Hostname}/@{WLS.Portnumber}</echo>
<undeployMDS Folder.Name="@{Folder.Name}" WLS.Hostname="@{WLS.Hostname}"
WLS.Portnumber="@{WLS.Portnumber}"
WLS.UserName="@{WLS.UserName}"
WLS.User.Password="@{WLS.User.Password}"/>
<echo>Undeployed content of @{Folder.Name} to server
http://@{WLS.Hostname}/@{WLS.Portnumber}</echo>
</then>
</elseif>
<else>
<echo>Invalid action passed</echo>
</else>
</if>
</sequential>
</macrodef>
</project>
No comments:
Post a Comment