ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Wilkinson <swilkin...@NETdelivery.com>
Subject RE: Ejbc with iPlanet 6.0 application server?
Date Tue, 21 Nov 2000 20:47:44 GMT
Conor,
Thanks for your response.
I have listed two files: build.xml, build.bat. Then I have listed the usage
of the ejbc and the j2eeappreg.bat.  The build.bat is used to call and pass
the parameters into ant.  The j2eeappreg.bat is used to register the ear
file with the application server registry file.  Let me know if you have any
other questions.
============================================================================
==================
Here is a build.xml file for iPlanet 6.0.
============================================================================
==================
<?xml version="1.0"?>

<!-- ============================================================== -->
<!-- Ant XML file for Bank sample application as deployed to        -->
<!-- iPlanet Application Server.                                    -->
<!--                                                                -->
<!-- Copyright (c) 2000 Sun Microsystems, Inc. All rights reserved. -->
<!-- ============================================================== -->

<project name="banksample" default="compile" basedir=".">

  <!-- App name-dependent settings. -->
  <property name="appname" value="bank"/>
  <property name="ear" value="${appname}.ear"/>
  <property name="war" value="${appname}.war"/>
  <property name="ejbjar" value="${appname}Ejb.jar"/>

  <!-- Package directory structures of interest. -->
  <property name="app.pkgprefix" value="com/iplanet/ias/bank"/>

  <property name="ias.bin" value="${ias.home}/bin"/>

  <!-- change this property to use a compiler other than javac. -->
  <property name="build.compiler" value="classic"/>
  
  <!-- Source file location. -->
  <property name="src" value="."/>
  <property name="src.docroot" value="${src}/docroot"/>

  <!-- Destination directory for the build -->
  <property name="build" value="../build"/>
  <property name="build.docdir" value="${build}/docs/api"/>
  <property name="build.classesdir" value="${build}/lib/classes"/>
  <property name="build.classpath"
value="${build.classesdir}:${ias.cpath}"/>

  <!-- Destination directory for the assembly targets -->
  <property name="assemble" value="../assemble"/>
  <property name="assemble.ejbjar" value="${assemble}/jar"/>
  <property name="assemble.war" value="${assemble}/war"/>
  <property name="assemble.ear" value="${assemble}/ear"/>

  <!-- ======================================================= -->
  <!-- Compile all classes.                                    -->
  <!-- ======================================================= -->
  <target name="compile">
    <mkdir dir="${build.classesdir}"/>
    <javac srcdir="${src}/com"
           destdir="${build.classesdir}"
	   classpath="${build.classpath}"/>
  </target> 

 <!-- ======================================================= -->
 <!-- Build iAS-specific EJB stubs and skeletons.             -->
 <!--                                                         -->
 <!-- See build/ejbc-<bean name>.txt files for ejbc results.  -->
 <!-- ======================================================= -->
 <target name="stubs">
    <property name="ias.ejbc.cpath"
value=".${cpath.seperator}${build.classpath}"/>
    <echo message="------------------" />
    <echo message="Started building iAS stubs and skeletons for EJBs" />

    <echo message="BankService EJB" />
    <exec dir="${build.classesdir}" output="${build}/ejbc-BankService.txt" 
        command="${ias.bin}/ejbc -debug -${ias.ejbc.cpathopt}
${ias.ejbc.cpath} -sl com.iplanet.ias.bank.bank.IBankServiceHome
com.iplanet.ias.bank.bank.IBankService
com.iplanet.ias.bank.bank.BankService"/>

    <echo message="CustomerService EJB" />
    <exec dir="${build.classesdir}"
output="${build}/ejbc-CustomerService.txt" 
        command="${ias.bin}/ejbc -debug -${ias.ejbc.cpathopt}
${ias.ejbc.cpath} -sl com.iplanet.ias.bank.customer.ICustomerServiceHome
com.iplanet.ias.bank.customer.ICustomerService
com.iplanet.ias.bank.customer.CustomerService"/>

    <echo message="Finished building iAS stubs and skeletons for EJBs" />
    <echo message="------------------" />
  </target> 

  <!-- ======================================================= -->
  <!-- Clean up various files and directories.                 -->
  <!-- ======================================================= -->
  <target name="clean_ear">
    <delete dir="${assemble.ear}"/>
  </target>
  <target name="clean_war">
    <delete dir="${assemble.war}"/>
  </target>
  <target name="clean_ejbjar">
    <delete dir="${assemble.ejbjar}"/>
  </target>
  <target name="clean_assemble">
    <delete dir="${assemble}"/>
  </target>
  <target name="clean" depends="clean_assemble">
    <delete dir="${build}"/>
    <delete file="../j2eeappreg.txt"/>
  </target>

  <target name="fixforunix">
    <fixcrlf srcdir="${src}"
       cr="remove" eof="remove"
 
includes="**/*.jsp,**/*.html,**/*.tld,**/*.xml,**/*.java,**/*.sh,**/*.sql"
    />
  </target>

  <!-- ======================================================= -->
  <!-- Assemble EJB JAR module.                                -->
  <!-- ======================================================= -->
  <target name="ejbjar" depends="clean_ejbjar">
    <mkdir dir="${assemble.ejbjar}"/>
    <copy todir="${assemble.ejbjar}/${app.pkgprefix}">
      <fileset dir="${build.classesdir}/${app.pkgprefix}/">
        <include name="**/*.class"/>
        <exclude name="**/servlets/"/>
      </fileset>
    </copy>
    <mkdir dir="${assemble.ejbjar}/META-INF"/>
    <copy todir="${assemble.ejbjar}/META-INF">
      <fileset dir=".">
        <include name="ejb-jar.xml,ias-ejb-jar.xml"/>
      </fileset>
    </copy>
    <jar jarfile="${assemble.ejbjar}/${ejbjar}"
       basedir="${assemble.ejbjar}"/>
  </target>
 
  <!-- ======================================================= -->
  <!-- Assemble WAR module.                                    -->
  <!-- ======================================================= -->
  <target name="war" depends="clean_war">
    <mkdir dir="${assemble.war}"/>
    <copy todir="${assemble.war}">
      <fileset dir="${src.docroot}">
        <exclude name="cvs,annontation"/>
      </fileset>
    </copy>
    <copy todir="${assemble.war}/WEB-INF/classes/${app.pkgprefix}">
      <fileset dir="${build.classesdir}/${app.pkgprefix}">
        <include name="**/servlets/*.class"/>
      </fileset>
    </copy>
    <copy todir="${assemble.war}/WEB-INF/classes/${app.pkgprefix}">
      <fileset dir="${build.classesdir}/${app.pkgprefix}">
        <include name="**/servlets/*.class"/>
      </fileset>
    </copy>
    <copy todir="${assemble.war}/WEB-INF">
      <fileset dir=".">
        <include name="web.xml"/>
      </fileset>
    </copy>
    <copy todir="${assemble.war}/WEB-INF">
      <fileset dir=".">
        <include name="ias-web.xml"/>
      </fileset>
    </copy>
    <jar jarfile="${assemble.war}/${war}"
       basedir="${assemble.war}"/>
  </target>
 
  <!-- ======================================================= -->
  <!-- Assemble EAR module.                                    -->
  <!-- ======================================================= -->
  <target name="ear" depends="ejbjar, war, clean_ear">
    <mkdir dir="${assemble.ear}"/>
    <copy todir="${assemble.ear}">
      <fileset dir="${assemble.ejbjar}">
        <include name="${ejbjar}" />
      </fileset>
    </copy>
    <copy todir="${assemble.ear}">
      <fileset dir="${assemble.war}">
        <include name="${war}" />
      </fileset>
    </copy>
    <copy todir="${assemble.ear}/META-INF">
      <fileset dir=".">
        <include name="application.xml"/>
      </fileset>
    </copy>
    <jar jarfile="${assemble.ear}/${ear}"
       basedir="${assemble.ear}"/>
    <delete file="${assemble.ear}/${ejbjar}" />
    <delete file="${assemble.ear}/${war}" />
  </target>
 
  <!-- ======================================================= -->
  <!-- Create Javadocs.                                        -->
  <!-- ======================================================= -->
  <target name="javadocs">
    <deltree dir="${build.docdir}"/>
    <mkdir dir="${build.docdir}"/>
    <javadoc packagenames="com.iplanet.ias.bank.*"
             sourcepath="${src}" 
             destdir="${build.docdir}"
             author="true"
             version="true"
             use="true"
             windowtitle="iPlanet App Server Bank Sample Application API"
             doctitle="iPlanet App Server Bank Sample"
             bottom="Copyright &#169; 2000 Sun Microsystems Inc. All Rights
Reserved."/>
  </target>
 
  <!-- ======================================================= -->
  <!-- Install targets.                                        -->
  <!-- ======================================================= -->
  <target name="install_javadocs">
    <deltree dir="../docs/api"/>
    <mkdir dir="../docs/api"/>
    <copy todir="../docs/api">
      <fileset dir="${build.docdir}">
      </fileset>
    </copy>
  </target>

  <target name="install_ear">
    <copy todir="../${ear}">
      <fileset dir="${assemble.ear}/${ear}">
      </fileset>
    </copy>
    <echo message="Copied ${ear} to sample root directory." />

    <copy todir="${ias.home}/JAR/${ear}">
      <fileset dir="${assemble.ear}/${ear}">
      </fileset>
    </copy>
    <echo message="Copied ${ear} to ${ias.home}/JAR/${ear}." />

    <echo message="Executing j2eeappreg to register ${ear}." />
    <echo message="This operation may take several minutes.  See output in
../j2eeappreg.txt" />
    <exec dir="${ias.home}/JAR" output="../j2eeappreg.txt"
        command="${ias.bin}/j2eeappreg ${ear}"/>
  </target>

  <target name="core" depends="compile, stubs, ejbjar, war, ear" />
  <target name="all" depends="core, javadocs" />
  <target name="install" depends="install_javadocs, install_ear" />

</project>

============================================================================
==================
Ant is called from the build.bat file shown below:
============================================================================
==================

@echo off

rem Set IAS_HOME and ANT_HOME for your environment

rem START OF CUSTOMIZATIONS
set IAS_HOME=c:/iplanet/ias6/ias
set ANT_HOME=d:/jakarta-ant
set JAXP_HOME=d:/jakarta-ant/lib
rem END OF CUSTOMIZATIONS

set JAVA_HOME=%IAS_HOME%/usr/java

set
ANT_CLASSPATH=%JAXP_HOME%/jaxp.jar;%JAXP_HOME%/parser.jar;%JAVA_HOME%/lib/to
ols.jar
set
ANT_CLASSPATH=%ANT_HOME%/lib/ant.jar;%ANT_HOME%/lib/xml.jar;%ANT_CLASSPATH%

set
IAS_CLASSPATH=%IAS_HOME%/classes/java/jdbc20.jar;%IAS_HOME%/classes/java/ser
vlet.jar;%IAS_HOME%/lib/java/ldapjdk.jar;%IAS_HOME%/lib/java/javax.jar;%JAVA
_HOME%/jre/lib/rt.jar;%JAVA_HOME%/lib/tools.jar;%IAS_HOME%/lib/java/kfcjdk11
.jar;%IAS_HOME%/classes/java/jndi/cosnaming.jar;%IAS_HOME%/classes/java/jndi
/providerutil.jar;%IAS_HOME%/classes/java/activation.jar;%IAS_HOME%/classes/
java/jms.jar;%IAS_HOME%/classes/java/mail.jar;%IAS_HOME%/classes/java

set ANT_CLASSPATH=%IAS_CLASSPATH%;%ANT_CLASSPATH%

java -classpath "%ANT_CLASSPATH%" -Dant.home=%ANT_HOME%
-Dias.home=%IAS_HOME% -Dcpath.seperator=; -Dias.cpath=%IAS_CLASSPATH%
-Dias.ejbc.cpathopt=cp org.apache.tools.ant.Main %1 %2 %3 %4
============================================================================
==================
iPlanet's ejbc has the following options:
============================================================================
==================
$ ejbc -help

iPlanet Enterprise Java Beans(tm) Compiler (version 6.0)

usage (typical):        EJBC <options> <home> <remote> <impl>
usage (RMIC mode):      EJBC <options> -rmic <remote>

options:
        -sl                     Compile as stateless session bean
        -sf                     Compile as stateful session bean
        -cmp                    Compile as CMP entity bean
        -iiop                   Generate additional CORBA classes
        -gs                     Generate java source files
        -d <dir>                Output directory
        -help                   Show this message
        -rmic                   Generate RMIC code (see usage)
        -cp <classpath>         Set classpath
        -javaccp <classpath>            Prefix to javac classpath

============================================================================
==================
The options on j2eeappreg are below:
============================================================================
==================

$ j2eeappreg.bat -help
Usage : j2eeappreg [-h] [-remove -verbose] ear-file
         'j2eeappreg ear-file' to register ear file.
         'j2eeappreg -remove [-verbose] ear-file' to unregister, and provide
ver
bose output if required.
         'j2eeappreg -help' to print help.


-----Original Message-----
From: Conor MacNeill [mailto:conor@ebinteractive.com.au]
Sent: Monday, November 20, 2000 3:31 PM
To: ant-user@jakarta.apache.org
Subject: RE: Ejbc with iPlanet 6.0 application server?


Steve,

The ejbjar task is structured so that it can be extended to cover vendor
specific deployment tools. The bulk of the work is generic and a nested
element controls the vendor specific part. So, for weblogic, the task is
used as

<ejbjar ...>
    <weblogic .../>
</ejbjar ...>

The idea is that someone will write the nexted element for the other app
servers so that, for iplanet, for example, we would have

<ejbjar ...>
    <iplanet .../>
</ejbjar>

or even

<ejbjar ...>
    <weblogic .../>
    <iplanet .../>
</ejbjar ...>

if you wanted to create two deployment jars for the different app servers.

To answer your specific questions. I know of no iPlanet tasks. Using exec
commands usually does not provide the control you really want such as
checking whether beans are out of date. Rather than writing your own
taskdef, it would be good if you wrote the nested element for iplanet that
works in the current ejbjar task.

If you can send me the <exec> stuff you are currently using, I can have a
look at how iplanet might fit into the ejbjar task. Also, please read the
documentation for the ejbjar task as see if it fits your needs
http://jakarta.apache.org/ant/jakarta-ant/docs/ejb.html#ejbjar

Conor



--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au

> -----Original Message-----
> From: Steve Wilkinson [mailto:swilkinson@NETdelivery.com]
> Sent: Tuesday, 21 November 2000 3:46
> To: 'ant-user@jakarta.apache.org'
> Subject: Q: Ejbc with iPlanet 6.0 application server?
>
>
> The documentation for the Task Def Ejbc says it only works with WebLogic.
> If I'm using the iPlanet 6.0 application server, than I guess I
> assume these
> are my options:
> 	Find out if there is a task def already written for iPlanet?  (How
> do I go about this?)
> 	Use exec commands? (already done this)
> 	Write my own task def?
>
> Thanks in advance,
>
> Steve Wilkinson, swilkinson@netdelivery.com
> 4725 Walnut St
> Boulder, Colorado 80301
>
> P: 303-245-7378
> F: 303-245-0301
>

Mime
View raw message