FileDocCategorySizeDatePackage
DeploymentStatusImplWithError.javaAPI DocGlassfish v2 API4236Fri May 04 22:34:28 BST 2007com.sun.enterprise.deployapi

DeploymentStatusImplWithError

public class DeploymentStatusImplWithError extends DeploymentStatusImpl
Simple implementation of DeploymentStatus intended to describe an exception that occurred during a DeploymentManager method invocation.
author
tjquinn

Fields Summary
private Throwable
cause
Records the error, if any, associated with this status object
private javax.enterprise.deploy.shared.CommandType
commandType
Constructors Summary
public DeploymentStatusImplWithError()
Creates a new instance of DeploymentStatusImplWithError

    
           
      
    
public DeploymentStatusImplWithError(javax.enterprise.deploy.shared.CommandType commandType, Throwable cause)
Creates a new instance of DeploymentStatusImplWithError

        super();
        initCause(cause);
        setState(StateType.FAILED);
        setCommand(commandType);
    
Methods Summary
public java.lang.ThrowablegetCause()
Returns the cause for this status.

return
Throwable that describes the error associated with this status

        return cause;
    
public voidinitCause(java.lang.Throwable cause)
Assigns the cause for this status.

param
Throwable that describes the error to be reported

        this.cause = cause;
        setMessage(cause.getMessage());
    
public java.lang.StringtoString()
Displays the status as a string, including stack trace information if error is present.

return
String describing the status, including stack trace info from the error (if present).

        StringBuffer result = new StringBuffer(super.toString());
        if (cause != null) {
            String lineSep = System.getProperty("line.separator");
            result.append(lineSep).append("Cause: ");
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            PrintWriter pw = new PrintWriter(baos);
            cause.printStackTrace(pw);
            pw.close();
            result.append(baos.toString());
        }
        return result.toString();