summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/apps
diff options
context:
space:
mode:
authorFraser Tweedale <ftweedal@redhat.com>2014-07-22 00:03:47 -0400
committerFraser Tweedale <frase@frase.id.au>2015-04-07 22:38:11 -0400
commit2af78cedd82a08046324ea13eb4973d65c80010f (patch)
tree343fab43ad95a4aca9b2988f5299644e2d2af0a0 /base/common/src/com/netscape/certsrv/apps
parent4785f08b9fa14e2abd60533542d763bdea8082a0 (diff)
downloadpki-2af78cedd82a08046324ea13eb4973d65c80010f.tar.gz
pki-2af78cedd82a08046324ea13eb4973d65c80010f.tar.xz
pki-2af78cedd82a08046324ea13eb4973d65c80010f.zip
Add ability to enable/disable dynamic subsystems
The CA installation process requires starting with the profile subsystem disabled, then enabling it once profiles have been loaded into the database. Accordingly, to avoid hacks with hardcoded offsets, add the "enabled" CS.cfg configuration parameter along with methods to enable or disable a subsystem based on the subsystem ID. A disabled subsystem does not have its `init` method called, but it is still instantiated and added to the registry so that other code can look up a subsystem by name and find out its class. Subsystems are enabled by default. This commit also removes an assumption that the subsystem config sub-store names are sequential numbers beginning at `0`.
Diffstat (limited to 'base/common/src/com/netscape/certsrv/apps')
-rw-r--r--base/common/src/com/netscape/certsrv/apps/CMS.java22
-rw-r--r--base/common/src/com/netscape/certsrv/apps/ICMSEngine.java9
2 files changed, 31 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/apps/CMS.java b/base/common/src/com/netscape/certsrv/apps/CMS.java
index 8b4bac2c0..85c8e58ca 100644
--- a/base/common/src/com/netscape/certsrv/apps/CMS.java
+++ b/base/common/src/com/netscape/certsrv/apps/CMS.java
@@ -509,6 +509,28 @@ public final class CMS {
}
/**
+ * Enable the subsystem with the given ID.
+ *
+ * Does not start the subsystem.
+ *
+ * @param id Subsystem ID.
+ */
+ public static void enableSubsystem(String id) throws EBaseException {
+ _engine.setSubsystemEnabled(id, true);
+ }
+
+ /**
+ * Disable the subsystem with the given ID.
+ *
+ * Does not stop the subsystem.
+ *
+ * @param id Subsystem ID.
+ */
+ public static void disableSubsystem(String id) throws EBaseException {
+ _engine.setSubsystemEnabled(id, false);
+ }
+
+ /**
* Retrieves the localized user message from UserMessages.properties.
*
* @param msgID message id defined in UserMessages.properties
diff --git a/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java b/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java
index 74fa09003..5c78a7c0f 100644
--- a/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java
+++ b/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java
@@ -171,6 +171,15 @@ public interface ICMSEngine extends ISubsystem {
public Enumeration<ISubsystem> getSubsystems();
/**
+ * Set whether the given subsystem is enabled.
+ *
+ * @param id The subsystem ID.
+ * @param enabled Whether the subsystem is enabled
+ */
+ public void setSubsystemEnabled(String id, boolean enabled)
+ throws EBaseException;
+
+ /**
* Retrieves the registered subsytem with the given name.
*
* @param name subsystem name