You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by le...@apache.org on 2014/06/03 23:37:12 UTC
svn commit: r1599802 - /gora/site/trunk/content/current/gora-camel.md
Author: lewismc
Date: Tue Jun 3 21:37:12 2014
New Revision: 1599802
URL: http://svn.apache.org/r1599802
Log:
update gora-camel documentation.
Modified:
gora/site/trunk/content/current/gora-camel.md
Modified: gora/site/trunk/content/current/gora-camel.md
URL: http://svn.apache.org/viewvc/gora/site/trunk/content/current/gora-camel.md?rev=1599802&r1=1599801&r2=1599802&view=diff
==============================================================================
--- gora/site/trunk/content/current/gora-camel.md (original)
+++ gora/site/trunk/content/current/gora-camel.md Tue Jun 3 21:37:12 2014
@@ -1,66 +1,294 @@
Title: Gora Configuration
-##gora.properties
+#Introduction
-Gora reads necessary configuration from a properties file name
-<code>gora.properties</code>.
+**Camel-Gora** is an [Apache Camel](http://camel.apache.org/) component that allows you to work with NoSQL databases using the
+[Apache Gora](http://gora.apache.org/) framework.
-The file is searched in the classpath, which is
-obtained using the <code>ClassLoader</code> of the [DataStoreFactory](http://gora.apache.org/current/api/apidocs-0.4/index.html?org/apache/gora/store/DataStoreFactory.html)
- class.
-
-The following properties are recognized:
-
-##Common Properties
-<table>
- <tr><th align="left">Property</th> <th align="left">Required</th> <th align="left">Default</th> <th align="left">Explanation</th></tr>
- <tr><td><code>gora.datastore.default</code></td><td>No</td> <td> â </td> <td>The full classname of the default data store implementation to use </td></tr>
- <tr><td><code>gora.datastore.autocreateschema</code></td><td>No</td><td>true</td><td>Whether to create schemas automatically</td></tr>
-</table>
-
-<code>gora.datastore.default</code> is perhaps the most important property in this file.
-This property configures the default [DataStore](http://gora.apache.org/current/api/apidocs-0.4/index.html?org/apache/gora/store/DataStore.html) implementation to use.
-However, other data stores can still be instantiated thorough the API.
-Data store implementation in Gora distribution include:
-
-<table>
- <caption>DataStore implementations</caption>
- <tr><th align="left">DataStore Implementation</th> <th align="left">Full Class Name</th> <th align="left">Module Name</th> <th align="left">Explanation</th></tr>
- <tr><td><b>AvroStore</b></td> <td><code>org.apache.gora.avro.store.AvroStore</code></td> <td>gora-core</td> <td>An adapter DataStore for binary-compatible Apache Avro serializations. AvroDataStore supports Binary and JSON serializations. </td></tr>
- <tr><td><b>DataFileAvroStore</b></td> <td><code>org.apache.gora.avro.store.DataFileAvroStore</code></td> <td>gora-core</td> <td>DataFileAvroStore is file based store which uses Avro's DataFile{Writer,Reader}'s as a backend. This datastore supports mapreduce.</td></tr>
- <tr><td><b>AccumuloStore</b></td> <td><code>org.apache.gora.accumulo.store.AccumuloStore</code></td> <td>gora-accumulo</td> <td> DataStore for Apache Accumulo. </td></tr>
- <tr><td><b>HBaseStore</b></td> <td><code>org.apache.gora.hbase.store.HBaseStore</code></td> <td>gora-hbase</td> <td> DataStore for Apache HBase. </td></tr>
- <tr><td><b>CassandraStore</b></td> <td><code>org.apache.gora.cassandra.store.CasssandraStore</code></td> <td>gora-cassandra</td> <td> DataStore for Apache Cassandra. </td></tr>
- <tr><td><b>SolrStore</b></td> <td><code>org.apache.gora.solr.store.SolrStore</code></td> <td>gora-solr</td> <td> A DataStore implementation for Apache Solr.</td></tr>
- <tr><td><b>MemStore</b></td> <td><code>org.apache.gora.memory.store.MemStore</td> <td>gora-core</td> <td> Memory based DataStore implementation for tests. </td></tr>
- <tr><td><b>Dynamodb</b></td> <td><code>org.apache.gora.dynamodb.store.DyanmoDBStore</td> <td>gora-dynamodb</td> <td> Webservices-based datastore implementation for Amazon's DynamoDB. </td></tr>
-</table>
+**N.B.** Camel-Gora is NOT a Gora module... but instead a Camel one. This documentation exists to provide detail on how
+Gora is being used in different settings.
-Some of the properties can be customized per datastore. The format of these
-properties is as follows: <code>gora.<data_store_class>.<property_name></code>.
+**Available as of Camel 2.14**
+
+Maven users will need to add the following dependency to their pom.xml for this component:
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-gora</artifactId>
+ <version>x.x.x</version>
+ <!-- use the same version as your Camel core version -->
+ </dependency>
+
+
+## URI format
+
+ gora:instanceName[?options]
+
+ Hbase examples with mandatory options :
+
+ *XML*
+
+ <to uri="gora:foobar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+ *Java DSL*
+
+ to("gora:foobar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+
+## Configuratiion
+
+ Using camel-gora needs some configuration. This mainly involve to configure the <code>AvroStore</code> through the <code>gora.properties</code> file and to define the relevant mappings as part of the *[gora-core](http://gora.apache.org/current/gora-core.html)* module.
+
+ Extensive information for this configuration can be found in the apache [gora documentation](./index.html) and the [gora-conf](./gora-conf.html) page.
+
+## Supported Gora Operations
+
+ Supported operations include : ***put**, **get**, **delete**, **getSchemaName**, **deleteSchema**, **createSchema**, **query**, **deleteByQuery**, **schemaExists***.
+
+ Some of the operations require arguments while some others no. The arguments to operations could be either the *body* of the *in* message or defined in a header property. Below there is a list with some additional info for each operation.
+
+
+<table>
+ <thead><tr><th>Property</th><th>Description</th></tr></thead>
+ <tbody>
+
+ <tr>
+ <td><tt>put</tt>
+ <td>*Inserts the persistent object with the given key.*</td>
+ </tr>
+ <tr>
+ <td><tt>get</tt>
+ <td>*Returns the object corresponding to the given key fetching all the fields.*</td>
+ </tr>
+ <tr>
+ <td><tt>delete</tt>
+ <td>*Deletes the object with the given key.*</td>
+ </tr>
+ <tr>
+ <td><tt>getSchemaName</tt>
+ <td>*Returns the schema name given to this DataStore.*</td>
+ </tr>
+ <tr>
+ <td><tt>deleteSchema</tt>
+ <td>*Deletes the underlying schema or table (or similar) in the datastore that holds the objects.*</td>
+ </tr>
+ <tr>
+ <td><tt>createSchema</tt>
+ <td>*Creates the optional schema or table (or similar) in the datastore to hold the objects.*</td>
+ </tr>
+ <tr>
+ <td><tt>query</tt>
+ <td>*Executes the given query and returns the results.*</td>
+ </tr>
+ <tr>
+ <td><tt>deleteByQuery</tt>
+ <td>*Deletes all the objects matching the query.*</td>
+ </tr>
+ <tr>
+ <td><tt>schemaExists</tt>
+ <td>*Returns whether the schema that holds the data exists in the datastore.*</td>
+ </tr>
+ <table>
+
+## Options
+### Gora Headers
+<table>
+ <thead><tr><th>Property</th><th>Description</th></tr></thead>
+ <tbody>
+
+ <tr>
+ <td><tt>GoraOperation</tt>
+ <td>*Used in order to define the operation to execute.*</td>
+ </tr>
+
+ <tr>
+ <tr>
+ <td><tt>GoraKey</tt>
+ <td>*Used in order to define the datum key for the operations need it.*</td>
+ </tr>
+ <table>
+
+### Gora Configuration attributes
+
+<table>
+ <thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead>
+ <tbody>
+
+ <tr>
+ <td><tt>keyClass</tt>
+ </td><td>_String_</td>
+ <td>*Key type.* *</td>
+ </tr>
+
+ <tr>
+ <td><tt>valueClass</tt>
+ </td><td>_String_</td>
+ <td> *Value type.* *</td>
+ </tr>
+
+ <tr>
+ <td><tt>dataStoreClass</tt>
+ </td><td>_String_</td>
+ <td> *DataStore type* *</td>
+ </tr>
+
+ <tr>
+ <td><tt>hadoopConfiguration</tt>
+ </td><td>_Configuration_</td>
+ <td> *Hadoop Configuration*</td>
+ </tr>
+
+ <tr>
+ <td><tt>concurrentConsumers</tt>
+ </td><td>_int_</td>
+ <td> *Concurrent Consumers (used only by consumers).*</td>
+ </tr>
+
+ <tr>
+ <td><tt>flushOnEveryOperation</tt>
+ </td><td>_boolean_</td>
+ <td> *Flush on every operation (used only by producers).*</td>
+ </tr>
+<table>
+
+*NOTE: the gora configuration properties marked with asterisk are mandatory*
+
+### Gora Query attributes
+
+<table>
+ <thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead>
+ <tbody>
+
+ <tr>
+ <td><tt>startTime</tt>
+ </td><td>_long_</td>
+ <td> *Start Time attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>endTime</tt>
+ </td><td>_long_</td>
+ <td> *End Time attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>timeRangeFrom</tt>
+ </td><td>_long_</td>
+ <td> *Time Range From attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>timeRangeTo</tt>
+ </td><td>_long_</td>
+ <td> *Time Range To attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>limit</tt>
+ </td><td>_long_</td>
+ <td> *Gora Query Limit attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>timestamp</tt>
+ </td><td>_long_</td>
+ <td> *Timestamp attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>startKey</tt>
+ </td><td>_Object_</td>
+ <td> *Start Key attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>endKey</tt>
+ </td><td>_Object_</td>
+ <td> *End Key attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>keyRangeFrom</tt>
+ </td><td>_Object_</td>
+ <td> *Key Range From attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>keyRangeTo</tt>
+ </td><td>_Object_</td>
+ <td> *Key Range To attribute.*</td>
+ </tr>
+
+ <tr>
+ <td><tt>fields</tt>
+ </td><td>_String_</td>
+ <td> *Fields attribute.*</td>
+ </tr>
+
+<table>
+
+### Usage examples
+
+
+**Create Schema** *(XML DSL)*:
+
+ <setHeader headerName="GoraOperation">
+ <constant>CreateSchema</constant>
+ </setHeader>
+
+ <to uri="gora:foobar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+**SchemaExists** *(XML DSL)*:
+
+ <setHeader headerName="GoraOperation">
+ <constant>SchemaExists</constant>
+ </setHeader>
+
+ <to uri="gora:foobar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+
+**Put** *(XML DSL)*:
+
+ <setHeader headerName="GoraOperation">
+ <constant>put</constant>
+ </setHeader>
+
+ <setHeader headerName="GoraKey">
+ <constant>22222</constant>
+ </setHeader>
+
+ <to uri="gora:foo?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+**Get** *(XML DSL)*:
+
+ <setHeader headerName="GoraOperation">
+ <constant>GET</constant>
+ </setHeader>
+
+ <setHeader headerName="GoraKey">
+ <constant>10101</constant>
+ </setHeader>
-Note that <code><data_store_class></code> is the classname of the datastore
-implementation w/o the package name, for example <code>HbaseStore</code>.
-You can also use the string datastore instead of the specific
-data store class name, in which case, the property setting is effective
-to all data stores. The following properties can be set per data store.
-
-##Per DataStore Properties
-<table>
- <caption>DataStore Properties</caption>
- <tr><th align="left">Property</th> <th align="left">Required</th> <th align="left">Default Value</th> <th align="left">Explanation</th></tr>
- <tr><td><code>gora.<data_store_class>.autocreateschema</code> No true Whether to create schemas automatically for the specific data store</td></tr>
- <tr><td><code>gora.<data_store_class>.mapping.file</code> No gora-{accumulo|hbase|cassandra|sql|dynamodb}-mapping.xml The name of the mapping file</td></tr>
-</table>
-
-##Data store specific settings
-Other than the properties above, some of the data stores have their
-own configurations. These properties are listed at the module documentations:
-
-* [Gora Core Module](./gora-core.html) (incl. AvroStore, DataFileAvroStore and MemStore)
-* [Gora HBase Module](./gora-hbase.html)
-* [Gora Cassandra Module](./gora-cassandra.html)
-* [Gora Solr Module](./gora-solr.html)
-* [Gora Accumulo Module](./gora-accumulo.html)
-* [Gora DynamoDB Module](./gora-dynamodb.html)
+ <to uri="gora:bar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+**Delete** *(XML DSL)*:
+
+ <setHeader headerName="GoraOperation">
+ <constant>DELETE</constant>
+ </setHeader>
+
+ <setHeader headerName="GoraKey">
+ <constant>22222</constant>
+ </setHeader>
+
+ <to uri="gora:bar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+**Query** *(XML DSL)*:
+
+ <to uri="gora:foobar?keyClass=java.lang.Long&valueClass=org.apache.camel.component.gora.generated.Pageview&dataStoreClass=org.apache.gora.hbase.store.HBaseStore"/>
+
+The full usage examples in the form of integration tests can be found at [camel-gora-examples](https://github.com/ipolyzos/camel-gora-examples/) repository.
+
+### More resources
+For more please information and in depth configuration refer to the [Apache Gora Documentation](./overview.html) and the [Apache Gora Tutorial](./tutorial.html).
\ No newline at end of file