Methods Summary |
---|
public static void | clearRuntimeStatus()
FileandSyslogHandler.clearRecentErrorMessages();
|
public java.lang.String | getName()
return _name;
|
public java.util.Vector | getRecentErrorMessages()
return _recentErrorMessages;
|
public static com.sun.enterprise.admin.servermgmt.RuntimeStatus | getRuntimeStatus(java.lang.String name, com.sun.enterprise.admin.servermgmt.InstancesManager manager)
int status = manager.getInstanceStatus();
return new RuntimeStatus(name, manager.isRestartNeeded(),
new Status(status, Status.getStatusString(status)),
FileandSyslogHandler.getRecentErrorMessages());
|
public com.sun.enterprise.admin.common.Status | getStatus()
return _status;
|
public boolean | isRestartNeeded()
return _restartNeeded;
|
public boolean | isRunning()
return getStatus().getStatusCode() == Status.kInstanceRunningCode ? true : false;
|
public boolean | isStopped()
return getStatus().getStatusCode() == Status.kInstanceNotRunningCode ? true : false;
|
public void | resetRecentErrorMessages()
// used by start-cluster when the instances are all running already.
// we don't need to show these old messages to them now.
_recentErrorMessages = new Vector();
|
public void | setStartClusterFlag(com.sun.enterprise.admin.servermgmt.RuntimeStatus before)
startCluster = true;
beforeRTStatus = before;
|
public void | setStatus(com.sun.enterprise.admin.common.Status status)
_status = status;
|
public void | setStopClusterFlag(com.sun.enterprise.admin.servermgmt.RuntimeStatus before)
stopCluster = true;
beforeRTStatus = before;
|
public java.lang.String | toShortString()
String result = getStatus().getStatusString();
if (isRunning()) {
if (isRestartNeeded()) {
result = LocalStrings.get("requiresRestartYes");
}
}
return result;
|
public java.lang.String | toString()
if(stopCluster)
return toStringStopCluster();
if(startCluster)
return toStringStartCluster();
return toStringRegular();
|
private java.lang.String | toStringRegular()
LocalStringsImpl stringy = new LocalStringsImpl();
String result = stringy.get("runtimeStatusToString", getName(), getStatus().getStatusString());
if (isRestartNeeded()) {
result += ", " + stringy.get("requiresRestartYes");
} else {
result += ", " + stringy.get("requiresRestartNo");
}
Vector messages = getRecentErrorMessages();
for (int i = 0; i < messages.size(); i++) {
result += "\n" + stringy.get("error") + " " + i + " " + (String)messages.get(i);
}
return result;
|
public java.lang.String | toStringStartCluster()
/*
* WBN May 2007
* These are impossible states:
* (1) ANY instances are still running in the cluster
* (2) ALL instances are already stopped (beforeRTStatus)
* (3) The before-status==stopped && after-status==!stopped
*/
if(beforeRTStatus == null)
{
// this is a programming error!
return toStringRegular();
}
// by my definition, "started" == kInstanceRunningCode
// "not-started" == !kInstanceRunningCode
final int afterCode = getStatus().getStatusCode();
final int beforeCode = beforeRTStatus.getStatus().getStatusCode();
final boolean beforeStarted = (beforeCode == Status.kInstanceRunningCode);
final boolean afterStarted = (afterCode == Status.kInstanceRunningCode);
LocalStringsImpl stringy = new LocalStringsImpl();
final String name = getName();
final String beforeString = beforeRTStatus.getStatus().getStatusString();
final String afterString = getStatus().getStatusString();
String result = "";
if(beforeStarted && afterStarted)
{
// normal -- instance was already running
result = stringy.get("runtimeStatusToStringStartCluster.alreadyStarted", name);
}
else if(!beforeStarted && afterStarted)
{
// normal -- instance was stopped and is now running
result = stringy.get("runtimeStatusToStringStartCluster.success", name);
}
else if(beforeStarted && !afterStarted)
{
// this can't happen...
result = stringy.get("runtimeStatusToStringStartCluster.startedToStopped",
name, afterString);
// there is no logger available in this file
System.err.println(result);
}
else if(!beforeStarted && !afterStarted)
{
// a "normal" error -- the instance could not be Started.
result = stringy.get("runtimeStatusToStringStartCluster.error", name,
beforeString, afterString);
}
Vector messages = getRecentErrorMessages();
for (int i = 0; i < messages.size(); i++) {
result += "\n" + stringy.get("error") + " " + i + " " + (String)messages.get(i);
}
return result;
|
public java.lang.String | toStringStopCluster()
/*
* WBN Feb 2007
* These are impossible states:
* (1) ANY instances are still running in the cluster
* (2) ALL instances are already stopped (beforeRTStatus)
* (3) The before-status==stopped && after-status==!stopped
*/
if(beforeRTStatus == null)
{
// this is a programming error!
return toStringRegular();
}
// by my definition, "stopped" == kInstanceNotRunningCode
// "not-stopped" == !kInstanceNotRunningCode
final int afterCode = getStatus().getStatusCode();
final int beforeCode = beforeRTStatus.getStatus().getStatusCode();
final boolean beforeStopped = (beforeCode == Status.kInstanceNotRunningCode);
final boolean afterStopped = (afterCode == Status.kInstanceNotRunningCode);
LocalStringsImpl stringy = new LocalStringsImpl();
final String name = getName();
final String beforeString = beforeRTStatus.getStatus().getStatusString();
final String afterString = getStatus().getStatusString();
String result = "";
if(beforeStopped && afterStopped)
{
// normal -- instance was already stopped
result = stringy.get("runtimeStatusToStringStopCluster.alreadyStopped", name);
}
else if(!beforeStopped && afterStopped)
{
// normal -- instance was running and was stopped.
result = stringy.get("runtimeStatusToStringStopCluster.success", name);
}
else if(beforeStopped && !afterStopped)
{
// this can't happen...
result = stringy.get("runtimeStatusToStringStopCluster.stoppedToRunning",
name, afterString);
// there is no logger available in this file
System.err.println(result);
}
else if(!beforeStopped && !afterStopped)
{
// a "normal" error -- the instance could not be stopped.
result = stringy.get("runtimeStatusToStringStopCluster.error", name,
beforeString, afterString);
}
Vector messages = getRecentErrorMessages();
for (int i = 0; i < messages.size(); i++) {
result += "\n" + stringy.get("error") + " " + i + " " + (String)messages.get(i);
}
return result;
|