Ant Tasks


If you're not already familiar with Ant, we highly recommend that you get to know it. Ant is an open source build facility that you can get from the Apache organization. It is similar to any of the 'make' utilities that are common in the marketplace. However, Ant is based on Java and can be easily extended with Java classes.

Note

http://jakarta.apache.org/ant/index.html is a good source of information about Ant.

Ant works from an XML file that describes the tasks that you want performed during the build – similar to rules in a make file. Each Ant task has a pseudo-DTD that describes the parameters that you can pass into the task – each parameter corresponding to an attribute of the task's Class object. The attributes of the XML task element are set on the Ant Task class. The task is then invoked with the execute() operation.

The WebSphere samples are built using Ant. For an example of an Ant build file, look into the samples/lib/source/PlantsByWebSphere/build.xml file in the WebSphere installation directory.

The following Ant tasks are supported by WebSphere:

Task

Description

wsadmin

Executes the WebSphere command-line administration tool with the specified arguments.

wsDefaultBindings

Enables you to generate default IBM WebSphere bindings for the specified EAR file.

wsejbdeploy

Executes the WebSphere EJB deploy tool on the specified JAR file with the specified options.

wsInstallApp

Lets you to install a new application into a WebSphere server or cell.

WsJspC

Compiles a directory full of JSP files into .class files.

wsListApps

Lists all the applications installed on a WebSphere server or cell.

wsNLSEcho

An echo extension task to display translated messages.

wsServerStatus

Enables you to get status on a server instance or all server instances.

wsStartApp

Allows you to start an existing or newly installed application on a WebSphere server or cell.

wsStartServer

Helps you to start a standalone server instance.

wsStopApp

Lets you to stop an existing or newly installed application on a WebSphere server or cell.

wsStopServer

Enables you to stop a standalone server instance.

wsUninstallApp

Lets you to uninstall an existing application from a WebSphere server or cell.

wsValidateModule

Performs validation of the deployment descriptor, extensions, and bindings documents of an EAR, WAR, EJB JAR, or application client JAR.

wsadmin

The wsadmin task can be used to invoke any wsadmin command-line script. The task element has the following XML syntax:

<wsadmin { command=<wsadmincmd> | script=<wsadminscript> } [lang=<scriptlang>]           [wasHome=<wasinstalldir>] [properties=<JVMsyspropsfile>]           [profile=<scriptprofile>] [conntype=<type>] [host=<hostaddr>]            [port=<portnumber>] [user=<username>] [password=<passwd>] >     <arg value=<argvalue> />     <arg value=<argvalue> />     ... </wsadmin>

Where:

  • <wsadmincmd>is the command that you want processed by wsadmin.

  • <wsadminscript> is the script file that you want processed by wsadmin. You must specify either <wsadminscsript> or <wsadmincmd>.

  • <scriptlang> is the language in which the command or script is written. WebSphere currently only supports the Jacl language. Support for Jython and Javascript expected in the future.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <JVMsyspropsfile> is the name of a file containing system properties that you want to pass into the JVM for this task.

  • <scriptprofile> is a profile script that you want run before the command or script
    is performed.

  • <type> is the type of connection you want to make to the AdminService for this task. This can be SOAP or IIOP.

  • <hostaddr> is the host name or IP address of the AdminService that you want to connect to.

  • <portnumber> is the port number of the SOAP or IIOP listener of the AdminService that you want to connect to.

  • <username>is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to perform whatever is contained your script.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

  • <argvalue> is any argument value you want/need to pass in to the script. You should specify as many <arg value=<argvalue> /> statements are you there are arguments in your script.

This task will invoke the wsadmin command utility, passing in the parameters that you've specified above, including either the command (as a –c parameter) or the script file (as a –f parameter).

You must add the following statement to your Ant build.xml file to use this task:

 <taskdef name="wsadmin" classname="com.ibm.websphere.ant.tasks.WsAdmin"/> 

The following demonstrates invoking a wsadmin script from an Ant task:

 <target name="installResources" depends="init"     description="Install the PBW JDBC and JMS resources via wsadmin">  <echo> " Installing Plants JDBC/JMS resources on WAS Node ${node} " </echo>  <input     message="Please enter the database type [db2 or oracle]:"     property="dbtype"  />  <input      message="Please enter the database username:"     property="dbuser"  />  <input      message="Please enter the database password:"     property="dbpass"  />  <input      message="Please enter the Oracle database hostname:"     property="dboraclehost"     onlyIfDbtypeEquals="oracle"  />  <input      message="Please enter the Oracle database SID:"     property="dboraclesid"     onlyIfDbtypeEquals="oracle"  />  <input      message="Please enter the fullpath to the JDBC driver db2java.zip or                   classes12.zip (e.g. c:/sqllib/java/db2java.zip)"     property="basepath"  />  <path  path="${basepath}"/>    <pathconvert dirsep="/" property="dbdriverpath" ref/>    <echo> "Database Classpath path converted ${dbdriverpath}" </echo>    <echo> "Creating Plants JDBC Datasource"</echo>  <wsadmin script="createPlantsRDBMSResources.jacl">  <arg value="${dbtype}"/>    <arg value="${node}"/>    <arg value="${dbdriverpath}"/>       <arg value="${dbuser}"/>    <arg value="${dbpass}"/>    <arg value="${dboraclehost}"/>    <arg value="${dboraclesid}"/>  </wsadmin>  <echo> "Creating Plants JMS Queues and Topics"</echo>   <wsadmin script="createPlantsJMSResources.jacl">    <arg value="${node}"/>  </wsadmin>    </target> 

This is part of a larger Ant task that could be used to deploy and install the Plants-By-WebSphere application to an application server, for example in a test environment. This task target shows prompting for the JDBC and JMS resources used by Plants-By-Websphere, and then firing the createPlantsRDBMSResrource and subsequently the createPlantsJMSResrouces Jacl scripts.

wsDefaultBindings

The wsDefaultBindings task can be used to create default bindings for an application. This task element has the following XML syntax:

<wsDefaultBindings ear=<earfilename> outputFile=<outputfilename>                    [defaultDataSource=<defDSname>] [dbUser=<dbusername>]                     [dbPassword=<dbpasswd>] [defaultConnectionFactory=<defCFname>]                    [resAuth={PerConnFact | Container}]                                      [ejbJndiPrefix=<jndiprefix>]                     [virtualHost=<vhname>] [forceBindings={true | false}]                     [strategy=<genstrategy>] [exportFile=<expstratfilename>] />

Where:

  • <earfilename> is the filename of the EAR that you want to deploy.

  • <outputfilename> is the name of the deployed EAR that you want produced from this task.

  • <defDSname> is the JNDI name of the default data source that you want used.

  • <dbusername> is the default user name that you want used to access the database.

  • <dbpasswd> is the password for the default user name for accessing the database.

  • <defCFname>is the JNDI name of the default connection factory you want used.

  • <jndiprefix> is the JNDI prefix that you want appended in front of any resources defined within this application.

  • <vhname> is the default virtual host name.

  • <genstrategy> is an external binding strategy file that may provide additional information about how to produce binding information for this application.

  • <expstratfilename> is the name of a binding strategy file that you want generated from this task. The resulting strategy file will capture the specifics of any assumptions or directions used in this task. Generating a strategy file may be useful for future invocations of this task – perhaps for re-deployment, or as input to other similar binding activities.

This task will produce the bindings information for your application – similar to what would be produced during the installation process. If you don't specify a binding strategy file, this task will generate binding names that are derived from the referenced objects and resources. If names won't work for your application, can provide specific binding information in a strategy file.

This is only part of the deployment process – you should use the wsEjbDeploy task to generate the EJB stubs, skeletons, and schema mapping files for your application.

You must add the following statement to your Ant build.xml file to use this task:

 <taskdef name="wsDefaultBindings"           classname="com.ibm.websphere.ant.tasks.DefaultBindings"/> 

Deploy-gen Strategy File

The <genstrategy> attribute refers to an external deploy-gen strategy file that provides more details about the deployment process. The deploy-gen strategy file is an XML file with the following DTD:

<!ELEMENT dfltbndngs (global-bindings?,module-bindings?) > <!ELEMENT global-bindings (data-source?,connection-factory?,virtual-host?)> <!ELEMENT connection-factory (jndi-name,res-auth)> <!ELEMENT module-bindings (ejb-jar-binding | war-binding | java-binding )+ > <!ELEMENT ejb-jar-binding (jar-name, data-source?,connection-factory?,                            ejb-bindings?,resource-ref-bindings?,                             resource-env-ref-bindings? )> <!ELEMENT war-binding (jar-name,virtual-host?,resource-ref-bindings?,                        resource-env-ref-bindings?)> <!ELEMENT java-binding (jar-name,resource-ref-bindings?,                          resource-env-ref-bindings?)> <!ELEMENT ejb-binding (ejb-name,jndi-name?,data-source?,connection-factory?,                        resource-ref-bindings?,                         resource-env-ref-bindings?,listener-port?)> <!ELEMENT resource-env-ref-bindings (resource-env-ref-binding)+> <!ELEMENT resource-env-ref-binding (resource-env-ref-name,jndi-name)> <!ELEMENT resource-ref-bindings (resource-ref-binding)+> <!ELEMENT resource-ref-binding (resource-ref-name,jndi-name)> <!ELEMENT data-source (jndi-name,user?,password?)> <!ELEMENT ejb-bindings (ejb-binding)+> <!ELEMENT ejb-name (#PCDATA)> <!ELEMENT jar-name (#PCDATA)> <!ELEMENT jndi-name (#PCDATA)> <!ELEMENT listener-port (#PCDATA)> <!ELEMENT password (#PCDATA)> <!ELEMENT res-auth (#PCDATA)> <!ELEMENT resource-env-ref-name (#PCDATA)> <!ELEMENT resource-ref-name (#PCDATA)> <!ELEMENT user (#PCDATA)> <!ELEMENT virtual-host (#PCDATA)>

For example, the following strategy.xml document might be used to set the virtual host and some binding information for Plants-By-WebSphere:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dfltbndngs SYSTEM "dfltbndngs.dtd" > <dfltbndngs>   <global-bindings>     <virtual-host>default_host</virtual-host>   </global-bindings>   <module-bindings>     <ejb-jar-binding>       <jar-name>PlantsByWebSphereEAR.jar</jar-name>       <data-source>         <jndi-name>eis/jdbc/PlantsByWebSphereDataSource_CMP</jndi-name>       </data-source>       <ejb-bindings>         <ejb-binding>           <ejb-name>Catelog</ejb-name>           <jndi-name>plantsby/CatelogHome</jndi-name>         </ejb-binding>       </ejb-bindings>     </ejb-jar-binding>   </module-bindings> </dfltbndngs> 

This DTD is stored in properties/dfltbndngs.dtd under the WAS installation root.

If you're going to be doing a lot of deployment, it is generally a good idea to create a strategy file that details the specifics of your deployment. You can then re-deploy the same application with the same strategy file, or make minor modifications to deploy other similar applications.

A common technique is to create a deployment strategy file for every application you put in to your production environment and save these in a source control system along with the application. That way you have a record of exactly how the application was deployed. This can be used for auditing purposes, as well as a control mechanism for future re-deployments of the application.

wsejbdeploy

The wsejbdeploy task can be used to deploy an application EAR – that is, promote and resolve deployment information and optionally generate the stubs, skeletons, and schema-mapping files for the application. The wsejbdeploy task element has the following XML syntax:

<wsejbdeploy inputJar=<injarfile> outputJar=<outjarfile>               [wasHome=<wasinstalldir>] [workingDirectory=<tempdir>]              [classpath=<classpath>] [classpathref=<antclasspath>]              [codegen=<enablecodegen>] [dbname=<databasename>]              [dbschema=<databaseschema>] [dbvendor=<databasevendor>]              [dynamic=<enabledynamicquery>] [keepGenerated=<enablekeepGenerated>]              [quiet=<enablequiet>] [noValidate=<enablenoValidate>]              [noWarnings=<enablenoWarnings>] [noInform=<enablenoInform>]              [rmicOptions=<rmicopts>] [compatible35=<enablecompatible35>]              [sqlj=<enablesqlj>] [failonerror=<enablefailonerror>]               [trace=<enabletrace>] />

Where:

  • <injarfile> is the JAR, WAR, or EAR file that you want to deploy.

  • <outjarfile> is the EAR file that should be produced from the deployment.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <tempdir> is a temporary working directory. Make sure you specify a directory that does not contain any files that you want to keep.

  • <enablekeepGenerated> is either "true" or "false" indicated whether to keep the working directory.

  • <classpath> is any additional classpath that is needed to compile the JSP pages.

  • <antclasspath> is the same as classpath, except expressed as an ANT reference path.

  • <enablecodegen> is either "true" or "false" indicating whether you want stub, skeleton, or schema-mapping code to be generated from this deployment processing.

  • <databasename> is the name of the database you want created when you install this application (used in top-down deployment).

  • <databaseschema> is the name of the database schema you want created when you install this application (used in top-down deployment).

  • <databasevendor> is the database identity/vendor you want to use with this application. This will be used to customize the SQL statement that will be generated – considering the access intent and other deployment policies set in the application.

  • <enabledynamicquery> is either "true" or "false" indicating whether you use the dynamic query service (only available with the programming model extensions in the Enterprise edition). This directs the deployment task to generate the metadata for the dynamic query service.

  • <enablequiet> is either "true" or "false" indicating whether you want the deploy process to suppress information and warning messages (only producing error messages).

  • <enablenoValidate> is either "true" or "false" indicating whether you want to
    suppress validation.

  • <enablenoWarnings> is either "true" or "false" indicating whether you want to suppress warning messages.

  • <enablenoInform> is either "true" or "false" indicating whether you want to support informational messages.

  • <rmicopts>is a list of additional options you want passed into the RMIC processor. These options should be enclosed in quotes.

  • <enablecompatible35> is either "true" or "false" indicating whether you want the deployed EAR to be compatible with WebSphere R3.5.

  • <enablesqlj> is either "true" or "false" indicating whether you want to use a SQLJ adapter for CMP beans.

  • <enablefailonerror> is either "true" or "false" indicating whether you want to stop deployment if any errors are encountered.

  • <enabletrace> is either "true" or "false" indicating whether you want to trace the deployment process.

You need to add the following to your build.xml before you can use this task:

 <taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy"/> 

wsInstallApp

The wsInstallApp task will install a deployed application into the runtime. The wsInstallApp task element has the following XML syntax:

<wsInstallApp ear=<earfilename> [wasHome=<wasinstalldir>]               [options=<installoptions>] [properties=<JVMsyspropsfile>]              [profile=<scriptprofile>] [conntype=<type>] [host=<hostaddr>]               [port=<portnumber>] [user=<username>] [password=<passwd>] />

Where:

  • <earfilename> is the name (and path location) of the EAR file that you want to install.

  • <wasinstalldir> is the installation directory for WebSphere. This should be installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <installoptions> are any of the installation options that you might normally pass to the $AdminApp install operation. These options should be enclosed in quotes so that they will be handled as a single XML attribute.

  • <JVMsyspropsfile> is the name of a file containing system properties that you want to pass into the JVM for this task.

  • <scriptprofile> is a profile script that you want run before the installation step is performed.

  • <type> is the type of connection you want to make to the AdminService for this installation task. This can be SOAP or IIOP.

  • <hostaddr> is the host name or IP address of the AdminService where you want to install the application.

  • <portnumber> is the port number of the SOAP or IIOP listener of the AdminService where you want to install the application.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to modify the configuration with the installation of this application.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

The InstallApp task is useful if you want to install your application after it has been compiled, Jar'ed, and deploy-gen'ed – for example, if you want to initiate a simple build-verification test on your application after it has been built.

You need to add the following to your build.xml before you can use this task:

 <taskdef name="wsInstallApp"          classname="com.ibm.websphere.ant.tasks.InstallApplication"/> 

The following demonstrates the installation of the Plants-By-WebSphere application using this Ant task:

 <target name="installApp" depends="init" description="Install the PBW ear file">    <wsInstallApp       ear="${PlantsByWebSphere.ear}"       options="-appname PlantsByWebSphere -useMetaDataFromBinary yes                 -deployejb yes -usedefaultbindings"    /> </target> 

wsJspC

The wsJspC task can be used to pre-compile the JSP pages in your application. Pre-compiling your JSP pages increases the size of your application EAR, slightly, but improves the performance of your application – your JSP pages have to be compiled on the first request that involves them if they haven't already been compiled.

The JspC task element has the following syntax:

<wsjspc src=<sourcedir> toDir=<targetdir> [wasHome=<wasinstalldir>]         [classpath=<classpath>] [classpathref=<antclasspath>] />

Where:

  • <sourcedir> is the directory containing your JSP source files.

  • <targetdir> is the directory where you want the compiled JSPs to be placed.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <classpath> is any additional classpath that is needed to compile the JSP pages.

  • <antclasspath> is the same as classpath, except expressed as an ANT reference path.

Add the following statement to your Ant build.xml if you want to use this task.

 <taskdef name="wsjspc" classname="com.ibm.websphere.ant.tasks.JspC"/> 

wsListApps

The wsListApps task will list all of the applications installed on the application server or in a cell. This task has the following syntax:

<wsListApps [wasHome=<wasinstalldir>] [options=<installoptions>] [properties=<JVMsyspropsfile>] [profile=<scriptprofile>] [conntype=<type>] [host=<hostaddr>] [port=<portnumber>]  [user=<username>] [password=<passwd>]  />

Where:

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <JVMsyspropsfile> is the name of a file containing system properties that you want to pass into the JVM for this task.

  • <scriptprofile> is a profile script that you want run before this step is performed.

  • <type> is the type of connection you want to make to the AdminService for this task. This can be "SOAP" or "IIOP".

  • <hostaddr> is the host name or IP address of the AdminService for this task.

  • <portnumber> is the port number of the SOAP or IIOP listener of the AdminService for this task.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to view the configuration of your cell or application server.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

Add the following statement to your Ant build.xml if you want to use this task.

 <taskdef name="wsListApps"           classname="com.ibm.websphere.ant.tasks.ListApplications"/> 

wsNLSEcho

The wsNLSEcho task can be used to display messages from a resource bundle. The syntax for this task is:

<wsNLSEcho message=<defaultMessage> [key=<messageKey>]             [bundle=<resourceBundle>] [replace=<subvalues>] />

Where:

  • <defaultMessage> is the default message that you want presented in the case none could be found in the resource bundle by the given key.

  • <messageKey> is the key of the message that you want to obtain from the resource bundle.

  • <resourceBundle> is the name of the resource bundle you want to use. Typically the resource bundle is identified here in its neutral form – the system will append the locale information of the local process to obtain the translated string for your locale.

  • <subvalues> is a list of value (strings), separated by the characters ";;". Each substitution value will be assigned to a position within the string in accordance with the ordinal identified in the message. This follows the same conventions as are used in java.text.MessageFormat.

This task extends the standard Ant Echo task by adding support for internationalization based on the standard Java resource bundle facility.

Add the following statement to your Ant build.xml if you want to use this task:

 <taskdef name="wsNLSEcho" classname="com.ibm.websphere.ant.tasks.NLSEcho"/> 

wsServerStatus

The wsServerStatus task can be used to get the operational status of a given server. The syntax of this task is:

<wsServerStatus { server=<serverName> | [all=<enableall>] } [quiet=<enablequiet>]                   [trace=<enabletrace>] [cell=<cellName>] [node=<nodeName>]                    [timeout=<requestTimeout>] [statusPort=<statusportnumber>]                    [wasHome=<wasinstalldir>] [failonerrror=<enablefailonerror>] />

Where:

  • <serverName> is the name of the server that you want to query.

  • <enableall> is "true" or "false" indicating whether you want to display the status of all servers.

  • <enablequiet> is "true" or "false" indicating whether you want to suppress all warning and informational messages from this task.

  • <enabletrace> is "true" or "false" indicating whether you want to trace the execution of this task.

  • <cellName> is the name of the cell for the server you are testing.

  • <nodename> is the name of the node for the server you are testing.

  • <requestTimeout> is the maximum time (in seconds) that you're willing to wait for this task to complete. If this attribute is not specified, the task will take as long as needed to get a status result.

  • <statusportnumber> is the port to send status reports to.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <enablefailonerror> is "true" or "false" indicating whether you want this task to terminate immediately if it encounters any errors.

Add the following statement to your Ant build.xml if you want to use this task:

 <taskdef name="wsServerStatus"           classname="com.ibm.websphere.ant.tasks.ServerStatus"/> 

wsStartApp

The wsStartApp task can be used to start an application. This task has the following syntax:

<wsStartApp  application=<appname> [wasHome=<wasinstalldir>]  [server=<serverName>] [node=<nodeName>] [properties=<JVMsyspropsfile>]  [profile=<scriptprofile>] [conntype=<type>] [host=<hostaddr>]  [port=<portnumber>] [user=<username>] [password=<passwd>] />

Where:

  • <appname> is the name of the application that you want to start.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <serverName> is the name of the server hosting the application that you want to start.

  • <nodeName> is the name of the node hosting the application that you want to start.

  • <JVMsyspropsfile> is the name of a file containing system properties that you want to pass into the JVM for this task.

  • <scriptprofile> is a profile script that you want run before this step is performed.

  • <type> is the type of connection you want to make to the AdminService for this task. This can be "SOAP" or "IIOP".

  • <hostaddr> is the host name or IP address of the AdminService for this task.

  • <portnumber> is the port number of the SOAP or IIOP listener of the AdminService for this task.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to operate on resources in the system.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

Add the following statement to your Ant build.xml if you want to use this task:

 <taskdef name="wsStartApplication"           classname="com.ibm.websphere.ant.tasks.StartApplication"/> 

The following demonstrates starting the PlantsByWebSphere application using this Ant task:

 <target name="startPlants" depends="init"          description="Starts the PlantsByWebSphere application in WebSphere">    <wsStartApplication application="PlantsByWebSphere" /> </target> 

wsStartServer

The wsStartServer task can be used to start an application. This task has the following syntax:

<wsStartServer server=<serverName> [wasHome=<wasinstalldir>]                 [noWait=<enablenoWait>] [quiet=<enablequiet>]                 [logFile=<logfilename>] [replaceLog=<enablereplaceLog>]                 [trace=<enabletrace>] [script=<scriptfile>]                [timeout=<timeoutseconds>] [failonerror=<enablefailonerror>]                [statusPort=<statusportnumber>] [username=<username>]                 [password=<passwd>] />

Where:

  • <serverName> is the name of the server that you want to start.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <enablenoWait> is "true" or "false" indicating whether to wait for the server to start.

  • <enablequiet> is "true" or "false" indicating whether to suppress warning and informational messages from this task.

  • <logfilename> is the name of the log file you want used to record the server start process.

  • <enablereplaceLog> is "true" or "false" indicating whether to replace the log file, or append to the end of the log file.

  • <scriptfile> is the name of a script file that you want to execute during server startup.

  • <timeoutseconds> the amount of time, in seconds, to wait for the server to start. If the server has not started in this number of seconds, the task will return control to the caller. The request to start the server will proceed in the background.

  • <enablefailonerror> is "true" or "false" indicating whether you want this task to terminate immediately if it encounters any errors.

  • <statusportnumber> the port you want this command-line client to use receive status about the server's startup results.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to operate on the resources in the system.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

Add the following statement to your Ant build.xml if you want to use this task:

 <taskdef name="wsStartServer"           classname="com.ibm.websphere.ant.tasks.StartServer"/> 

The following depicts starting server1 using this Ant task:

 <target name="startWebSphere" depends="init"          description="Start the WebSphere app server1">    <wsStartServer server="server1" /> </target>   

wsStopApp

The wsStopApp task can be used to stop an application. This task has the following syntax:

<wsStopApp application=<appname> [wasHome=<wasinstalldir>]             [server=<serverName>] [node=<nodeName>] [properties=<JVMsyspropsfile>]             [profile=<scriptprofile>] [conntype=<type>] [host=<hostaddr>]             [port=<portnumber>] [user=<username>] [password=<passwd>] />

Where:

  • <appname> is the name of the application that you want to stop.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <serverName> is the name of the server hosting the application that you want to stop.

  • `.

  • <JVMsyspropsfile> is the name of a file containing system properties that you want to pass into the JVM for this task.

  • <scriptprofile> is a profile script that you want run before this step is performed.

  • <type> is the type of connection you want to make to the AdminService for this task. This can be "SOAP" or "IIOP".

  • <hostaddr> is the host name or IP address of the AdminService for this task.

  • <portnumber> is the port number of the SOAP or IIOP listener of the AdminService for this task.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to operate on resources in the system.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

Add the following statement to your Ant build.xml if you want to use this task:

 <taskdef name="wsStopApplication"           classname="com.ibm.websphere.ant.tasks.StopApplication"/> 

The following demonstrates stopping the Plants-By-WebSphere application using this Ant task:

 <target name="stopPlants" depends="init"          description="Stops the PlantsByWebSphere application in WebSphere">    <wsStopApplication application="PlantsByWebSphere" /> </target> 

wsStopServer

The wsStopServer task can be used to start an application. This task has the following syntax:

<wsStopServer server=<serverName> [wasHome=<wasinstalldir>]                [noWait=<enablenoWait>] [quiet=<enablequiet>]                [logFile=<logfilename>] [replaceLog=<enablereplaceLog>]                [trace=<enabletrace>] [timeout=<timeoutseconds>]                [failonerror=<enablefailonerror>][conntype=<type>] [host=<hostaddr>]                 [port=<portnumber>] [statusPort=<statusportnumber>]                [username=<username>] [password=<passwd>] />

Where:

  • <serverName> is the name of the server that you want to stop.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <enablenoWait> is "true" or "false" indicating whether to wait for the server to stop.

  • <enablequiet> is "true" or "false" indicating whether to suppress warning and informational messages from this task.

  • <logfilename> is the name of the log file you want used to record the server stop process.

  • <enablereplaceLog> is "true" or "false" indicating whether to replace the log file, or append to the end of the log file.

  • <timeoutseconds> the amount of time, in seconds, to wait for the server to stop. If the server has not stopped in this number of seconds, the task will return control to the caller. The request to stop the server will proceed in the background.

  • <enablefailonerror> is "true" or "false" indicating whether you want this task to terminate immediately if it encounters any errors.

  • <type> is the type of connection you want to make to the AdminService for this task. This can be "SOAP" or "IIOP".

  • <hostaddr> is the host name or IP address of the AdminService for this task.

  • <portnumber> is the port number of the SOAP or IIOP listener of the AdminService for this task.

  • <statusportnumber> the port you want this command-line client to use receive status about the server's startup results.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to operate on the resources in the system.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

Add the following statement to your Ant build.xml if you want to use this task:

 <taskdef name="wsStopServer"           classname="com.ibm.websphere.ant.tasks.StopServer"/> 

The following depicts stopping server1 using this Ant task:

 <target name="stopWebSphere" depends="init"          description="Stop the WebSphere app server1">    <wsStopServer server="server1" /> </target>   

wsUninstallApp

The wsUninstallApp task can be used to uninstall an application. The syntax of this task is:

<wsUninstallApp application=<appName> [wasHome=<wasinstalldir>]                  [options=<uninstalloptions>] [properties=<JVMsyspropsfile>]                 [profile=<scriptprofile>] [conntype=<type>] [host=<hostaddr>]                  [port=<portnumber>] [user=<username>] [password=<passwd>] />

Where:

  • <appname> is the name of the application that you want to uninstall.

  • <wasinstalldir> is the installation directory for WebSphere. This should be the installation directory for the App Server when installing in a single server environment, and should be the installation directory for the Deployment Manager when installing against the deployment manager in a networked cell environment.

  • <uninstalloptions> are any of the uninstallation options that you might normally pass to the $AdminApp uninstall operation. These options should be enclosed in quotes so that they will be handled as a single XML attribute.

  • <JVMsyspropsfile> is the name of a file containing system properties that you want to pass into the JVM for this task.

  • <scriptprofile> is a profile script that you want run before the uninstallation step is performed.

  • <type> is the type of connection you want to make to the AdminService for this task. This can be SOAP or IIOP.

  • <hostaddr> is the host name or IP address of the AdminService.

  • <portnumber> is the port number of the SOAP or IIOP listener of the.

  • <username> is your user ID. This is only needed if security has been enabled. If so, you must have been granted the authority to modify the configuration with the uninstallation of this application.

  • <passwd> is your password – corresponding to the user ID you supplied in <username>.

You need to add the following to your build.xml before you can use this task:

 <taskdef name="wsUninstallApp"          classname="com.ibm.websphere.ant.tasks.UninstallApplication"/> 

wsValidateModule

The wsValidateModule can be used to validate the modules of an EAR file. This task has the following syntax:

<wsValidateModule  src=<srcfilename> />

Where:

<srcfilename> is the directory path and filename of the EAR file that you want validated.

You need to add the following to your build.xml before you can use this task:

 <taskdef name="wsValidateModule"           ="com.ibm.websphere.ant.tasks.ModuleValidator"/> 




Professional IBM WebSphere 5. 0 Applicationa Server
Professional IBM WebSphere 5. 0 Applicationa Server
ISBN: N/A
EAN: N/A
Year: 2001
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net