incubator-gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1169727 - in /incubator/gora/trunk: ./ gora-core/src/examples/java/org/apache/gora/examples/ gora-core/src/examples/java/org/apache/gora/examples/mapreduce/ gora-core/src/main/java/org/apache/gora/mapreduce/ gora-core/src/main/java/org/apa...
Date Mon, 12 Sep 2011 13:05:05 GMT
Author: mattmann
Date: Mon Sep 12 13:05:04 2011
New Revision: 1169727

URL: http://svn.apache.org/viewvc?rev=1169727&view=rev
Log:
Apply patch from GORA-26: Configurable classes should pass around Configuration consistently.

Modified:
    incubator/gora/trunk/CHANGES.txt
    incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
    incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
    incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/WordCount.java
    incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraInputFormat.java
    incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraOutputFormat.java
    incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
    incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
    incubator/gora/trunk/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
    incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/GoraHBaseTestDriver.java
    incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/mapreduce/TestHBaseStoreMapReduce.java
    incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java
    incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalytics.java
    incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java

Modified: incubator/gora/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/CHANGES.txt?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/CHANGES.txt (original)
+++ incubator/gora/trunk/CHANGES.txt Mon Sep 12 13:05:04 2011
@@ -2,6 +2,8 @@ Gora Change Log
 
 Trunk (unreleased changes):
 
+* GORA-26. Configurable classes should pass around Configuration consistently (ab via mattmann)
+
 * GORA-32. Map type with long values generates non-compilable Java class (Yves Langisch)
 
 * GORA-29. Gora maven support (Ioannis Canellos via mattmann)

Modified: incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
(original)
+++ incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
Mon Sep 12 13:05:04 2011
@@ -30,6 +30,7 @@ import org.apache.gora.examples.generate
 import org.apache.gora.examples.generated.WebPage;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
+import org.apache.hadoop.conf.Configuration;
 
 /**
  * Creates and stores some data to be used in the tests.
@@ -141,7 +142,7 @@ public class WebPageDataCreator {
     }
     
     DataStore<String,WebPage> store 
-      = DataStoreFactory.getDataStore(dataStoreClass, String.class, WebPage.class);
+      = DataStoreFactory.getDataStore(dataStoreClass, String.class, WebPage.class, new Configuration());
     createWebPageData(store);
     
     return 0;

Modified: incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
(original)
+++ incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
Mon Sep 12 13:05:04 2011
@@ -124,14 +124,15 @@ public class QueryCounter<K, T extends P
     Class<T> persistentClass = (Class<T>) Class.forName(args[1]);
 
     DataStore<K,T> dataStore;
+    Configuration conf = new Configuration();
 
     if(args.length > 2) {
       Class<? extends DataStore<K,T>> dataStoreClass
           = (Class<? extends DataStore<K, T>>) Class.forName(args[2]);
-      dataStore = DataStoreFactory.getDataStore(dataStoreClass, keyClass, persistentClass);
+      dataStore = DataStoreFactory.getDataStore(dataStoreClass, keyClass, persistentClass,
conf);
     }
     else {
-      dataStore = DataStoreFactory.getDataStore(keyClass, persistentClass);
+      dataStore = DataStoreFactory.getDataStore(keyClass, persistentClass, conf);
     }
 
     long results = countQuery(dataStore);

Modified: incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/WordCount.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/WordCount.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/WordCount.java
(original)
+++ incubator/gora/trunk/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/WordCount.java
Mon Sep 12 13:05:04 2011
@@ -142,19 +142,19 @@ public class WordCount extends Configure
     
     DataStore<String,WebPage> inStore;
     DataStore<String, TokenDatum> outStore;
-    
+    Configuration conf = new Configuration();
     if(args.length > 0) {
       String dataStoreClass = args[0];
       inStore = DataStoreFactory.getDataStore(dataStoreClass, 
-          String.class, WebPage.class);
+          String.class, WebPage.class, conf);
       if(args.length > 1) {
         dataStoreClass = args[1];
       }
       outStore = DataStoreFactory.getDataStore(dataStoreClass, 
-          String.class, TokenDatum.class);
+          String.class, TokenDatum.class, conf);
     } else {
-      inStore = DataStoreFactory.getDataStore(String.class, WebPage.class);
-      outStore = DataStoreFactory.getDataStore(String.class, TokenDatum.class);
+      inStore = DataStoreFactory.getDataStore(String.class, WebPage.class, conf);
+      outStore = DataStoreFactory.getDataStore(String.class, TokenDatum.class, conf);
     }
     
     return wordCount(inStore, outStore);

Modified: incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraInputFormat.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraInputFormat.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraInputFormat.java
(original)
+++ incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraInputFormat.java
Mon Sep 12 13:05:04 2011
@@ -175,7 +175,7 @@ public class GoraInputFormat<K, T extend
   throws IOException {
 
     DataStore<K1,V1> store = DataStoreFactory.getDataStore(dataStoreClass
-        , inKeyClass, inValueClass);
+        , inKeyClass, inValueClass, job.getConfiguration());
     setInput(job, store.newQuery(), store, reuseObjects);
   }
 }

Modified: incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraOutputFormat.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraOutputFormat.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraOutputFormat.java
(original)
+++ incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/mapreduce/GoraOutputFormat.java
Mon Sep 12 13:05:04 2011
@@ -86,7 +86,7 @@ public class GoraOutputFormat<K, T exten
     Class<K> keyClass = (Class<K>) conf.getClass(OUTPUT_KEY_CLASS, null);
     Class<T> rowClass = (Class<T>) conf.getClass(OUTPUT_VALUE_CLASS, null);
     final DataStore<K, T> store =
-      DataStoreFactory.createDataStore(dataStoreClass, keyClass, rowClass);
+      DataStoreFactory.createDataStore(dataStoreClass, keyClass, rowClass, context.getConfiguration());
 
     setOutputPath(store, context);
 

Modified: incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java
(original)
+++ incubator/gora/trunk/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java
Mon Sep 12 13:05:04 2011
@@ -28,6 +28,8 @@ import org.apache.gora.persistency.Persi
 import org.apache.gora.store.impl.DataStoreBase;
 import org.apache.gora.util.GoraException;
 import org.apache.gora.util.ReflectionUtils;
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.conf.Configuration;
 
 /**
  * A Factory for {@link DataStore}s. DataStoreFactory instances are thread-safe.
@@ -76,31 +78,34 @@ public class DataStoreFactory {
   private DataStoreFactory() { }
 
   private static <K, T extends Persistent> void initializeDataStore(
-      DataStore<K, T> dataStore, Class<K> keyClass, Class<T> persistent
-      , Properties properties) throws IOException {
+      DataStore<K, T> dataStore, Class<K> keyClass, Class<T> persistent,
+      Properties properties) throws IOException {
     dataStore.initialize(keyClass, persistent, properties);
   }
 
   public static <D extends DataStore<K,T>, K, T extends Persistent>
   D createDataStore(Class<D> dataStoreClass
-      , Class<K> keyClass, Class<T> persistent) throws GoraException {
-    return createDataStore(dataStoreClass, keyClass, persistent, properties);
+      , Class<K> keyClass, Class<T> persistent, Configuration conf) throws GoraException
{
+    return createDataStore(dataStoreClass, keyClass, persistent, conf, properties);
   }
 
   public static <D extends DataStore<K,T>, K, T extends Persistent>
   D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, 
-      Class<T> persistent, String schemaName) throws GoraException {
-    return createDataStore(dataStoreClass, keyClass, persistent, properties, schemaName);
+      Class<T> persistent, Configuration conf, String schemaName) throws GoraException
{
+    return createDataStore(dataStoreClass, keyClass, persistent, conf, properties, schemaName);
   }
 
   public static <D extends DataStore<K,T>, K, T extends Persistent>
   D createDataStore(Class<D> dataStoreClass, Class<K> keyClass
-      , Class<T> persistent, Properties properties, String schemaName) 
+      , Class<T> persistent, Configuration conf, Properties properties, String schemaName)

   throws GoraException {
     try {
       setDefaultSchemaName(properties, schemaName);
       D dataStore =
         ReflectionUtils.newInstance(dataStoreClass);
+      if ((dataStore instanceof Configurable) && conf != null) {
+        ((Configurable)dataStore).setConf(conf);
+      }
       initializeDataStore(dataStore, keyClass, persistent, properties);
       return dataStore;
 
@@ -113,21 +118,21 @@ public class DataStoreFactory {
 
   public static <D extends DataStore<K,T>, K, T extends Persistent>
   D createDataStore(Class<D> dataStoreClass
-      , Class<K> keyClass, Class<T> persistent, Properties properties) 
+      , Class<K> keyClass, Class<T> persistent, Configuration conf, Properties
properties) 
   throws GoraException {
-    return createDataStore(dataStoreClass, keyClass, persistent, properties, null);
+    return createDataStore(dataStoreClass, keyClass, persistent, conf, properties, null);
   }
 
   @SuppressWarnings("unchecked")
   public static <D extends DataStore<K,T>, K, T extends Persistent>
   D getDataStore( Class<D> dataStoreClass, Class<K> keyClass,
-      Class<T> persistentClass) throws GoraException {
+      Class<T> persistentClass, Configuration conf) throws GoraException {
     int hash = getDataStoreKey(dataStoreClass, keyClass, persistentClass);
 
     D dataStore = (D) dataStores.get(hash);
     if(dataStore == null) {
-      dataStore = createDataStore(dataStoreClass, keyClass, persistentClass
-          , properties);
+      dataStore = createDataStore(dataStoreClass, keyClass, persistentClass,
+          conf, properties);
       dataStores.put(hash, dataStore);
     }
     return dataStore;
@@ -135,12 +140,12 @@ public class DataStoreFactory {
 
   @SuppressWarnings("unchecked")
   public static synchronized <K, T extends Persistent> DataStore<K, T> getDataStore(
-      String dataStoreClass, Class<K> keyClass, Class<T> persistentClass)
+      String dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Configuration
conf)
       throws GoraException {
     try {
       Class<? extends DataStore<K,T>> c
         = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass);
-      return getDataStore(c, keyClass, persistentClass);
+      return getDataStore(c, keyClass, persistentClass, conf);
     } catch(GoraException ex) {
       throw ex;
     } catch (Exception ex) {
@@ -150,13 +155,13 @@ public class DataStoreFactory {
 
   @SuppressWarnings({ "unchecked", "rawtypes" })
   public static synchronized DataStore getDataStore(
-      String dataStoreClass, String keyClass, String persistentClass)
+      String dataStoreClass, String keyClass, String persistentClass, Configuration conf)
     throws GoraException {
 
     try {
       Class k = Class.forName(keyClass);
       Class p = Class.forName(persistentClass);
-      return getDataStore(dataStoreClass, k, p);
+      return getDataStore(dataStoreClass, k, p, conf);
     } catch(GoraException ex) {
       throw ex;
     } catch (Exception ex) {
@@ -165,8 +170,8 @@ public class DataStoreFactory {
   }
 
   public static <K, T extends Persistent> DataStore<K, T> getDataStore(
-      Class<K> keyClass, Class<T> persistent) throws GoraException {
-    return getDataStore(defaultDataStoreClass, keyClass, persistent);
+      Class<K> keyClass, Class<T> persistent, Configuration conf) throws GoraException
{
+    return getDataStore(defaultDataStoreClass, keyClass, persistent, conf);
   }
 
   private static int getDataStoreKey(

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java (original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java Mon Sep
12 13:05:04 2011
@@ -28,6 +28,7 @@ import org.apache.gora.persistency.Persi
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.util.GoraException;
+import org.apache.hadoop.conf.Configuration;
 
 /**
  * GoraTestDriver is a helper class for third party tests.
@@ -40,6 +41,7 @@ public class GoraTestDriver {
   protected static final Log log = LogFactory.getLog(GoraTestDriver.class);
 
   protected Class<? extends DataStore> dataStoreClass;
+  protected Configuration conf = new Configuration();
 
   @SuppressWarnings("rawtypes")
   protected HashSet<DataStore> dataStores;
@@ -103,7 +105,7 @@ public class GoraTestDriver {
     createDataStore(Class<K> keyClass, Class<T> persistentClass) throws GoraException
{
     setProperties(DataStoreFactory.properties);
     DataStore<K,T> dataStore = DataStoreFactory.createDataStore(
-        (Class<? extends DataStore<K,T>>)dataStoreClass, keyClass, persistentClass);
+        (Class<? extends DataStore<K,T>>)dataStoreClass, keyClass, persistentClass,
conf);
     dataStores.add(dataStore);
 
     return dataStore;

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java
(original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java
Mon Sep 12 13:05:04 2011
@@ -34,6 +34,7 @@ import org.apache.gora.query.Result;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.DataStoreTestUtil;
+import org.apache.hadoop.conf.Configuration;
 import org.junit.Test;
 
 /**
@@ -43,6 +44,7 @@ public class TestPersistentDatumReader {
 
   private PersistentDatumReader<WebPage> webPageDatumReader 
     = new PersistentDatumReader<WebPage>();
+  private Configuration conf = new Configuration();
   
   private void testClone(Persistent persistent) throws IOException {
     Persistent cloned = webPageDatumReader.clone(persistent, persistent.getSchema());
@@ -58,7 +60,7 @@ public class TestPersistentDatumReader {
   public void testCloneEmployee() throws Exception {
     @SuppressWarnings("unchecked")
     MemStore<String, Employee> store = DataStoreFactory.getDataStore(
-        MemStore.class, String.class, Employee.class);
+        MemStore.class, String.class, Employee.class, conf);
 
     Employee employee = DataStoreTestUtil.createEmployee(store);
     
@@ -86,7 +88,7 @@ public class TestPersistentDatumReader {
   public void testCloneWebPage() throws Exception {
     @SuppressWarnings("unchecked")
     DataStore<String, WebPage> store = DataStoreFactory.createDataStore(
-        MemStore.class, String.class, WebPage.class);
+        MemStore.class, String.class, WebPage.class, conf);
     WebPageDataCreator.createWebPageData(store);
 
     Query<String, WebPage> query = store.newQuery();

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java
(original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java
Mon Sep 12 13:05:04 2011
@@ -71,7 +71,7 @@ public class TestAvroStore {
   @SuppressWarnings("unchecked")
   protected AvroStore<String, Employee> createEmployeeDataStore() throws GoraException
{
     return DataStoreFactory.getDataStore(
-        AvroStore.class, String.class, Employee.class);
+        AvroStore.class, String.class, Employee.class, conf);
   }
 
   protected AvroStore<String, WebPage> createWebPageDataStore() {

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
(original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
Mon Sep 12 13:05:04 2011
@@ -32,6 +32,7 @@ import org.apache.gora.query.Result;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.DataStoreTestUtil;
 import org.apache.gora.util.TestIOUtils;
+import org.apache.hadoop.conf.Configuration;
 import org.junit.Test;
 
 /** Test class for {@link PersistentSerialization}, {@link PersistentSerializer}
@@ -44,7 +45,7 @@ public class TestPersistentSerialization
   public void testSerdeEmployee() throws Exception {
 
     MemStore<String, Employee> store = DataStoreFactory.getDataStore(
-        MemStore.class, String.class, Employee.class);
+        MemStore.class, String.class, Employee.class, new Configuration());
 
     Employee employee = DataStoreTestUtil.createEmployee(store);
 
@@ -73,7 +74,7 @@ public class TestPersistentSerialization
   public void testSerdeWebPage() throws Exception {
 
     MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
-        MemStore.class, String.class, WebPage.class);
+        MemStore.class, String.class, WebPage.class, new Configuration());
     WebPageDataCreator.createWebPageData(store);
 
     Result<String, WebPage> result = store.newQuery().execute();

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
(original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/mock/store/MockDataStore.java
Mon Sep 12 13:05:04 2011
@@ -31,6 +31,7 @@ import org.apache.gora.query.impl.Partit
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.impl.DataStoreBase;
 import org.apache.gora.util.GoraException;
+import org.apache.hadoop.conf.Configuration;
 
 public class MockDataStore extends DataStoreBase<String, MockPersistent> {
 
@@ -41,7 +42,7 @@ public class MockDataStore extends DataS
     MockDataStore dataStore;
     try {
       dataStore = DataStoreFactory.getDataStore(MockDataStore.class
-          , String.class, MockPersistent.class);
+          , String.class, MockPersistent.class, new Configuration());
       return dataStore;
     } catch (GoraException ex) {
       throw new RuntimeException(ex);

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
(original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
Mon Sep 12 13:05:04 2011
@@ -27,6 +27,7 @@ import org.apache.gora.examples.generate
 import org.apache.gora.memory.store.MemStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.DataStoreTestUtil;
+import org.apache.hadoop.conf.Configuration;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -111,7 +112,7 @@ public class TestPersistentBase {
     //more tests for clone are in TestPersistentDatumReader
     @SuppressWarnings("unchecked")
     MemStore<String, Employee> store = DataStoreFactory.getDataStore(
-        MemStore.class, String.class, Employee.class);
+        MemStore.class, String.class, Employee.class, new Configuration());
 
     Employee employee = DataStoreTestUtil.createEmployee(store);
     

Modified: incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
(original)
+++ incubator/gora/trunk/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
Mon Sep 12 13:05:04 2011
@@ -26,26 +26,29 @@ import org.apache.gora.avro.store.DataFi
 import org.apache.gora.mock.persistency.MockPersistent;
 import org.apache.gora.mock.store.MockDataStore;
 import org.apache.gora.util.GoraException;
+import org.apache.hadoop.conf.Configuration;
 import org.junit.Before;
 import org.junit.Test;
 
 public class TestDataStoreFactory {
+  private Configuration conf;
   
   @Before
   public void setUp() {
+    conf = new Configuration();
   }
 
   @Test
   public void testGetDataStore() throws GoraException {
     DataStore<?,?> dataStore = DataStoreFactory.getDataStore("org.apache.gora.mock.store.MockDataStore"
-        , String.class, MockPersistent.class);
+        , String.class, MockPersistent.class, conf);
     Assert.assertNotNull(dataStore);
   }
   
   @Test
   public void testGetClasses() throws GoraException {
     DataStore<?,?> dataStore = DataStoreFactory.getDataStore("org.apache.gora.mock.store.MockDataStore"
-        , String.class, MockPersistent.class);
+        , String.class, MockPersistent.class, conf);
     Assert.assertNotNull(dataStore);
     Assert.assertEquals(String.class, dataStore.getKeyClass());
     Assert.assertEquals(MockPersistent.class, dataStore.getPersistentClass());
@@ -54,18 +57,18 @@ public class TestDataStoreFactory {
   @Test
   public void testGetDataStore2() throws GoraException {
     DataStore<?,?> dataStore = DataStoreFactory.getDataStore(MockDataStore.class
-        , String.class, MockPersistent.class);
+        , String.class, MockPersistent.class, conf);
     Assert.assertNotNull(dataStore);
   }
   
   @Test
   public void testGetDataStore3() throws GoraException {
     DataStore<?,?> dataStore1 = DataStoreFactory.getDataStore("org.apache.gora.mock.store.MockDataStore"
-        , Object.class, MockPersistent.class);
+        , Object.class, MockPersistent.class, conf);
     DataStore<?,?> dataStore2 = DataStoreFactory.getDataStore("org.apache.gora.mock.store.MockDataStore"
-        , Object.class, MockPersistent.class);
+        , Object.class, MockPersistent.class, conf);
     DataStore<?,?> dataStore3 = DataStoreFactory.getDataStore("org.apache.gora.mock.store.MockDataStore"
-        , String.class, MockPersistent.class);
+        , String.class, MockPersistent.class, conf);
     
     Assert.assertTrue(dataStore1 == dataStore2);
     Assert.assertNotSame(dataStore1, dataStore3);
@@ -74,7 +77,8 @@ public class TestDataStoreFactory {
   @Test
   public void testReadProperties() throws GoraException{
     //indirect testing
-    DataStore<?,?> dataStore = DataStoreFactory.getDataStore(String.class, MockPersistent.class);
+    DataStore<?,?> dataStore = DataStoreFactory.getDataStore(String.class,
+            MockPersistent.class, conf);
     Assert.assertNotNull(dataStore);
     Assert.assertEquals(MockDataStore.class, dataStore.getClass());
   }

Modified: incubator/gora/trunk/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
(original)
+++ incubator/gora/trunk/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
Mon Sep 12 13:05:04 2011
@@ -106,9 +106,9 @@ implements Configurable {
   public void initialize(Class<K> keyClass, Class<T> persistentClass,
       Properties properties) throws IOException {
     super.initialize(keyClass, persistentClass, properties);
-    this.conf = new HBaseConfiguration();
+    this.conf = HBaseConfiguration.create(getConf());
 
-    admin = new HBaseAdmin(new HBaseConfiguration(getConf()));
+    admin = new HBaseAdmin(this.conf);
 
     try {
       mapping = readMapping(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE));

Modified: incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/GoraHBaseTestDriver.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/GoraHBaseTestDriver.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/GoraHBaseTestDriver.java
(original)
+++ incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/GoraHBaseTestDriver.java
Mon Sep 12 13:05:04 2011
@@ -20,7 +20,7 @@ package org.apache.gora.hbase;
 
 import org.apache.gora.GoraTestDriver;
 import org.apache.gora.hbase.store.HBaseStore;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -74,8 +74,8 @@ public class GoraHBaseTestDriver extends
     }
   }
   
-  public HBaseConfiguration getConf() {
-      return (HBaseConfiguration)hbaseUtil.getConfiguration();
+  public Configuration  getConf() {
+      return hbaseUtil.getConfiguration();
   }
   
   public HBaseTestingUtility getHbaseUtil() {

Modified: incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/mapreduce/TestHBaseStoreMapReduce.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/mapreduce/TestHBaseStoreMapReduce.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/mapreduce/TestHBaseStoreMapReduce.java
(original)
+++ incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/mapreduce/TestHBaseStoreMapReduce.java
Mon Sep 12 13:05:04 2011
@@ -40,9 +40,9 @@ public class TestHBaseStoreMapReduce ext
   public void setUp() throws Exception {
     super.setUp();
     webPageStore = DataStoreFactory.getDataStore(
-        HBaseStore.class, String.class, WebPage.class);
+        HBaseStore.class, String.class, WebPage.class, conf);
     tokenStore = DataStoreFactory.getDataStore(HBaseStore.class, 
-        String.class, TokenDatum.class);
+        String.class, TokenDatum.class, conf);
   }
   
   @Override

Modified: incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java
(original)
+++ incubator/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java
Mon Sep 12 13:05:04 2011
@@ -30,6 +30,7 @@ import org.apache.gora.hbase.store.HBase
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.DataStoreTestBase;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -40,22 +41,30 @@ import org.apache.hadoop.hbase.util.Byte
  */
 public class TestHBaseStore extends DataStoreTestBase {
 
+  private Configuration conf;
+  
   static {
     setTestDriver(new GoraHBaseTestDriver());
   }
+  
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    conf = getTestDriver().getHbaseUtil().getConfiguration();
+  }
     
   @Override
   protected DataStore<String, Employee> createEmployeeDataStore()
       throws IOException {
     return DataStoreFactory.createDataStore(HBaseStore.class, String.class, 
-        Employee.class);
+        Employee.class, conf);
   }
 
   @Override
   protected DataStore<String, WebPage> createWebPageDataStore()
       throws IOException {
     return DataStoreFactory.createDataStore(HBaseStore.class, String.class, 
-        WebPage.class);
+        WebPage.class, conf);
   }
 
   public GoraHBaseTestDriver getTestDriver() {

Modified: incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalytics.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalytics.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalytics.java
(original)
+++ incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalytics.java
Mon Sep 12 13:05:04 2011
@@ -28,6 +28,7 @@ import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.tutorial.log.generated.MetricDatum;
 import org.apache.gora.tutorial.log.generated.Pageview;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configured;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
@@ -160,18 +161,21 @@ public class LogAnalytics extends Config
     
     DataStore<Long, Pageview> inStore;
     DataStore<String, MetricDatum> outStore;
-    
+    Configuration conf = new Configuration();    
+
     if(args.length > 0) {
       String dataStoreClass = args[0];
-      inStore = DataStoreFactory.getDataStore(dataStoreClass, Long.class, Pageview.class);
+      inStore = DataStoreFactory.
+          getDataStore(dataStoreClass, Long.class, Pageview.class, conf);
       if(args.length > 1) {
         dataStoreClass = args[1];
       }
-      outStore = DataStoreFactory.getDataStore(dataStoreClass, 
-          String.class, MetricDatum.class);
+      outStore = DataStoreFactory.
+          getDataStore(dataStoreClass, 
+			 String.class, MetricDatum.class, conf);
     } else {
-      inStore = DataStoreFactory.getDataStore(Long.class, Pageview.class);
-      outStore = DataStoreFactory.getDataStore(String.class, MetricDatum.class);
+	inStore = DataStoreFactory.getDataStore(Long.class, Pageview.class, conf);
+	outStore = DataStoreFactory.getDataStore(String.class, MetricDatum.class, conf);
     }
     
     Job job = createJob(inStore, outStore, 3);

Modified: incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
URL: http://svn.apache.org/viewvc/incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java?rev=1169727&r1=1169726&r2=1169727&view=diff
==============================================================================
--- incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
(original)
+++ incubator/gora/trunk/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogManager.java
Mon Sep 12 13:05:04 2011
@@ -32,6 +32,7 @@ import org.apache.gora.query.Result;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.tutorial.log.generated.Pageview;
+import org.apache.hadoop.conf.Configuration;
 
 /**
  * LogManager is the tutorial class to illustrate the basic 
@@ -68,7 +69,8 @@ public class LogManager {
     //Data store objects are created from a factory. It is necessary to 
     //provide the key and value class. The datastore class is optional, 
     //and if not specified it will be read from the properties file
-    dataStore = DataStoreFactory.getDataStore(Long.class, Pageview.class);
+    dataStore = DataStoreFactory.getDataStore(Long.class, Pageview.class,
+            new Configuration());
   }
   
   /**



Mime
View raw message