// Copyright © 2002 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
shell>cat ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
<ejb-jar>
<display-name>Mailing List Manager</display-name>
<enterprise-beans>
<entity>
<description>Mailing List Manager</description>
<ejb-name>MailList</ejb-name>
<home>MailListHome</home>
<remote>MailList</remote>
<ejb-class>MailListEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<primkey-field>email</primkey-field>
<reentrant>False</reentrant>
<cmp-field><field-name>email</field-name></cmp-field>
</entity>
</enterprise-beans>
</ejb-jar>
shell>cat web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN'
'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>
<web-app>
<display-name>Mailing List Manager</display-name>
<description>Mailing List Manager</description>
<servlet>
<servlet-name>ListManageServlet</servlet-name>
<servlet-class>ListManageServlet
</servlet-class>
</servlet>
<servlet>
<servlet-name>SendServlet</servlet-name>
<servlet-class>SendServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ListManageServlet</servlet-name>
<url-pattern>/Manage</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SendServlet</servlet-name>
<url-pattern>/Send</url-pattern>
</servlet-mapping>
<ejb-ref>
<ejb-ref-name>MailListHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>MailListHome</home>
<remote>MailList</remote>
<ejb-link>MailList</ejb-link>
</ejb-ref>
</web-app>
shell> cat application.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application
PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN'
'http://java.sun.com/j2ee/dtds/application_1_2.dtd'>
<application>
<display-name>Mailing List Manager</display-name>
<description>Mailing List Manager</description>
<module>
<ejb>MailList.jar</ejb>
</module>
<module>
<web>
<web-uri>MailList.war</web-uri>
<context-root>/MailList/*</context-root>
</web>
</module>
</application>
shell> cat build.xml
<project name="example mailing list manager" default="build-all" basedir=".">
<property name="appname" value="MailList"/>
<!-- change this to your local jboss installation, if different -->
<property name="dist.root" value="/usr/local/jboss/jboss-3.0.2/"/>
<property name="jboss.dist" value="${dist.root}/server/default"/>
<property name="jboss.deploy.dir" value="${jboss.dist}/deploy"/>
<!-- change this if you are not using jetty -->
<property name="servlet.jar" value="${dist.root}/jetty/lib/javax.servlet.jar"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.docroot" value="${src}/docroot"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<path id="build.path">
<pathelement location="${jboss.dist}/client/jboss-j2ee.jar"/>
<pathelement location="${servlet.jar}"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${jboss.dist}/lib/ext/mail.jar"/>
</path>
<!-- war, jar, ear files -->
<property name="war" value="${appname}.war"/>
<property name="jar" value="${appname}.jar"/>
<property name="ear" value="${appname}.ear"/>
<target name="war" depends="compile">
<war warfile="${war}" webxml="web.xml">
<classes dir="${build.classes.dir}">
<include name="*Servlet.class" />
</classes>
</war>
</target>
<target name="jar" depends="compile">
<jar jarfile="${jar}">
<fileset dir="${build.classes.dir}">
<include name="${appname}.class" />
<include name="${appname}Home.class" />
<include name="${appname}EJB.class" />
</fileset>
<metainf dir="${basedir}" includes="ejb-jar.xml"/>
</jar>
</target>
<target name="ear" depends="war, jar">
<ear earfile="${appname}.ear" appxml="application.xml">
<fileset dir="${basedir}" includes="${jar}, ${war}"/>
</ear>
</target>
<target name="compile">
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="on"
deprecation="on"
classpathref="build.path"
optimize="off"
includes="*"
/>
</target>
<target name="build-all" depends="ear">
<copy file="${ear}" todir="${jboss.deploy.dir}"/>
</target>
</project>