FileDocCategorySizeDatePackage
ServerInstanceStatus.javaAPI DocGlassfish v2 API7049Fri May 04 22:33:18 BST 2007com.sun.enterprise.admin.common

ServerInstanceStatus

public class ServerInstanceStatus extends Status
A class that represents the status of a Server Instance.

Fields Summary
public static final long
serialVersionUID
private boolean
mDebug
private int
mDebugPort
private static com.sun.enterprise.admin.util.SOMLocalStringsManager
localizedStrMgr
Constructors Summary
public ServerInstanceStatus()
Creates new Status that represents state of a running Server Instance.


                           
      
    
        super(Status.kInstanceRunningCode, Status.kInstanceRunningMsg);
    
public ServerInstanceStatus(int statusCode)
Create new status that represents specified status. If specified status code is invalid the method throws an IllegalArgumentException

param
statusCode status code, one of Status.kInstanceStartingCode, Status.kInstanceRunningCode, Status.kInstanceStoppingCode and Status.kInstanceNotRunningCode.
throws
IllegalArgumentException if specified status code is invalid.

        super();
        setStatusCodeAndStr(statusCode);
    
public ServerInstanceStatus(int code, String str)

        super(code, str);
    
Methods Summary
public intgetDebugPort()
Returns the port on which JPDA port in admin-server JVM listens. Returns -1 in case the debug flag is not enabled.

        return ( mDebugPort );
    
public booleanisDebug()
Returns true if the instance is set to run in debug mode, false otherwise.

        return mDebug;
    
public booleanisNotRunning()
Returns true if the status code is set to kInstanceNotRunning, false otherwise.

        return (mStatusCode == Status.kInstanceNotRunningCode);
    
public booleanisRunning()

        return (mStatusCode == Status.kInstanceRunningCode);
    
public booleanisStarting()
Returns true if the status code is set to kInstanceStartingCode, false otherwise.

        return (mStatusCode == kInstanceStartingCode);
    
public booleanisStopping()
Returns true if the status code is set to kInstanceStoppingCode, false otherwise.

        return (mStatusCode == kInstanceStoppingCode);
    
public voidsetDebug(boolean debug)

        mDebug = debug;
    
public voidsetDebugPort(int port)
Sets the JPDA debugger port. This is the port to which the debuggers can connect in case the JVM is to be debugged.

param
port integer representing port

        mDebugPort = port;
    
public voidsetNotRunning()
Convenience method for setting the current status code to not running.

        mStatusCode     = kInstanceNotRunningCode;
        mStatusString   = kInstanceNotRunningMsg;
    
public voidsetRunning()
Convenience method for setting the current status code to running.

        mStatusCode     = kInstanceRunningCode;
        mStatusString   = kInstanceRunningMsg;
    
public voidsetStarting()
Convenience method for setting the current status code to starting.

        mStatusCode     = kInstanceStartingCode;
        mStatusString   = kInstanceStartingMsg;
    
private voidsetStatusCodeAndStr(int statusCode)
Set status code and string to appropriate values using specified status code. An IllegalArgumentException is thrown if status code is invalid for server instance.

        switch (statusCode) {
          case Status.kInstanceStartingCode:
            this.mStatusCode = statusCode;
            this.mStatusString = Status.kInstanceStartingMsg;
            break;
          case Status.kInstanceRunningCode:
            this.mStatusCode = statusCode;
            this.mStatusString = Status.kInstanceRunningMsg;
            break;
          case Status.kInstanceStoppingCode:
            this.mStatusCode = statusCode;
            this.mStatusString = Status.kInstanceStoppingMsg;
            break;
          case Status.kInstanceNotRunningCode:
            this.mStatusCode = statusCode;
            this.mStatusString = Status.kInstanceNotRunningMsg;
            break;
          default:
			String msg = localizedStrMgr.getString( "admin.common.invalid_server_instance_status_code", new String( statusCode + "" ) );
            throw new IllegalArgumentException( msg );
        }
    
public voidsetStopping()
Convenience method for setting the current status code to stopping.

        mStatusCode     = kInstanceStoppingCode;
        mStatusString   = kInstanceStoppingMsg;