Prerequisites
- A database account with access to the Rice database
- An LDAP Service Account
- Procure the UC Davis-specific
rice-api
andrice-impl
JARs and all transitive dependencies using either of the following methods:- Download
ucd-rice-standalone-server-impl
WAR from Artifactory . This WAR contains all dependencies. - Maven users: Add
ucd-rice-impl
as a dependency in your project.pom.xml<repositories> <repository> <id>ietmavenrepositori</id> <name>IET Maven Repository</name> <url>https://psl-95.ucdavis.edu/repo</url> </repository> </repositories> <properties> <ucd-rice-impl.version>[some UCD Rice Implementation version]</ucd-rice-impl.version> </properties> <dependencies> <dependency> <groupId>edu.ucdavis.kuali.rice</groupId> <artifactId>ucd-rice-impl</artifactId> <version>${ucd-rice-impl.version}</version> </dependency> </dependencies>
- Download
Properties Configuration
We use a simple XML configuration to declare properties as key-value pairs. For example:
<config> <param name="datasource.ojb.platform">Oracle</param> <param name="datasource.platform">org.kuali.rice.core.database.platform.OraclePlatform</param> <param name="datasource.url">jdbc:oracle:thin:@dbhost.ucdavis.edu:1521:SID</param> <param name="datasource.driver.name">oracle.jdbc.driver.OracleDriver</param> <param name="datasource.pool.validationQuery">select 1 from duak</param> <param name="datasource.pool.maxWait">30000</param> <param name="datasource.pool.size">30</param> <param name="datasource.pool.maxActive">50</param> <param name="datasource.minIdle">7</param> <param name="datasource.initialSize">7</param> <param name="datasource.accessToUnderlyingConnectionAllowed">true</param> <param name="datasource.username">my_db_user</param> <param name="datasource.password">my_db_password</param> <config>
Default Rice Configuration
- By default Rice looks for
rice-config.xml
in/usr/local/rice/
at launch time. This allows us substitute different values for different properties in different environments (e.g. TEST vs. PROD). - See a full-blown set of sample properties .
Core Data Source Configuration
Kuali Rice uses Java Open Transaction Manager, so we declare the appropriate beans.
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"> <property name="defaultTimeout" value="${transaction.timeout}"/> </bean> <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="jotm"/> <property name="userTransaction" ref="jotm"/> </bean>
We must declare three data sources:
- A transactional data source where the local client application's Rice tables are located. This is required by JOTM.
classpath:edu/ucdavis/myapp/config/application-data.xml
<bean id="dataSource" class="org.kuali.rice.core.database.XAPoolDataSource"> <property name="transactionManager" ref="jotm" /> <property name="driverClassName" value="${datasource.driver.name}" /> <property name="url" value="${datasource.url}" /> <property name="maxSize" value="${datasource.pool.size}" /> <property name="minSize" value="${datasource.initialSize}" /> <property name="maxWait" value="${datasource.pool.maxWait}" /> <property name="validationQuery" value="${datasource.pool.validationQuery}" /> <property name="username" value="${datasource.username}" /> <property name="password" value="${datasource.password}" /> </bean>
- A non-transactional data source pointing to those same Rice tables. This is required by Quartz.
classpath:edu/ucdavis/myapp/config/application-data.xml
<bean id="nonTransactionalDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${datasource.driver.name}" /> <property name="url" value="${datasource.url}" /> <property name="maxActive" value="${datasource.pool.maxActive}" /> <property name="minIdle" value="${datasource.minIdle}" /> <property name="initialSize" value="${datasource.initialSize}" /> <property name="validationQuery" value="${datasource.pool.validationQuery}" /> <property name="username" value="${datasource.username}" /> <property name="password" value="${datasource.password}" /> <property name="accessToUnderlyingConnectionAllowed" value="${datasource.accessToUnderlyingConnectionAllowed}" /> </bean>
- A transactional data source pointing to the database of the Rice Standalone Server.
classpath:edu/ucdavis/myapp/config/application-data.xml
<bean id="standaloneDataSource" class="org.kuali.rice.core.database.XAPoolDataSource"> <property name="transactionManager" ref="jotm" /> <property name="driverClassName" value="${standalone.datasource.driver.name}" /> <property name="url" value="${standalone.datasource.url}" /> <property name="maxSize" value="${standalone.datasource.pool.size}" /> <property name="minSize" value="${standalone.datasource.initialSize}" /> <property name="maxWait" value="${standalone.datasource.pool.maxWait}" /> <property name="validationQuery" value="${standalone.datasource.pool.validationQuery}" /> <property name="username" value="${standalone.datasource.username}" /> <property name="password" value="${standalone.datasource.password}" /> </bean>
KIM Service Configuration
UCD has implemented a custom KIM Identity Service which fetches Entity and Principal information from UCD LDAP.
Data Source Configuration
KIM Identity Service requires a data source for the UCD LDAP server defined by a bean named ldapContextSource
<bean id="ldapContextSource" class="org.springframework.ldap.core.support.LdapContextSource"> <property name="url" value="${ldap.url}" /> <property name="base" value="${ldap.base}" /> <property name="pooled" value="${ldap.pooled}" /> <property name="userDn" value="${ldap.user}" /> <property name="password" value="${ldap.password}" /> </bean>
Optionally, KIM Identity Service provides access to the PEOPLE_DISPLAY_NAME
view in the ORG
schema in Mothra defined by a bean named whitePagesDataSource
<bean id="whitePagesDataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${datasource.driver.name}"/> <property name="url" value="${datasource.url}"/> <property name="username" value="${datasource.username}"/> <property name="password" value="${datasource.password}"/> </bean>
Spring Bean Configuration
Declare the service using either of the following methods:
- Declare it as part of the
rice.additionalSpringFiles
property/usr/local/rice/rice-config.xml<param name="rice.additionalSpringFiles">classpath:edu/ucdavis/kuali/rice/kim/config/ucd-kim-service.xml</param>
- Inject it into the
rice
bean using theadditionalSpringFiles
property (see Rice Bean Configuration)classpath:edu/ucdavis/myapp/config/rice-common.xml<bean id="rice" class="org.kuali.rice.core.config.RiceConfigurer"> <property name="additionalSpringFiles"> <list> ... <value>classpath:edu/ucdavis/kuali/rice/kim/config/ucd-kim-service.xml</value> ... </list> </property> </bean>
- If you're using Spring's
ContextLoaderListener
, declare it inweb.xml
src/main/webapp/WEB-INF/web.xml<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> ... classpath:edu/ucdavis/iet/kuali/rice/kim/config/ucd-kim-service.xml ... </param-value> </context-param>
KEW Service Configuration
UCD has implemented a custom Encryption Service that overrides the default demonstration encryption service.
Property Configuration
The encryption service requires an encryption.key
property be set.
<param name="encryption.key">[some generated encryption key]</param>
Spring Bean Configuration
Declare the service using either of the following methods:
- Declare it as part of the
rice.additionalSpringFiles
property/usr/local/rice/rice-config.xml<param name="rice.additionalSpringFiles">classpath:edu/ucdavis/kuali/rice/kew/config/ucd-kew-service.xml</param>
- Inject it into the
rice
bean using theadditionalSpringFiles
property (see Rice Bean Configuration)classpath:edu/ucdavis/myapp/config/rice-common.xml<bean id="rice" class="org.kuali.rice.core.config.RiceConfigurer"> <property name="additionalSpringFiles"> <list> <value>classpath:edu/ucdavis/kuali/rice/kew/config/ucd-kew-service.xml</value> </list> </property> </bean>
- If you're using Spring's
ContextLoaderListener
, declare it inweb.xml
src/main/webapp/WEB-INF/web.xml<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:edu/ucdavis/kuali/rice/kew/config/ucd-kew-service.xml </param-value> </context-param>
Rice Bean Configuration
Finally, we declare the rice
bean and inject all of the data source beans into it along with any required additional Spring files.
<bean id="rice" class="org.kuali.rice.core.config.RiceConfigurer"> <property name="dataSource" ref="dataSource" /> <property name="nonTransactionalDataSource" ref="nonTransactionalDataSource"/> <property name="serverDataSource" ref="standaloneDataSource"/> <property name="transactionManager" ref="jotm" /> <property name="userTransaction" ref="jotm" /> <property name="serviceNamespace" value="${service.namespace}" /> <property name="environment" value="${environment}" /> <property name="rootConfig" ref="config" /> <property name="ksbConfigurer"> <bean class="org.kuali.rice.ksb.messaging.config.KSBConfigurer"> <property name="serviceServletUrl" value="${serviceServletUrl}" /> </bean> </property> <property name="kewConfigurer"> <bean class="org.kuali.rice.kew.config.KEWConfigurer"> <property name="clientProtocol" value="local" /> </bean> </property> <property name="knsConfigurer"> <bean class="org.kuali.rice.kns.config.KNSConfigurer"/> </property> <property name="kimConfigurer"> <bean class="org.kuali.rice.kim.config.KIMConfigurer"/> </property> <property name="kcbConfigurer"> <bean class="org.kuali.rice.kcb.config.KCBConfigurer"/> </property> <property name="additionalSpringFiles"> <value>${rice.additionalSpringFiles}</value> </property> </bean>