| 1 | // $Id: PoolStatusChangedMessage.java,v 1.4 2004-11-05 12:07:20 tigran Exp $ |
| 2 | |
| 3 | package diskCacheV111.vehicles; |
| 4 | |
| 5 | import diskCacheV111.pools.PoolV2Mode ; |
| 6 | |
| 7 | public class PoolStatusChangedMessage extends PoolMessage { |
| 8 | |
| 9 | public static final int UP = 1 ; |
| 10 | public static final int DOWN = 2 ; |
| 11 | public static final int RESTART = 3 ; |
| 12 | |
| 13 | public static final String [] statusString = { "UNKNOWN" , "UP" , "DOWN" , "RESTART" } ; |
| 14 | |
| 15 | private int _state = 0 ; |
| 16 | |
| 17 | private PoolV2Mode _poolMode = null ; |
| 18 | private String _detailMessage = null ; |
| 19 | private int _detailCode = 0 ; |
| 20 | |
| 21 | private static final long serialVersionUID = 7246217707829001604L; |
| 22 | |
| 23 | public PoolStatusChangedMessage( String poolName , int poolStatus ){ |
| 24 | super(poolName); |
| 25 | if( ( poolStatus < 1 ) || ( poolStatus > 3 ) ) |
| 26 | throw new |
| 27 | IllegalArgumentException("Not a valid pool status"); |
| 28 | _state = poolStatus ; |
| 29 | } |
| 30 | public int getPoolState(){ return _state ; } |
| 31 | public String getPoolStatus(){ return statusString[_state] ; } |
| 32 | public String toString(){ |
| 33 | return "PoolName="+getPoolName()+ |
| 34 | ";status="+statusString[_state]+ |
| 35 | ( _poolMode == null ? "" : ( ";mode="+ _poolMode.toString() ) ) + |
| 36 | ";code=("+_detailCode+ |
| 37 | ( _detailMessage==null ? ")" : (","+_detailMessage+")") ) ; |
| 38 | } |
| 39 | public void setDetail( int code , String message ){ |
| 40 | _detailCode = code ; |
| 41 | _detailMessage = message ; |
| 42 | } |
| 43 | public int getDetailCode(){ return _detailCode ; } |
| 44 | public String getDetailMessage(){ return _detailMessage ; } |
| 45 | public void setPoolMode( PoolV2Mode mode ){ _poolMode = mode ; } |
| 46 | public PoolV2Mode getPoolMode(){ return _poolMode ; } |
| 47 | |
| 48 | } |