FileDocCategorySizeDatePackage
WLStop.javaAPI DocApache Ant 1.704885Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.ejb

WLStop

public class WLStop extends org.apache.tools.ant.Task
Shuts down a WebLogic server. To shut down an instance you must supply both a username and a password.

Fields Summary
private org.apache.tools.ant.types.Path
classpath
The classpath to be used. It must contains the weblogic.Admin class.
private String
username
The weblogic username to use to request the shutdown.
private String
password
The password to use to shutdown the weblogic server.
private String
serverURL
The URL which the weblogic server is listening on.
private int
delay
The delay (in seconds) to wait before shutting down.
private File
beaHome
The location of the BEA Home under which this server is run. WL6 only
Constructors Summary
Methods Summary
public org.apache.tools.ant.types.PathcreateClasspath()
The classpath to be used with the Java Virtual Machine that runs the Weblogic Shutdown command;

return
the path to be configured.

        if (classpath == null) {
            classpath = new Path(getProject());
        }
        return classpath.createPath();
    
public voidexecute()
Do the work. The work is actually done by creating a separate JVM to run the weblogic admin task This approach allows the classpath of the helper task to be set.

exception
BuildException if someting goes wrong with the build


                                                 
         
        if (username == null || password == null) {
            throw new BuildException("weblogic username and password must both be set");
        }

        if (serverURL == null) {
            throw new BuildException("The url of the weblogic server must be provided.");
        }

        Java weblogicAdmin = new Java(this);
        weblogicAdmin.setFork(true);
        weblogicAdmin.setClassname("weblogic.Admin");
        String args;

        if (beaHome == null) {
            args = serverURL + " SHUTDOWN " + username + " " + password + " " + delay;
        } else {
            args = " -url " + serverURL
                    + " -username " + username
                    + " -password " + password
                    + " SHUTDOWN " + " " + delay;
        }

        weblogicAdmin.createArg().setLine(args);
        weblogicAdmin.setClasspath(classpath);
        weblogicAdmin.execute();
    
public voidsetBEAHome(java.io.File beaHome)
The location of the BEA Home; implicitly selects Weblogic 6.0 shutdown; optional.

param
beaHome the BEA Home directory.

        this.beaHome = beaHome;
    
public voidsetClasspath(org.apache.tools.ant.types.Path path)
The classpath to be used with the Java Virtual Machine that runs the Weblogic Shutdown command;

param
path the classpath to use when executing the weblogic admin task.

        this.classpath = path;
    
public voidsetDelay(java.lang.String s)
Set the delay (in seconds) before shutting down the server; optional.

param
s the selay.

        delay = Integer.parseInt(s);
    
public voidsetPassword(java.lang.String s)
The password for the account specified in the user parameter; required

param
s the password.

        this.password = s;
    
public voidsetUrl(java.lang.String s)
Set the URL to which the weblogic server is listening for T3 connections; required.

param
s the url.

        this.serverURL = s;
    
public voidsetUser(java.lang.String s)
The username of the account which will be used to shutdown the server; required.

param
s the username.

        this.username = s;