Using ant to register plugins and deploy metadata xmls

Posted by Gaurav.gg.goyal on Oracle Blogs See other posts from Oracle Blogs or by Gaurav.gg.goyal
Published on Wed, 5 Dec 2012 09:58:23 +0000 Indexed on 2012/12/05 11:14 UTC
Read the original article Hit count: 308

Filed under:

Ant can be used to register plugins directly to MDS.

Following is the ant script to register plugin zip:

<target name="register_plugin" depends="compile_package">
    <echo> Register Plugin : ${plugin.base}/${project.name}.zip</echo>
    <java classname="oracle.iam.platformservice.utils.PluginUtility" classpathref="classpath" fork="true">
        <sysproperty key="XL.HomeDir" value="${oim.home.server}"/>
        <sysproperty key="OIM.Username" value="${oim.username}"/>    
        <sysproperty key="OIM.UserPassword" value="${oim.password}"/>
        <sysproperty key="ServerURL" value="${oim.url}"/>
       <sysproperty key="PluginZipToRegister" value="${plugin.base}/${project.name}.zip"/>
        <sysproperty key="java.security.auth.login.config" value="${oim.home}\designconsole\config\authwl.conf"/>
        <arg value="REGISTER"/>
        <redirector error="redirector.err" errorproperty="redirector.err" output="redirector.out" outputproperty="redirector.out"/>
    </java>
    <copy file="${plugin.base}/${project.name}.zip" todir="${oim.home.server}\plugins"/>
</target>

This script requires following properties:

plugin.base

project.name

oim.home.server

oim.username

oim.password

You can either define a properties file for these properties or define them directly in build.xml. Build.properties will look like:

# Set the OIM home here

oim.home=C:/Oracle/Middleware02/Oracle_IDM

# Set the weblogic home here

wls.home=C:/Oracle/Middleware02/wlserver_10.3

OIM.ServerName=oim_server1

# e.g.: used in building the jar and zip files

#Note : no spaces in the project name

project.name=ScheduledTask_Sample

#Set the oim username

oim.username=xelsysadm

# set the oim password

oim.password=Welcome1

WL.Username=weblogic

WL.UserPassword=weblogic1

#set the oim URL here

oim.url=t3://localhost:14000

WL.url=t3://localhost:7001

#Location from where the metadata files are pickedup for MDS import

metadata.location=C:/Project /src/ScheduledTask_Sample /metaxml/

Following is the ANT script to import metadata xml:

<target name="ImportMetadata">
                <echo> Preparing for MDS xmls Upload...</echo>
                <copy file="${oim.home}/bin/weblogic.properties" todir="."/>
                <replaceregexp file="weblogic.properties" match="wls_servername=(.*)" replace="wls_servername=${OIM.ServerName}" byline="true"/>
                <replaceregexp file="weblogic.properties" match="application_name=(.*)" replace="application_name=OIMMetadata" byline="true"/>
                <replaceregexp file="weblogic.properties" match="metadata_from_loc=(.*)" replace="metadata_from_loc=${metadata.location}" byline="true"/>
                <copy file="${oim.home}/bin/weblogicImportMetadata.py" todir="."/>
                <replace file="weblogicImportMetadata.py">
                     <replacefilter token="connect()" value="connect('${wl.username}', '${wl.password}', '${wl.url}')"/>
                </replace>
                <echo> Importing metadata xmls to MDS... </echo>
                <exec dir="." vmlauncher="false" executable="${oim.home}/../common/bin/wlst.sh">
                        <arg value="-loadProperties"/>
                        <arg value="weblogic.properties"/>
                        <arg value="weblogicImportMetadata.py"/>
                        <redirector output="deletemd_redirector.out" logerror="true" outputproperty="deletemd_redirector.out" />
                </exec>
                <echo>${deletemd_redirector.out}</echo>
                <echo>${deletemd_redirector.out}</echo>
                <echo>Completed metadata xmls import to MDS</echo>
</target>

© Oracle Blogs or respective owner

Related posts about /Oracle