diff options
author | Ade Lee <alee@redhat.com> | 2011-12-07 16:58:12 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2011-12-07 16:58:12 -0500 |
commit | 32150d3ee32f8ac27118af7c792794b538c78a2f (patch) | |
tree | 52dd96f664a6fa51be25b28b6f10adc5f2c9f660 /pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java | |
parent | f05d58a46795553beb8881039cc922974b40db34 (diff) | |
download | pki-32150d3ee32f8ac27118af7c792794b538c78a2f.tar.gz pki-32150d3ee32f8ac27118af7c792794b538c78a2f.tar.xz pki-32150d3ee32f8ac27118af7c792794b538c78a2f.zip |
Formatting
Formatted project according to eclipse project settings
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java | 444 |
1 files changed, 220 insertions, 224 deletions
diff --git a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java index acaf9772a..578324869 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.profile.common; - import java.util.Enumeration; import java.util.Hashtable; import java.util.Locale; @@ -49,10 +48,9 @@ import com.netscape.certsrv.registry.IPluginRegistry; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestStatus; - /** * This class implements a basic profile. - * + * * @version $Revision$, $Date$ */ public abstract class BasicProfile implements IProfile { @@ -76,8 +74,8 @@ public abstract class BasicProfile implements IProfile { public static final String PROP_NAME = "name"; public static final String PROP_DESC = "desc"; public static final String PROP_NO_DEFAULT = "noDefaultImpl"; - public static final String PROP_NO_CONSTRAINT= "noConstraintImpl"; - public static final String PROP_GENERIC_EXT_DEFAULT= "genericExtDefaultImpl"; + public static final String PROP_NO_CONSTRAINT = "noConstraintImpl"; + public static final String PROP_GENERIC_EXT_DEFAULT = "genericExtDefaultImpl"; protected IProfileSubsystem mOwner = null; protected IConfigStore mConfig = null; @@ -144,21 +142,19 @@ public abstract class BasicProfile implements IProfile { public IProfileAuthenticator getAuthenticator() throws EProfileException { try { - IAuthSubsystem authSub = (IAuthSubsystem) - CMS.getSubsystem(CMS.SUBSYSTEM_AUTH); - IProfileAuthenticator auth = (IProfileAuthenticator) - authSub.get(mAuthInstanceId); - - if (mAuthInstanceId != null && mAuthInstanceId.length() > 0 - && auth == null) { - throw new EProfileException("Cannot load " + - mAuthInstanceId); + IAuthSubsystem authSub = (IAuthSubsystem) CMS + .getSubsystem(CMS.SUBSYSTEM_AUTH); + IProfileAuthenticator auth = (IProfileAuthenticator) authSub + .get(mAuthInstanceId); + + if (mAuthInstanceId != null && mAuthInstanceId.length() > 0 + && auth == null) { + throw new EProfileException("Cannot load " + mAuthInstanceId); } return auth; } catch (Exception e) { if (mAuthInstanceId != null) { - throw new EProfileException("Cannot load " + - mAuthInstanceId); + throw new EProfileException("Cannot load " + mAuthInstanceId); } return null; } @@ -167,7 +163,7 @@ public abstract class BasicProfile implements IProfile { public String getRequestorDN(IRequest request) { return null; } - + public String getAuthenticatorId() { return mAuthInstanceId; } @@ -185,7 +181,7 @@ public abstract class BasicProfile implements IProfile { * Initializes this profile. */ public void init(IProfileSubsystem owner, IConfigStore config) - throws EBaseException { + throws EBaseException { CMS.debug("BasicProfile: start init"); mOwner = owner; mConfig = config; @@ -204,17 +200,19 @@ public abstract class BasicProfile implements IProfile { // policy.p1.default.class=com.netscape.cms.profile.defaults.SubjectName // policy.p1.default.params.x1=x1 // policy.p1.default.params.x2=x2 - // policy.p1.constraint.class= ... .cms.profile.constraints.ValidityRange + // policy.p1.constraint.class= ... + // .cms.profile.constraints.ValidityRange // policy.p1.constraint.params.x1=x1 // policy.p1.constraint.params.x2=x2 - // handle profile authentication plugins + // handle profile authentication plugins try { - mAuthInstanceId = config.getString("auth." + PROP_INSTANCE_ID, null); + mAuthInstanceId = config + .getString("auth." + PROP_INSTANCE_ID, null); mAuthzAcl = config.getString("authz.acl", ""); } catch (EBaseException e) { - CMS.debug("BasicProfile: authentication class not found " + - e.toString()); + CMS.debug("BasicProfile: authentication class not found " + + e.toString()); } // handle profile input plugins @@ -224,8 +222,8 @@ public abstract class BasicProfile implements IProfile { while (input_st.hasMoreTokens()) { String input_id = (String) input_st.nextToken(); - String inputClassId = inputStore.getString(input_id + "." + - PROP_CLASS_ID); + String inputClassId = inputStore.getString(input_id + "." + + PROP_CLASS_ID); IPluginInfo inputInfo = mRegistry.getPluginInfo("profileInput", inputClassId); String inputClass = inputInfo.getClassName(); @@ -233,13 +231,12 @@ public abstract class BasicProfile implements IProfile { IProfileInput input = null; try { - input = (IProfileInput) - Class.forName(inputClass).newInstance(); + input = (IProfileInput) Class.forName(inputClass).newInstance(); } catch (Exception e) { // throw Exception - CMS.debug("BasicProfile: input plugin Class.forName " + - inputClass + " " + e.toString()); - throw new EBaseException( e.toString() ); + CMS.debug("BasicProfile: input plugin Class.forName " + + inputClass + " " + e.toString()); + throw new EBaseException(e.toString()); } IConfigStore inputConfig = inputStore.getSubStore(input_id); input.init(this, inputConfig); @@ -255,8 +252,8 @@ public abstract class BasicProfile implements IProfile { while (output_st.hasMoreTokens()) { String output_id = (String) output_st.nextToken(); - String outputClassId = outputStore.getString(output_id + "." + - PROP_CLASS_ID); + String outputClassId = outputStore.getString(output_id + "." + + PROP_CLASS_ID); IPluginInfo outputInfo = mRegistry.getPluginInfo("profileOutput", outputClassId); String outputClass = outputInfo.getClassName(); @@ -264,13 +261,13 @@ public abstract class BasicProfile implements IProfile { IProfileOutput output = null; try { - output = (IProfileOutput) - Class.forName(outputClass).newInstance(); + output = (IProfileOutput) Class.forName(outputClass) + .newInstance(); } catch (Exception e) { // throw Exception - CMS.debug("BasicProfile: output plugin Class.forName " + - outputClass + " " + e.toString()); - throw new EBaseException( e.toString() ); + CMS.debug("BasicProfile: output plugin Class.forName " + + outputClass + " " + e.toString()); + throw new EBaseException(e.toString()); } IConfigStore outputConfig = outputStore.getSubStore(output_id); output.init(this, outputConfig); @@ -286,22 +283,22 @@ public abstract class BasicProfile implements IProfile { while (updater_st.hasMoreTokens()) { String updater_id = (String) updater_st.nextToken(); - String updaterClassId = updaterStore.getString(updater_id + "." + - PROP_CLASS_ID); + String updaterClassId = updaterStore.getString(updater_id + "." + + PROP_CLASS_ID); IPluginInfo updaterInfo = mRegistry.getPluginInfo("profileUpdater", - updaterClassId); + updaterClassId); String updaterClass = updaterInfo.getClassName(); IProfileUpdater updater = null; try { - updater = (IProfileUpdater) - Class.forName(updaterClass).newInstance(); + updater = (IProfileUpdater) Class.forName(updaterClass) + .newInstance(); } catch (Exception e) { // throw Exception - CMS.debug("BasicProfile: updater plugin Class.forName " + - updaterClass + " " + e.toString()); - throw new EBaseException( e.toString() ); + CMS.debug("BasicProfile: updater plugin Class.forName " + + updaterClass + " " + e.toString()); + throw new EBaseException(e.toString()); } IConfigStore updaterConfig = updaterStore.getSubStore(updater_id); updater.init(this, updaterConfig); @@ -325,15 +322,15 @@ public abstract class BasicProfile implements IProfile { String id = (String) st1.nextToken(); String defaultRoot = id + "." + PROP_DEFAULT; - String defaultClassId = policyStore.getString(defaultRoot + "." + - PROP_CLASS_ID); + String defaultClassId = policyStore.getString(defaultRoot + "." + + PROP_CLASS_ID); String constraintRoot = id + "." + PROP_CONSTRAINT; - String constraintClassId = - policyStore.getString(constraintRoot + "." + PROP_CLASS_ID); + String constraintClassId = policyStore.getString(constraintRoot + + "." + PROP_CLASS_ID); - createProfilePolicy(setId, id, defaultClassId, - constraintClassId, false); + createProfilePolicy(setId, id, defaultClassId, + constraintClassId, false); } } CMS.debug("BasicProfile: done init"); @@ -380,20 +377,20 @@ public abstract class BasicProfile implements IProfile { } public String getInput(String name, Locale locale, IRequest request) - throws EProfileException { + throws EProfileException { return null; } public void setInput(String name, Locale locale, IRequest request, - String value) throws EProfileException { + String value) throws EProfileException { } public Enumeration getProfilePolicySetIds() { return mPolicySet.keys(); } - public void deleteProfilePolicy(String setId, String policyId) - throws EProfileException { + public void deleteProfilePolicy(String setId, String policyId) + throws EProfileException { Vector policies = (Vector) mPolicySet.get(setId); if (policies == null) { @@ -436,26 +433,28 @@ public abstract class BasicProfile implements IProfile { policies.removeElementAt(i); if (size == 1) { mPolicySet.remove(setId); - String setlist = policySetSubStore.getString(PROP_POLICY_LIST, null); + String setlist = policySetSubStore.getString( + PROP_POLICY_LIST, null); StringTokenizer st1 = new StringTokenizer(setlist, ","); String newlist1 = ""; while (st1.hasMoreTokens()) { String e = st1.nextToken(); - if (!e.equals(setId)) + if (!e.equals(setId)) newlist1 = newlist1 + e + ","; } - if (!newlist1.equals("")) - newlist1 = newlist1.substring(0, newlist1.length() - 1); + if (!newlist1.equals("")) + newlist1 = newlist1.substring(0, + newlist1.length() - 1); policySetSubStore.putString(PROP_POLICY_LIST, newlist1); } break; } } - mConfig.putString("lastModified", - Long.toString(CMS.getCurrentDate().getTime())); + mConfig.putString("lastModified", + Long.toString(CMS.getCurrentDate().getTime())); mConfig.commit(false); } catch (Exception e) { } @@ -496,8 +495,8 @@ public abstract class BasicProfile implements IProfile { mInputs.remove(inputId); mConfig.putString("input." + PROP_INPUT_LIST, newlist); - mConfig.putString("lastModified", - Long.toString(CMS.getCurrentDate().getTime())); + mConfig.putString("lastModified", + Long.toString(CMS.getCurrentDate().getTime())); mConfig.commit(false); } catch (Exception e) { } @@ -537,24 +536,22 @@ public abstract class BasicProfile implements IProfile { mOutputs.remove(outputId); mConfig.putString("output." + PROP_OUTPUT_LIST, newlist); - mConfig.putString("lastModified", - Long.toString(CMS.getCurrentDate().getTime())); + mConfig.putString("lastModified", + Long.toString(CMS.getCurrentDate().getTime())); mConfig.commit(false); } catch (Exception e) { } } - public IProfileOutput createProfileOutput(String id, String outputId, - NameValuePairs nvps) - throws EProfileException { - return createProfileOutput(id, outputId, nvps, true); + public IProfileOutput createProfileOutput(String id, String outputId, + NameValuePairs nvps) throws EProfileException { + return createProfileOutput(id, outputId, nvps, true); } public IProfileOutput createProfileOutput(String id, String outputId, - NameValuePairs nvps, boolean createConfig) + NameValuePairs nvps, boolean createConfig) - - throws EProfileException { + throws EProfileException { IConfigStore outputStore = mConfig.getSubStore("output"); String output_list = null; @@ -576,8 +573,7 @@ public abstract class BasicProfile implements IProfile { IProfileOutput output = null; try { - output = (IProfileOutput) - Class.forName(outputClass).newInstance(); + output = (IProfileOutput) Class.forName(outputClass).newInstance(); } catch (Exception e) { // throw Exception CMS.debug(e.toString()); @@ -610,7 +606,8 @@ public abstract class BasicProfile implements IProfile { String pid = st1.nextToken(); if (pid.equals(id)) { - throw new EProfileException("Duplicate output id: " + id); + throw new EProfileException("Duplicate output id: " + + id); } } outputStore.putString(PROP_OUTPUT_LIST, list + "," + id); @@ -618,7 +615,7 @@ public abstract class BasicProfile implements IProfile { String prefix = id + "."; outputStore.putString(prefix + "name", - outputInfo.getName(Locale.getDefault())); + outputInfo.getName(Locale.getDefault())); outputStore.putString(prefix + "class_id", outputId); Enumeration enum1 = nvps.getNames(); @@ -626,19 +623,20 @@ public abstract class BasicProfile implements IProfile { while (enum1.hasMoreElements()) { String name = (String) enum1.nextElement(); - outputStore.putString(prefix + "params." + name, nvps.getValue(name)); + outputStore.putString(prefix + "params." + name, + nvps.getValue(name)); try { - if (output != null) { - output.setConfig(name, nvps.getValue(name)); - } + if (output != null) { + output.setConfig(name, nvps.getValue(name)); + } } catch (EBaseException e) { - CMS.debug(e.toString()); + CMS.debug(e.toString()); } } try { - mConfig.putString("lastModified", - Long.toString(CMS.getCurrentDate().getTime())); + mConfig.putString("lastModified", + Long.toString(CMS.getCurrentDate().getTime())); mConfig.commit(false); } catch (EBaseException e) { CMS.debug(e.toString()); @@ -648,15 +646,13 @@ public abstract class BasicProfile implements IProfile { return output; } - public IProfileInput createProfileInput(String id, String inputId, - NameValuePairs nvps) - throws EProfileException { - return createProfileInput(id, inputId, nvps, true); + public IProfileInput createProfileInput(String id, String inputId, + NameValuePairs nvps) throws EProfileException { + return createProfileInput(id, inputId, nvps, true); } public IProfileInput createProfileInput(String id, String inputId, - NameValuePairs nvps, boolean createConfig) - throws EProfileException { + NameValuePairs nvps, boolean createConfig) throws EProfileException { IConfigStore inputStore = mConfig.getSubStore("input"); String input_list = null; @@ -666,8 +662,8 @@ public abstract class BasicProfile implements IProfile { } catch (Exception ee) { } - IPluginInfo inputInfo = mRegistry.getPluginInfo("profileInput", - inputId); + IPluginInfo inputInfo = mRegistry + .getPluginInfo("profileInput", inputId); if (inputInfo == null) { CMS.debug("Cannot find " + inputId); @@ -679,8 +675,7 @@ public abstract class BasicProfile implements IProfile { IProfileInput input = null; try { - input = (IProfileInput) - Class.forName(inputClass).newInstance(); + input = (IProfileInput) Class.forName(inputClass).newInstance(); } catch (Exception e) { // throw Exception CMS.debug(e.toString()); @@ -720,28 +715,29 @@ public abstract class BasicProfile implements IProfile { } String prefix = id + "."; - inputStore.putString(prefix + "name", - inputInfo.getName(Locale.getDefault())); + inputStore.putString(prefix + "name", + inputInfo.getName(Locale.getDefault())); inputStore.putString(prefix + "class_id", inputId); - + Enumeration enum1 = nvps.getNames(); while (enum1.hasMoreElements()) { String name = (String) enum1.nextElement(); - inputStore.putString(prefix + "params." + name, nvps.getValue(name)); + inputStore.putString(prefix + "params." + name, + nvps.getValue(name)); try { - if (input != null) { - input.setConfig(name, nvps.getValue(name)); - } + if (input != null) { + input.setConfig(name, nvps.getValue(name)); + } } catch (EBaseException e) { - CMS.debug(e.toString()); + CMS.debug(e.toString()); } } try { - mConfig.putString("lastModified", - Long.toString(CMS.getCurrentDate().getTime())); + mConfig.putString("lastModified", + Long.toString(CMS.getCurrentDate().getTime())); mConfig.commit(false); } catch (EBaseException e) { CMS.debug(e.toString()); @@ -754,23 +750,25 @@ public abstract class BasicProfile implements IProfile { /** * Creates a profile policy */ - public IProfilePolicy createProfilePolicy(String setId, String id, - String defaultClassId, String constraintClassId) - throws EProfileException { - return createProfilePolicy(setId, id, defaultClassId, + public IProfilePolicy createProfilePolicy(String setId, String id, + String defaultClassId, String constraintClassId) + throws EProfileException { + return createProfilePolicy(setId, id, defaultClassId, constraintClassId, true); } - public IProfilePolicy createProfilePolicy(String setId, String id, - String defaultClassId, String constraintClassId, - boolean createConfig) - throws EProfileException { - + public IProfilePolicy createProfilePolicy(String setId, String id, + String defaultClassId, String constraintClassId, + boolean createConfig) throws EProfileException { + // String setId ex: policyset.set1 - // String id Id of policy : examples: p1,p2,p3 - // String defaultClassId : id of the default plugin ex: validityDefaultImpl - // String constraintClassId : if of the constraint plugin ex: basicConstraintsExtConstraintImpl - // boolean createConfig : true : being called from the console. false: being called from server startup code + // String id Id of policy : examples: p1,p2,p3 + // String defaultClassId : id of the default plugin ex: + // validityDefaultImpl + // String constraintClassId : if of the constraint plugin ex: + // basicConstraintsExtConstraintImpl + // boolean createConfig : true : being called from the console. false: + // being called from server startup code Vector policies = (Vector) mPolicySet.get(setId); @@ -778,9 +776,9 @@ public abstract class BasicProfile implements IProfile { if (policies == null) { policies = new Vector(); mPolicySet.put(setId, policies); - if (createConfig) { + if (createConfig) { // re-create policyset.list - StringBuffer setlist =new StringBuffer(); + StringBuffer setlist = new StringBuffer(); Enumeration keys = mPolicySet.keys(); while (keys.hasMoreElements()) { @@ -794,62 +792,64 @@ public abstract class BasicProfile implements IProfile { mConfig.putString("policyset.list", setlist.toString()); } } else { - String ids = null; + String ids = null; - try { - ids = policyStore.getString(PROP_POLICY_LIST, ""); - } catch (Exception ee) { - } + try { + ids = policyStore.getString(PROP_POLICY_LIST, ""); + } catch (Exception ee) { + } - if( ids == null ) { - CMS.debug("BasicProfile::createProfilePolicy() - ids is null!" ); - return null; - } + if (ids == null) { + CMS.debug("BasicProfile::createProfilePolicy() - ids is null!"); + return null; + } - StringTokenizer st1 = new StringTokenizer(ids, ","); - int appearances = 0; - int appearancesTooMany = 0; - if (createConfig) - appearancesTooMany = 1; - else - appearancesTooMany = 2; + StringTokenizer st1 = new StringTokenizer(ids, ","); + int appearances = 0; + int appearancesTooMany = 0; + if (createConfig) + appearancesTooMany = 1; + else + appearancesTooMany = 2; - while (st1.hasMoreTokens()) { - String pid = st1.nextToken(); - if (pid.equals(id)) { - appearances++; - if (appearances >= appearancesTooMany) { - CMS.debug("WARNING detected duplicate policy id: " + id + " Profile: " + mId); - if (createConfig) { - throw new EProfileException("Duplicate policy id: " + id); - } + while (st1.hasMoreTokens()) { + String pid = st1.nextToken(); + if (pid.equals(id)) { + appearances++; + if (appearances >= appearancesTooMany) { + CMS.debug("WARNING detected duplicate policy id: " + + id + " Profile: " + mId); + if (createConfig) { + throw new EProfileException("Duplicate policy id: " + + id); } } } + } } // Now make sure we aren't trying to add a policy that already exists IConfigStore policySetStore = mConfig.getSubStore("policyset"); - String setlist = null; + String setlist = null; try { setlist = policySetStore.getString("list", ""); } catch (Exception e) { } StringTokenizer st = new StringTokenizer(setlist, ","); - int matches = 0; + int matches = 0; while (st.hasMoreTokens()) { String sId = (String) st.nextToken(); - //Only search the setId set. Ex: encryptionCertSet + // Only search the setId set. Ex: encryptionCertSet if (!sId.equals(setId)) { continue; } IConfigStore pStore = policySetStore.getSubStore(sId); - + String list = null; try { - list = pStore.getString(PROP_POLICY_LIST, ""); + list = pStore.getString(PROP_POLICY_LIST, ""); } catch (Exception e) { CMS.debug("WARNING, can't get policy id list!"); } @@ -862,38 +862,48 @@ public abstract class BasicProfile implements IProfile { String defaultRoot = curId + "." + PROP_DEFAULT; String curDefaultClassId = null; try { - curDefaultClassId = pStore.getString(defaultRoot + "." + - PROP_CLASS_ID); - } catch(Exception e) { + curDefaultClassId = pStore.getString(defaultRoot + "." + + PROP_CLASS_ID); + } catch (Exception e) { CMS.debug("WARNING, can't get default plugin id!"); } String constraintRoot = curId + "." + PROP_CONSTRAINT; String curConstraintClassId = null; try { - curConstraintClassId = pStore.getString(constraintRoot + "." + PROP_CLASS_ID); + curConstraintClassId = pStore.getString(constraintRoot + + "." + PROP_CLASS_ID); } catch (Exception e) { CMS.debug("WARNING, can't get constraint plugin id!"); } - //Disallow duplicate defaults with the following exceptions: + // Disallow duplicate defaults with the following exceptions: // noDefaultImpl, genericExtDefaultImpl - if ((curDefaultClassId.equals(defaultClassId) && - !curDefaultClassId.equals(PROP_NO_DEFAULT) && - !curDefaultClassId.equals(PROP_GENERIC_EXT_DEFAULT)) ) { + if ((curDefaultClassId.equals(defaultClassId) + && !curDefaultClassId.equals(PROP_NO_DEFAULT) && !curDefaultClassId + .equals(PROP_GENERIC_EXT_DEFAULT))) { matches++; if (createConfig) { if (matches == 1) { - CMS.debug("WARNING attempt to add duplicate Policy " + defaultClassId + ":" + constraintClassId + - " Contact System Administrator."); - throw new EProfileException("Attempt to add duplicate Policy : " + defaultClassId + ":" + constraintClassId); + CMS.debug("WARNING attempt to add duplicate Policy " + + defaultClassId + + ":" + + constraintClassId + + " Contact System Administrator."); + throw new EProfileException( + "Attempt to add duplicate Policy : " + + defaultClassId + ":" + + constraintClassId); } } else { - if( matches > 1) { - CMS.debug("WARNING attempt to add duplicate Policy " + defaultClassId + ":" + constraintClassId + - " Contact System Administrator."); + if (matches > 1) { + CMS.debug("WARNING attempt to add duplicate Policy " + + defaultClassId + + ":" + + constraintClassId + + " Contact System Administrator."); } } } @@ -915,12 +925,11 @@ public abstract class BasicProfile implements IProfile { IPolicyDefault def = null; try { - def = (IPolicyDefault) - Class.forName(defaultClass).newInstance(); + def = (IPolicyDefault) Class.forName(defaultClass).newInstance(); } catch (Exception e) { // throw Exception - CMS.debug("BasicProfile: default policy " + - defaultClass + " " + e.toString()); + CMS.debug("BasicProfile: default policy " + defaultClass + " " + + e.toString()); } if (def == null) { CMS.debug("BasicProfile: failed to create " + defaultClass); @@ -931,18 +940,18 @@ public abstract class BasicProfile implements IProfile { def.init(this, defStore); } - IPluginInfo conInfo = mRegistry.getPluginInfo("constraintPolicy", + IPluginInfo conInfo = mRegistry.getPluginInfo("constraintPolicy", constraintClassId); String constraintClass = conInfo.getClassName(); IPolicyConstraint constraint = null; try { - constraint = (IPolicyConstraint) - Class.forName(constraintClass).newInstance(); + constraint = (IPolicyConstraint) Class.forName(constraintClass) + .newInstance(); } catch (Exception e) { // throw Exception - CMS.debug("BasicProfile: constraint policy " + - constraintClass + " " + e.toString()); + CMS.debug("BasicProfile: constraint policy " + constraintClass + + " " + e.toString()); } ProfilePolicy policy = null; if (constraint == null) { @@ -968,21 +977,20 @@ public abstract class BasicProfile implements IProfile { } else { policyStore.putString(PROP_POLICY_LIST, list + "," + id); } - policyStore.putString(id + ".default.name", - defInfo.getName(Locale.getDefault())); - policyStore.putString(id + ".default.class_id", - defaultClassId); - policyStore.putString(id + ".constraint.name", - conInfo.getName(Locale.getDefault())); - policyStore.putString(id + ".constraint.class_id", - constraintClassId); + policyStore.putString(id + ".default.name", + defInfo.getName(Locale.getDefault())); + policyStore.putString(id + ".default.class_id", defaultClassId); + policyStore.putString(id + ".constraint.name", + conInfo.getName(Locale.getDefault())); + policyStore.putString(id + ".constraint.class_id", + constraintClassId); try { - mConfig.putString("lastModified", - Long.toString(CMS.getCurrentDate().getTime())); + mConfig.putString("lastModified", + Long.toString(CMS.getCurrentDate().getTime())); policyStore.commit(false); } catch (EBaseException e) { - CMS.debug("BasicProfile: commiting config store " + - e.toString()); + CMS.debug("BasicProfile: commiting config store " + + e.toString()); } } @@ -1038,7 +1046,7 @@ public abstract class BasicProfile implements IProfile { * Creates request. */ public abstract IRequest[] createRequests(IProfileContext ctx, Locale locale) - throws EProfileException; + throws EProfileException; /** * Returns the profile description. @@ -1056,12 +1064,12 @@ public abstract class BasicProfile implements IProfile { } public void populateInput(IProfileContext ctx, IRequest request) - throws EProfileException { + throws EProfileException { Enumeration ids = getProfileInputIds(); while (ids.hasMoreElements()) { String id = (String) ids.nextElement(); - IProfileInput input = getProfileInput(id); + IProfileInput input = getProfileInput(id); input.populate(ctx, request); } @@ -1074,36 +1082,32 @@ public abstract class BasicProfile implements IProfile { } /** - * Passes the request to the set of default policies that - * populate the profile information against the profile. - */ - public void populate(IRequest request) - throws EProfileException { + * Passes the request to the set of default policies that populate the + * profile information against the profile. + */ + public void populate(IRequest request) throws EProfileException { String setId = getPolicySetId(request); Vector policies = getPolicies(setId); - CMS.debug("BasicProfile: populate() policy setid ="+ setId); + CMS.debug("BasicProfile: populate() policy setid =" + setId); for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) - policies.elementAt(i); + ProfilePolicy policy = (ProfilePolicy) policies.elementAt(i); policy.getDefault().populate(request); } } /** - * Passes the request to the set of constraint policies - * that validate the request against the profile. - */ - public void validate(IRequest request) - throws ERejectException { + * Passes the request to the set of constraint policies that validate the + * request against the profile. + */ + public void validate(IRequest request) throws ERejectException { String setId = getPolicySetId(request); - CMS.debug("BasicProfile: validate start on setId="+ setId); + CMS.debug("BasicProfile: validate start on setId=" + setId); Vector policies = getPolicies(setId); for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) - policies.elementAt(i); + ProfilePolicy policy = (ProfilePolicy) policies.elementAt(i); policy.getConstraint().validate(request); } @@ -1129,25 +1133,23 @@ public abstract class BasicProfile implements IProfile { Vector v = new Vector(); for (int i = 0; i < policies.size(); i++) { - ProfilePolicy policy = (ProfilePolicy) - policies.elementAt(i); + ProfilePolicy policy = (ProfilePolicy) policies.elementAt(i); - v.addElement(policy.getId()); + v.addElement(policy.getId()); } return v.elements(); } - public void execute(IRequest request) - throws EProfileException { + public void execute(IRequest request) throws EProfileException { } /** * Signed Audit Log - * - * This method is inherited by all extended "BasicProfile"s, - * and is called to store messages to the signed audit log. + * + * This method is inherited by all extended "BasicProfile"s, and is called + * to store messages to the signed audit log. * <P> - * + * * @param msg signed audit log message */ protected void audit(String msg) { @@ -1158,21 +1160,17 @@ public abstract class BasicProfile implements IProfile { return; } - mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT, - null, - ILogger.S_SIGNED_AUDIT, - ILogger.LL_SECURITY, - msg); + mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT, null, + ILogger.S_SIGNED_AUDIT, ILogger.LL_SECURITY, msg); } /** * Signed Audit Log Subject ID - * - * This method is inherited by all extended "BasicProfile"s, - * and is called to obtain the "SubjectID" for - * a signed audit log message. + * + * This method is inherited by all extended "BasicProfile"s, and is called + * to obtain the "SubjectID" for a signed audit log message. * <P> - * + * * @return id string containing the signed audit log message SubjectID */ protected String auditSubjectID() { @@ -1187,8 +1185,7 @@ public abstract class BasicProfile implements IProfile { SessionContext auditContext = SessionContext.getExistingContext(); if (auditContext != null) { - subjectID = (String) - auditContext.get(SessionContext.USER_ID); + subjectID = (String) auditContext.get(SessionContext.USER_ID); if (subjectID != null) { subjectID = subjectID.trim(); @@ -1202,4 +1199,3 @@ public abstract class BasicProfile implements IProfile { return subjectID; } } - |