User: stark   
  Date: 01/02/12 01:11:05

  Added:       security/src/build build.bat build.sh build.xml
  Log:
  The ant build file and utility scripts to build the contrib security
  code and create a patched JBoss server
  
  Revision  Changes    Path
  1.1                  contrib/security/src/build/build.bat
  
  Index: build.bat
  ===================================================================
  @echo off
  @if not "%ECHO%" == ""  echo %ECHO%
  @if "%OS%" == "Windows_NT"  setlocal
  
  REM convenience bat file to build with
  if exist %1\dist\bin\run.jar (
    set jboss_home=%1
    set jboss_dist=%jboss_home%\dist
  ) else (
    echo Specify a valid location for the jboss src as the first arg
    echo and rerun after building jboss src to create a dist directory
    exit
  )
  
  
  set CP=%jboss_home%\lib\ant.jar
  set CP=%CP%;%jboss_home%\lib\jaxp.jar
  set CP=%CP%;%jboss_home%\lib\parser.jar
  set CP=%CP%;%jboss_home%\lib\xmlbeans.jar
  set CP=%CP%;%jboss_home%\build\classes
  set CP=%CP%;%jboss_home%\lib\javac.jar
  
  java -classpath "%CP%" org.apache.tools.ant.Main -Djboss.home=%jboss_dist% %2 %3 %4 
%5
  
  
  
  1.1                  contrib/security/src/build/build.sh
  
  Index: build.sh
  ===================================================================
  #!/bin/sh
  
  # convenience sh file to build with
  if [ $# -eq 0 ]
  then
        echo "Usage: build.sh jboss_cvs_home"
        exit 1
  fi
  
  if [ -f $1/dist/bin/run.jar ]
  then
    jboss_home=$1
    jboss_dist=$jboss_home/dist
    shift
  else
    echo Specify a valid location for the jboss src as the first arg
    echo and rerun after building jboss src to create a dist directory
    exit 1
  fi
  
  CP=$jboss_home/lib/ant.jar
  CP=$CP:$jboss_home/lib/jaxp.jar
  CP=$CP:$jboss_home/lib/parser.jar
  CP=$CP:$jboss_home/lib/xmlbeans.jar
  CP=$CP:$jboss_home/lib/build/classes
  CP=$CP:$jboss_home/lib/javac.jar
  
  java -classpath "$CP" org.apache.tools.ant.Main -Djboss.home=$jboss_dist $*
  
  
  
  1.1                  contrib/security/src/build/build.xml
  
  Index: build.xml
  ===================================================================
  <!-- An ant build file for security contrib framework
  @author [EMAIL PROTECTED]
  @version $Revision: 1.1 $
  -->
  <project name="contrib-security" default="deploy" basedir="../../">
        <target name="init">
                <property name="lib.dir" value="${jboss.home}/lib" />
                <property name="lib.ext.dir" value="${jboss.home}/lib/ext" />
                <property name="bin.dir" value="${jboss.home}/bin" />
                <property name="build.dir" value="build"/>
                <property name="build.classes.dir" value="build/classes"/>
                <property name="conf.dir" value="${jboss.home}/conf/default"/>
                <property name="dist.dir" value="dist"/>
                <property name="src.lib" value="${basedir}/lib"/>
                <property name="src.dir" value="${basedir}/src/main"/>
            <property name="classpath" 
value="${build.classes.dir}:${lib.dir}/jaas.jar:${bin.dir}/run.jar:${lib.ext.dir}/ejb.jar:${lib.ext.dir}/jboss.jar:${lib.dir}/jmxri.jar:${lib.ext.dir}/awt.jar:${lib.dir}/xml.jar:${lib.ext.dir}/ejb2.0.jar:${lib.ext.dir}/ejxeditor.jar:${lib.ext.dir}/ejxejb.jar:${lib.ext.dir}/jta-spec1_0_1.jar:${lib.ext.dir}/jnpserver.jar:${lib.ext.dir}/dynaserver.jar:${lib.ext.dir}/hsql.jar:${lib.ext.dir}/webserver.jar:${lib.ext.dir}/idb.jar:${lib.dir}/jdbc2_0-stdext.jar:${lib.ext.dir}/jpl-util-0_5b.jar:${lib.ext.dir}/jms.jar:${lib.ext.dir}/exolabcore-0.1.jar:${lib.ext.dir}/jboss-jms.jar:${lib.ext.dir}/jaxp.jar:${lib.ext.dir}/connector.jar:${lib.ext.dir}/mail.jar"/>
  
                <mkdir dir="${build.dir}"/>
                <mkdir dir="${build.classes.dir}"/>
  
                <echo message="Using basedir=${basedir}" />
        </target>
        <target name="validate" unless="jboss.home" depends="init">
                <fail message="+++ Error, jboss.home is not set" />
        </target>
  
        <!-- Deploy the source dependent patch jars and test ejb jar -->
        <target name="deploy" depends="install">
                <mkdir dir="${jboss.home}/lib/patch"/>
                <copy todir="${conf.dir}">
                        <fileset dir="${src.dir}/org/jboss/test/security/test/ejbs">
                                <include name="*.properties" />
                        </fileset>
                </copy>
  
                <!-- Create the jboss-patch.jar that contains the security extensions
            and core overrides.
            -->
                <jar jarfile="${jboss.home}/lib/patch/jboss-patch.jar"
                        basedir="${build.classes.dir}"
                >
                        <include name="org/jboss/ejb/**" />
                        <include name="org/jboss/metadata/**" />
                        <include name="org/jboss/security/**" />
                        <include name="org/jboss/util/**" />
                        <!-- Include the test permission classes -->
                        <include name="org/jboss/test/security/test/Namespace*.class" 
/>
                        <include name="org/jboss/test/security/test/Perm*.class" />
                        <!-- Exclude the JAAS classes that they have to be on the 
classspath -->
                        <exclude name="org/jboss/security/plugins/*LoginModule.class" 
/>
                </jar>
  
                <!-- Create the jboss-jaas-patch.jar that contains the JAAS login 
modules
             as they need to be on the classpath to be loaded.
            -->
                <jar jarfile="${jboss.home}/lib/patch/jboss-jaas-patch.jar"
                        basedir="${build.classes.dir}"
                >
                        <include name="org/jboss/security/plugins/*LoginModule.class" 
/>
                </jar>
  
                <!-- Create a separate jar that contains the security proxy classes.
                        These need to be segregated so that they can be assigned a 
minimal
                        Java2 permission set.
            -->
                <mkdir dir="${jboss.home}/lib/restricted"/>
                <jar jarfile="${jboss.home}/lib/restricted/proxy.jar"
                        basedir="${build.classes.dir}"
                >
                        <include 
name="org/jboss/test/security/test/ejbs/project/*Proxy.class" />
                        <include 
name="org/jboss/test/security/test/ejbs/project/interfaces/*" />
                </jar>
  
                <!-- Create the srp.jar -->
                <jar jarfile="${jboss.home}/lib/patch/srp.jar"
                        basedir="${build.classes.dir}"
                >
                        <include name="security/srp/**" />
                </jar>
  
                <!-- Create the secure-ejbs.jar -->
                <mkdir dir="${build.classes.dir}/META-INF" />
                <delete>
                        <fileset dir="${build.classes.dir}/META-INF" includes="*" />
                </delete>
                <copy todir="${build.classes.dir}/META-INF">
                        <fileset dir="${src.dir}/org/jboss/test/security/test/ejbs">
                                <include name="*.xml" />
                        </fileset>
                </copy>
                <jar jarfile="${jboss.home}/deploy/secure-ejbs.jar"
                        basedir="${build.classes.dir}"
                >
                        <include name="META-INF/*" />
                        <include name="org/jboss/test/security/test/ejbs/**" />
                        <exclude 
name="org/jboss/test/security/test/ejbs/project/interfaces/*" />
                        <exclude 
name="org/jboss/test/security/test/ejbs/project/*Proxy.class" />
                        <exclude name="org/jboss/test/security/test/ejbs/*.xml" />
                        <exclude name="org/jboss/test/security/test/ejbs/*.properties" 
/>
                </jar>
        </target>
  
        <!-- Install the source independent stuff -->
        <target name="install" depends="compile">
                <filter token="jboss.home" value="${jboss.home}" />
                <!-- Copy the run scripts and password store to bin -->
                <copy todir="${bin.dir}" filtering="yes" overwrite="yes">
                        <fileset dir="${src.dir}/resources">
                                <include name="run_patch.*" />
                        </fileset>
                </copy>
                <copy file="${src.dir}/resources/SRPVerifierStore.ser" 
todir="${bin.dir}" />
                <!-- Copy the server config files to conf/default -->
                <copy todir="${conf.dir}" overwrite="yes">
                        <fileset dir="${src.dir}/resources">
                                <include name="jboss.conf" />
                                <include name="jboss.jcml" />
                                <include name="server.policy" />
                                <include name="sample_policy.xml" />
                        </fileset>
                </copy>
                <copy file="${src.dir}/resources/server-auth.conf"
                        tofile="${conf.dir}/auth.conf" overwrite="yes"/>
        </target>
  
        <!-- Compile the security contrib code -->
        <target name="compile" depends="validate">
                <!-- Expand the srp source code -->
                <unjar src="${src.lib}/srp-src.jar" dest="${src.dir}" />
                <!-- Compile everything into build/classes -->
                <javac srcdir="${src.dir}"
                        destdir="${build.classes.dir}"
                        classpath="${classpath}"
                        debug="on"
                >
                <include name="org/jboss/**" />
                <include name="security/srp/**" />
                </javac>
  
                <!-- Generate the RMI stub for the SRPRemoteServer -->
                <rmic stubversion="1.2" base="${build.classes.dir}"
                        classname="security.srp.protocol.SRPRemoteServer"
                />
        </target>
  
        <target name="run-project-test" depends="compile">
                <java classname="org.jboss.test.security.test.ProjRepositoryMain"
                        fork="true" failonerror="true"
                >
                        <classpath>
                                <pathelement location="${jboss.home}/client/jaas.jar" 
/>
                                <pathelement location="${jboss.home}/client/ejb.jar" />
                                <pathelement 
location="${jboss.home}/client/jnp-client.jar" />
                                <pathelement 
location="${jboss.home}/client/jboss-client.jar" />
                                <pathelement location="${build.classes.dir}" />
                                <pathelement location="${src.dir}/resources/" />
                        </classpath>
                        <jvmarg 
value="-Djava.security.auth.login.config=${src.dir}/resources/auth.conf" />
                </java>
        </target>
  
        <!-- We need to jar this test up so that the Main2.SecurityDelegate class
                is in a speparate jar so that it has a codesource distinct from the
                rest of the code. This allows us to remove all the Java2 permissions
                assigned to Main2.
        -->
        <target name="run-policy-test" depends="compile">
                <jar jarfile="${build.classes.dir}/SecurityDelegate.jar" 
basedir="${build.classes.dir}">
                        <include 
name="org/jboss/test/security/test/Main2*SecurityDelegate.class" />
                </jar>
                <java classname="org.jboss.test.security.test.Main2"
                        fork="true" failonerror="true"
                >
                        <classpath>
                                <pathelement location="${jboss.home}/client/jaas.jar" 
/>
                                <pathelement location="${lib.dir}/jaxp.jar" />
                                <pathelement location="${lib.dir}/parser.jar" />
                                <pathelement 
location="${jboss.home}/client/jboss-client.jar" />
                                <pathelement 
location="${build.classes.dir}/SecurityDelegate.jar" />
                                <pathelement location="${build.classes.dir}" />
                                <pathelement location="${src.dir}/resources/" />
                        </classpath>
                        <jvmarg value="-Djava.security.manager" />
                        <jvmarg 
value="-Djava.security.policy=${src.dir}/resources/tst.policy" />
                        <arg value="tst-policy.xml" />
                </java>
        </target>
  
        <target name="run-timing-test" depends="compile">
                <java classname="org.jboss.test.security.test.Main2"
                        fork="true" failonerror="true"
                >
                        <classpath>
                                <pathelement location="${jboss.home}/client/jaas.jar" 
/>
                                <pathelement location="${lib.dir}/jaxp.jar" />
                                <pathelement location="${lib.dir}/parser.jar" />
                                <pathelement 
location="${jboss.home}/client/jboss-client.jar" />
                                <pathelement location="${build.classes.dir}" />
                        </classpath>
                        <jvmarg value="-Djava.security.manager" />
                        <jvmarg 
value="-Djava.security.policy=${src.dir}/resources/tst.policy" />
                        <!-- jvmarg 
value="-Xrunhprof:cpu=times,file=/tmp/prof.txt,depth=4" -->
                        <arg value="-t" />
                </java>
        </target>
  
        <target name="run-login-test" depends="compile">
                <java classname="org.jboss.test.security.test.TstSRPLogin"
                        fork="true" failonerror="true"
                >
                        <classpath>
                                <pathelement location="${jboss.home}/client/jaas.jar" 
/>
                                <pathelement 
location="${jboss.home}/client/jnp-client.jar" />
                                <pathelement 
location="${jboss.home}/client/jboss-client.jar" />
                                <pathelement location="${lib.dir}/jaxp.jar" />
                                <pathelement location="${lib.dir}/parser.jar" />
                                <pathelement location="${build.classes.dir}" />
                                <pathelement location="${src.dir}/resources/" />
                        </classpath>
                        <jvmarg value="-Djava.security.manager" />
                        <jvmarg 
value="-Djava.security.policy=${src.dir}/resources/tst.policy" />
                        <arg value="tst-policy.xml" />
                </java>
        </target>
  </project>
  
  
  
  

Reply via email to