[jboss-cvs] jboss-seam/examples/groovybooking ...

Emmanuel Bernard emmanuel.bernard at jboss.com
Wed Apr 18 02:40:03 EDT 2007


  User: ebernard
  Date: 07/04/18 02:40:03

  Added:       examples/groovybooking      readme.txt build-dev.properties
                        hibernate-console.properties build.xml
                        build-prod.properties
  Log:
  JBSEAM-1199 Support for .groovy deployment in WEB-INF/dev Cannot be used to write EJB 3 Groovy session beans
  JBSEAM-1200 Support for Groovy in the seam-gen environment
  
  Revision  Changes    Path
  1.1      date: 2007/04/18 06:40:03;  author: ebernard;  state: Exp;jboss-seam/examples/groovybooking/readme.txt
  
  Index: readme.txt
  ===================================================================
  This is the Hotel Booking example implemented in Groovy Beans and Hibernate JPA..
  
  JBoss AS 4.2 (with or without EJB3):
    * Install JBoss AS 4.2 with the default J2EE profile
    * Set jboss.home in build.properties
    * ant explode
    * Start JBoss AS 
    * Access the app at http://localhost:8080/groovybooking/
  
  When editing Groovy files from action, a simple ant explode is enough
  When editing Groovy files from model, ant explode restart is necessary
  
  
  
  
  1.1      date: 2007/04/18 06:40:03;  author: ebernard;  state: Exp;jboss-seam/examples/groovybooking/build-dev.properties
  
  Index: build-dev.properties
  ===================================================================
  debug=true
  action.dir=WEB-INF/dev
  
  
  
  1.1      date: 2007/04/18 06:40:03;  author: ebernard;  state: Exp;jboss-seam/examples/groovybooking/hibernate-console.properties
  
  Index: hibernate-console.properties
  ===================================================================
  #File used by hibernate tools to override <datasource> and other container specific settings in persistence.xml
  hibernate.connection.password=
  hibernate.connection.username=sa
  hibernate.connection.driver_class=org.hsqldb.jdbcDriver
  hibernate.dialect=org.hibernate.dialect.HSQLDialect
  hibernate.connection.url=jdbc:hsqldb:.
  
  hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
  hibernate.datasource=
  hibernate.transaction.manager_lookup_class=
  
  
  1.1      date: 2007/04/18 06:40:03;  author: ebernard;  state: Exp;jboss-seam/examples/groovybooking/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="groovybooking" default="deploy" basedir=".">
  
      <!-- Give user a chance to override without editing this file or typing -D -->
      <property file="../../build.properties" />
  
      <property name="profile" value="dev" />
      <property file="build-${profile}.properties" />
  
      <!-- set global properties for this build -->
      <property name="project.name" value="groovybooking"/>
      <property name="dist.dir" value="dist" />
      <property name="src.model.dir" value="src/model" />
      <property name="src.action.dir" value="src/action" />
      <property name="src.test.dir" value="src/test" />
      <property name="seam.dir" value="../.."/>
      <property name="seam.lib.dir" value="${seam.dir}/lib"/>
      <property name="war.dir" value="exploded-archives/${project.name}.war" />
      <property name="classes.model.dir" value="${war.dir}/WEB-INF/classes" />
      <property name="action.dir" value="WEB-INF/classes" />
      <property name="classes.action.dir" value="${war.dir}/${action.dir}" />
      <property name="test.dir" value="test-build" />
      <property name="embedded-ejb3.dir" value="${basedir}/embedded-ejb/conf" />
      <property name="deploy.dir" value="${jboss.home}/server/default/deploy" />
      <property name="war.deploy.dir" value="${deploy.dir}/${project.name}.war" />
      <property name="testng.jar" value="${seam.lib.dir}/testng-4.5.1-jdk15.jar" />
      <property name="javac.debug" value="true" />
      <property name="javac.deprecation" value="false" />
      <property name="debug" value="false" />
      
      <fileset id="lib" dir="${seam.dir}">
          <include name="lib/*.jar" />
          <include name="jboss-seam.jar"/>
      </fileset>
      
      <path id="build.classpath">
          <fileset refid="lib" />
      </path>
  
      <taskdef name ="groovyc"
          classname ="org.codehaus.groovy.ant.Groovyc"
          classpathref="build.classpath"/> <!-- really only the groovy jar is necessary -->
      <taskdef name="groovy"
          classname="org.codehaus.groovy.ant.Groovy"
          classpathref="build.classpath"/> <!-- really only the groovy jar is necessary -->
  
      
      <target name="init" description="Initialize the build">
          <mkdir dir="${classes.model.dir}" />
          <mkdir dir="${classes.action.dir}" />
          <mkdir dir="${dist.dir}" />
          <!-- if a .groovy file is in model or action, set groovy.present -->
          <groovy>
            File file = new File("${properties.basedir}/${properties.'src.action.dir'}")
            boolean isGroovy
            file.eachFileRecurse {
              //use an exception for short exit
              if ( it.name.endsWith('.groovy') ) isGroovy = true
            }
  
            if (!isGroovy) {
              file = new File("${properties.basedir}/${properties.'src.model.dir'}")
              file.eachFileRecurse {
                //use an exception for short exit
                if ( it.name.endsWith('.groovy') ) isGroovy = true
              }
            }
            if (isGroovy) properties.'groovy.present' = true
          </groovy>
          <condition property="groovy.dynamic" value="true">
              <and>
                  <isset property="groovy.present"/>
                  <istrue value="${debug}"/>
              </and>
          </condition>
          <condition property="groovy.static" value="true">
              <and>
                  <isset property="groovy.present"/>
                  <isfalse value="${debug}"/>
              </and>
          </condition>
      </target>
      
      <target name="compilemodel" depends="init,compilemodel.groovy"
              description="Compile the Java source code"
              unless="eclipse.running">
          <javac classpathref="build.classpath" 
                 destdir="${classes.model.dir}" 
                 debug="${javac.debug}" 
                 deprecation="${javac.deprecation}" 
                 nowarn="on">
              <src path="${src.model.dir}" />
          </javac>
      </target>
  
      <!-- private task -->
      <target name="compilemodel.groovy" if="groovy.present">
          <!-- model is always compiled -->
          <groovyc classpathref="build.classpath"
                 destdir="${classes.model.dir}"
                 srcdir="${src.model.dir}" >
          </groovyc>
      </target>
      
      <target name="compileactions" depends="init,compileactions.compilegroovy,compileactions.copygroovy"
              description="Compile the Java source code"
              unless="eclipse.running">
          <javac classpathref="build.classpath"
                 destdir="${classes.action.dir}"
                 debug="${javac.debug}" 
                 deprecation="${javac.deprecation}" 
                 nowarn="on">
              <classpath path="${classes.model.dir}"/>
              <src path="${src.action.dir}" />
          </javac>
      </target>
  
      <!-- private task -->
      <target name="compileactions.compilegroovy" if="groovy.static">
          <path id="groovy.action.classpath">
              <path refid="build.classpath"/>
              <dirset dir="${classes.model.dir}"/>
          </path>
          <groovyc classpathref="groovy.action.classpath"
                 destdir="${classes.action.dir}"
                 srcdir="${src.action.dir}" >
          </groovyc>
      </target>
  
      <!-- private task -->
      <target name="compileactions.copygroovy" if="groovy.dynamic">
          <!-- copy the action groovy files into action if not compiled -->
          <copy todir="${classes.action.dir}">
              <fileset dir="${src.action.dir}">
                  <include name="**/*.groovy"/>
              </fileset>
          </copy>
      </target>
      
      <target name="copyclasses" depends="init,compileactions.copygroovy"
              description="Copy the classes that were compiled by eclipse"
              if="eclipse.running">
          <copy todir="${classes.model.dir}">
              <fileset dir="classes/model">
                  <include name="**/*.class"/>
              </fileset>
          </copy>
          <copy todir="${classes.action.dir}">
              <fileset dir="classes/action">
                  <include name="**/*.class"/>
              </fileset>
          </copy>
      </target>
      
      <target name="war" depends="compilemodel,compileactions,copyclasses" 
              description="Build the distribution .war file">
          
          <copy todir="${war.dir}/WEB-INF/classes">
              <fileset dir="${basedir}/resources">
                  <include name="seam.properties" />
                  <include name="security.drl" />
              </fileset>
          </copy>
          
          <copy tofile="${war.dir}/WEB-INF/classes/META-INF/persistence.xml" 
                file="${basedir}/resources/META-INF/persistence-${profile}-war.xml"
                overwrite="true"/>
          
          <copy tofile="${war.dir}/WEB-INF/classes/import.sql" 
                file="${basedir}/resources/import-${profile}.sql"
                overwrite="true"/>
          
          <copy todir="${war.dir}">
              <fileset dir="${basedir}/view" />
          </copy>
          
          <copy todir="${war.dir}/WEB-INF">
              <fileset dir="${basedir}/resources/WEB-INF">
                  <include name="*.*"/>
                  <include name="classes/**/*.*"/>
                  <exclude name="classes/**/*.class"/>
                  <exclude name="classes/**/*.groovy"/>
              </fileset>
              <filterset>
                  <filter token="debug"       value="${debug}" />
                  <filter token="jndiPattern" value="${project.name}/#{ejbName}/local"/>
                  <filter token="embeddedEjb" value="false"/>
              </filterset>
          </copy>
          
          <copy todir="${war.dir}/WEB-INF">
              <fileset dir="${basedir}/resources/WEB-INF">
                  <include name="lib/*.*"/>
                  <include name="classes/**/*.class"/>
              </fileset>
          </copy>
          
          <copy todir="${war.dir}/WEB-INF/lib">
              <fileset dir="${seam.lib.dir}">
                  <include name="ajax4jsf*.jar" />
                  <include name="richfaces*.jar" />
                  <include name="oscache*.jar" />
                  <include name="commons*.jar" />
                  <include name="jsf-facelets.jar" />
                  <include name="antlr-*.jar"/>
                  <include name="groovy-*.jar" if="groovy.present"/>
              </fileset>
              <fileset dir="${seam.dir}/drools/lib">
                  <include name="drools-*.jar"/>
                  <include name="janino-*.jar"/>
                  <include name="antlr-*.jar"/>
                  <include name="commons-jci-*.jar"/>
                  <include name="stringtemplate-*.jar"/>
              </fileset>
              <fileset dir="${seam.dir}">
                  <include name="jboss-seam-*.jar" />
                  <exclude name="jboss-seam-gen.jar" />
              </fileset>
          </copy>
          
          <copy todir="${war.dir}/WEB-INF/classes">
              <fileset dir="${basedir}/resources"> 
                  <include name="messages*.properties"/>
              </fileset>
          </copy>
          
          <copy todir="${war.dir}/WEB-INF/classes">
              <fileset dir="${basedir}/resources">
                  <include name="*jpdl.xml" />
                  <include name="hibernate.cfg.xml" />
                  <include name="jbpm.cfg.xml" />
              </fileset>
          </copy>
          
          <copy todir="${war.dir}/WEB-INF/lib">
              <fileset dir="${seam.lib.dir}">
                  <include name="jboss-seam.jar" />
                  <include name="jbpm*.jar" />
                  <!-- include name="jboss-el*.jar" / -->
                  <!-- include name="el-*.jar" / -->
              </fileset>
              <fileset dir="${seam.dir}">
                  <include name="jboss-seam.jar" />
              </fileset>
          </copy>
          
      </target>
      
      <target name="archive" depends="war" 
              description="Package the archives">
          <jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
      </target>
      
      <target name="datasource">
          <fail unless="jboss.home">jboss.home not set</fail>
          <copy todir="${deploy.dir}">
              <fileset dir="${basedir}/resources">
                  <include name="${project.name}-${profile}-ds.xml" />
              </fileset>
          </copy>
      </target>
      
      <target name="explode" depends="war,datasource" 
              description="Deploy the exploded archive">
          <fail unless="jboss.home">jboss.home not set</fail>
          
          <mkdir dir="${war.deploy.dir}"/>
          <copy todir="${war.deploy.dir}">
              <fileset dir="${war.dir}"/>
          </copy>
      </target>
      
      <target name="unexplode" description="Undeploy the exploded archive">
          <delete failonerror="no">
              <fileset dir="${war.deploy.dir}">
                  <exclude name="**/*.jar"/>
              </fileset>
          </delete>
          <delete file="${deploy.dir}/${project.name}-${profile}-ds.xml" failonerror="no"/>
          <delete dir="${war.deploy.dir}" failonerror="no"/>
      </target>
      
      <target name="restart" depends="explode" description="Restart the exploded archive">
          <touch file="${war.deploy.dir}/WEB-INF/web.xml"/>
      </target>
      
      <target name="deploy" depends="archive,datasource" description="Deploy to JBoss AS">
          <fail unless="jboss.home">jboss.home not set</fail>
          <copy todir="${deploy.dir}" file="${dist.dir}/${project.name}.war" />
      </target>
      
      <target name="undeploy" description="Undeploy the example from JBoss">
          <delete file="${deploy.dir}/${project.name}.war" />
          <delete file="${deploy.dir}/${project.name}-dev-ds.xml" />
          <delete file="${deploy.dir}/${project.name}-prod-ds.xml" />
      </target>
      
      <target name="clean" description="Cleans up the build directory">
          <delete dir="${dist.dir}"/>
          <delete dir="${war.dir}"/>
          <delete dir="${basedir}/test-report"/>
          <delete dir="${basedir}/test-output"/>
          <delete failonerror="no">
              <fileset dir="${test.dir}">
                  <exclude name="**/*.class" if="eclipse.running"/>
              </fileset>
          </delete>
      </target>
      
      <target name="compiletest" unless="eclipse.running" description="Compile the Java source code for the tests">
          <mkdir dir="${test.dir}"/>
          <javac classpathref="build.classpath"
                 destdir="${test.dir}"
                 debug="${javac.debug}"
                 deprecation="${javac.deprecation}"
                 nowarn="on">
              <src path="${src.action.dir}" />
              <src path="${src.model.dir}" />
              <src path="${src.test.dir}" />
          </javac>
      </target>
      
      <target name="copytestclasses" if="eclipse.running" description="Copy classes compiled by eclipse to the test dir">
          <mkdir dir="${test.dir}"/>
          <copy todir="${test.dir}">
              <fileset dir="classes/model">
                  <include name="**/*.class"/>
              </fileset>
          </copy>
          <copy todir="${test.dir}">
              <fileset dir="classes/action">
                  <include name="**/*.class"/>
              </fileset>
          </copy>
          <copy todir="${test.dir}">
              <fileset dir="classes/test">
                  <include name="**/*.class"/>
              </fileset>
          </copy>
      </target>
      
      <target name="buildtest" depends="compiletest,copytestclasses" description="Build the tests">
          <copy todir="${test.dir}">
              <fileset dir="${basedir}/resources">
                  <exclude name="META-INF/persistence*.xml"/>
                  <exclude name="import*.sql"/>
                  <exclude name="${project.name}-*-ds.xml"/>
              </fileset>
          </copy>
          <copy tofile="${test.dir}/META-INF/persistence.xml" 
                file="${basedir}/resources/META-INF/persistence-test-war.xml"
                overwrite="true"/>
          <copy tofile="${test.dir}/import.sql" 
                file="${basedir}/resources/import-test.sql"
                overwrite="true"/>
          <copy todir="${test.dir}" flatten="true">
              <fileset dir="${src.test.dir}">
                  <include name="**/*Test.xml" />
              </fileset>
          </copy>
      </target>
      
      <target name="test" depends="buildtest" description="Run the tests">            
          <taskdef resource="testngtasks" classpath="${testng.jar}" />
          <testng outputdir="${basedir}/test-report">
              <classpath path="${test.dir}" />
              <classpath path="${embedded-ejb3.dir}" />
              <classpath refid="build.classpath" />
              <xmlfileset dir="${test.dir}" includes="*Test.xml" />
          </testng>
      </target>
      
  </project>
  
  
  
  1.1      date: 2007/04/18 06:40:03;  author: ebernard;  state: Exp;jboss-seam/examples/groovybooking/build-prod.properties
  
  Index: build-prod.properties
  ===================================================================
  debug=false
  
  
  
  
  
  



More information about the jboss-cvs-commits mailing list