1 23 package com.sun.appserv.management.base; 24 25 import java.util.Map ; 26 import java.io.Serializable ; 27 28 import com.sun.appserv.management.util.misc.ThrowableMapper; 29 30 33 34 public class OperationStatusBase 35 extends MapCapableBase 36 implements OperationStatus 37 { 38 39 45 public <T extends Serializable > 46 OperationStatusBase( 47 final Map <String ,T> m, 48 final String className ) 49 { 50 super( m, className ); 51 } 52 53 54 protected boolean 55 validate() 56 { 57 return( true ); 59 } 60 61 64 public int 65 getStatusCode() 66 { 67 int statusCode = STATUS_CODE_FAILURE; 68 69 final Integer code = getInteger( STATUS_CODE_KEY ); 70 if ( code != null ) 71 { 72 statusCode = code.intValue(); 73 } 74 else 75 { 76 statusCode = getThrowable() != null ? 77 STATUS_CODE_FAILURE : STATUS_CODE_SUCCESS; 78 } 79 80 return( statusCode ); 81 } 82 83 86 public void 87 setStatusCode( final int statusCode ) 88 { 89 putField( STATUS_CODE_KEY, new Integer ( statusCode ) ); 90 } 91 92 93 96 public Throwable 97 getThrowable() 98 { 99 return( (Throwable )getObject( THROWABLE_KEY ) ); 100 } 101 102 103 106 public void 107 setThrowable( final Throwable t) 108 { 109 final Throwable conforming = new ThrowableMapper( t ).map(); 110 111 putField( THROWABLE_KEY, conforming ); 112 } 113 114 115 } 116 117 118 119 120 121 122 123 124 | Popular Tags |