blob: f1af46d81911ef68346944e7a873565969d79079 [file] [log] [blame]
<!--
Copyright (C) 2009-2013, JoshuaTree. All Rights Reserved.
Licensed to Joshua Tree Software, LLC under New BSD license agreements.
See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
JTS licenses this file to You under the New BSD License
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://jts.us/License
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="fortress-core" default="build" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- =================================
initialize all Fortress Core package properties
================================= -->
<target name="init">
<tstamp/>
<!-- read user defined properties from the build.properties -->
<property name="component-propfile" value="${basedir}/build.properties"/>
<property file="${component-propfile}"/>
<!-- read properties from the ${user.home}/propfile, if any -->
<property name="user-propfile" value="${user.home}/build.properties"/>
<property file="${user-propfile}"/>
<!-- ########### Project specific properties ########################### -->
<property name="project.name" value="Fortress Identity Access Management SDK"/>
<property name="name" value="fortress"/>
<property name="ivy.install.version" value="2.2.0"/>
<property name="title" value="Fortress Identity and Access Management SDK for Java ${version}"/>
<property name="title.samples" value="Fortress Identity and Access Management Samples for Java ${version}"/>
<property name="vendor" value="Joshua Tree Software"/>
<property name="package" value="us.jts.fortress.*"/>
<property name="package.samples" value="us.jts.fortress.samples"/>
<property name="images.dir" value="${basedir}/images"/>
<!-- ########### Env specific properties ########################### -->
<property name="src.dir" value="${basedir}/src"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.java.dir" value="${src.dir}/main/java"/>
<property name="src.test.dir" value="${src.dir}/test/java"/>
<!-- ########### Build properties & artifacts ########################### -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.test-classes.dir" value="${build.dir}/test-classes"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="dist.jar" value="${dist.dir}/${name}-${version}.jar"/>
<property name="dist.test.jar" value="${dist.dir}/${name}-${version}-test.jar"/>
<property name="src.dist.zip" value="${dist.dir}/${name}-${version}-sources.jar"/>
<property name="src.test.dist.zip" value="${dist.dir}/${name}-${version}-sourcestest.jar"/>
<property name="src.samples.dist.zip" value="${dist.dir}/${name}SamplesSrc-${version}.zip"/>
<property name="samples.dist.zip" value="${dist.dir}/${name}Samples-${version}.zip"/>
<property name="fortressBuilder.zip" value="${dist.dir}/fortressBuilder-${platform}-${version}.zip"/>
<!-- ########### LDAP properties ########################### -->
<property name="ldap.dir" value="${basedir}/ldap"/>
<property name="ldap.setup.dir" value="${ldap.dir}/setup"/>
<property name="ldap.schema.dir" value="${ldap.dir}/schema"/>
<property name="slapd.schema.dir" value="${slapd.dir}/schema"/>
<!-- ########### Configuration, Load and builder properties ########################### -->
<property name="src.load.bootstrap.script" value="${ldap.setup.dir}/refreshLDAPData-src.xml"/>
<property name="dst.load.bootstrap.script" value="${ldap.setup.dir}/refreshLDAPData.xml"/>
<property name="load.delegatedadmin.script" value="${ldap.setup.dir}/DelegatedAdminManagerLoad.xml"/>
<property name="load.demo.script" value="${ldap.setup.dir}/FortressDemoUsers.xml"/>
<property name="load.commander.script" value="${ldap.setup.dir}/CommanderDemoUsers.xml"/>
<property name="build.win.properties" value="${basedir}/build.win.properties"/>
<property name="build.nix.properties" value="${basedir}/build.nix.properties"/>
<property name="build.properties" value="${basedir}/build.properties"/>
<property name="config.dir" value="${basedir}/config"/>
<property name="config.bootstrap.dir" value="${config.dir}/bootstrap"/>
<property name="src.remote.conf" value="${config.dir}/fortress.properties.src"/>
<property name="dst.remote.conf" value="${config.dir}/fortress.properties"/>
<property name="src.bootstrap.conf" value="${config.bootstrap.dir}/fortress.properties.src"/>
<property name="dst.bootstrap.conf" value="${config.bootstrap.dir}/fortress.properties"/>
<property name="builder.bootstrap.conf" value="${builder.home}/config/bootstrap/fortress.properties"/>
<property name="builder.remote.conf" value="${builder.home}/config/fortress.properties"/>
<property name="builder.load.bootstrap.script" value="${builder.home}/ldap/refreshLDAPData-src.xml"/>
<property name="ehcache.conf" value="${config.dir}/ehcache.xml"/>
<property name="bootstrap.ehcache.conf" value="${config.bootstrap.dir}/ehcache.xml"/>
<property name="apacheds-resource.dir" value="${basedir}/src/test/resources"/>
<!-- ########### Slapd manage & config properties ########################### -->
<property name="stop.slapd.script-win" value="${ldap.setup.dir}/stopSlapd.cmd"/>
<property name="src.start.slapd.script-win" value="${ldap.setup.dir}/startSlapd.cmd.src"/>
<property name="dst.start.slapd.script-win" value="${ldap.setup.dir}/startSlapd.cmd"/>
<property name="stop.slapd.script" value="${ldap.setup.dir}/stopSlapd.sh"/>
<property name="start.slapd.script" value="${ldap.setup.dir}/startSlapd.sh"/>
<property name="mkdir.slapd-win" value="${ldap.setup.dir}/mkDir.cmd"/>
<property name="uninstall.slapd.script" value="${ldap.setup.dir}/uninstall.sh"/>
<property name="install.slapd.script" value="${ldap.setup.dir}/install.sh"/>
<property name="source.slapd.conf" value="${ldap.dir}/slapd.conf.src"/>
<property name="target.slapd.conf" value="${ldap.dir}/slapd.conf"/>
<property name="dst.slapd.conf" value="${slapd.dir}/slapd.conf"/>
<property name="source.fortress.schema" value="${ldap.schema.dir}/fortress.schema"/>
<property name="target.fortress.schema" value="${slapd.schema.dir}/fortress.schema"/>
<property name="db.cfg" value="${ldap.dir}/DB_CONFIG"/>
<!-- ########### Sentry manage & config properties ########################### -->
<property name="sentry" value="sentry"/>
<property name="sentry.dir" value="${basedir}/${sentry}-${version}"/>
<property name="sentry.zip" value="${lib.dir}/${sentry}-${version}.jar"/>
<!-- ########### EnMasse manage & config properties ########################### -->
<property name="enmasse" value="enmasse"/>
<property name="enmasse.dir" value="${basedir}/${enmasse}-${version}"/>
<property name="enmasse.zip" value="${basedir}/lib/${enmasse}-${version}.jar"/>
<!-- ########### Commander manage & config properties ########################### -->
<property name="commander" value="commander"/>
<property name="commander.dir" value="${basedir}/${commander}-${version}"/>
<property name="commander.zip" value="${basedir}/lib/${commander}-${version}.jar"/>
<!-- ########### Java compile switches ########################### -->
<property name="javac.optimize" value="false"/>
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="true"/>
<!-- ########### Javadoc properties ########################### -->
<property name="javadoc.dir" value="${dist.dir}/docs/api"/>
<property name="javadoc.images.dir" value="${javadoc.dir}/images"/>
<property name="javadoc.bottom" value="&lt;small&gt;Copyright &amp;copy; 2009-2013, JoshuaTree. All Rights Reserved. Generated ${TODAY}&lt;/small&gt;"/>
<property name="javadoc.overview" value="${src.java.dir}/us/jts/fortress/overview.html" />
<property name="javadoc.dist.zip" value="${dist.dir}/${name}-${version}-javadoc.jar"/>
<property name="javadoc.stylesheet" value="${src.java.dir}/us/jts/fortress/fortress-javadoc.css" />
<property name="javadoc.samples.dir" value="${dist.dir}/docs/samples"/>
<property name="javadoc.samples.images.dir" value="${javadoc.samples.dir}/images"/>
<property name="javadoc.samples.dist.zip" value="${dist.dir}/${name}-${version}-javadocsamples.jar"/>
<property name="javadoc.samples.overview" value="${src.test.dir}/us/jts/fortress/samples/overview.html" />
<!-- ########### Fortress Package Dependencies ########################### -->
<property name="commons-config.jar" value="${lib.dir}/commons-configuration-1.6.jar"/>
<property name="commons-lang.jar" value="${lib.dir}/commons-lang-2.4.jar"/>
<property name="commons-collections.jar" value="${lib.dir}/commons-collections-3.2.1.jar"/>
<property name="commons-pool.jar" value="${lib.dir}/commons-pool-1.5.2.jar"/>
<property name="commons-logging.jar" value="${lib.dir}/commons-logging-1.1.1.jar"/>
<property name="commons-io.jar" value="${lib.dir}/commons-io-2.4.jar"/>
<property name="cxf-common-utilities.jar" value="${lib.dir}/cxf-common-utilities-2.5.0.jar"/>
<property name="commons-codec.jar" value="${lib.dir}/commons-codec-1.2.jar"/>
<property name="unboundsdk.jar" value="${lib.dir}/unboundid-ldapsdk-2.1.0.jar"/>
<property name="jgraph.jar" value="${lib.dir}/jgrapht-jdk1.5-0.7.3.jar"/>
<property name="log4j.jar" value="${lib.dir}/log4j-1.2.17.jar"/>
<property name="junit.jar" value="${lib.dir}/junit-4.9.jar"/>
<property name="jasypt.jar" value="${lib.dir}/jasypt-1.8.jar"/>
<property name="jaxb-api.jar" value="${lib.dir}/jaxb-api-2.2.6.jar"/>
<property name="jaxb-impl.jar" value="${lib.dir}/jaxb-impl-2.2.4-1.jar"/>
<property name="jaxb-xjc.jar" value="${lib.dir}/jaxb-xjc-2.2.4-1.jar"/>
<property name="jackson-jaxrs.jar" value="${lib.dir}/jackson-jaxrs-1.9.0.jar"/>
<property name="commons-httpclient.jar" value="${lib.dir}/commons-httpclient-3.1.jar"/>
<property name="jsr311-api.jar" value="${lib.dir}/jsr311-api-1.1.1.jar"/>
<property name="ehcache-core.jar" value="${lib.dir}/ehcache-core-2.6.5.jar"/>
<property name="slf4j-api.jar" value="${lib.dir}/slf4j-api-1.7.5.jar"/>
<property name="slf4j-jcl.jar" value="${lib.dir}/slf4j-jcl-1.7.5.jar"/>
<property name="slf4j-log4j.jar" value="${lib.dir}/slf4j-log4j12-1.7.5.jar"/>
<property name="apacheds-all.jar" value="${lib.dir}/apacheds-all-2.0.0-M15.jar"/>
<property name="opencsv.jar" value="${lib.dir}/opencsv-2.3.jar"/>
<!-- ########### Define classpaths ########################### -->
<path id="build.class.path">
<pathelement location="${build.classes.dir}"/>
<pathelement location="${jgraph.jar}"/>
<pathelement location="${unboundsdk.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${commons-config.jar}"/>
<pathelement location="${commons-lang.jar}"/>
<pathelement location="${commons-pool.jar}"/>
<pathelement location="${commons-io.jar}"/>
<pathelement location="${jasypt.jar}"/>
<pathelement location="${jaxb-api.jar}"/>
<pathelement location="${jaxb-impl.jar}"/>
<pathelement location="${jaxb-xjc.jar}"/>
<pathelement location="${jackson-jaxrs.jar}"/>
<pathelement location="${commons-httpclient.jar}"/>
<pathelement location="${jsr311-api.jar}"/>
<pathelement location="${cxf-common-utilities.jar}"/>
<pathelement location="${ehcache-core.jar}"/>
<pathelement location="${apacheds-all.jar}"/>
<pathelement location="${opencsv.jar}"/>
</path>
<!-- This is used for the JUnit Tests -->
<path id="test.class.path">
<path location="${config.dir}"/>
<path location="${apacheds-resource.dir}"/>
<pathelement location="${build.test-classes.dir}"/>
<pathelement location="${dist.jar}"/>
<pathelement location="${jgraph.jar}"/>
<pathelement location="${unboundsdk.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${log4j.jar}"/>
<pathelement location="${commons-config.jar}"/>
<pathelement location="${commons-lang.jar}"/>
<pathelement location="${commons-pool.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${commons-collections.jar}"/>
<pathelement location="${commons-codec.jar}"/>
<pathelement location="${commons-io.jar}"/>
<pathelement location="${jasypt.jar}"/>
<pathelement location="${jackson-jaxrs.jar}"/>
<pathelement location="${commons-httpclient.jar}"/>
<pathelement location="${jsr311-api.jar}"/>
<pathelement location="${cxf-common-utilities.jar}"/>
<pathelement location="${jaxb-api.jar}"/>
<pathelement location="${jaxb-impl.jar}"/>
<pathelement location="${jaxb-xjc.jar}"/>
<pathelement location="${ehcache-core.jar}"/>
<pathelement location="${slf4j-api.jar}"/>
<pathelement location="${slf4j-jcl.jar}"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
<pathelement location="${images.dir}"/>
<pathelement location="${apacheds-all.jar}"/>
<pathelement location="${opencsv.jar}"/>
</path>
<!-- This is used before the initial loads have stored properties on the ldap server. -->
<path id="bootstrap.class.path">
<path location="${config.bootstrap.dir}"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${jgraph.jar}"/>
<pathelement location="${unboundsdk.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${log4j.jar}"/>
<pathelement location="${commons-config.jar}"/>
<pathelement location="${commons-lang.jar}"/>
<pathelement location="${commons-pool.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${commons-collections.jar}"/>
<pathelement location="${jasypt.jar}"/>
<pathelement location="${ehcache-core.jar}"/>
</path>
<!-- ########### Test properties ########################### -->
<property name="test.sample.entry" value="us.jts.fortress.samples.AllSamplesJUnitTest"/>
<property name="test.regression.entry" value="us.jts.fortress.rbac.FortressJUnitTest"/>
<property name="test.failonerror" value="false" />
<property name="test.showoutput" value="yes" />
<!-- define Maven coordinates (publishing only) -->
<property name="groupId" value="us.jts" />
<property name="artifactId" value="fortress" />
<!-- defined maven snapshots and staging repository id and url (publishing only) -->
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots" />
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
<!-- define artifacts' name, which follows the convention of Maven (publishing only) -->
<property name="maven-jar" value="${dist.jar}" />
<property name="maven-javadoc-jar" value="${javadoc.dist.zip}" />
<property name="maven-sources-jar" value="${src.dist.zip}" />
</target>
<!-- =================================
target: clean - Will remove old distribution packages from dist folder
================================= -->
<target name="clean" depends="init" description="--> removes generated files">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- =================================
target: compile the source
================================= -->
<target name="compile" depends="init,resolve" description="--> compiles source files">
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${src.java.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.dir}">
<classpath refid="build.class.path"/>
</javac>
</target>
<!-- =================================
target: compile the test source
================================= -->
<target name="compile-test" depends="compile" description="--> compiles test source files">
<mkdir dir="${build.test-classes.dir}"/>
<javac destdir="${build.test-classes.dir}"
srcdir="${src.test.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
optimize="${javac.optimize}">
<classpath refid="build.class.path"/>
</javac>
</target>
<!-- =================================
target: build-jar - create java archive (jar) files which contain the compiled classes
================================= -->
<target name="build-jar" depends="compile" description="--> create the core classes">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${dist.jar}">
<fileset dir="${build.classes.dir}"/>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
<manifest>
<attribute name="Created-By" value="${vendor} - ${project.name} dev team"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Specification-Title" value="${title}"/>
<attribute name="Package" value="${package}"/>
<attribute name="Extension-Name" value="${name}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Compile-JDK" value="${java.runtime.version}"/>
<attribute name="Test-VM" value="${java.vm.version}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
</jar>
</target>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<!-- =================================
target: build-jar-test - create jar containing compiled test classes
================================= -->
<target name="build-jar-test" depends="compile-test" description="--> create the core test classes">
<mkdir dir="${dist.dir}"/>
<jar jarfile="${dist.test.jar}">
<fileset dir="${build.test-classes.dir}"/>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
<manifest>
<attribute name="Created-By" value="${vendor} - ${project.name} dev team"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Specification-Title" value="${title}"/>
<attribute name="Package" value="${package}"/>
<attribute name="Extension-Name" value="${name}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Compile-JDK" value="${java.runtime.version}"/>
<attribute name="Test-VM" value="${java.vm.version}"/>
</manifest>
</jar>
</target>
<!-- =================================
target: create the javadoc based on source code
================================= -->
<target name="javadoc" depends="init" description="--> generates javadocs">
<mkdir dir="${javadoc.dir}"/>
<javadoc packagenames="${package}"
sourcepath="${src.java.dir}"
destdir="${javadoc.dir}"
windowtitle="${title}"
doctitle="${title} "
bottom="${javadoc.bottom}"
overview="${javadoc.overview}"
public="true"
version="true"
author="true"
splitindex="false"
nodeprecated="true"
nodeprecatedlist="true"
notree="true"
noindex="false"
nohelp="true"
nonavbar="false"
classpathref="test.class.path"
serialwarn="false">
</javadoc>
</target>
<!-- =================================
target: create the javadoc based on source test code
================================= -->
<target name="javadoc-samples" depends="init" description="--> generates samples javadocs">
<mkdir dir="${javadoc.samples.dir}"/>
<javadoc packagenames="${package.samples}"
sourcepath="${src.test.dir}"
destdir="${javadoc.samples.dir}"
windowtitle="${title.samples}"
doctitle="${title.samples} "
bottom="${javadoc.bottom}"
overview="${javadoc.samples.overview}"
public="true"
version="true"
author="true"
splitindex="false"
nodeprecated="true"
nodeprecatedlist="true"
notree="true"
noindex="false"
nohelp="true"
nonavbar="false"
classpathref="test.class.path"
serialwarn="false">
</javadoc>
</target>
<!-- =================================
target: build
================================= -->
<target name="build" depends="clean,build-jar,build-jar-test,javadoc,javadoc-samples" description="--> create the core Fortress library">
<copy todir="${dist.dir}" file="${basedir}/LICENSE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/NOTICE.txt"/>
</target>
<!-- =================================
target: dist - creates the distribution packages
================================= -->
<target name="dist" depends="build" description="--> create source and binary distribution">
<zip destfile='${src.dist.zip}'>
<zipfileset dir='${src.java.dir}'/>
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</zipfileset>
</zip>
<zip destfile='${src.test.dist.zip}'>
<zipfileset dir='${src.test.dir}'/>
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</zipfileset>
</zip>
<zip destfile="${javadoc.dist.zip}" basedir="${javadoc.dir}">
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</zipfileset>
</zip>
<zip destfile="${samples.dist.zip}" basedir="${src.test.dir}" includes="**/samples/*.java,build.xml">
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</zipfileset>
<zipfileset dir='${javadoc.samples.dir}'/>
</zip>
</target>
<!-- =================================
target: test-samples - runs junit programming samples tests
================================= -->
<target name="test-samples" depends="compile-test,init-fortress-config" description="--> runs (junit) sample unit tests">
<echo message="Run the Fortress programming sample JUnit tests..."/>
<junit fork="yes" haltonfailure="${test.failonerror}" showoutput="${test.showoutput}">
<sysproperty key="tenant" value="${tenant}"/>
<sysproperty key="version" value="${version}"/>
<classpath refid="test.class.path"/>
<formatter type="plain" usefile="false"/>
<test name="${test.sample.entry}"/>
</junit>
</target>
<!-- =================================
target: test-full - runs junit regression tests
================================= -->
<target name="test-full" depends="build-jar,compile-test,init-fortress-config" description="--> run junit FULL regression tests">
<echo message="Run the Fortress regression JUnit tests. Be patient this can take a while to complete."/>
<junit fork="yes" haltonfailure="${test.failonerror}" showoutput="${test.showoutput}" maxmemory="1024m">
<sysproperty key="isFirstJUnitRun" value="false" />
<sysproperty key="version" value="${version}"/>
<sysproperty key="tenant" value="${tenant}"/>
<classpath refid="test.class.path"/>
<formatter type="plain" usefile="false"/>
<test name="${test.regression.entry}"/>
</junit>
</target>
<!-- =================================
target: test-apacheds - runs junit regression tests
================================= -->
<target name="test-apacheds" depends="build-jar,compile-test,init-fortress-config" description="--> run ApacheDS junit FULL regression tests">
<echo message="Run the Fortress regression JUnit tests. Be patient this can take a while to complete."/>
<junit fork="yes" haltonfailure="${test.failonerror}" showoutput="${test.showoutput}" maxmemory="1024m">
<sysproperty key="version" value="${version}"/>
<sysproperty key="tenant" value="${tenant}"/>
<classpath refid="test.class.path"/>
<formatter type="plain" usefile="false"/>
<test name="us.jts.fortress.rbac.apacheds.FortressJUnitApachedsTest"/>
</junit>
</target>
<!-- =================================
target: console - starts the Fortress Console app
================================= -->
<target name="console" depends="build-jar,compile-test,init-fortress-config" description="--> start Fortress Console app">
<echo message="Run the Fortress console app"/>
<java
classname="us.jts.fortress.FortressConsole"
fork="false"
failonerror="true"
timeout="4000000"
>
<classpath refid="test.class.path"/>
<sysproperty key="version" value="${version}"/>
<sysproperty key="tenant" value="${tenant}"/>
</java>
</target>
<!-- =================================
target: cli - starts the Fortress Command Line Interpreter
================================= -->
<target name="cli" depends="build-jar,compile,init-fortress-config" description="--> start Fortress Command Line Interpreter">
<echo message="Run the Fortress Command Line Interpreter"/>
<java
classname="us.jts.fortress.cli.CommandLineInterpreter"
fork="false"
failonerror="true"
timeout="4000000"
>
<classpath refid="test.class.path"/>
<sysproperty key="version" value="${version}"/>
<sysproperty key="tenant" value="${tenant}"/>
</java>
</target>
<!-- =================================
target: encrypt - allows users to encrypt values which are displayed to the standard output
================================= -->
<target name="encrypt" depends="compile" description="--> encrypt -Dparam1=value : encrypts value from clear text to encrypted cypher string that is hex encoded">
<echo message="Encrypt a value"/>
<java
classname="us.jts.fortress.util.crypto.EncryptUtil"
fork="false"
failonerror="true"
timeout="4000000"
>
<classpath refid="bootstrap.class.path"/>
<arg value="${param1}"/>
</java>
</target>
<!-- =================================
target: admin - runs the Ant demo load scripts
================================= -->
<target name="admin" depends="init-fortress-config" description="--> admin -Dparam1=path/to/FileName.xml : to run fortress admin scripts at specified location">
<echo message="############### Run Fortress Ant script ${param1} ###############"/>
<java
classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
dir="${ldap.setup.dir}"
timeout="4000000"
taskname="startAnt">
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
<path refid="bootstrap.class.path"/>
<path refid="test.class.path"/>
</classpath>
<sysproperty key="version" value="${version}"/>
<sysproperty key="tenant" value="${tenant}"/>
<arg value="-buildfile"/>
<arg file="${param1}"/>
<arg value="-Dbasedir=${ldap.setup.dir}"/>
</java>
</target>
<!-- =================================
target: admin-debug - runs the Ant demo load scripts in debug mode
================================= -->
<target name="admin-debug" depends="init-fortress-config" description="--> admin -Dparam1=path/to/FileName.xml : to run fortress admin scripts at specified location">
<echo message="############### Run Fortress Ant script ${param1} ###############"/>
<java
classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
dir="${ldap.setup.dir}"
timeout="4000000"
taskname="startAnt">
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
<!--<path refid="bootstrap.class.path"/>-->
<path refid="test.class.path"/>
</classpath>
<sysproperty key="debug.admin" value="true"/>
<sysproperty key="version" value="${version}"/>
<sysproperty key="tenant" value="${tenant}"/>
<arg value="-buildfile"/>
<arg file="${param1}"/>
<arg value="-Dbasedir=${ldap.setup.dir}"/>
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" />
</java>
</target>
<!-- =================================
target: init-openldap-config - modifies openldap artifacts for runtime use of fortress-core
================================= -->
<target name="init-openldap-config" depends="init" description="--> map env params from build.properties to scripts and config files">
<echo message="############### Modify slapd configuration per user settings ###############"/>
<delete file="${target.slapd.conf}"/>
<copy file="${source.slapd.conf}" tofile="${target.slapd.conf}"/>
<replace file="${target.slapd.conf}" token="@SCHEMA_PATH@" value="${slapd.schema.dir}"/>
<replace file="${target.slapd.conf}" token="@SUFFIX@" value="${suffix}"/>
<replace file="${target.slapd.conf}" token="@PID_PATH@" value="${pid.dir}"/>
<replace file="${target.slapd.conf}" token="@HISTORY_DB_PATH@" value="${db.hist.dir}"/>
<replace file="${target.slapd.conf}" token="@DEFAULT_DB_PATH@" value="${db.dir}"/>
<replace file="${target.slapd.conf}" token="@SLAPD_MODULE_PATH@" value="${slapd.module.dir}"/>
<replace file="${target.slapd.conf}" token="@LOGOPS@" value="${log.ops}"/>
<replace file="${target.slapd.conf}" token="@ROOT_DN@" value="${root.dn}"/>
<replace file="${target.slapd.conf}" token="@ROOT_PW@" value="${root.pw}"/>
<replace file="${target.slapd.conf}" token="@LOG_ROOT_DN@" value="${log.root.dn}"/>
<replace file="${target.slapd.conf}" token="@LOG_ROOT_PW@" value="${log.root.pw}"/>
<replace file="${target.slapd.conf}" token="@LOG_SUFFIX@" value="${log.suffix}"/>
<replace file="${target.slapd.conf}" token="@LOG_DBNOSYNCH@" value="${log.dbnosynch}"/>
<replace file="${target.slapd.conf}" token="@LOG_CHECKPOINT@" value="${log.checkpoint}"/>
<replace file="${target.slapd.conf}" token="@DFLT_DBNOSYNCH@" value="${dflt.dbnosynch}"/>
<replace file="${target.slapd.conf}" token="@DFLT_CHECKPOINT@" value="${dflt.checkpoint}"/>
<replace file="${target.slapd.conf}" token="@DB_MODULE_NM@" value="back_${db.type}.la"/>
<replace file="${target.slapd.conf}" token="@DB_TYPE@" value="${db.type}"/>
<replace file="${target.slapd.conf}" token="@LOG_RDRS@" value="${log.rdrs}"/>
<replace file="${target.slapd.conf}" token="@LOG_SIZE@" value="${log.size}"/>
<replace file="${target.slapd.conf}" token="@LOG_BDB_CACHE_SIZE@" value="${log.bdb.cache.size}"/>
<replace file="${target.slapd.conf}" token="@DFLT_RDRS@" value="${dflt.rdrs}"/>
<replace file="${target.slapd.conf}" token="@DFLT_SIZE@" value="${dflt.size}"/>
<replace file="${target.slapd.conf}" token="@DFLT_BDB_CACHE_SIZE@" value="${dflt.bdb.cache.size}"/>
<replace file="${target.slapd.conf}" token="@DFLT_BDB_CACHE_IDLE_SIZE@" value="${dflt.bdb.cache.idle.size}"/>
<echo message="Target init-all-config complete."/>
</target>
<!-- =================================
init slapd for windows
================================= -->
<target name="init-slapd-win-script" depends="init" description="--> creates a startup file for slapd on windows">
<echo message="############### Create slapd startup script for windows ###############"/>
<delete file="${dst.start.slapd.script-win}"/>
<copy file="${src.start.slapd.script-win}" tofile="${dst.start.slapd.script-win}"/>
<replace file="${dst.start.slapd.script-win}" token="@SLAPD_LOCATION@" value="${slapd.exe.location}"/>
<echo message="init-slapd-win-script."/>
</target>
<!-- =================================
initialize the config files
================================= -->
<target name="init-fortress-config" depends="init">
<echo message="Determine configuration requirements"/>
<antcall target="init-fortress-config-local"></antcall>
<antcall target="init-fortress-config-remote"></antcall>
</target>
<!-- =================================
target: init-fortress-config - uses configuration artifacts created by Fortress Builder in target system environment.
================================= -->
<target name="init-fortress-config-remote" depends="init" description="--> uses external build.properties to create local script and config files.." if="builder.home">
<echo message="############### Import fortress configuration from Builder directory ###############"/>
<copy file="${builder.bootstrap.conf}" tofile="${dst.bootstrap.conf}"/>
<copy file="${builder.remote.conf}" tofile="${dst.remote.conf}"/>
<copy file="${builder.load.bootstrap.script}" tofile="${dst.load.bootstrap.script}"/>
<echo message="############### Copy ehcache config to bootstrap config folder ###############"/>
<delete file="${bootstrap.ehcache.conf}"/>
<copy file="${ehcache.conf}" tofile="${bootstrap.ehcache.conf}"/>
<echo message="Target init-fortress-config-remote complete."/>
</target>
<!-- =================================
target: init-fortress-config - modifies fortress-core configuration artifacts for use of openldap in target system environment.
================================= -->
<target name="init-fortress-config-local" depends="init" description="--> map env params from build.properties to scripts and config files.." unless="builder.home">
<echo message="############### Modify fortress configuration per user settings ###############"/>
<delete file="${dst.bootstrap.conf}"/>
<delete file="${dst.remote.conf}"/>
<copy file="${src.bootstrap.conf}" tofile="${dst.bootstrap.conf}"/>
<replace file="${dst.bootstrap.conf}" token="@SUFFIX@" value="${suffix}"/>
<replace file="${dst.bootstrap.conf}" token="@LDAP_HOST@" value="${ldap.host}"/>
<replace file="${dst.bootstrap.conf}" token="@LDAP_PORT@" value="${ldap.port}"/>
<replace file="${dst.bootstrap.conf}" token="@ROOT_DN@" value="${root.dn}"/>
<replace file="${dst.bootstrap.conf}" token="@CFG_ROOT_PW@" value="${cfg.root.pw}"/>
<replace file="${dst.bootstrap.conf}" token="@ADM_MIN_CONN@" value="${admin.min.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@ADM_MAX_CONN@" value="${admin.max.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@LOG_MIN_CONN@" value="${log.min.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@LOG_MAX_CONN@" value="${log.max.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@USR_MIN_CONN@" value="${user.min.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@USR_MAX_CONN@" value="${user.max.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@CFG_CRYPTO_PROP@" value="${crypto.prop}"/>
<replace file="${dst.bootstrap.conf}" token="@SERVER_TYPE@" value="${ldap.server.type}"/>
<replace file="${dst.bootstrap.conf}" token="@LDAP_CLIENT_TYPE@" value="${ldap.client.type}"/>
<copy file="${src.remote.conf}" tofile="${dst.remote.conf}"/>
<replace file="${dst.remote.conf}" token="@SUFFIX@" value="${suffix}"/>
<replace file="${dst.remote.conf}" token="@LDAP_HOST@" value="${ldap.host}"/>
<replace file="${dst.remote.conf}" token="@LDAP_PORT@" value="${ldap.port}"/>
<replace file="${dst.remote.conf}" token="@ROOT_DN@" value="${root.dn}"/>
<replace file="${dst.remote.conf}" token="@CFG_ROOT_PW@" value="${cfg.root.pw}"/>
<replace file="${dst.remote.conf}" token="@ADM_MIN_CONN@" value="${admin.min.conn}"/>
<replace file="${dst.remote.conf}" token="@ADM_MAX_CONN@" value="${admin.max.conn}"/>
<replace file="${dst.remote.conf}" token="@CFG_CRYPTO_PROP@" value="${crypto.prop}"/>
<replace file="${dst.remote.conf}" token="@ENABLE_REST@" value="${enable.mgr.impl.rest}"/>
<replace file="${dst.remote.conf}" token="@REST_HTTP_USER@" value="${http.user}"/>
<replace file="${dst.remote.conf}" token="@REST_HTTP_PW@" value="${http.pw}"/>
<replace file="${dst.remote.conf}" token="@REST_HTTP_HOST@" value="${http.host}"/>
<replace file="${dst.remote.conf}" token="@REST_HTTP_PORT@" value="${http.port}"/>
<replace file="${dst.remote.conf}" token="@LDAP_CLIENT_TYPE@" value="${ldap.client.type}"/>
<echo message="############### Modify fortress load scripts per user settings ###############"/>
<delete file="${dst.load.bootstrap.script}"/>
<copy file="${src.load.bootstrap.script}" tofile="${dst.load.bootstrap.script}"/>
<replace file="${dst.load.bootstrap.script}" token="@SUFFIX_NAME@" value="${suffix.name}"/>
<replace file="${dst.load.bootstrap.script}" token="@SUFFIX_DC@" value="${suffix.dc}"/>
<replace file="${dst.load.bootstrap.script}" token="@SUFFIX@" value="${suffix}"/>
<replace file="${dst.load.bootstrap.script}" token="@LOG_ROOT_DN@" value="${log.root.dn}"/>
<replace file="${dst.load.bootstrap.script}" token="@CFG_LOG_ROOT_PW@" value="${cfg.log.root.pw}"/>
<replace file="${dst.load.bootstrap.script}" token="@LOG_MIN_CONN@" value="${user.min.conn}"/>
<replace file="${dst.load.bootstrap.script}" token="@LOG_MAX_CONN@" value="${user.max.conn}"/>
<replace file="${dst.load.bootstrap.script}" token="@USR_MIN_CONN@" value="${log.min.conn}"/>
<replace file="${dst.load.bootstrap.script}" token="@USR_MAX_CONN@" value="${log.max.conn}"/>
<replace file="${dst.load.bootstrap.script}" token="@SERVER_TYPE@" value="${ldap.server.type}"/>
<echo message="############### Copy ehcache config to bootstrap config folder ###############"/>
<delete file="${bootstrap.ehcache.conf}"/>
<copy file="${ehcache.conf}" tofile="${bootstrap.ehcache.conf}"/>
<echo message="Target init-fortress-config-local complete."/>
</target>
<!-- =================================
target: init-all-config - configures openldap, fortress and the the base load scripts for ldap Directory Information Tree (DIT)
================================= -->
<target name="init-all-config" depends="init" description="--> map env params from build.properties to scripts and config files">
<antcall target="init-openldap-config"></antcall>
<antcall target="init-fortress-config"></antcall>
<echo message="Target init-all-config complete."/>
</target>
<!-- =================================
target: load-slapd - seeds openldap and base loads for test/use.
================================= -->
<target name="load-slapd" depends="build-jar" description="--> task runs ant admin scripts to refresh fortress boostrap data">
<echo message="############### Initialize OpenLDAP ###############"/>
<echo message="Load the Fortress boostrap config and demo users"/>
<antcall target="admin">
<param name="param1" value="${dst.load.bootstrap.script}"/>
</antcall>
<antcall target="admin">
<param name="param1" value="${load.delegatedadmin.script}"/>
</antcall>
<antcall target="admin">
<param name="param1" value="${load.demo.script}"/>
</antcall>
<echo message="Target load-slapd complete."/>
</target>
<!-- =================================
target: use-slapd - configures fortress to work with an existing OpenLDAP system.
================================= -->
<target name="use-slapd" depends="build-jar" description="--> task refreshes fortress config and reloads slapd data">
<echo message="############### Use OpenLDAP ###############"/>
<antcall target="init-fortress-config"></antcall>
<antcall target="load-slapd"></antcall>
<echo message="Target use-slapd complete."/>
</target>
<!-- =================================
target: init-slapd - initializes the fortress, OpenLDAP and Berkeley DB
Use Caution as it removes the file volume containing the BerkeleyDB User data!
This operation is destructive and non-reversible. It is intended for complete openldap
system tear down and reinstall.
Never run this Ant target on a production system.
================================= -->
<target name="init-slapd" depends="build-jar" description="--> task recreates openldap system and must be run as elevated priv's to teardown/create slapd files and folders">
<echo message="############### Initialize OpenLDAP ###############"/>
<echo message="############### Stop slapd process ###############"/>
<antcall target="stop-slapd"></antcall>
<antcall target="uninstall-slapd"></antcall>
<echo message="############### Backup the slpad bdb folders ###############"/>
<!-- Backup the OpenLDAP access log db folder -->
<move todir="${db.bak.hist.dir}/${TODAY}" failonerror="false">
<fileset dir="${db.hist.dir}"/>
</move>
<!-- Backup the OpenLDAP db folder -->
<move todir="${db.bak.dir}/${TODAY}" failonerror="false">
<fileset dir="${db.dir}"/>
</move>
<antcall target="install-slapd"></antcall>
<echo message="############### Create new slapd bdb folders ###############"/>
<mkdir dir="${db.dir}"/>
<mkdir dir="${db.hist.dir}"/>
<copy todir="${db.dir}" file="${db.cfg}"/>
<copy todir="${db.hist.dir}" file="${db.cfg}"/>
<echo message="############### Backup slapd configuration and Fortress LDAP schema ###############"/>
<move file="${dst.slapd.conf}" tofile="${dst.slapd.conf}.bak.${TODAY}" failonerror="false" />
<move file="${target.fortress.schema}" tofile="${target.fortress.schema}.${TODAY}" failonerror="false" />
<echo message="############### Setup meta config and base load scripts for openldap and fortress ###############"/>
<antcall target="init-all-config"></antcall>
<echo message="############### Copy slapd configuration and Fortress LDAP schema files from source ###############"/>
<copy todir="${slapd.schema.dir}" file="${source.fortress.schema}"/>
<copy todir="${slapd.dir}" file="${target.slapd.conf}"/>
<antcall target="copy-access-libs"></antcall>
<antcall target="init-slapd-win-script"></antcall>
<antcall target="start-slapd"></antcall>
<antcall target="load-slapd"></antcall>
<echo message="Target init-slapd complete."/>
</target>
<!-- =================================
perform test configurations
================================= -->
<target name="test-config" depends="init">
<echo message="############### Test Config Steps"/>
<echo message="############### Setup meta config and base load scripts for openldap and fortress ###############"/>
<antcall target="init-all-config"></antcall>
<echo message="############### Copy slapd configuration and Fortress LDAP schema files from source ###############"/>
<copy todir="${slapd.schema.dir}" file="${source.fortress.schema}"/>
<copy todir="${slapd.dir}" file="${target.slapd.conf}"/>
<antcall target="copy-access-libs"></antcall>
<antcall target="init-slapd-win-script"></antcall>
</target>
<!-- =================================
copy the slapd access log libs from install to bin folder
================================= -->
<target name="copy-access-libs" depends="init" >
<echo message="############### Copy access log libs ${openldap.install.artifact.dir} to openldap lib folder ${slapd.module.dir}"/>
<copy todir="${slapd.module.dir}" failonerror="false">
<fileset dir="${openldap.install.artifact.dir}">
<include name="**/accesslog*"/>
</fileset>
</copy>
</target>
<!-- =================================
if windows system create slapd server folders
================================= -->
<target name="mkdir-slapd-win" depends="init" if="windows">
<echo message="############### Create the folder for windows slapd by running ${mkdir.slapd-win}"/>
<exec command="cmd.exe" spawn="true" osfamily="windows" dir="${install.image.loc}">
<arg value="/${fortress.home.drive}"/>
<arg value="${mkdir.slapd-win}"/>
</exec>
</target>
<!-- =================================
call the target to uninstall slapd server
================================= -->
<target name="uninstall-slapd" depends="init">
<antcall target="uninstall-slapd-win"></antcall>
<antcall target="uninstall-slapd-nix"></antcall>
</target>
<!-- =================================
uninstall slapd from unix system
================================= -->
<target name="uninstall-slapd-nix" depends="init" unless="windows">
<echo message="############### Uninstall OpenLDAP binaries"/>
<exec dir="." executable="/bin/sh">
<arg line="${uninstall.slapd.script}"/>
<arg value="${slapd.uninstall}"/>
<arg value="${sudo.pw}"/>
</exec>
</target>
<!-- =================================
call the target to uninstall slapd from windows system
================================= -->
<target name="uninstall-slapd-win" depends="init" if="windows">
<antcall target="uninstall-slapd-win-if-present"></antcall>
</target>
<!-- =================================
if detect running windows uninstall slapd server from windows system.
================================= -->
<target name="uninstall-slapd-win-if-present" depends="slapd.dir.check" if="slapd.dir.exists">
<echo message="############### Uninstall OpenLDAP WIN binaries: from ${slapd.exe.location2}"/>
<exec command="cmd.exe" spawn="true" osfamily="windows" dir="${slapd.exe.location2}" >
<arg value="/${fortress.home.drive}"/>
<arg value="${uninstall.image.exe}"/>
<arg value="/S"/>
</exec>
</target>
<!-- =================================
call the target to uninstall slapd server
================================= -->
<target name="install-slapd" depends="init">
<antcall target="install-slapd-win"></antcall>
<antcall target="install-slapd-nix"></antcall>
</target>
<!-- =================================
uninstall slapd from unix system
================================= -->
<target name="install-slapd-nix" depends="init" unless="windows">
<echo message="############### Install OpenLDAP binaries"/>
<exec dir="${openldap.install.artifact.dir}" executable="/bin/sh">
<arg line="${install.slapd.script}"/>
<arg value="${slapd.install}"/>
<arg value="${sudo.pw}"/>
</exec>
</target>
<!-- =================================
uninstall slapd from windows system
================================= -->
<target name="install-slapd-win" depends="init" if="windows">
<echo message="############### Install OpenLDAP WIN binaries to ${slapd.exe.location}"/>
<mkdir dir="${slapd.exe.location}"/>
<exec command="cmd.exe" spawn="false" osfamily="windows" dir="${install.image.loc}">
<arg value="/${fortress.home.drive}"/>
<arg value="${install.image.exe}"/>
<arg value="/S"/>
<arg value="/D=${slapd.exe.location}"/>
</exec>
</target>
<!-- =================================
call the target to start the slapd server
================================= -->
<target name="start-slapd" depends="init" description="--> start the OpenLDAP server">
<antcall target="start-slapd-win"></antcall>
<antcall target="start-slapd-nix"></antcall>
</target>
<!-- =================================
start the slapd server on unix system
================================= -->
<target name="start-slapd-nix" depends="init" unless="windows">
<echo message="############### Start the slapd process up ###############"/>
<exec dir="." executable="/bin/sh">
<arg line="${start.slapd.script}"/>
<arg value="${slapd.start}"/>
<arg value="${sudo.pw}"/>
</exec>
</target>
<!-- =================================
call the target to stop the slapd server
================================= -->
<target name="stop-slapd" depends="init" description="--> stop the OpenLDAP server">
<antcall target="stop-slapd-win"></antcall>
<antcall target="stop-slapd-nix"></antcall>
</target>
<!-- =================================
stop the slapd server on unix system
================================= -->
<target name="stop-slapd-nix" depends="init" unless="windows">
<echo message="############### Stop the slapd process"/>
<exec dir="." executable="/bin/sh">
<arg line="${stop.slapd.script}"/>
<arg value="${sudo.pw}"/>
</exec>
</target>
<!-- =================================
start the slapd server on windows system
================================= -->
<target name="start-slapd-win" depends="init" if="windows">
<echo message="############### Start the slapd process up: ${dst.start.slapd.script-win} in ${slapd.exe.dir}"/>
<exec command="cmd.exe" spawn="true" osfamily="windows" dir="${slapd.exe.drive}:/${slapd.exe.dir}">
<arg value="/${fortress.home.drive}"/>
<arg value="${dst.start.slapd.script-win}"/>
</exec>
</target>
<!-- =================================
return true if slapd bin folder exists
================================= -->
<target name="slapd.dir.check">
<condition property="slapd.dir.exists">
<available file="${slapd.exe.location}" type="dir"/>
</condition>
</target>
<!-- =================================
call the target to stop the slapd server on windows system
================================= -->
<target name="stop-slapd-win" depends="init" if="windows">
<antcall target="stop-slapd-win-if-present"></antcall>
</target>
<!-- =================================
if slapd dir exists stop the slapd server on windows system
================================= -->
<target name="stop-slapd-win-if-present" depends="slapd.dir.check" if="slapd.dir.exists">
<echo>${directory} exists</echo>
<echo message="############### Stop the slapd process by running ${stop.slapd.script-win}"/>
<exec command="cmd.exe" spawn="true" osfamily="windows" dir="${slapd.exe.location}">
<arg value="/${fortress.home.drive}"/>
<arg value="${stop.slapd.script-win}"/>
</exec>
</target>
<!-- =================================
target: bdb-delete - Use Caution as it removes the file volume containing the BerkeleyDB User data!
This operation is destructive and non-reversible. It is intended for clearing out existing systems data
before reinstalling with brand new data.
Never run this Ant target on a production system.
================================= -->
<target name="bdb-delete" depends="init" description="--> delete OpenLDAP DB">
<echo message="Delete BDB DB"/>
<exec dir="." executable="/bin/sh">
<arg line="${stop.slapd.script}"/>
</exec>
<delete dir="${db.dir}"/>
</target>
<!-- =================================
target: init-apacheds - initializes the fortress to use ApacheDS LDAP
================================= -->
<target name="init-apacheds" depends="build-jar" description="--> task configures fortress to use an existing ApacheDS LDAP server">
<echo message="############### Setup meta config and base load scripts for openldap and fortress ###############"/>
<antcall target="init-fortress-config"></antcall>
<antcall target="load-slapd"></antcall>
<echo message="Target init-apacheds complete."/>
</target>
<!-- =================================
target: init-jaxb - initializes properties and taskdefs used for schema generation and compilation.
================================= -->
<target name="init-jaxb" depends="resolve" description="--> initializes properties and taskdefs used for schema generation and compilation">
<property name="generated.dir" value="${basedir}/generated"/>
<property name="generated.classes.dir" value="${generated.dir}/classes"/>
<property name="generated.schema.dir" value="${generated.dir}/schema"/>
<!-- Defines XJC and SchemaGen tasks -->
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath refid="build.class.path"/>
</taskdef>
<taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask">
<classpath refid="build.class.path"/>
</taskdef>
</target>
<!-- =================================
target: generate-schema - generates JAXB schmea based on Java classes.
================================= -->
<target name="generate-schema" depends="init-jaxb,compile" description="--> generates JAXB schema based on Fortress entity classes">
<echo message="Generating schemas..."/>
<mkdir dir="${generated.schema.dir}"/>
<schemagen srcdir="${src.java.dir}/us/jts/fortress" destdir="${generated.schema.dir}">
<classpath refid="build.class.path"/>
<include name="rbac/Address.java"/>
<include name="rbac/AdminRole.java"/>
<include name="rbac/AdminRoleRelationship.java"/>
<include name="rbac/AuthZ.java"/>
<include name="rbac/Bind.java"/>
<include name="util/time/Constraint.java"/>
<include name="FortEntity.java"/>
<include name="rest/FortRequest.java"/>
<include name="rest/FortResponse.java"/>
<include name="rbac/Mod.java"/>
<include name="rbac/OrgUnit.java"/>
<include name="rbac/OrgUnitRelationship.java"/>
<include name="rbac/Permission.java"/>
<include name="rbac/PermGrant.java"/>
<include name="rbac/Permission.java"/>
<include name="rbac/PermObj.java"/>
<include name="rbac/Props.java"/>
<include name="rbac/PwPolicy.java"/>
<include name="rbac/Role.java"/>
<include name="rbac/RolePerm.java"/>
<include name="rbac/RoleRelationship.java"/>
<include name="rbac/SDSet.java"/>
<include name="rbac/Session.java"/>
<include name="rbac/User.java"/>
<include name="rbac/UserAdminRole.java"/>
<include name="rbac/UserAudit.java"/>
<include name="rbac/UserRole.java"/>
</schemagen>
</target>
<!-- =================================
target: compile-schema - generates Java classes based on schema.
================================= -->
<target name="compile-schema" depends="init-jaxb,generate-schema" description="--> generates Java classes based on Fortress schema">
<echo message="Compiling the schema..."/>
<mkdir dir="${generated.classes.dir}"/>
<xjc schema="${generated.schema.dir}/schema1.xsd" destdir="${src.java.dir}" package="us.jts.fortress.model" removeOldOutput="yes"/>
</target>
<!-- =================================
create Fortress Builder distribution package
================================= -->
<target name="builder" depends="dist" description="--> create the Fortress QUICKSTART package">
<echo message="############### Build Fortress Builder distribution package named: ${fortressBuilder.zip} ###############"/>
<zip destfile="${fortressBuilder.zip}"
update="true">
<zipfileset dir="${src.dir}" prefix="src">
<include name="*/**"/>
<exclude name="*.iml"/>
</zipfileset>
<zipfileset dir="${basedir}">
<include name="*.xml"/>
<include name="*.properties"/>
<include name="*.sh"/>
<include name="*.bat"/>
<include name="*.html"/>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
<exclude name="*.log"/>
<exclude name="build.sh"/>
<exclude name="codetemplates.xml"/>
<exclude name="formatting.xml"/>
</zipfileset>
<zipfileset dir="${images.dir}" prefix="images">
<include name="Screenshot*.png"/>
<include name="fortresscommunitylogov3.jpg"/>
</zipfileset>
<zipfileset dir="${ldap.dir}" prefix="ldap">
<include name="*/**"/>
<exclude name="*.conf"/>
<exclude name="*.log"/>
<exclude name="*/*.log"/>
</zipfileset>
<zipfileset dir="${config.dir}" prefix="config">
<include name="*/**"/>
<exclude name="*.log"/>
<exclude name="*.properties"/>
<exclude name="*/*.properties"/>
</zipfileset>
<zipfileset dir="${install.image.dir}" prefix="symas-openldap">
<include name="*/**"/>
</zipfileset>
<zipfileset dir="${ant.home}" prefix="apache-ant">
<include name="*/**"/>
</zipfileset>
<zipfileset dir="${maven.image.dir}" prefix="apache-maven">
<include name="*/**"/>
</zipfileset>
<zipfileset dir="${tomcat.image.dir}" prefix="apache-tomcat">
<include name="*/**"/>
</zipfileset>
</zip>
</target>
<!-- =================================
Install EnMasse Demo
================================= -->
<target name="install-enmasse-demo" depends="init" description="--> install EnMasse Demo">
<antcall target="doSentry"></antcall>
<antcall target="sentry-ant-start-tomcat"></antcall>
<antcall target="install-enmasse"></antcall>
<antcall target="enmasse-maven-test"></antcall>
</target>
<target name="doSentry" depends="dir.check" unless="dir.exists">
<echo>Install sentry to ${sentry.dir}"</echo>
<antcall target="install-sentry"></antcall>
<antcall target="sentry-ant-deploy-tomcat"></antcall>
</target>
<target name="dir.check">
<condition property="dir.exists">
<available file="${sentry.dir}" type="dir"/>
</condition>
</target>
<!-- =================================
Install Fortress Sentry
================================= -->
<target name="install-sentry" depends="init" description="--> install sentry">
<unzip src="${sentry.zip}" dest="${basedir}"/>
<!-- copy the build.properties file to sentry -->
<copy todir="${sentry.dir}" file="${basedir}/build.properties" overwrite="true" />
<!-- Sentry should use LDAPv3 for the demo install -->
<replace file="${sentry.dir}/build.properties" token="enable.mgr.impl.rest=true" value="enable.mgr.impl.rest=false"/>
<antcall target="sentry-ant-dist"></antcall>
<chmod dir="${basedir}" perm="a+x" includes="**/*.sh"/>
</target>
<!-- =================================
Call the Sentry Ant target to Install Fortress Sentry
================================= -->
<target name="sentry-ant-dist" depends="init" description="--> run Fortress admin script">
<echo message="############### Build Sentry Distribution ###############"/>
<java
classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
dir="${sentry.dir}"
timeout="4000000"
taskname="startAnt">
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
</classpath>
<arg value="dist"/>
</java>
</target>
<!-- =================================
Call the Sentry Ant target to deploy Tomcat Realm
================================= -->
<target name="sentry-ant-deploy-tomcat" depends="init" description="--> deploy Sentry to Tomcat">
<echo message="############### Deploy Sentry to Tomcat ###############"/>
<java
classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
dir="${sentry.dir}"
timeout="4000000"
taskname="startAnt">
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
</classpath>
<arg value="deploy-tomcat"/>
</java>
</target>
<!-- =================================
Call the Sentry Ant target to start Tomcat server
================================= -->
<target name="sentry-ant-start-tomcat" depends="init" description="--> start Tomcat server">
<echo message="############### Start Tomcat Server ###############"/>
<property name="tomcat.dir" value="./tomcat"/>
<java
classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
dir="${sentry.dir}"
timeout="4000000"
taskname="startAnt"
jvmargs="-Dversion=${version}">
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
</classpath>
<arg value="start-tomcat"/>
</java>
</target>
<!-- =================================
Call the Sentry Ant target to stop Tomcat server
================================= -->
<target name="sentry-ant-stop-tomcat" depends="init" description="--> stop Tomcat server">
<echo message="############### Stop Tomcat Server ###############"/>
<property name="tomcat.dir" value="./tomcat"/>
<java
classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
dir="${sentry.dir}"
timeout="4000000"
taskname="startAnt">
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
</classpath>
<arg value="stop-tomcat"/>
</java>
</target>
<!-- =================================
Install EnMasse
================================= -->
<target name="install-enmasse" depends="init" description="--> install sentry">
<unzip src="${enmasse.zip}" dest="${basedir}"/>
<!-- copy the fortress.properties file to enmasse -->
<copy todir="${enmasse.dir}/src/main/resources" file="${dst.remote.conf}"/>
<!-- For demo Enmasse should use LDAPv3 for backend connections -->
<copy todir="${enmasse.dir}/src/main/resources" file="${dst.remote.conf}" overwrite="true" />
<replace file="${enmasse.dir}/src/main/resources/fortress.properties" token="enable.mgr.impl.rest=true" value="enable.mgr.impl.rest=false"/>
<antcall target="enmasse-maven-install"></antcall>
<antcall target="enmasse-maven-deploy"></antcall>
</target>
<!-- =================================
Call the EnMasse Maven to install
================================= -->
<target name="enmasse-maven-install" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${enmasse.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="install"/>
</artifact:mvn>
</target>
<!-- =================================
Call the EnMasse Maven to deploy Web app
================================= -->
<target name="enmasse-maven-deploy" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${enmasse.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="tomcat:deploy"/>
<arg value="-DfailIfNoTests=false" />
</artifact:mvn>
</target>
<!-- =================================
Call the EnMasse Maven to redeploy Web app
================================= -->
<target name="enmasse-maven-redeploy" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${enmasse.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="tomcat:redeploy"/>
<arg value="-DfailIfNoTests=false" />
</artifact:mvn>
</target>
<!-- =================================
Call the EnMasse Maven to test Web app
================================= -->
<target name="enmasse-maven-test" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${enmasse.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="test"/>
</artifact:mvn>
</target>
<!-- =================================
Install Commander Demo
================================= -->
<target name="install-commander-demo" depends="init" description="--> install Commander Demo">
<antcall target="doSentry"></antcall>
<antcall target="sentry-ant-start-tomcat"></antcall>
<antcall target="install-commander"></antcall>
</target>
<!-- =================================
Install Commander
================================= -->
<target name="install-commander" depends="init" description="--> install commander">
<unzip src="${commander.zip}" dest="${basedir}"/>
<!-- copy the fortress.properties file to commander -->
<copy todir="${commander.dir}/src/main/resources" file="${dst.remote.conf}" overwrite="true" />
<concat destfile="${commander.dir}/src/main/resources/fortress.properties" append="true">${line.separator}version=${version}</concat>
<!-- load the sample test policy for commander -->
<antcall target="commander-maven-load"></antcall>
<antcall target="commander-maven-deploy"></antcall>
</target>
<!-- =================================
Call the Commander Maven to install
================================= -->
<target name="commander-maven-install" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${commander.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="install"/>
</artifact:mvn>
</target>
<!-- =================================
Call the Commander Maven to deploy Web app
================================= -->
<target name="commander-maven-deploy" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${commander.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="tomcat:deploy"/>
</artifact:mvn>
</target>
<!-- =================================
Call the Commander Maven to redeploy Web app
================================= -->
<target name="commander-maven-redeploy" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn pom="${commander.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="tomcat:redeploy"/>
</artifact:mvn>
</target>
<!-- =================================
Call the Commander Maven to load test policy into LDAP
================================= -->
<target name="commander-maven-load" depends="init" description="--> load Commander test policy into LDAP">
<artifact:mvn pom="${commander.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="test"/>
</artifact:mvn>
</target>
<!-- =================================
Call the Commander Maven to integration test Web app with Selenium Web Driver
================================= -->
<target name="commander-maven-test" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<replace file="${commander.dir}/src/test/java/us/jts/commander/integration/CommanderSeleniumITCase.java" token="http://192.168.1.101:8080" value="http://${http.host}:${http.port}"/>
<artifact:mvn pom="${commander.dir}/pom.xml" mavenHome="${M2_HOME}" fork="true">
<arg value="verify"/>
<arg value="-DskipTests=false"/>
</artifact:mvn>
</target>
<!-- =================================
target: download-ivy - pulls down ivy.jar from maven 2 website
================================= -->
<target name="download-ivy" depends="init" description="--> pull the ivy jar dependency" unless="local.mode">
<!-- download from web site so that it can be used even without any special installation -->
<echo message="downloading ivy to Ant home: ${ant.home}"/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ant.home}/lib" usetimestamp="true"/>
</target>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" depends="download-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" />
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache" description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<!-- =================================
Deploy snapshot to remote Maven repository
================================= -->
<target name="deploy" depends="init" description="--> deploy snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven-snapshots-repository-url}" />
<arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
</artifact:mvn>
</target>
<!-- =================================
Update project version (both build.xml and pom.xml) from SNAPSHOT to RELEASE
================================= -->
<target name="stage" depends="dist" description="--> deploy release version to Maven staging repository">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>