Jetspeed-2 RDBMS component provide a layer of abstraction from the persistence mechanism used by Jetspeed-2. It provides facilities for datasource configuration as well as data access.
Jetspeed-2 uses OJBPersistenceBroker
API as its default
persistence mechanism. The ConnectionRepositoryEntry
component configures OJB for Jetspeed-2 as well
as the properties available under /etc/db-ojb
in the Jetspeed-2 source repository or WEB-INF/classes
in a deployed instance of Jetspeed-2.
The datasource.xml
spring assembly configuration file configures ConnectionRepositoryEntry
and is located
in WEB-INF/assembly/boot
.
The ConnectionRepositoryEntry
configures an entry in OJB's ConnectionRepository according to its properties.
The properties driverClassName
, url
, username
and password
are used
only if no jndiName
is set, i.e. if the connection factory uses the driver to create data sources. The platform
settings are derived from the configured data source or database driver using OJB's JdbcMetadataUtils
class. The default
Jetspeed-2 ConnectionRepositoryEntry
configuration expose a datasource.
<bean id="JetspeedDS" class="org.apache.jetspeed.components.rdbms.ojb.ConnectionRepositoryEntry"> <property name="jndiName"> <value>java:comp/env/jdbc/jetspeed</value> </property> </bean>
In order for OJB to be configured properly with Jetspeed-2, the OJB.properties
file (located under
/etc/db-ojb/OJB.properties
in the source tree and WEB-INF/classes
in the deployed application)
must set:
ConnectionManagerClass=org.apache.jetspeed.components.rdbms.ojb.ConnectionManagerImpl
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
A class diagram of ConnectionRepositoryEntry
and ConnectionManagerImpl
is
provided below:
The bean name provided in datasource.xml
must match the jdbc-connection-descriptor
jcd-alias
property (by default JetspeedDS
) located in OJB repository_database.xml
as illustrated below.
<jdbc-connection-descriptor jcd-alias="JetspeedDS" default-connection="true" batch-mode="false">
Jetspeed-2 configure the following datasource in Tomcat. In the source tree, the Tomcat datasource configuration
is located under /etc/conf/tomcat
. When deployed Jetspeed-2 in a Tomcat instance, the Jetspeed-2
datasource configuration are deployed under ${tomcat_home}/conf/Catalina/localhost/jetspeed.xml
. If a different
portal name is being used for Jetspeed-2, the configuration file will be named accordingly.
<Resource name="jdbc/jetspeed" auth="Container" factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource" username="" password="" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" url="jdbc:derby:/tmp/productiondb;create=true" maxActive="100" maxIdle="30" maxWait="10000"/>