Skip to content

Instantly share code, notes, and snippets.

@alexivkin
Created July 19, 2016 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexivkin/11ed0ebab094a46b9fdef1b31a5f4327 to your computer and use it in GitHub Desktop.
Save alexivkin/11ed0ebab094a46b9fdef1b31a5f4327 to your computer and use it in GitHub Desktop.
Ant Comple and Deploy automation script for IBM Security Directory Integrator

This script allows automatic build to be done for ITIM service profiles straight from the ITDI's Configuration Editor.

In other words, when configured as a second builder and an external tool to run a TDI project, it will help in creating a JAR file with an adapter profile suitable for an import into TIM. As a "runner" of the project it would deploy the adapter profile to TIM.

The next one is a bit more complicated and relies on [[http://ant-contrib.sourceforge.net/|ant-contrib]] and [[http://subclipse.tigris.org/|subclipse]] libararies to make it all work. Put the libs into the ant-contrib subfolder.

<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
AdapterBuilder
Builds an ITIM RMI adapter profile
by Alex Ivkin
====================================================================== -->
<project name="AdapterBuilder" default="packup" basedir=".">
<description>
Builds an ITIM RMI adapter profile
</description>
<xmlproperty file=".project" />
<dirname file="${ant.file}" property="tools.base"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${tools.base}/ant-contrib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="packup" description="Builds an ITIM RMI adapter profile">
<fileset id="adapter.files" dir="AdapterDefinitions/" includes="*" />
<pathconvert pathsep="," property="tdiadapter.files" refid="adapter.files" />
<!-- get the current revision number -->
<path id="svnant.libs.path">
<fileset dir="${tools.base}/ant-contrib/">
<include name="svnant.jar"/>
<include name="svnClientAdapter.jar"/>
<include name="svnjavahl.jar"/>
</fileset>
</path>
<!-- Load SvnAnt -->
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.libs.path" />
<!--<property name="curdir" location="."/>-->
<tstamp><format property="touch.time" pattern="EEE MMM d HH:mm:ss z yyyy" offset="-8" unit="hour"/></tstamp>
<!--<echo>curdir ${curdir}</echo>-->
<!-- use javahl or command line binding, svnkit="true" may hang eclipse = javahl="false" svnkit="false"-->
<svn>
<info target="${basedir}"/>
<wcVersion path="${basedir}" prefix="svn.version."/>
</svn>
<if>
<equals arg1="${svn.version.modified}" arg2="true" />
<then>
<echo message="The code you are building has not been committed." />
<echo message="Make sure to re-build once it has been committed to have the version correctly reflected in the build" />
<property name="tagalong" value="plus"/>
<property name="updatedate" value="${touch.time}"/>
</then>
<else>
<property name="tagalong" value=""/>
<property name="updatedate" value="${svn.info.lastDate}"/>
</else>
</if>
<!-- Display svn revision number-->
<!--<echo>Revision: ${svn.info.lastRev} ${svn.info.lastDate} ${basedir} ${user.dir} ${touch.time}</echo>-->
<mkdir dir="Runtime-${projectDescription.name}/${projectDescription.name}" />
<copy todir="Runtime-${projectDescription.name}/${projectDescription.name}">
<fileset dir="AdapterDefinitions/" includes="*" />
<fileset dir="Runtime-${projectDescription.name}/" includes="${projectDescription.name}.xml" />
</copy>
<replace file="Runtime-${projectDescription.name}/${projectDescription.name}/CustomLabels.properties" token="#Revision#" value="Rev:${svn.info.lastRev}${tagalong} (${updatedate})" />
<jar jarfile="Runtime-${projectDescription.name}/${projectDescription.name}.rev${svn.info.lastRev}${tagalong}.jar" basedir="Runtime-${projectDescription.name}" includes="${projectDescription.name}/*" />
<delete dir="Runtime-${projectDescription.name}/${projectDescription.name}"/>
</target>
</project>
<project name="AdapterBuilder" default="packup" basedir=".">
<description>
Builds and deploys an ITIM RMI adapter profile
</description>
<xmlproperty file=".project" />
<target name="packup" description="Builds an ITIM RMI adapter profile">
<fileset id="adapter.files" dir="AdapterDefinitions/" includes="*" />
<pathconvert pathsep="," property="tdiadapter.files" refid="adapter.files" />
<!--<echo message="${tdiadapter.files}" />-->
<mkdir dir="Runtime-${projectDescription.name}/${projectDescription.name}" />
<copy todir="Runtime-${projectDescription.name}/${projectDescription.name}">
<fileset dir="AdapterDefinitions/" includes="*" />
<fileset dir="Runtime-${projectDescription.name}/" includes="${projectDescription.name}.xml" />
</copy>
<jar jarfile="Runtime-${projectDescription.name}/${projectDescription.name}.jar" basedir="Runtime-${projectDescription.name}" includes="${projectDescription.name}/*">
</jar>
</target>
<target name="deploy" depends="packup" description="Deploy the profile onto an ITIM server">
<copy file="Runtime-${projectDescription.name}/${projectDescription.name}.jar" todir="\\${server}\f$\Temp" />
<echo message="Deploying to \\${server}..." />
<exec executable="psexec.exe">
<arg value="\\${server}" />
<arg value="-accepteula" />
<arg value="cmd"/>
<arg value="/c" />
<arg value="F:\Program Files\ibm\itim\bin\win\config_remote_services.cmd" />
<arg value="-profile" />
<arg value="${projectDescription.name}" />
<arg value="-jar" />
<arg value="F:\Temp\${projectDescription.name}.jar" />
<arg value=">" />
<arg value="nul" />
</exec>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment