1 23 24 package com.sun.enterprise.admin.common; 25 26 import com.sun.enterprise.admin.util.SOMLocalStringsManager; 28 29 32 public class ServerInstanceStatus extends Status 33 { 34 35 public static final long serialVersionUID = 7309765796199182533L; 36 37 private boolean mDebug = false; 38 private int mDebugPort = -1; 39 private static SOMLocalStringsManager localizedStrMgr = 41 SOMLocalStringsManager.getManager( ServerInstanceStatus.class ); 42 43 46 public ServerInstanceStatus () 47 { 48 super(Status.kInstanceRunningCode, Status.kInstanceRunningMsg); 49 } 50 51 59 public ServerInstanceStatus (int statusCode) 60 { 61 super(); 62 setStatusCodeAndStr(statusCode); 63 } 64 65 public ServerInstanceStatus(int code, String str) 66 { 67 super(code, str); 68 } 69 70 public boolean isRunning () 71 { 72 return (mStatusCode == Status.kInstanceRunningCode); 73 } 74 75 79 public void setRunning() 80 { 81 mStatusCode = kInstanceRunningCode; 82 mStatusString = kInstanceRunningMsg; 83 } 84 85 89 public boolean isStarting() 90 { 91 return (mStatusCode == kInstanceStartingCode); 92 } 93 94 98 public void setStarting() 99 { 100 mStatusCode = kInstanceStartingCode; 101 mStatusString = kInstanceStartingMsg; 102 } 103 104 108 public boolean isStopping() 109 { 110 return (mStatusCode == kInstanceStoppingCode); 111 } 112 113 117 public void setStopping() 118 { 119 mStatusCode = kInstanceStoppingCode; 120 mStatusString = kInstanceStoppingMsg; 121 } 122 123 127 public boolean isNotRunning() 128 { 129 return (mStatusCode == Status.kInstanceNotRunningCode); 130 } 131 132 136 public void setNotRunning() 137 { 138 mStatusCode = kInstanceNotRunningCode; 139 mStatusString = kInstanceNotRunningMsg; 140 } 141 142 146 public boolean isDebug() 147 { 148 return mDebug; 149 } 150 151 153 public void setDebug(boolean debug) 154 { 155 mDebug = debug; 156 } 157 158 162 public int getDebugPort() 163 { 164 return ( mDebugPort ); 165 } 166 171 public void setDebugPort(int port) 172 { 173 mDebugPort = port; 174 } 175 176 181 private void setStatusCodeAndStr(int statusCode) { 182 switch (statusCode) { 183 case Status.kInstanceStartingCode: 184 this.mStatusCode = statusCode; 185 this.mStatusString = Status.kInstanceStartingMsg; 186 break; 187 case Status.kInstanceRunningCode: 188 this.mStatusCode = statusCode; 189 this.mStatusString = Status.kInstanceRunningMsg; 190 break; 191 case Status.kInstanceStoppingCode: 192 this.mStatusCode = statusCode; 193 this.mStatusString = Status.kInstanceStoppingMsg; 194 break; 195 case Status.kInstanceNotRunningCode: 196 this.mStatusCode = statusCode; 197 this.mStatusString = Status.kInstanceNotRunningMsg; 198 break; 199 default: 200 String msg = localizedStrMgr.getString( "admin.common.invalid_server_instance_status_code", new String ( statusCode + "" ) ); 201 throw new IllegalArgumentException ( msg ); 202 } 203 } 204 } 205 | Popular Tags |