From do-not-reply at jboss.org Fri Feb 10 09:43:15 2012
Content-Type: multipart/mixed; boundary="===============6686231119877020407=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: gatein-commits at lists.jboss.org
Subject: [gatein-commits] gatein SVN: r8419 - in portal/trunk:
docs/reference-guide/en-US/modules/Configuration and 1 other directories.
Date: Fri, 10 Feb 2012 09:43:15 -0500
Message-ID: <201202101443.q1AEhFwj005500@svn01.web.mwc.hst.phx2.redhat.com>
--===============6686231119877020407==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: chris.laprun(a)jboss.com
Date: 2012-02-10 09:43:12 -0500 (Fri, 10 Feb 2012)
New Revision: 8419
Added:
portal/trunk/docs/reference-guide/en-US/modules/Configuration/ValidatorC=
onfiguration.xml
Modified:
portal/trunk/docs/reference-guide/en-US/modules/Configuration.xml
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validat=
or/UserConfigurableValidator.java
Log:
- GTNPORTAL-1673: Added documentation.
Added: portal/trunk/docs/reference-guide/en-US/modules/Configuration/Valida=
torConfiguration.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/docs/reference-guide/en-US/modules/Configuration/Validator=
Configuration.xml (rev 0)
+++ portal/trunk/docs/reference-guide/en-US/modules/Configuration/Validator=
Configuration.xml 2012-02-10 14:43:12 UTC (rev 8419)
@@ -0,0 +1,164 @@
+
+
+ %BOOK_ENTITIES;
+ ]>
+
+ Configuration of custom data validators
+
+
+ Overview
+
+ &PRODUCT; includes a user-configurable validator that can be a=
pplied to
+ input fields of different bundled portlets. Currently, this valid=
ator is only used to configure the
+ validation of user name formats in the user account, user registr=
ation and group membership portlets, though
+ the architecture allows for configurable validation to be used in=
different contexts if needed.
+
+
+ The validator can be configured via properties in the
+ configuration.properties
+ file found in the &PRODUCT_NAME; configuration directory. By defa=
ult, this directory is found at
+ $JBOSS_HOME/server/default/conf/gatein/
+ if you are using JBoss Application Server or
+ $TOMCAT_HOME/gatein/conf/
+ if you are using Tomcat.
+
+
+
+ The architecture supports several configurations that can be acti=
vated and associated to specific instances of
+ the user-configurable validator when they are created and assigne=
d to fields in portlets. We will only concern
+ ourselves with the currently supported use cases, which are creat=
ion/modification of a user name during
+ registration/modification of a user and group membership assignme=
nts.
+
+
+
+
+
+ Validator configuration
+
+
+ A configuration is created by adding an entry in
+ configuration.properties
+ using the
+ gatein.validators.
+ prefix followed by the name of the configuration, a period '.' an=
d the name of the validation aspect you want
+ to configure. The user-configurable validator currently supports =
four different aspects per configuration, as
+ follows, where
+ {configuration}
+ refers to the configuration name:
+
+
+ gatein.validators.{configuration}.length.min=
: minimal length of the validated
+ field
+
+
+
+ gatein.validators.{configuration}.length.max=
: maximal length of the validated
+ field
+
+
+
+ gatein.validators.{configuration}.regexp: regular expression to which values of
+ the validated field must conform
+
+
+
+ gatein.validators.{configuration}.format.mes=
sage: information message to display
+ when the value of the validated field doesn't conform to=
the
+ specified regular expression
+
+
+
+
+
+
+ Only two configurations are currently supported by &PRODUCT_NAME;=
, one, named
+ username, to configure validation of user name=
s when they are created/modified and the
+ other, named
+ groupmembership,
+ to configure validation of user names in the context of group mem=
berships.
+
+
+
+ For example, if you want to make sure that your users use an emai=
l address as their user name, you could use
+ the following configuration:
+
+
+
+
+ # validators
+ gatein.validators.username.regexp=3D^[A-Za-z0-9._%+-]+@[A-Z=
a-z0-9.-]+\.[A-za-z]{2,4}$
+ gatein.validators.username.format.message=3DUsername must b=
e a valid email address.
+
+
+
+
+
+
+ If you don't change the configuration of the validator, user n=
ames will be validated as follows:
+
+
+ Length must be between 3 and 30 characters.
+
+
+ Only lowercase letters, numbers, undescores (_) an=
d period (.) can be used.
+
+
+ No consecutive undescores (_) or period (.) can be=
used.
+
+
+ Must start with a letter.
+
+
+ Must end with a letter or number.
+
+
+
+
+
+
+
+ Developer information
+
+
+ The user-configurable validator is implemented by the
+ org.exoplatform.webui.form.validator.UserConfigurableVal=
idator
+ class. Please refer to its documentation for more details.
+
+
+
+ To use a specific validator configuration to validate a given fie=
ld value, add the validator to the field as
+ follows, where
+ configurationName
+ is a
+ String
+ representing the name of the configuration to use:
+
+ addValidator(UserConfigurableValidator.class, configurationNam=
e))
+
+
+
+ The validator instance can then be configured by adding the relev=
ant information in configuration.properties, for examp=
le:
+
+ # validators
+ gatein.validators.configurationName.length.min=3D5
+ gatein.validators.configurationName.length.max=3D10
+ gatein.validators.configurationName.regexp=3D^u\d{4,9}$
+ gatein.validators.configurationName.format.message=3DUsername =
must start with ''u'' and be followed by 4 to 9 digits.
+
+
+
+
+ Alternatively, a resource key can also be passed to the
+ addValidator
+ method to specify which localized message should be used in case =
a validation error occurs, for example as
+ follows:
+ configurationName
+
+ addValidator(UserConfigurableValidator.class, UserConfigurable=
Validator.GROUPMEMBERSHIP,
+ UserConfigurableValidator.GROUP_MEMBERSHIP_LOCALIZATION_KEY);
+
+
+
+
Modified: portal/trunk/docs/reference-guide/en-US/modules/Configuration.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/docs/reference-guide/en-US/modules/Configuration.xml 2012-=
02-09 23:49:41 UTC (rev 8418)
+++ portal/trunk/docs/reference-guide/en-US/modules/Configuration.xml 2012-=
02-10 14:43:12 UTC (rev 8419)
@@ -8,4 +8,5 @@
+
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/=
validator/UserConfigurableValidator.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/valida=
tor/UserConfigurableValidator.java 2012-02-09 23:49:41 UTC (rev 8418)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/valida=
tor/UserConfigurableValidator.java 2012-02-10 14:43:12 UTC (rev 8419)
@@ -40,7 +40,7 @@
=
/**
* A user-configurable validator. Several aspects of this validator can be=
configured via properties in the
- * configuration.properties file found in the GateIn configuration directo=
ry (${gatein.conf.dir}. The validator
+ * configuration.properties file found in the GateIn configuration directo=
ry (${gatein.conf.dir}). The validator
* supports several configurations that can be activated when a validator =
instance is created by passing it the name of
* the configuration to be activated. A configuration is created by adding=
an entry in configuration.properties using
* the {@link #KEY_PREFIX} prefix followed by the name of the configuratio=
n, a period '.' and the name of the
--===============6686231119877020407==--