<?xml version="1.0"?>
<project name="kaajee_security_providers" default="all" basedir=".">

<!--   version:    kaajee_security_provider_1.1.0.002.zip				           -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Ant build script for the sample security providers.                       -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Usage:                                                                    -->
<!--   1) build and install the sample providers                               -->
<!--      prompt> ant                                                          -->
<!--                                                                           -->
<!--   2) use the config wizard to make a new domain (see the readme).         -->
<!--                                                                           -->
<!--   3) boot the new domain (see the readme).                                -->
<!--                                                                           -->
<!--   4) reconfigure the domain to use the sample providers                   -->
<!--      (pass in your domain's directory)                                    -->
<!--     prompt> ant -Ddomain=c:\bea\user_projects\domain\kaajeewebdomain setup.domain  -->
<!--                                                                           -->
<!--   5) reboot the server to use the sample providers (see the readme).      -->
<!--                                                                           -->
<!--   7) shutdown the server (see the readme).                                -->
<!--                                                                           -->
<!--   8) de-install the sample providers and restore this directory to        -->
<!--      its original state.                                                  -->
<!--      prompt> ant clean                                                    -->
<!--																		   -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!--                                                                           -->
<!-- Internal build targets (helpers)                                          -->
<!--                                                                           -->
<!--   1) build.mdf           : builds a provider's mbean definition           -->
<!--                            file (MDF)                                     -->
<!--                                                                           -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

  <!-- global properties -->
  <property environment="env"/>
  <property name="lib"                 value="C:/bea/weblogic81/server/lib"/>
  <property name="mbeantypes"          value="${lib}/mbeantypes"/>
  <property name="sampleprovidersjar"  value="wlKaajeeSecurityProviders-1.1.0.002.jar"/>
  <property name="src_dir"             value="./src"/>
  <property name="provider_src_dir"    value="${src_dir}/gov/va/med/authentication/kernel/sspi"/>
  <property name="props_dir"           value="./props"/>
  <property name="build_dir"           value="./build"/>
  <property name="commons-dbcp"           value="./common_pool_jars/commons-dbcp-1.2.1.jar"/>
  <property name="commons-collections"    value="./common_pool_jars/commons-collections-3.1.jar"/>
  <property name="commons-pool"           value="./common_pool_jars/commons-pool-1.2.jar"/>
 
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Build These Samples                                               -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Configure properties -->
  
  
  <target name="all" depends="clean">

    <!-- Set up the build directories -->
    <mkdir dir="${build_dir}"/>

    <!-- Only copy over the commo dtd and sample provider xml files for now -->
    <copy todir="${build_dir}" flatten="true">
      <fileset dir="${lib}">
        <include name="commo.dtd"/>
      </fileset>
    </copy>
    <copy todir="${build_dir}" flatten="true">
      <fileset dir="${props_dir}">
        <include name="**/*.xml"/>
      </fileset>
    </copy>
    
    	<!-- Build the sample security providers' mbean definition files -->
    <!-- <antcall target="build.mdf"> <param name="mdf" value="KaajeeAuditor.xml"           /> </antcall>
    <antcall target="build.mdf"> <param name="mdf" value="SimpleSampleIdentityAsserter.xml"  /> </antcall> 
    <antcall target="build.mdf"> <param name="mdf" value="KaajeeAuthorizer.xml"        /> </antcall>
    <antcall target="build.mdf"> <param name="mdf" value="kaajeeRoleMapper.xml"        /> </antcall>  -->

	 <antcall target="build.mdf"> <param name="mdf" value="KaajeeManageableAuthenticator.xml" /> </antcall>
	
    
    <!-- Copy over sources (they depend on generated code so they can't be copied over until now) -->
    <copy todir="${build_dir}" flatten="true" overwrite="true">
      <fileset dir="${provider_src_dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Build the sample security providers' jar file -->
    <java classname="weblogic.management.commo.WebLogicMBeanMaker" fork="true" failonerror="true">
      <jvmarg line="-Dfiles=${build_dir} -DMJF=${build_dir}/${sampleprovidersjar}"/>
      <classpath>
      	
        <pathelement path="${java.class.path}"/>
        <pathelement path="${commons-dbcp}"/>
        <pathelement path="${commons-collections}"/>
        <pathelement path="${commons-pool}"/>
        <pathelement location="${mbeantypes}/wlManagement.jar"/>
        
      </classpath>
    </java>

    <!-- Deploy the sample security providers   <copy todir="${mbeantypes}" flatten="true">-->
    <copy todir="./" flatten="true">
      <fileset dir="${build_dir}">
        <include name="${sampleprovidersjar}"/>
      </fileset>
    </copy>

  </target>

  <!-- helper to build an MDF (mbean definition file) -->
  <target name="build.mdf" >
    <java classname="weblogic.management.commo.WebLogicMBeanMaker" fork="true" failonerror="true">
      <jvmarg line="-Dfiles=${build_dir} -DMDF=${build_dir}/${mdf} -DcreateStubs=true"/>
      <classpath>
        <pathelement path="${java.class.path}"/>
        
        <pathelement location="${build_dir}"/>
        <pathelement location="${mbeantypes}/wlManagement.jar"/>
      </classpath>
    </java>
  </target>

  <target name="clean">
    <delete quiet="true" dir="${build_dir}"/>
    <!-- <delete quiet="true" dir="${class_dir}"/> -->
    <delete quiet="true" file="./${sampleprovidersjar}"/>
    
  </target>


</project>
