This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Writing a new DataStore for Gora HOW_TO
Skip to end of metadata
Go to start of metadata

Writing a New DataStore for Apache Gora

What You Need

A couple of hours time and some patience...

Step 1 - Get the Gora Code

Check out the Gora trunk source code from one of the many sources, the documentation on how to do this is located here.

Step 2 - Create a New Module

Depending on how you obtained the Gora trunk source code above, there are numerous possible methods for how you do this.
The best advice is to copy another module (such as gora-accumulo) to use as a template.

svn cp gora-accumulo gora-$moduleName

In Git
cp gora-accumulo gora-$moduleName
git add gora-$moduleName

N.B Beware the curse of SVN here when copying can sometimes get you in to a bit of a mess.

You will now have the full directory structure which will look something similar to this:

Customize the Directory Structure

Here we wish to replace ALL instances of the old module name with the new one. For this we can use a tool such as sed which makes life much easier.
The following command can be run from within the new module directory.

The first command recursively replaces all occurrences of the term Accumulo (uppercase A) with $moduleName

sed -i 's/Accumulo/$moduleName/g' `grep -rl 'Accumulo' *`

The second command recursively replaces all occurrences of the term accumulo (lowercase A) with $moduleName

sed -i 's/accumulo/$moduleName/g' `grep -rl 'accumulo' *`

Establish Maven Parent pom.xml Configuration

Navigate to the Gora parent pom.xml. Find the <modules></modules> section of the pom tree and add your new modules there

Then locate and add the version of the new datastore and any other properties to the <properties></properties>. This merely acts as a central convenient location to house the datastore specific version properties.

Finally navigate to the <dependencyManagement></dependencyManagement> section of the pom.xml and add in the new modules.

Establish Maven Module pom.xml Configuration

Open the new project pom.xml and replace all old dependencies with new ones.

Replace Old Files Names With New

This simply consists of manually replacing (may require svn mv or something similar) all of the old Java and configuration file names with the new ones.
You can hopefully copy, edit and paste the following string which makes the replacements and can be run from the terminal.

mv src/main/java/org/apache/gora/accumulo/ mv src/main/java/org/apache/gora/$moduleName/
mv src/test/java/org/apache/gora/accumulo/ mv src/test/java/org/apache/gora/$moduleName/
mv src/main/java/org/apache/gora/voldemort/query/ src/main/java/org/apache/gora/$moduleName/query/$
mv src/main/java/org/apache/gora/voldemort/query/ src/main/java/org/apache/gora/$moduleName/query/$
mv src/main/java/org/apache/gora/voldemort/store/ src/main/java/org/apache/gora/$moduleName/store/$
mv src/main/java/org/apache/gora/voldemort/store/ src/main/java/org/apache/gora/$moduleName/store/$
mv src/test/resources/gora-accumulo-mapping.xml src/test/resources/gora-$moduleName-mapping.xml
mv src/test/java/org/apache/gora/voldemort/store/ src/main/java/org/apache/gora/$moduleName/store/$

... of course there may be others but hopefully this is a help.

  • No labels