>From dca414db50a3cfe12eef2932a67b917a2bdb5f27 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Thu, 29 Aug 2013 11:28:16 -0400
Subject: [PATCH] Move status marker from CS.cfg to a variable.

---
 base/common/src/com/netscape/certsrv/apps/CMS.java |  4 ++++
 .../src/com/netscape/certsrv/apps/ICMSEngine.java  |  2 ++
 .../netscape/cms/servlet/csadmin/GetStatus.java    |  2 +-
 .../src/com/netscape/cmscore/apps/CMSEngine.java   | 12 +++++++----
 .../netscape/certsrv/app/CMSEngineDefaultStub.java | 24 +++++-----------------
 5 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/apps/CMS.java b/base/common/src/com/netscape/certsrv/apps/CMS.java
index 00d2e0653f50e1e8b211eb3ff5a22971ac8fa1e1..27cddadb83c16c5573fc501f7349a9d23a4a4491 100644
--- a/base/common/src/com/netscape/certsrv/apps/CMS.java
+++ b/base/common/src/com/netscape/certsrv/apps/CMS.java
@@ -1637,6 +1637,10 @@ public final class CMS {
         return _engine.getSecurityDomainSessionTable();
     }
 
+    public static String getServerStatus() {
+        return _engine.getServerStatus();
+    }
+
     /**
      * Main driver to start CMS.
      */
diff --git a/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java b/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java
index f11005c07edfc7a0b4f2ee80bcde06420a34096d..74fa090038b892713c872025470e4c4d9cb87760 100644
--- a/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java
+++ b/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java
@@ -1133,4 +1133,6 @@ public interface ICMSEngine extends ISubsystem {
     public void setConfigSDSessionId(String id);
 
     public String getConfigSDSessionId();
+
+    public String getServerStatus();
 }
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java b/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java
index dee3c1930c5bff6fc3a69ee8d26e870eb88dae2d..1d2d0e61f34390194880c96efb82a4987fbe3664 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/GetStatus.java
@@ -66,7 +66,7 @@ public class GetStatus extends CMSServlet {
 
         String state = config.getString("cs.state", "");
         String type = config.getString("cs.type", "");
-        String status = config.getString("cs.status", "unknown");
+        String status = CMS.getServerStatus();
         String version = GetStatus.class.getPackage().getImplementationVersion();
 
         try {
diff --git a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
index a3172f51ad769d365b89a4e16e0499dffc562fce..ff44c6dea6ca2820e13b7dc7f9446c557a8a3fb8 100644
--- a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
+++ b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
@@ -203,6 +203,7 @@ public class CMSEngine implements ICMSEngine {
     private String mConfigSDSessionId = null;
     private Timer mSDTimer = null;
     private String mServerCertNickname = null;
+    private String serverStatus = null;
 
     // static subsystems - must be singletons
     private static SubsystemInfo[] mStaticSubsystems = {
@@ -343,8 +344,7 @@ public class CMSEngine implements ICMSEngine {
         mConfig = config;
         int state = mConfig.getInteger("cs.state");
 
-        mConfig.putString("cs.status", "starting");
-        mConfig.commit(false);
+        serverStatus = "starting";
 
         // my default is 1 day
         String flush_timeout = config.getString("securitydomain.flushinterval", "86400000");
@@ -419,8 +419,7 @@ public class CMSEngine implements ICMSEngine {
             mSDTimer.schedule(timertask, 5, (new Long(secdomain_check_interval)).longValue());
         }
 
-        mConfig.putString("cs.status", "running");
-        mConfig.commit(false);
+        serverStatus = "running";
     }
 
     /**
@@ -1929,6 +1928,11 @@ public class CMSEngine implements ICMSEngine {
         Logger.getLogger().log(ILogger.EV_SYSTEM, null,
                 ILogger.S_AUTHENTICATION, level, msg);
     }
+
+    @Override
+    public String getServerStatus() {
+        return serverStatus;
+    }
 }
 
 class WarningListener implements ILogEventListener {
diff --git a/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java b/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java
index ce5570667fde65a4e5a6ef34513aea9fef4641e5..dbd27c914bd47b983e5d25427d17e76add2b617c 100644
--- a/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java
+++ b/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java
@@ -551,87 +551,73 @@ public class CMSEngineDefaultStub implements ICMSEngine {
 
     @Override
     public String getEEClientAuthSSLPort() {
-        // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public boolean verifySystemCerts() {
-        // TODO Auto-generated method stub
         return false;
     }
 
     @Override
     public boolean verifySystemCertByTag(String tag) {
-        // TODO Auto-generated method stub
         return false;
     }
 
     @Override
     public boolean verifySystemCertByNickname(String nickname,
             String certificateUsage) {
-        // TODO Auto-generated method stub
         return false;
     }
 
     @Override
     public CertificateUsage getCertificateUsage(String certusage) {
-        // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public void getGeneralNameConfigDefaultParams(String name,
             boolean isValueConfigured, Vector<String> params) {
-        // TODO Auto-generated method stub
-
     }
 
     @Override
     public void getGeneralNamesConfigDefaultParams(String name,
             boolean isValueConfigured, Vector<String> params) {
-        // TODO Auto-generated method stub
-
     }
 
     @Override
     public void getGeneralNameConfigExtendedPluginInfo(String name,
             boolean isValueConfigured, Vector<String> info) {
-        // TODO Auto-generated method stub
-
     }
 
     @Override
     public void getGeneralNamesConfigExtendedPluginInfo(String name,
             boolean isValueConfigured, Vector<String> info) {
-        // TODO Auto-generated method stub
-
     }
 
     @Override
     public void getSubjAltNameConfigDefaultParams(String name,
             Vector<String> params) {
-        // TODO Auto-generated method stub
-
     }
 
     @Override
     public void getSubjAltNameConfigExtendedPluginInfo(String name,
             Vector<String> params) {
-        // TODO Auto-generated method stub
-
     }
 
     @Override
     public IArgBlock createArgBlock(String realm,
             Hashtable<String, String> httpReq) {
-        // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public IArgBlock createArgBlock(Hashtable<String, String> httpReq) {
-        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getServerStatus() {
         return null;
     }
 }
-- 
1.8.1.4

