Title: MongoDB Support Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. As of 0.19, Rave has a [MongoDB][4] module that provides implementations for all of Rave's repository interfaces; thus providing support for MongoDB. #Using MongoDB for Persistence JPA remains the primary supported data access method in the rave-portal & rave-portal-resources projects; but can be easily replaced with MongoDB using the following techniques: ##Build from source To build a MongoDB version of the demo binaries follow these steps: 1. Obtain the source from the [downloads][0] or from [Source Control][1] 2. From the project root directory execute: `mvn install -Pmongodb` The rave-portal, rave-portal-resources & rave-shindig wars created by this process contain everything needed to run Rave with MongoDB persistence. See [configuring MongoDB][3] for information on how to set the database properties. ##Custom Rave Extension In a custom build that depends on rave-jpa directly, the only thing that needs to be done is to replace the rave-jpa dependency with rave-mongodb. If the custom application depends on JPA indirectly, via a dependency on rave-portal-dependencies, add an exclusion of rave-jpa to rave-portal-dependencies as follows: org.apache.rave rave-portal-dependencies pom org.apache.rave rave-jpa org.apache.rave rave-mongodb Configure the properties files for portal & shindig as described in [configuring MongoDB][3] ##Demo Binaries To replace the JPA implementation with Mongo in an extracted demo binary or other packaged Rave instance, take the following steps. This method is **NOT** recommended for production deployments. The preferred method is to modify a custom extension, or build, of Rave to as noted above: 1. Start the demo binary as normal to allow it to extract the war archives 2. Remove rave-jpa.jar from webapps/portal/WEB-INF/lib & webapps/ROOT/WEB-INF/lib 3. Configure the properties files located in webapps/portal/WEB-INF/classes & webapps/ROOT/WEB-INF/classes per [configuring MongoDB][3]   ##Configuring MongoDB Both portal.properties & rave.shindig.properties have entries for connecting to MongoDB. mongo.host=localhost mongo.port=27017 mongo.database=rave mongo.username= mongo.password= #Architecture Rave leverages Spring Data MongoDB to simplify interactions with the MongoDB database using the [MongoOperations][2] model serialization pattern. One the the primary benefits of using MongoDB for Rave persistence is that entire object hierarchies can be deserialized from the database in a single call. For example, rather than making a call to the database for a Page object, its Regions and RegionWidgets, we can now just deserialize the entire page in one call. Since Rave currently has repositories for many of the sub-components of a hierarchy, we needed a way to access the same object type from multiple repositories. This lead to the following component architecture: |_ Rave MongoDB repository implementations | |_ MongoModelOperations implementations | |_ Spring MongoOperations | |_ Mongo Driver As with any Rave component, MongoModelOperations instances can be wired in by interface or class name to custom components. *NOTE: Since some simple Rave objects such as PortalPreference & PageLayout instances don't have sub-component repositories, not every Rave model object has a corresponding MongoModelOperations instance.* [0]: /downloads.html [1]: /source.html [2]: http://static.springsource.org/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/core/MongoOperations.html [3]: #configure [4]: http://www.mongodb.org