1. EJB Ant Task
Several Ant tasks are provided for developing EJB components based on JEUS.
1.1. appcompiler
The appcompiler Ant task is used to create a RMI stub and skeleton classes required by the EJB module and individual EJB beans after the pre-deployment process. The Ant task can create EJB client JAR files, which are required for clients to communicate with beans deployed to a remote host.
The following describes appcompiler task properties.
Property | Description |
---|---|
jeusHome |
Sets JEUS_HOME. (String type) |
client |
Client view file that contains the stub classes to be created. (String type) |
keep |
Option to save the source files created during the compilation process. (Default value: false) |
jspmap |
Option to create the servlet-mapping table in the jeus_jspmap.xml file. (Default value: false) |
ejbJar |
ejb-jar.xml file used for compilation. (String type) |
jeusEjbDd |
jeus-ejb-dd.xml file used for compilation. (String type) |
name |
Deployment name. (String type) |
target |
Application and stand-alone module files to be compiled. (Required option, String type) |
Example
This following is an example of a build.xml file that executes the appcompiler.
-
build.xml example
appcompiler Ant Task Build File Example: <build.xml><?xml version="1.0"?> <project name="example" default="appcompiler" basedir="."> <property environment="env"/> <!-- jeus.home project property is required when you run the various tasks in an ant jvm and one of the various tasks requirs JEUS_HOME information --> <property name="jeus.home" value="${env.JEUS_HOME}"/> <!-- set properties to be needed for appcompiler task --> <property name="client" value="client_view.jar"/> <property name="keep" value="false"/> <property name="jspmap" value="false"/> <property name="ejbjar" value="ejb-jar.xml"/> <property name="jeusejbdd" value="jeus-ejb-dd.xml"/> <property name="targetfile" value="ejb"/> <!-- set the library-classpath or to run the task class --> <path id="jeus.libraries"> <fileset dir="${jeus.home}/lib/system" includes="*.jar"/> </path> <!-- include the task definition resource file --> <taskdef resource="jeus/util/ant/jeusant.properties"> <classpath> <path refid="jeus.libraries"/> </classpath> </taskdef> <target name="init"> </target> <!-- appcompiler task --> <target name="appcompiler" depends="init"> <appcompiler jeusHome="${jeus.home}" client="${client}" keep="${keep}" jspmap="${jspmap}" ejbJar="${ejbjar}" jeusEjbDd="${jeusejbdd}" target="${targetfile}"/> </target> </project>
-
Execution example
$ ant appcompiler Buildfile: build.xml init: appcompiler: BUILD SUCCESSFUL Total time: 3 minutes 7 seconds
1.2. ejbddinit
The ejbddinit Ant Task is used to create the JEUS EJB Deployment Descriptor (DD) for EJB applications. For more information about ejbddinit, refer to ejbddinit.
The following describes the ejbddinit Ant task properties.
Property | Description |
---|---|
propertyFile |
Property files referred to when executing ejbddinit. (String type) |
logginginglevel |
Log level displayed on a screen when executing ejbddinit. This level is matches the J2SE logging API level. (Default value: INFO) |
target |
Path to the EJB module executed by ejbddint. The EJB module can be a JAR archive or directory. (Required option. This property can be omitted when the property file contains the target information.) |
The ejbddinit property files can be set in the ejbddinit Ant script.
The properties of the ejbddinit property files must be set according to the following rules of the ejbddinit Ant script. For more information about ejbddinit properties, refer to Properties List.
ejbddinit Property File | ejbddinit Ant Script |
---|---|
export-name=%{ejb-class} |
<property name="export-name" value="%{ejb-class}"/> |
thread-max=100 |
<property name="thread-max" value="100"/> |
HelloBean.export-port=55555 |
ejbddinit properties cannot be set for a specific EJB component, such as HelloBean, in build.xml. |
Like the ejbddinit property file, the '%{ejb-class}' expression can be used to set the export-name property of an Ant script. For more information about the expression for setting export-name, refer to Supported patterns for the export-name property.
An Ant script cannot set ejbddinit properties for a specific EJB component. To set ejbddinit properties for a specific EJB component, write a separate ejbddinit property file. A configuration for a specific EJB component has a higher priority than common configurations in ejbddinit property files and Ant scripts. If ejbddinit property files and ejbddinit Ant scripts have the same configurations, the configuration in the Ant scripts is given higher priority.
Example
The following is an example of writing and executing an ejbddinit Ant script.
-
ejbddinit Ant script example
ejbddinit Ant Script Example<?xml version="1.0"?> <project name="example" default="ejbddinit" basedir="."> <property environment="env"/> <!-- jeus.home project property is required when you run the various tasks in an ant jvm and one of the various tasks requirs JEUS_HOME information --> <property name="jeus.home" value="${env.JEUS_HOME}"/> <!-- set properties to be needed for ejbddinit task --> <property name="targetfile" value="ejb.jar"/> <property name="logginglevel" value="FINE"/> <property name="propertyfile" value="ejbddinit.properties"/> <!-- set properties to be needed for ejbddinit properties --> <property name="export-name" value="%{ejb-class}"/> <property name="thread-max" value="100"/> <!-- set the library-classpath or to run the task class --> <path id="jeus.libraries"> <fileset dir="${jeus.home}/lib/system" includes="*.jar"/> </path> <!-- include the task definition resource file --> <taskdef resource="jeus/util/ant/jeusant.properties"> <classpath> <path refid="jeus.libraries"/> </classpath> </taskdef> <target name="init"> </target> <!-- ejbddinit task --> <target name="ejbddinit" depends="init"> <ejbddinit loggingLevel="${logginglevel}" property="${propertyfile}" target="${targetfile}" exportName="${export-name}" threadMax="${thread-max}"> </ejbddinit> </target> </project>
-
ejbddinit Ant Task execution
$ ant ejbddinit Buildfile: build.xml init: ejbddinit: [ejbddinit] LoadFile: /jeus/sample/ejbddinit.properties [ejbddinit] Source=/jeus/sample/ejbddinit/ejb.jar [ejbddinit] Successfully configured the parameters. [ejbddinit] Deployment descriptor initialization started. [ejbddinit] Creating JEUS descriptors. [ejbddinit] Deployment descriptor initialization finished. BUILD SUCCESSFUL Total time: 2 seconds