![]() |
|
Developers who regularly use ANT to manage application development and deployment can use the Pramati ANT Handler to prepare and distribute applications on local and remote Pramati Server instances. The following sections describe how to install ANT handler, an example that uses it to deploy an application, and the Server commands.
Note: For more information on ANT, visit http://jakarta.apache.org/ant/index.html.
ANT is typically used to build application classes. Web components get packaged in a .war, enterprise beans are packaged in a .jar, and .wars and .jars are packaged in a .ear. ANT enables this process to be automated, without any intervention.
The XML file, or the build.xml that contains the instructions, is made up of targets. Each target has a task or set of tasks associated with it. A custom target that handles remote server tasks is provided as part of the ANT integration in Pramati Server. These remote tasks include commands Deploy, Prepare and Start, and Stop and Remove.
Table 1: .jar files needed to use the ANT handler
| File | Description |
|---|---|
| pramati_ant.jar | Is the Pramati ANT Handler that enables remote shell commands from a customized ANT task. |
| pramati_client_all.jar | Includes all the classes that are required for Java clients to access the Server. |
<install_dir>/server/lib/pramati_client/.<ant_home _moz-userdefined=""/> environment variable to the directory containing the bin and lib directories of ANT.pramati_ant.jar under <ANT_Home>/lib. Essentially, pramati_ant.jar files must be specified in the ANT classpath. Only the archives that are in a ready-to-deploy state, that is, the archives that have all the required deployment descriptors, can be deployed or started using the Pramati ANT handler.<path>ant -buildfile <ANT script filename>Example: Using the sample ant.xml to Perform a Server Task:
Type D:\ant\ant.xml prepare_app.
This prepares the application BankDesk.ear on the server as specified in the ant.xml (see sample below).
Table 2: ANT handler commands
| Command | Description |
|---|---|
| prepare | Prepares the application mentioned in the commands attribute. |
| start | Starts the application mentioned in the commands attribute if it is already deployed. |
| deploy | Prepares and starts the application mentioned in the commands attribute. |
| stop | Stops the running application mentioned in the commands attribute. |
| remove | Removes application archive from Server installation directory. The application has to be re-prepared. |
ip="127.0.0.1" port="9191" realm="system" user="root" password="pramati"Specify the properties as listed in the table below when you need to connect to the Server:
Table 3: Server attributes
| Attribute | Description | Mandatory |
|---|---|---|
| ip | Is the address of the remote server. | Yes |
| port | Is the port on which the server is running. | Yes |
| realm | Is the security realm of the remote server. | Yes |
| user | Is the username to login to the remote server. | Yes |
| password | Is the password to login to the remote server. | Yes |
| wait | Waits for commands to be executed. Default is True. | No |
| classpath | Is the classpath required to execute the task. | No |
| commands | Are the commands to be executed. | Yes |
| verbose | Generates messages when the task executes. The default value for this attribute is False. | No |
BankDesk.ear that is shipped with Pramati Server.
<project name="AntShell" default="servertasks">
<taskdef name="pramati" classname="com.pramati.AntTaskHandler"/>
<target name="servertasks" depends="prepare_app,start_app,stop_app,remove_app"/>
<target name="prepare_app">
<pramati verbose="true"
ip ="localhost"
port ="9191"
realm ="system"
user ="root"
password ="pramati"
wait ="true"
classpath ="D:\ant\lib\pramati_client_all.jar"
commands ="prepare D:\PServer50\server\samples\ejb11\BankDesk\ear\BankDesk.ear"
/>
</target>
<target name="start_app">
<pramati verbose="true"
ip ="localhost"
port ="9191"
realm ="system"
user ="root"
password ="pramati"
wait = "true"
classpath ="D:\ant\lib\pramati_client_all.jar"
commands ="start BankDesk.ear"
/>
<target>
<target name="stop_app">
<pramati verbose="true"
ip ="localhost"
port ="9191"
realm ="system"
user ="root"
password ="pramati"
wait ="true"
classpath ="D:\ant\lib\pramati_client_all.jar"
commands ="stop BankDesk.ear"
/>
</target>
<target name="remove_app">
<pramati verbose="true"
ip ="localhost"
port ="9191"
realm ="system"
user ="root"
password ="pramati"
wait ="true"
classpath ="D:\ant\lib\pramati_client_all.jar"
commands ="remove BankDesk.ear"
/>
<target>
</project>
</pre>
Note: The classpath attribute inside <pramati _moz-userdefined=""> element should definitely include pramati_client_all.jar.<pramati>.
| © Pramati Technologies 2007 | Runs on Pramati Server | Feedback | Legal |