Author: ferdy
Date: Thu Jul 19 09:56:04 2012
New Revision: 1363276
URL: http://svn.apache.org/viewvc?rev=1363276&view=rev
Log:
recommit GORA-150
Modified:
gora/trunk/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
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=1363276&r1=1363275&r2=1363276&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
Thu Jul 19 09:56:04 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,22 +214,25 @@ 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
+ * The schema name is prefixed with schema.prefix from {@link Configuration}.
+ * 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 prefix = getOrCreateConf().get("schema.prefix","");
+
String schemaName = DataStoreFactory.getDefaultSchemaName(properties,
this);
if(schemaName != null) {
- return schemaName;
+ return prefix+schemaName;
}
if(mappingSchemaName != null) {
- return mappingSchemaName;
+ return prefix+mappingSchemaName;
}
- return StringUtils.getClassname(persistentClass);
+ return prefix+StringUtils.getClassname(persistentClass);
}
}