You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ja...@apache.org on 2011/09/14 14:21:11 UTC

svn commit: r1170561 - /incubator/rave/site/trunk/content/rave/documentation/configure-database.mdtext

Author: jasha
Date: Wed Sep 14 12:21:10 2011
New Revision: 1170561

URL: http://svn.apache.org/viewvc?rev=1170561&view=rev
Log:
Add extra information about the default initialization and setup

Modified:
    incubator/rave/site/trunk/content/rave/documentation/configure-database.mdtext

Modified: incubator/rave/site/trunk/content/rave/documentation/configure-database.mdtext
URL: http://svn.apache.org/viewvc/incubator/rave/site/trunk/content/rave/documentation/configure-database.mdtext?rev=1170561&r1=1170560&r2=1170561&view=diff
==============================================================================
--- incubator/rave/site/trunk/content/rave/documentation/configure-database.mdtext (original)
+++ incubator/rave/site/trunk/content/rave/documentation/configure-database.mdtext Wed Sep 14 12:21:10 2011
@@ -19,18 +19,39 @@ Notice:    Licensed to the Apache Softwa
 ## Default setup
 In the default setup Rave uses an in memory [H2 database][1].
 
-All schemas are generated using JPA annotations. The H2 database is populated with low level SQL queries using the DataSourcePopulator which is configured as Spring bean. These queries are not guaranteed to work for a different database.
+### Filling the default database
+All schemes are generated using JPA annotations. The H2 database is populated with low level SQL queries using the DataSourcePopulator which is configured as Spring bean. These queries are not guaranteed to work for a different database.
 
-To access the tables for the portal, go to [http://localhost:11111][2]. 
-To access the tables for the OpenSocial container (Shindig), go to [http://localhost:22222][3]. Username is `sa`, password `local`.
+    <bean id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator">
+        <property name="executeScriptQuery" value="SELECT * FROM WIDGET"/>
+        <property name="scriptLocations">
+            <list>
+                <value>classpath:initial_data.sql</value>
+            </list>
+        </property>
+    </bean>
+
+If the query in `executeScriptQuery` returns no error and no results, the database will be populated with the contents of `scriptLocations`.
+
+### Access the default database
+.When the application is running the H2 databases can be accessed through a web interface. In the default setup this is configured using a Spring bean:
+
+    <bean id="org.h2.tools.Server-WebServer" class="org.h2.tools.Server"
+          factory-method="createWebServer" depends-on="dataSource"
+          init-method="start" lazy-init="false" destroy-method="stop">
+        <constructor-arg value="-web,-webPort,11111"/>
+    </bean>
 
+The default username is `sa`, password `local`.
 
+  - Portal database: [http://localhost:11111][2].  
+  - Shindig database: [http://localhost:22222][3].
 
 ## Setup a different database
 
 First start with [extending Rave][4].
 
-Make sure the jdbc driver ends up in the classpath. Either add it to a common lib directory of the application container or add its dependency to the pom of the several modules.
+Make sure the JDBC driver ends up in the classpath. Either add it to a common lib directory of the application container or add its dependency to the pom of the several modules.
 
 Then customize the properties for the portal and Shindig to use the database of your choice.
 
@@ -70,7 +91,7 @@ Rave Shindig:
     rave-shindig.jpaVendorAdapter.database=MYSQL
 
 #### Notes
-The DataSourcePopulator uses a single statement to execute all queries in the configured SQL files. The MySQL JDBC driver does not allow this by default, unless you add `allowMultiple=true` to the driver url.
+The DataSourcePopulator uses a single statement to execute all queries in the configured SQL files. The MySQL JDBC driver does not allow this by default, unless you add `allowMultiple=true` to the driver URL.
 
 ### PostgreSQL
 #### JDBC driver
@@ -105,7 +126,8 @@ Rave Shindig:
     rave-shindig.jpaVendorAdapter.database=POSTGRESQL
 
 #### Notes
-The syntax for setting variables in SQL queries in PostgreSQL is different from the syntax in H2 databases. Therefore the default data cannot be loaded using the initial data.
+  - The DataSourcePopulator cannot handle a PostgreSQL database that has not yet been initialized.
+  - The syntax for setting variables in SQL queries in PostgreSQL is different from the syntax in H2 databases. Therefore the default data cannot be loaded using the initial data.
 
   [1]: http://www.h2database.com/
   [2]: http://localhost:11111