diff options
Diffstat (limited to 'base/common/src/com/netscape/certsrv/profile')
17 files changed, 1766 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java b/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java new file mode 100644 index 000000000..5c192e9cd --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/CertInfoProfile.java @@ -0,0 +1,102 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.Vector; + +import netscape.security.x509.X509CertInfo; + +import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.base.IConfigStore; + +public class CertInfoProfile { + private Vector<ICertInfoPolicyDefault> mDefaults = new Vector<ICertInfoPolicyDefault>(); + private String mName = null; + private String mID = null; + private String mDescription = null; + private String mProfileIDMapping = null; + private String mProfileSetIDMapping = null; + + public CertInfoProfile(String cfg) throws Exception { + IConfigStore config = CMS.createFileConfigStore(cfg); + mID = config.getString("id"); + mName = config.getString("name"); + mDescription = config.getString("description"); + mProfileIDMapping = config.getString("profileIDMapping"); + mProfileSetIDMapping = config.getString("profileSetIDMapping"); + StringTokenizer st = new StringTokenizer(config.getString("list"), ","); + while (st.hasMoreTokens()) { + String id = (String) st.nextToken(); + String c = config.getString(id + ".default.class"); + try { + /* load defaults */ + ICertInfoPolicyDefault def = (ICertInfoPolicyDefault) + Class.forName(c).newInstance(); + init(config.getSubStore(id + ".default"), def); + mDefaults.addElement(def); + } catch (Exception e) { + CMS.debug("CertInfoProfile: " + e.toString()); + } + } + } + + private void init(IConfigStore config, ICertInfoPolicyDefault def) + throws Exception { + try { + def.init(null, config); + } catch (Exception e) { + CMS.debug("CertInfoProfile.init: " + e.toString()); + } + } + + public String getID() { + return mID; + } + + public String getName() { + return mName; + } + + public String getDescription() { + return mDescription; + } + + public String getProfileIDMapping() { + return mProfileIDMapping; + } + + public String getProfileSetIDMapping() { + return mProfileSetIDMapping; + } + + public void populate(X509CertInfo info) { + Enumeration<ICertInfoPolicyDefault> e1 = mDefaults.elements(); + while (e1.hasMoreElements()) { + ICertInfoPolicyDefault def = + (ICertInfoPolicyDefault) e1.nextElement(); + try { + def.populate(null /* request */, info); + } catch (Exception e) { + CMS.debug(e); + CMS.debug("CertInfoProfile.populate: " + e.toString()); + } + } + } +} diff --git a/base/common/src/com/netscape/certsrv/profile/EDeferException.java b/base/common/src/com/netscape/certsrv/profile/EDeferException.java new file mode 100644 index 000000000..c92630b97 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/EDeferException.java @@ -0,0 +1,48 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +/** + * This represents a profile specific exception. The + * framework raises this exception when a request is + * deferred. + * <p> + * A deferred request will not be processed immediately. Manual approval is required for processing the request again. + * <p> + * + * @version $Revision$, $Date$ + */ +public class EDeferException extends EProfileException { + + /** + * + */ + private static final long serialVersionUID = -8267140233153746034L; + + /** + * Creates a defer exception. + * + * @param msg localized message that will be + * displayed to end user. This message + * should indicate the reason why a request + * is deferred. + */ + public EDeferException(String msg) { + super(msg); + } +} diff --git a/base/common/src/com/netscape/certsrv/profile/EProfileException.java b/base/common/src/com/netscape/certsrv/profile/EProfileException.java new file mode 100644 index 000000000..37f968a67 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/EProfileException.java @@ -0,0 +1,47 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import com.netscape.certsrv.base.EBaseException; + +/** + * This represents a generic profile exception. + * <p> + * This is the base class for all profile-specific exception. + * <p> + * + * @version $Revision$, $Date$ + */ +public class EProfileException extends EBaseException { + + /** + * + */ + private static final long serialVersionUID = -4259647804183018757L; + + /** + * Creates a profile exception. + * + * @param msg additional message for the handler + * of the exception. The message may + * or may not be localized. + */ + public EProfileException(String msg) { + super(msg); + } +} diff --git a/base/common/src/com/netscape/certsrv/profile/ERejectException.java b/base/common/src/com/netscape/certsrv/profile/ERejectException.java new file mode 100644 index 000000000..59b35bcdb --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/ERejectException.java @@ -0,0 +1,46 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +/** + * This represents a profile specific exception. This + * exception is raised when a request is rejected. + * <p> + * A rejected request cannot be reprocessed. Rejected request is considered as a request in its terminal state. + * <p> + * + * @version $Revision$, $Date$ + */ +public class ERejectException extends EProfileException { + + /** + * + */ + private static final long serialVersionUID = -542393641391361342L; + + /** + * Creates a rejection exception. + * + * @param msg localized message that indicates + * the reason why a request is + * rejected. + */ + public ERejectException(String msg) { + super(msg); + } +} diff --git a/base/common/src/com/netscape/certsrv/profile/ICertInfoPolicyDefault.java b/base/common/src/com/netscape/certsrv/profile/ICertInfoPolicyDefault.java new file mode 100644 index 000000000..698791296 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/ICertInfoPolicyDefault.java @@ -0,0 +1,32 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import netscape.security.x509.X509CertInfo; + +import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.request.IRequest; + +public interface ICertInfoPolicyDefault extends IPolicyDefault { + + /** + * Populates certificate info directly. + */ + public void populate(IRequest request, X509CertInfo info) + throws EBaseException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IEnrollProfile.java b/base/common/src/com/netscape/certsrv/profile/IEnrollProfile.java new file mode 100644 index 000000000..189530f7a --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IEnrollProfile.java @@ -0,0 +1,157 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import com.netscape.certsrv.request.IRequest; + +/** + * This interface represents an enrollment profile. + * <p> + * An enrollment profile contains a list of enrollment specific input plugins, default policies, constriant policies and + * output plugins. + * <p> + * This interface also defines a set of enrollment specific attribute names that can be used to retrieve values from an + * enrollment request. + * <p> + * + * @version $Revision$, $Date$ + */ +public interface IEnrollProfile extends IProfile { + + /** + * Name of request attribute that stores the User + * Supplied Certificate Request Type. + */ + public static final String CTX_CERT_REQUEST_TYPE = "cert_request_type"; + + /** + * Name of request attribute that stores the User + * Supplied Certificate Request. + */ + public static final String CTX_CERT_REQUEST = "cert_request"; + + /** + * Possible values for CTX_CERT_REQUEST_TYPE attribute. + */ + public static final String REQ_TYPE_PKCS10 = "pkcs10"; + public static final String REQ_TYPE_CRMF = "crmf"; + public static final String REQ_TYPE_CMC = "cmc"; + public static final String REQ_TYPE_KEYGEN = "keygen"; + + /** + * Name of request attribute that stores the End-User Locale. + * <p> + * The value is of type java.util.Locale. + */ + public static final String REQUEST_LOCALE = "req_locale"; + + /** + * Name of request attribute that stores the sequence number. Consider + * a CRMF request that may contain multiple certificate request. + * The first sub certificate certificate request has a sequence + * number of 0, the next one has a sequence of 1, and so on. + * <p> + * The value is of type java.lang.Integer. + */ + public static final String REQUEST_SEQ_NUM = "req_seq_num"; + + /** + * Name of the request attribute that stores the sequence number for a + * renewal request. Only one request at a time is permitted for a renewal. + * This value corresponds to the sequence number (and hence the appropriate + * certificate) of the original request + */ + public static final String CTX_RENEWAL_SEQ_NUM = "renewal_seq_num"; + + /** + * Name of request attribute to indicate if this is a renewal + */ + public static final String CTX_RENEWAL = "renewal"; + + /** + * Name of request attribute that stores the End-User Supplied + * Key. + * <p> + * The value is of type netscape.security.x509.CertificateX509Key + */ + public static final String REQUEST_KEY = "req_key"; + + /** + * Name of request attribute that stores the End-User Supplied + * Subject Name. + * <p> + * The value is of type netscape.security.x509.CertificateSubjectName + */ + public static final String REQUEST_SUBJECT_NAME = "req_subject_name"; + + /** + * Name of request attribute that stores the End-User Supplied + * Validity. + * <p> + * The value is of type netscape.security.x509.CertificateValidity + */ + public static final String REQUEST_VALIDITY = "req_validity"; + + /** + * Name of request attribute that stores the End-User Supplied + * Signing Algorithm. + * <p> + * The value is of type netscape.security.x509.CertificateAlgorithmId + */ + public static final String REQUEST_SIGNING_ALGORITHM = "req_signing_alg"; + + /** + * Name of request attribute that stores the End-User Supplied + * Extensions. + * <p> + * The value is of type netscape.security.x509.CertificateExtensions + */ + public static final String REQUEST_EXTENSIONS = "req_extensions"; + + /** + * Name of request attribute that stores the End-User Supplied + * PKI Archive Option extension. This extension is extracted + * from a CRMF request that has the user-provided private key. + * <p> + * The value is of type byte [] + */ + public static final String REQUEST_ARCHIVE_OPTIONS = "req_archive_options"; + + /** + * Name of request attribute that stores the certificate template + * that will be signed and then become a certificate. + * <p> + * The value is of type netscape.security.x509.X509CertInfo + */ + public static final String REQUEST_CERTINFO = "req_x509info"; + + /** + * Name of request attribute that stores the issued certificate. + * <p> + * The value is of type netscape.security.x509.X509CertImpl + */ + public static final String REQUEST_ISSUED_CERT = "req_issued_cert"; + + /** + * Set Default X509CertInfo in the request. + * + * @param request profile-based certificate request. + * @exception EProfileException failed to set the X509CertInfo. + */ + public void setDefaultCertInfo(IRequest request) throws EProfileException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IPolicyConstraint.java b/base/common/src/com/netscape/certsrv/profile/IPolicyConstraint.java new file mode 100644 index 000000000..bf2374652 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IPolicyConstraint.java @@ -0,0 +1,89 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Locale; + +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.property.IConfigTemplate; +import com.netscape.certsrv.request.IRequest; + +/** + * This represents a constraint policy. A constraint policy + * validates if the given request conforms to the set + * rules. + * <p> + * + * @version $Revision$, $Date$ + */ +public interface IPolicyConstraint extends IConfigTemplate { + + /** + * Initializes this constraint policy. + * + * @param profile owner of this policy + * @param config configuration store for this constraint + * @exception EProfileException failed to initialize + */ + public void init(IProfile profile, IConfigStore config) + throws EProfileException; + + /** + * Returns the corresponding configuration store + * of this constraint policy. + * + * @return config store of this constraint + */ + public IConfigStore getConfigStore(); + + /** + * Validates the request. The request is not modified + * during the validation. + * + * @param request request to be validated + * @exception ERejectException reject the given request + */ + public void validate(IRequest request) + throws ERejectException; + + /** + * Returns localized description of this constraint. + * + * @param locale locale of the end-user + * @return localized description of this constraint + */ + public String getText(Locale locale); + + /** + * Returns localized name of this constraint. + * + * @param locale locale of the end-user + * @return localized name of this constraint + */ + public String getName(Locale locale); + + /** + * Checks if this constraint is applicable to the + * given default policy. + * + * @param def default policy to be checked + * @return true if this constraint can be applied to + * the given default policy + */ + public boolean isApplicable(IPolicyDefault def); +} diff --git a/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java b/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java new file mode 100644 index 000000000..469d6dded --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IPolicyDefault.java @@ -0,0 +1,136 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; +import java.util.Locale; + +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.property.EPropertyException; +import com.netscape.certsrv.property.IConfigTemplate; +import com.netscape.certsrv.property.IDescriptor; +import com.netscape.certsrv.request.IRequest; + +/** + * This represents a default policy that populates + * the request with additional values. + * <p> + * + * During request submission process, a default policy is invoked to populate the default values in the request. The + * default values will later on be used for execution. The default values are like the parameters for the request. + * <p> + * + * This policy is called in 2 places. For automated enrollment request, this policy is invoked to populate the HTTP + * parameters into the request. For request that cannot be executed immediately, this policy will be invoked again right + * after the agent's approval. + * <p> + * + * Each default policy may contain zero or more properties that describe the default value. For example, a X509 Key can + * be described by its key type, key length, and key data. The properties help to describe the default value into human + * readable values. + * <p> + * + * @version $Revision$, $Date$ + */ +public interface IPolicyDefault extends IConfigTemplate { + + /** + * Initializes this default policy. + * + * @param profile owner of this default policy + * @param config configuration store for this default + * @exception EProfileException failed to initialize + */ + public void init(IProfile profile, IConfigStore config) + throws EProfileException; + + /** + * Retrieves the configuration store of this default. + * + * @return configuration store of this default policy + */ + public IConfigStore getConfigStore(); + + /** + * Populates the request with this policy default. + * + * @param request request to be populated + * @exception EProfileException failed to populate + */ + public void populate(IRequest request) + throws EProfileException; + + /** + * Retrieves the localizable name of this policy. + * + * @param locale locale of the end user + * @return localized name of this default policy + */ + public String getName(Locale locale); + + /** + * Retrieves the localizable description of this policy. + * + * @param locale locale of the end user + * @return localized description of this default policy + */ + public String getText(Locale locale); + + /** + * Retrieves a list of names of the property. + * + * @return a list of property names. The values are + * of type java.lang.String + */ + public Enumeration<String> getValueNames(); + + /** + * Retrieves the descriptor of the given property + * by name. The descriptor contains syntax + * information. + * + * @param locale locale of the end user + * @param name name of property + * @return descriptor of the property + */ + public IDescriptor getValueDescriptor(Locale locale, String name); + + /** + * Sets the value of the given value property by name. + * + * @param name name of property + * @param locale locale of the end user + * @param request request + * @param value value to be set in the given request + * @exception EPropertyException failed to set property + */ + public void setValue(String name, Locale locale, IRequest request, + String value) throws EPropertyException; + + /** + * Retrieves the value of the given value + * property by name. + * + * @param name name of property + * @param locale locale of the end user + * @param request request + * @exception EPropertyException failed to get property + */ + public String getValue(String name, Locale locale, IRequest request) + throws EPropertyException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfile.java b/base/common/src/com/netscape/certsrv/profile/IProfile.java new file mode 100644 index 000000000..0cd39c091 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfile.java @@ -0,0 +1,408 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; +import java.util.Locale; + +import com.netscape.certsrv.authentication.IAuthToken; +import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.common.NameValuePairs; +import com.netscape.certsrv.request.IRequest; +import com.netscape.certsrv.request.IRequestQueue; +import com.netscape.cms.profile.common.ProfilePolicy; + +/** + * This interface represents a profile. A profile contains + * a list of input policies, default policies, constraint + * policies and output policies. + * <p> + * + * The input policy is for building the enrollment page. + * <p> + * + * The default policy is for populating user-supplied and system-supplied values into the request. + * <p> + * + * The constraint policy is for validating the request before processing. + * <p> + * + * The output policy is for building the result page. + * <p> + * + * Each profile can have multiple policy set. Each set is composed of zero or more default policies and zero or more + * constraint policies. + * <p> + * + * @version $Revision$, $Date$ + */ +public interface IProfile { + + /** + * Initializes this profile. + * + * @param owner profile subsystem + * @param config configuration store for this profile + * @exception EBaseException failed to initialize + */ + public void init(IProfileSubsystem owner, IConfigStore config) + throws EBaseException; + + /** + * Retrieves the request queue that is associated with + * this profile. The request queue is for creating + * new requests. + * + * @return request queue + */ + public IRequestQueue getRequestQueue(); + + /** + * Sets id of this profile. + * + * @param id profile identifier + */ + public void setId(String id); + + /** + * Returns the identifier of this profile. + * + * @return profile id + */ + public String getId(); + + /** + * Retrieves a localized string that represents + * requestor's distinguished name. This string + * displayed in the request listing user interface. + * + * @param request request + * @return distringuished name of the request owner + */ + public String getRequestorDN(IRequest request); + + /** + * Retrieves the configuration store of this profile. + * + * @return configuration store + */ + public IConfigStore getConfigStore(); + + /** + * Retrieves the instance id of the authenticator for this profile. + * + * @return authenticator instance id + */ + public String getAuthenticatorId(); + + public String getAuthzAcl(); + + /** + * Sets the instance id of the authenticator for this profile. + * + * @param id authenticator instance id + */ + public void setAuthenticatorId(String id); + + /** + * Retrieves the associated authenticator instance. + * + * @return profile authenticator instance. + * if no associated authenticator, null is returned + * @exception EProfileException failed to retrieve + */ + public IProfileAuthenticator getAuthenticator() + throws EProfileException; + + /** + * Retrieves a list of input policy IDs. + * + * @return input policy id list + */ + public Enumeration<String> getProfileInputIds(); + + /** + * Retrieves input policy by id. + * + * @param id input policy id + * @return input policy instance + */ + public IProfileInput getProfileInput(String id); + + /** + * Retrieves a list of output policy IDs. + * + * @return output policy id list + */ + public Enumeration<String> getProfileOutputIds(); + + /** + * Retrieves output policy by id. + * + * @param id output policy id + * @return output policy instance + */ + public IProfileOutput getProfileOutput(String id); + + /** + * Checks if this profile is end-user profile or not. + * End-user profile will be displayed to the end user. + * Non end-user profile mainly is for registration + * manager. + * + * @return end-user profile or not + */ + public boolean isVisible(); + + /** + * Sets this profile end-user profile or not. + * + * @param v end-user profile or not + */ + public void setVisible(boolean v); + + /** + * Retrieves the user id of the person who + * approves this profile. + * + * @return user id of the approver of this profile + */ + public String getApprovedBy(); + + /* + * Is this a renewal profile + */ + public String isRenewal(); + + /* + * is output going to be in xml? + */ + public String isXmlOutput(); + + /** + * Returns the profile name. + * + * @param locale end-user locale + * @param name profile name + */ + public void setName(Locale locale, String name); + + /** + * Retrieves the profile name. + * + * @param locale end-user locale + * @return localized profile name + */ + public String getName(Locale locale); + + /** + * Returns the profile description. + * + * @param locale end-user locale + * @param desc profile description + */ + public void setDescription(Locale locale, String desc); + + /** + * Retrieves the profile description. + * + * @param locale end-user locale + * @return localized profile description + */ + public String getDescription(Locale locale); + + /** + * Retrieves profile context. The context stores + * information about the requestor before the + * actual request is created. + * + * @return profile context. + */ + public IProfileContext createContext(); + + /** + * Returns the profile policy set identifiers. + * + * @return a list of policy set id + */ + public Enumeration<String> getProfilePolicySetIds(); + + /** + * Creates a profile policy. + * + * @param setId id of the policy set that owns this policy + * @param id policy id + * @param defaultClassId id of the registered default implementation + * @param constraintClassId id of the registered constraint implementation + * @exception EProfileException failed to create policy + * @return profile policy instance + */ + public IProfilePolicy createProfilePolicy(String setId, String id, + String defaultClassId, String constraintClassId) + throws EProfileException; + + /** + * Deletes input policy by id. + * + * @param inputId id of the input policy + * @exception EProfileException failed to delete + */ + public void deleteProfileInput(String inputId) throws EProfileException; + + /** + * Deletes output policy by id. + * + * @param outputId id of the output policy + * @exception EProfileException failed to delete + */ + public void deleteProfileOutput(String outputId) throws EProfileException; + + /** + * Creates a input policy. + * + * @param id input policy id + * @param inputClassId id of the registered input implementation + * @param nvp default parameters + * @return input policy + * @exception EProfileException failed to create + */ + public IProfileInput createProfileInput(String id, String inputClassId, + NameValuePairs nvp) + throws EProfileException; + + /** + * Creates a output policy. + * + * @param id output policy id + * @param outputClassId id of the registered output implementation + * @param nvp default parameters + * @return output policy + * @exception EProfileException failed to create + */ + public IProfileOutput createProfileOutput(String id, String outputClassId, + NameValuePairs nvp) throws EProfileException; + + /** + * Deletes a policy. + * + * @param setId id of the policy set + * @param policyId id of policy to delete + * @exception EProfileException failed to delete + */ + public void deleteProfilePolicy(String setId, String policyId) + throws EProfileException; + + /** + * Retrieves a policy. + * + * @param setId set id + * @param id policy id + * @return profile policy + */ + public IProfilePolicy getProfilePolicy(String setId, String id); + + /** + * Retrieves all the policy id within a set. + * + * @param setId set id + * @return a list of policy id + */ + public Enumeration<String> getProfilePolicyIds(String setId); + + /** + * Retrieves a default set id for the given request. + * It is the profile's responsibility to return + * an appropriate set id for the request. + * + * @param req request + * @return policy set id + */ + public String getPolicySetId(IRequest req); + + /** + * Returns a list of profile policies. + * + * @param setId set id + * @return a list of policies + */ + public Enumeration<ProfilePolicy> getProfilePolicies(String setId); + + /** + * Creates one or more requests. Normally, only one request will + * be created. In case of CRMF request, multiple requests may be + * created for one submission. + * + * @param ctx profile context + * @param locale user locale + * @return a list of requests + * @exception EProfileException failed to create requests + */ + public IRequest[] createRequests(IProfileContext ctx, Locale locale) + throws EProfileException; + + /** + * Populates user-supplied input values into the requests. + * + * @param ctx profile context + * @param request request + * @exception EProfileException failed to populate + */ + public void populateInput(IProfileContext ctx, IRequest request) + throws EProfileException; + + /** + * Passes the request to the set of default policies that + * populate the profile information against the profile. + * + * @param request request + * @exception EProfileException failed to populate default values + */ + public void populate(IRequest request) + throws EProfileException; + + /** + * Passes the request to the set of constraint policies + * that validate the request against the profile. + * + * @param request request + * @exception ERejectException validation violation + */ + public void validate(IRequest request) + throws ERejectException; + + /** + * Process a request after validation. + * + * @param request request to be processed + * @exception EProfileException failed to process + */ + public void execute(IRequest request) + throws EProfileException; + + /** + * Handles end-user request submission. + * + * @param token authentication token + * @param request request to be processed + * @exception EDeferException defer request + * @exception EProfileException failed to submit + */ + public void submit(IAuthToken token, IRequest request) + throws EDeferException, EProfileException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java b/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java new file mode 100644 index 000000000..98546c601 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileAuthenticator.java @@ -0,0 +1,120 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; +import java.util.Locale; + +import com.netscape.certsrv.authentication.IAuthManager; +import com.netscape.certsrv.authentication.IAuthToken; +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.property.IDescriptor; +import com.netscape.certsrv.request.IRequest; + +/** + * This interface represents an authenticator for profile. + * An authenticator is responsibile for authenting + * the end-user. If authentication is successful, request + * can be processed immediately. Otherwise, the request will + * be defered and manual approval is then required. + * + * @version $Revision$, $Date$ + */ +public interface IProfileAuthenticator extends IAuthManager { + + public static final String AUTHENTICATED_NAME = "authenticatedName"; + + /** + * Initializes this default policy. + * + * @param profile owner of this authenticator + * @param config configuration store + * @exception EProfileException failed to initialize + */ + public void init(IProfile profile, IConfigStore config) + throws EProfileException; + + /** + * Retrieves the configuration store. + * + * @return configuration store + */ + public IConfigStore getConfigStore(); + + /** + * Populates authentication specific information into the + * request for auditing purposes. + * + * @param token authentication token + * @param request request + * @exception EProfileException failed to populate + */ + public void populate(IAuthToken token, IRequest request) + throws EProfileException; + + /** + * Retrieves the localizable name of this policy. + * + * @param locale end user locale + * @return localized authenticator name + */ + public String getName(Locale locale); + + /** + * Retrieves the localizable description of this policy. + * + * @param locale end user locale + * @return localized authenticator description + */ + public String getText(Locale locale); + + /** + * Retrieves a list of names of the property. + * + * @return a list of property names + */ + public Enumeration<String> getValueNames(); + + /** + * Checks if the value of the given property should be + * serializable into the request. Passsword or other + * security-related value may not be desirable for + * storage. + * + * @param name property name + * @return true if the property is not security related + */ + public boolean isValueWriteable(String name); + + /** + * Retrieves the descriptor of the given value + * property by name. + * + * @param locale user locale + * @param name property name + * @return descriptor of the requested property + */ + public IDescriptor getValueDescriptor(Locale locale, String name); + + /** + * Checks if this authenticator requires SSL client authentication. + * + * @return client authentication required or not + */ + public boolean isSSLClientRequired(); +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileContext.java b/base/common/src/com/netscape/certsrv/profile/IProfileContext.java new file mode 100644 index 000000000..b3c27d040 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileContext.java @@ -0,0 +1,44 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +/** + * This interface represents a profile context which + * stores system-wide and user-provided information for + * assisting request creation. + * + * @version $Revision$, $Date$ + */ +public interface IProfileContext { + + /** + * Sets a value into the context. + * + * @param name property name + * @param value property value + */ + public void set(String name, String value); + + /** + * Retrieves a value from the context. + * + * @param name property name + * @return property value + */ + public String get(String name); +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileEx.java b/base/common/src/com/netscape/certsrv/profile/IProfileEx.java new file mode 100644 index 000000000..79e4f4175 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileEx.java @@ -0,0 +1,36 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import com.netscape.certsrv.base.EBaseException; + +/** + * This interface represents the extension version of + * profile. + * <p> + * + * @version $Revision$, $Date$ + */ +public interface IProfileEx extends IProfile { + + /** + * Called after initialization. It populates default + * policies, inputs, and outputs. + */ + public void populate() throws EBaseException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileInput.java b/base/common/src/com/netscape/certsrv/profile/IProfileInput.java new file mode 100644 index 000000000..4ef598698 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileInput.java @@ -0,0 +1,120 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; +import java.util.Locale; + +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.property.EPropertyException; +import com.netscape.certsrv.property.IConfigTemplate; +import com.netscape.certsrv.property.IDescriptor; +import com.netscape.certsrv.request.IRequest; + +/** + * This interface represents a input policy which + * provides information on how to create the + * end-user enrollment page. + * + * @version $Revision$, $Date$ + */ +public interface IProfileInput extends IConfigTemplate { + + /** + * Initializes this default policy. + * + * @param profile owner of this input + * @param config configuration store + * @exception EProfileException failed to initialize + */ + public void init(IProfile profile, IConfigStore config) + throws EProfileException; + + /** + * Returns configuration store. + * + * @return configuration store + */ + public IConfigStore getConfigStore(); + + /** + * Populates the request with this policy default. + * + * @param ctx profile context + * @param request request + * @exception EProfileException failed to populate + */ + public void populate(IProfileContext ctx, IRequest request) + throws EProfileException; + + /** + * Retrieves the localizable name of this policy. + * + * @param locale user locale + * @return localized input name + */ + public String getName(Locale locale); + + /** + * Retrieves the localizable description of this policy. + * + * @param locale user locale + * @return localized input description + */ + public String getText(Locale locale); + + /** + * Retrieves a list of names of the property. + * + * @return a list of property names + */ + public Enumeration<String> getValueNames(); + + /** + * Retrieves the descriptor of the given value + * property by name. + * + * @param locale user locale + * @param name property name + * @return descriptor of the property + */ + public IDescriptor getValueDescriptor(Locale locale, String name); + + /** + * Retrieves value from the request. + * + * @param name property name + * @param locale user locale + * @param request request + * @exception EProfileException failed to get value + */ + public String getValue(String name, Locale locale, IRequest request) + throws EProfileException; + + /** + * Sets the value of the given property by name. + * + * @param name property name + * @param locale user locale + * @param request request + * @param value value + * @exception EProfileException failed to get value + */ + public void setValue(String name, Locale locale, IRequest request, + String value) throws EPropertyException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java b/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java new file mode 100644 index 000000000..b60e4475b --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileOutput.java @@ -0,0 +1,121 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; +import java.util.Locale; + +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.property.EPropertyException; +import com.netscape.certsrv.property.IConfigTemplate; +import com.netscape.certsrv.property.IDescriptor; +import com.netscape.certsrv.request.IRequest; + +/** + * This interface represents a output policy which + * provides information on how to build the result + * page for the enrollment. + * + * @version $Revision$, $Date$ + */ +public interface IProfileOutput extends IConfigTemplate { + + /** + * Initializes this default policy. + * + * @param profile owner of this policy + * @param config configuration store + * @exception EProfileException failed to initialize + */ + public void init(IProfile profile, IConfigStore config) + throws EProfileException; + + /** + * Retrieves configuration store. + * + * @return configuration store + */ + public IConfigStore getConfigStore(); + + /** + * Populates the request with this policy default. + * + * @param ctx profile context + * @param request request + * @exception EProfileException failed to populate + */ + public void populate(IProfileContext ctx, IRequest request) + throws EProfileException; + + /** + * Retrieves the localizable name of this policy. + * + * @param locale user locale + * @return output policy name + */ + public String getName(Locale locale); + + /** + * Retrieves the localizable description of this policy. + * + * @param locale user locale + * @return output policy description + */ + public String getText(Locale locale); + + /** + * Retrieves a list of names of the value parameter. + * + * @return a list of property names + */ + public Enumeration<String> getValueNames(); + + /** + * Retrieves the descriptor of the given value + * parameter by name. + * + * @param locale user locale + * @param name property name + * @return property descriptor + */ + public IDescriptor getValueDescriptor(Locale locale, String name); + + /** + * Retrieves the value of the given value parameter by name. + * + * @param name property name + * @param locale user locale + * @param request request + * @return property value + * @exception EProfileException failed to retrieve value + */ + public String getValue(String name, Locale locale, IRequest request) + throws EProfileException; + + /** + * Sets the value of the given value parameter by name. + * + * @param name property name + * @param locale user locale + * @param request request + * @param value property value + * @exception EProfileException failed to retrieve value + */ + public void setValue(String name, Locale locale, IRequest request, + String value) throws EPropertyException; +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfilePolicy.java b/base/common/src/com/netscape/certsrv/profile/IProfilePolicy.java new file mode 100644 index 000000000..d231f8d55 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfilePolicy.java @@ -0,0 +1,49 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +/** + * This interface represents a profile policy + * which consists a default policy and a + * constraint policy. + * + * @version $Revision$, $Date$ + */ +public interface IProfilePolicy { + + /** + * Retrieves the policy id + * + * @return policy id + */ + public String getId(); + + /** + * Retrieves the default policy. + * + * @return default policy + */ + public IPolicyDefault getDefault(); + + /** + * Retrieves the constraint policy. + * + * @return constraint policy + */ + public IPolicyConstraint getConstraint(); +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java b/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java new file mode 100644 index 000000000..b7a68445b --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileSubsystem.java @@ -0,0 +1,134 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Enumeration; + +import com.netscape.certsrv.base.ISubsystem; + +/** + * This represents the profile subsystem that manages + * a list of profiles. + * + * @version $Revision$, $Date$ + */ +public interface IProfileSubsystem extends ISubsystem { + public static final String ID = "profile"; + + /** + * Retrieves a profile by id. + * + * @return profile + * @exception EProfileException failed to retrieve + */ + public IProfile getProfile(String id) + throws EProfileException; + + /** + * Checks if a profile is approved by an agent or not. + * + * @param id profile id + * @return true if profile is approved + */ + public boolean isProfileEnable(String id); + + /** + * Retrieves the approver of the given profile. + * + * @param id profile id + * @return user id of the agent who has approved the profile + */ + public String getProfileEnableBy(String id); + + /** + * Creates new profile. + * + * @param id profile id + * @param classid implementation id + * @param className class Name + * @param configFile configuration file + * @exception EProfileException failed to create profile + */ + public IProfile createProfile(String id, String classid, + String className, String configFile) + throws EProfileException; + + /** + * Deletes profile. + * + * @param id profile id + * @param configFile configuration file + * @exception EProfileException failed to delete profile + */ + public void deleteProfile(String id, String configFile) + throws EProfileException; + + /** + * Creates a new profile configuration file. + * + * @param id profile id + * @param classId implementation id + * @param configPath location to create the configuration file + * @exception failed to create profile + */ + public void createProfileConfig(String id, String classId, + String configPath) throws EProfileException; + + /** + * Enables a profile. + * + * @param id profile id + * @param enableBy agent's user id + * @exception EProfileException failed to enable profile + */ + public void enableProfile(String id, String enableBy) + throws EProfileException; + + /** + * Disables a profile. + * + * @param id profile id + * @exception EProfileException failed to disable + */ + public void disableProfile(String id) + throws EProfileException; + + /** + * Retrieves the id of the implementation of the given profile. + * + * @param id profile id + * @return implementation id managed by the registry + */ + public String getProfileClassId(String id); + + /** + * Retrieves a list of profile ids. The return + * list is of type String. + * + * @return a list of profile ids + */ + public Enumeration<String> getProfileIds(); + + /** + * Checks if owner id should be enforced during profile approval. + * + * @return true if approval should be checked + */ + public boolean checkOwner(); + +} diff --git a/base/common/src/com/netscape/certsrv/profile/IProfileUpdater.java b/base/common/src/com/netscape/certsrv/profile/IProfileUpdater.java new file mode 100644 index 000000000..3749cd1d2 --- /dev/null +++ b/base/common/src/com/netscape/certsrv/profile/IProfileUpdater.java @@ -0,0 +1,77 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.profile; + +import java.util.Locale; + +import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.property.IConfigTemplate; +import com.netscape.certsrv.request.IRequest; +import com.netscape.certsrv.request.RequestStatus; + +/** + * This interface represents an updater that will be + * called when the request's state changes. + * + * @version $Revision$, $Date$ + */ +public interface IProfileUpdater extends IConfigTemplate { + + /** + * Initializes this default policy. + * + * @param profile owner of this policy + * @param config configuration store + * @exception EProfileException failed to initialize + */ + public void init(IProfile profile, IConfigStore config) + throws EProfileException; + + /** + * Retrieves configuration store. + * + * @return configuration store + */ + public IConfigStore getConfigStore(); + + /** + * Notifies of state change. + * + * @param req request + * @param status The status to check for. + * @exception EProfileException failed to populate + */ + public void update(IRequest req, RequestStatus status) + throws EProfileException; + + /** + * Retrieves the localizable name of this policy. + * + * @param locale user locale + * @return output policy name + */ + public String getName(Locale locale); + + /** + * Retrieves the localizable description of this policy. + * + * @param locale user locale + * @return output policy description + */ + public String getText(Locale locale); +} |