Author: ferdy
Date: Wed Jul 18 13:52:09 2012
New Revision: 1362954
URL: http://svn.apache.org/viewvc?rev=1362954&view=rev
Log:
GORA-150 Introduce Configuration property preferred.schema.name
Modified:
gora/trunk/CHANGES.txt
gora/trunk/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
Modified: gora/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/gora/trunk/CHANGES.txt?rev=1362954&r1=1362953&r2=1362954&view=diff
==============================================================================
--- gora/trunk/CHANGES.txt (original)
+++ gora/trunk/CHANGES.txt Wed Jul 18 13:52:09 2012
@@ -6,6 +6,8 @@ Gora Change Log
0.3 (trunk) Current Development:
+* GORA-150 Introduce Configuration property preferred.schema.name (ferdy)
+
* GORA-142 Creates org.apache.gora.cassandra.serializers package in order to
clean the code of store and query packages and to support additional types in
future. (kazk)
* GORA-148 CassandraMapping supports only (first) keyspace and class in
gora-cassandra-mapping.xml (kazk)
Modified:
gora/trunk/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
URL:
http://svn.apache.org/viewvc/gora/trunk/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java?rev=1362954&r1=1362953&r2=1362954&view=diff
==============================================================================
---
gora/trunk/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
(original)
+++
gora/trunk/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
Wed Jul 18 13:52:09 2012
@@ -22,7 +22,6 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Properties;
import org.apache.avro.Schema;
@@ -40,9 +39,7 @@ import org.apache.gora.util.ClassLoading
import org.apache.gora.util.StringUtils;
import org.apache.gora.util.WritableUtils;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
/**
* A Base class for {@link DataStore}s.
@@ -198,7 +195,7 @@ implements DataStore<K, T> {
public boolean equals(Object obj) {
if(obj instanceof DataStoreBase) {
@SuppressWarnings("rawtypes")
- DataStoreBase that = (DataStoreBase) obj;
+ DataStoreBase that = (DataStoreBase) obj;
EqualsBuilder builder = new EqualsBuilder();
builder.append(this.keyClass, that.keyClass);
builder.append(this.persistentClass, that.persistentClass);
@@ -217,13 +214,19 @@ implements DataStore<K, T> {
/**
* Returns the name of the schema to use for the persistent class.
*
- * First the schema name in the defined properties is returned. If null then
+ * First the schema name in the {@link Configuration} is used. If null,
+ * the schema name in the defined properties is returned. If null then
* the provided mappingSchemaName is returned. If this is null too,
* the class name, without the package, of the persistent class is returned.
* @param mappingSchemaName the name of the schema as read from the mapping
file
* @param persistentClass persistent class
*/
protected String getSchemaName(String mappingSchemaName, Class<?>
persistentClass) {
+ String confSchemaName = getOrCreateConf().get("preferred.schema.name");
+ if (confSchemaName != null) {
+ return confSchemaName;
+ }
+
String schemaName = DataStoreFactory.getDefaultSchemaName(properties,
this);
if(schemaName != null) {
return schemaName;