JBoss.orgCommunity Documentation

Chapter 2. Configuration

2.1. Database Configuration
2.1.1. Overview
2.1.2. Configuring the database for JCR
2.1.3. Configuring the database for the default identity store
2.2. E-Mail Service Configuration
2.2.1. Overview
2.2.2. Configuring the outgoing e-mail account
2.3. HTTPS Configuration
2.3.1. Overview
2.3.2. Generate your key
2.3.3. Setup Jboss configuration to use your key
2.3.4. Setup Tomcat configuration to use your key
2.4. Configuration of custom data validators
2.4.1. Overview
2.4.2. Validator configuration
2.4.3. Developer information

To configure the database used by JCR you will need to edit the file:

$JBOSS_HOME/server/default/conf/gatein/configuration.properties

For Tomcat, the file is located at

$TOMCAT_HOME/gatein/conf/configuration.properties

And edit the values of driver, url, username and password with the values for your JDBC connection (please, refer to your database JDBC driver documentation).


gatein.jcr.datasource.driver=org.hsqldb.jdbcDriver
gatein.jcr.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcjcr_${name}
gatein.jcr.datasource.username=sa
gatein.jcr.datasource.password=

By default, the name of the database is "jdbcjcr_${name}" - ${name} should be a part of the database name, as it is dynamically replaced by the name of the portal container extension (for instance, gatein-sample-portal.ear defines "sample-portal" as container name and the default portal defines "portal" as container name).

In the case of HSQL the databases are created automatically. For any other database you will need to create a database named jdbcjcr_portal (and "jdbcjcr_sample-portal" if you have gatein-sample-portal.ear in $JBOSS_HOME/server/default/deploy - note that some databases don't accept '-' in the database name, so you may have to remove $JBOSS_HOME/server/default/deploy/gatein-sample-portal.ear)

Make sure the user has rights to create tables on jdbcjcr_portal, and to update them as they will be automatically created during the first startup .

Also add your database's JDBC driver into the classpath - you can put it in $JBOSS_HOME/server/default/lib (or $TOMCAT_HOME/lib, if you are running on Tomcat)

MySQL example:

Let's configure our JCR to store data in MySQL. Let's pretend we have a user named "gateinuser" with a password "gateinpassword". We would create a database "mygateindb_portal" (remember that _portal is required), and assign our user the rights to create tables.

Then we need to add MySQL's JDBC driver to the classpath, and finally edit gatein.ear/02portal.war/WEB-INF/conf/jcr/jcr-configuration to contain the following:

gatein.jcr.datasource.driver=com.mysql.jdbc.Driver
gatein.jcr.datasource.url=jdbc:mysql://localhost:3306/mygateindb${container.name.suffix}
gatein.jcr.datasource.username=gateinuser
gatein.jcr.datasource.password=gateinpassword

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 '.' and 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:

Only two configurations are currently supported by GateIn, one, named username, to configure validation of user names when they are created/modified and the other, named groupmembership, to configure validation of user names in the context of group memberships.

For example, if you want to make sure that your users use an email address as their user name, you could use the following configuration:


Note

If you don't change the configuration of the validator, user names will be validated as follows:

  • Length must be between 3 and 30 characters.

  • Only lowercase letters, numbers, undescores (_) and period (.) can be used.

  • No consecutive undescores (_) or period (.) can be used.

  • Must start with a letter.

  • Must end with a letter or number.

Important

Some components that leverage GateIn depend on user names being all lowercase. We therefore strongly recommend that you also only accept lowercase user names.