summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java73
1 files changed, 33 insertions, 40 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java b/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
index 3af3321d..1651b54e 100644
--- a/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
+++ b/pki/base/common/src/com/netscape/cmscore/profile/ProfileSubsystem.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.profile;
-
import java.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -34,7 +33,6 @@ import com.netscape.certsrv.profile.IProfileSubsystem;
import com.netscape.certsrv.registry.IPluginInfo;
import com.netscape.certsrv.registry.IPluginRegistry;
-
public class ProfileSubsystem implements IProfileSubsystem {
private static final String PROP_LIST = "list";
private static final String PROP_CLASS_ID = "class_id";
@@ -54,7 +52,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
* Retrieves the name of this subsystem.
*/
public String getId() {
- return null;
+ return null;
}
/**
@@ -64,19 +62,18 @@ public class ProfileSubsystem implements IProfileSubsystem {
}
/**
- * Initializes this subsystem with the given configuration
- * store.
+ * Initializes this subsystem with the given configuration store.
* <P>
- *
+ *
* @param owner owner of this subsystem
* @param config configuration store
* @exception EBaseException failed to initialize
*/
public void init(ISubsystem owner, IConfigStore config)
- throws EBaseException {
+ throws EBaseException {
CMS.debug("ProfileSubsystem: start init");
- IPluginRegistry registry = (IPluginRegistry)
- CMS.getSubsystem(CMS.SUBSYSTEM_REGISTRY);
+ IPluginRegistry registry = (IPluginRegistry) CMS
+ .getSubsystem(CMS.SUBSYSTEM_REGISTRY);
mConfig = config;
mOwner = owner;
@@ -99,8 +96,9 @@ public class ProfileSubsystem implements IProfileSubsystem {
IPluginInfo info = registry.getPluginInfo("profile", classid);
String configPath = subStore.getString(PROP_CONFIG);
- CMS.debug("Start Profile Creation - " + id + " " + classid + " " + info.getClassName());
- IProfile profile = createProfile(id, classid, info.getClassName(),
+ CMS.debug("Start Profile Creation - " + id + " " + classid + " "
+ + info.getClassName());
+ IProfile profile = createProfile(id, classid, info.getClassName(),
configPath);
CMS.debug("Done Profile Creation - " + id);
@@ -112,15 +110,14 @@ public class ProfileSubsystem implements IProfileSubsystem {
String id = (String) ee.nextElement();
CMS.debug("Registered Confirmation - " + id);
- }
+ }
}
/**
* Creates a profile instance.
*/
- public IProfile createProfile(String id, String classid, String className,
- String configPath)
- throws EProfileException {
+ public IProfile createProfile(String id, String classid, String className,
+ String configPath) throws EProfileException {
IProfile profile = null;
try {
@@ -142,12 +139,13 @@ public class ProfileSubsystem implements IProfileSubsystem {
return null;
}
- public void deleteProfile(String id, String configPath) throws EProfileException {
-
+ public void deleteProfile(String id, String configPath)
+ throws EProfileException {
+
if (isProfileEnable(id)) {
throw new EProfileException("CMS_PROFILE_DELETE_ENABLEPROFILE");
}
-
+
String ids = "";
try {
ids = mConfig.getString(PROP_LIST, "");
@@ -166,7 +164,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
}
if (!list.equals(""))
list = list.substring(0, list.length() - 1);
-
+
mConfig.putString(PROP_LIST, list);
mConfig.removeSubStore(id);
File file1 = new File(configPath);
@@ -181,13 +179,12 @@ public class ProfileSubsystem implements IProfileSubsystem {
}
}
- public void createProfileConfig(String id, String classId,
- String configPath)
- throws EProfileException {
+ public void createProfileConfig(String id, String classId, String configPath)
+ throws EProfileException {
try {
if (mProfiles.size() > 0) {
- mConfig.putString(PROP_LIST,
- mConfig.getString(PROP_LIST) + "," + id);
+ mConfig.putString(PROP_LIST, mConfig.getString(PROP_LIST) + ","
+ + id);
} else {
mConfig.putString(PROP_LIST, id);
}
@@ -207,8 +204,8 @@ public class ProfileSubsystem implements IProfileSubsystem {
}
/**
- * Stops this system. The owner may call shutdown
- * anytime after initialization.
+ * Stops this system. The owner may call shutdown anytime after
+ * initialization.
* <P>
*/
public void shutdown() {
@@ -222,7 +219,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
/**
* Returns the root configuration storage of this system.
* <P>
- *
+ *
* @return configuration store of this subsystem
*/
public IConfigStore getConfigStore() {
@@ -233,7 +230,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
* Adds a profile.
*/
public void addProfile(String id, IProfile profile)
- throws EProfileException {
+ throws EProfileException {
}
public boolean isProfileEnable(String id) {
@@ -267,7 +264,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
* Enables a profile for execution.
*/
public void enableProfile(String id, String enableBy)
- throws EProfileException {
+ throws EProfileException {
IProfile profile = (IProfile) mProfiles.get(id);
profile.getConfigStore().putString(PROP_ENABLE, "true");
@@ -281,8 +278,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
/**
* Disables a profile for execution.
*/
- public void disableProfile(String id)
- throws EProfileException {
+ public void disableProfile(String id) throws EProfileException {
IProfile profile = (IProfile) mProfiles.get(id);
profile.getConfigStore().putString(PROP_ENABLE, "false");
@@ -295,8 +291,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
/**
* Retrieves a profile by id.
*/
- public IProfile getProfile(String id)
- throws EProfileException {
+ public IProfile getProfile(String id) throws EProfileException {
return (IProfile) mProfiles.get(id);
}
@@ -305,8 +300,7 @@ public class ProfileSubsystem implements IProfileSubsystem {
}
/**
- * Retrieves a list of profile ids. The return
- * list is of type String.
+ * Retrieves a list of profile ids. The return list is of type String.
*/
public Enumeration getProfileIds() {
return mProfileIds.elements();
@@ -314,15 +308,14 @@ public class ProfileSubsystem implements IProfileSubsystem {
/**
* Checks if owner id should be enforced during profile approval.
- *
+ *
* @return true if approval should be checked
*/
- public boolean checkOwner()
- {
+ public boolean checkOwner() {
try {
- return mConfig.getBoolean(PROP_CHECK_OWNER, false);
+ return mConfig.getBoolean(PROP_CHECK_OWNER, false);
} catch (EBaseException e) {
- return false;
+ return false;
}
}
}