1 23 package com.sun.appserv.management.deploy; 24 25 import java.util.Locale ; 26 import java.util.Map ; 27 import java.io.Serializable ; 28 29 30 import com.sun.appserv.management.deploy.DeploymentProgress; 31 import com.sun.appserv.management.base.MapCapableBase; 32 33 36 public final class DeploymentProgressImpl 37 extends MapCapableBase 38 implements DeploymentProgress 39 { 40 43 public 44 DeploymentProgressImpl( final DeploymentProgress src ) 45 { 46 this( src.asMap() ); 47 } 48 49 protected boolean 50 validate() 51 { 52 final byte progressPercent = getProgressPercent(); 53 return( progressPercent >= 0 && progressPercent <= 100 ); 54 } 55 56 63 public <T extends Serializable > 64 DeploymentProgressImpl( 65 final byte progressPercent, 66 final String description, 67 final Map <String ,T> other ) 68 { 69 this( other, false ); 70 71 putField( PROGRESS_PERCENT_KEY, new Byte ( (byte)progressPercent ) ); 72 putField( DESCRIPTION_KEY, description ); 73 74 validateThrow(); 75 } 76 77 81 private <T extends Serializable > 82 DeploymentProgressImpl( final Map <String ,T> m, final boolean validate ) 83 { 84 super( m, DEPLOYMENT_PROGRESS_CLASS_NAME); 85 86 if ( validate ) 87 { 88 validateThrow(); 89 } 90 } 91 92 95 111 public <T extends Serializable > 112 DeploymentProgressImpl( final Map <String ,T> m ) 113 { 114 super( m, DEPLOYMENT_PROGRESS_CLASS_NAME ); 115 checkValidType( m, DEPLOYMENT_PROGRESS_CLASS_NAME ); 116 117 validateThrow(); 118 } 119 120 public String 121 getMapClassName() 122 { 123 return( DEPLOYMENT_PROGRESS_CLASS_NAME ); 124 } 125 126 public static String 127 getLocalizedDescriptionKey( final Locale locale ) 128 { 129 return( LOCALIZED_DESCRIPTION_KEY_BASE + "_" + locale.toString() ); 130 } 131 132 public byte 133 getProgressPercent() 134 { 135 return( getByte( PROGRESS_PERCENT_KEY ).byteValue() ); 136 } 137 138 public String 139 getDescription() 140 { 141 return( getString( DESCRIPTION_KEY ) ); 142 } 143 144 public String 145 getLocalizedDescription( final Locale locale) 146 { 147 return( getString( getLocalizedDescriptionKey( locale ) ) ); 148 } 149 } 150 151 152 153 | Popular Tags |