gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject svn commit: r1356215 [2/3] - in /gora/branches/goraamazon: ./ gora-accumulo/src/main/java/org/apache/gora/accumulo/query/ gora-accumulo/src/main/java/org/apache/gora/accumulo/store/ gora-cassandra/src/main/java/org/apache/gora/cassandra/query/ gora-cas...
Date Mon, 02 Jul 2012 13:39:02 GMT
Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/PartitionWSQueryImpl.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/PartitionWSQueryImpl.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/PartitionWSQueryImpl.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/PartitionWSQueryImpl.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,158 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.query.ws.impl;
+
+import java.util.Arrays;
+
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.query.PartitionQuery;
+import org.apache.gora.query.Query;
+import org.apache.gora.store.DataStore;
+
+/**
+ * Implementation for {@link PartitionQuery}.
+ */
+public class PartitionWSQueryImpl<K, T extends Persistent>
+  extends QueryWSBase<K, T> implements PartitionQuery<K, T> {
+
+  protected Query<K, T> baseQuery;
+  protected String[] locations;
+
+  public PartitionWSQueryImpl() {
+    super(null);
+  }
+
+  public PartitionWSQueryImpl(Query<K, T> baseQuery, String... locations) {
+    this(baseQuery, null, null, locations);
+  }
+
+  public PartitionWSQueryImpl(Query<K, T> baseQuery, K startKey, K endKey,
+      String... locations) {
+    super(baseQuery.getDataStore());
+    this.baseQuery = baseQuery;
+    this.locations = locations;
+    setStartKey(startKey);
+    setEndKey(endKey);
+    this.dataStore = baseQuery.getDataStore();
+  }
+
+  @Override
+public String[] getLocations() {
+    return locations;
+  }
+
+  public Query<K, T> getBaseQuery() {
+    return baseQuery;
+  }
+
+  /* Override everything except start-key/end-key */
+
+  @Override
+  public String[] getFields() {
+    return baseQuery.getFields();
+  }
+
+  @Override
+  public DataStore<K, T> getDataStore() {
+    return baseQuery.getDataStore();
+  }
+
+  @Override
+  public long getTimestamp() {
+    return baseQuery.getTimestamp();
+  }
+
+  @Override
+  public long getStartTime() {
+    return baseQuery.getStartTime();
+  }
+
+  @Override
+  public long getEndTime() {
+    return baseQuery.getEndTime();
+  }
+
+  @Override
+  public long getLimit() {
+    return baseQuery.getLimit();
+  }
+
+  @Override
+  public void setFields(String... fields) {
+    baseQuery.setFields(fields);
+  }
+
+  @Override
+  public void setTimestamp(long timestamp) {
+    baseQuery.setTimestamp(timestamp);
+  }
+
+  @Override
+  public void setStartTime(long startTime) {
+    baseQuery.setStartTime(startTime);
+  }
+
+  @Override
+  public void setEndTime(long endTime) {
+    baseQuery.setEndTime(endTime);
+  }
+
+  @Override
+  public void setTimeRange(long startTime, long endTime) {
+    baseQuery.setTimeRange(startTime, endTime);
+  }
+
+  @Override
+  public void setLimit(long limit) {
+    baseQuery.setLimit(limit);
+  }
+
+  /*@Override
+  public void write(DataOutput out) throws IOException {
+    super.write(out);
+    IOUtils.serialize(null, out, baseQuery);
+    IOUtils.writeStringArray(out, locations);
+  }*/
+
+  /*@Override
+  public void readFields(DataInput in) throws IOException {
+    super.readFields(in);
+    try {
+      baseQuery = IOUtils.deserialize(null, in, null);
+    } catch (ClassNotFoundException ex) {
+      throw new IOException(ex);
+    }
+    locations = IOUtils.readStringArray(in);
+    //we should override the data store as basequery's data store
+    //also we may not call super.readFields so that temporary this.dataStore
+    //is not created at all
+    this.dataStore = baseQuery.getDataStore();
+  }*/
+
+  @Override
+  @SuppressWarnings({ "rawtypes" })
+  public boolean equals(Object obj) {
+    if(obj instanceof PartitionWSQueryImpl) {
+      PartitionWSQueryImpl that = (PartitionWSQueryImpl) obj;
+      return this.baseQuery.equals(that.baseQuery)
+        && Arrays.equals(locations, that.locations);
+    }
+    return false;
+  }
+}

Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/QueryWSBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/QueryWSBase.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/QueryWSBase.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/QueryWSBase.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,310 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.query.ws.impl;
+
+//import org.apache.commons.lang.builder.EqualsBuilder;
+//import org.apache.commons.lang.builder.HashCodeBuilder;
+//import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.query.Query;
+import org.apache.gora.query.Result;
+import org.apache.gora.store.DataStore;
+
+/**
+ * Base class for Query implementations.
+ */
+public abstract class QueryWSBase<K, T extends Persistent> 
+implements Query<K,T>{
+	
+  protected DataStore<K,T> dataStore;
+
+  protected String queryString;
+  protected String[] fields;
+
+  protected K startKey;
+  protected K endKey;
+
+  protected long startTime = -1;
+  protected long endTime = -1;
+
+  protected String filter;
+
+  protected long limit = -1;
+
+  protected boolean isCompiled = false;
+
+  /** Object that will hold user's authentication tokens for webservice database */
+  private Object authentication;
+
+  public QueryWSBase(DataStore<K,T> dataStore) {
+    this.dataStore = dataStore;
+  }
+
+  @Override
+  public Result<K,T> execute() throws Exception {
+    //compile();
+    return dataStore.execute(this);
+  }
+
+//  @Override
+//  public void compile() {
+//    if(!isCompiled) {
+//      isCompiled = true;
+//    }
+//  }
+
+  @Override
+  public void setDataStore(DataStore<K, T> dataStore) {
+    this.dataStore = dataStore;
+  }
+
+  @Override
+  public DataStore<K, T> getDataStore() {
+    return dataStore;
+  }
+
+//  @Override
+//  public void setQueryString(String queryString) {
+//    this.queryString = queryString;
+//  }
+//
+//  @Override
+//  public String getQueryString() {
+//    return queryString;
+//  }
+
+  @Override
+  public void setFields(String... fields) {
+    this.fields = fields;
+  }
+
+  @Override
+public String[] getFields() {
+    return fields;
+  }
+
+  @Override
+  public void setKey(K key) {
+    setKeyRange(key, key);
+  }
+
+  @Override
+  public void setStartKey(K startKey) {
+    this.startKey = startKey;
+  }
+
+  @Override
+  public void setEndKey(K endKey) {
+    this.endKey = endKey;
+  }
+
+  @Override
+  public void setKeyRange(K startKey, K endKey) {
+    this.startKey = startKey;
+    this.endKey = endKey;
+  }
+
+  @Override
+  public K getKey() {
+    if(startKey == endKey) {
+      return startKey; //address comparison
+    }
+    return null;
+  }
+
+  @Override
+  public K getStartKey() {
+    return startKey;
+  }
+
+  @Override
+  public K getEndKey() {
+    return endKey;
+  }
+
+  @Override
+  public void setTimestamp(long timestamp) {
+    setTimeRange(timestamp, timestamp);
+  }
+
+  @Override
+  public void setStartTime(long startTime) {
+    this.startTime = startTime;
+  }
+
+  @Override
+  public void setEndTime(long endTime) {
+    this.endTime = endTime;
+  }
+
+  @Override
+  public void setTimeRange(long startTime, long endTime) {
+    this.startTime = startTime;
+    this.endTime = endTime;
+  }
+
+  @Override
+  public long getTimestamp() {
+    return startTime == endTime ? startTime : -1;
+  }
+
+  @Override
+  public long getStartTime() {
+    return startTime;
+  }
+
+  @Override
+  public long getEndTime() {
+    return endTime;
+  }
+
+//  @Override
+//  public void setFilter(String filter) {
+//    this.filter = filter;
+//  }
+//
+//  @Override
+//  public String getFilter() {
+//    return filter;
+//  }
+
+  @Override
+  public void setLimit(long limit) {
+    this.limit = limit;
+  }
+
+  @Override
+  public long getLimit() {
+    return limit;
+  }
+
+  public Object getConf() {
+    return authentication;
+  }
+
+  public void setConf(Object auth) {
+    this.authentication = auth;
+  }
+
+ 
+  /*@SuppressWarnings("unchecked")
+  public void readFields(DataInput in) throws IOException {
+    String dataStoreClass = Text.readString(in);
+    try {
+      dataStore = (DataStore<K, T>) ReflectionUtils.newInstance(ClassLoadingUtils.loadClass(dataStoreClass), conf);
+      dataStore.readFields(in);
+    } catch (ClassNotFoundException ex) {
+      throw new IOException(ex);
+    }
+
+    boolean[] nullFields = IOUtils.readNullFieldsInfo(in);
+
+    if(!nullFields[0])
+      queryString = Text.readString(in);
+    if(!nullFields[1])
+      fields = IOUtils.readStringArray(in);
+    if(!nullFields[2])
+      startKey = IOUtils.deserialize(null, in, null, dataStore.getKeyClass());
+    if(!nullFields[3])
+      endKey = IOUtils.deserialize(null, in, null, dataStore.getKeyClass());
+    if(!nullFields[4])
+      filter = Text.readString(in);
+
+    startTime = WritableUtils.readVLong(in);
+    endTime = WritableUtils.readVLong(in);
+    limit = WritableUtils.readVLong(in);
+  }*/
+
+ /* public void write(DataOutput out) throws IOException {
+    //write datastore
+    Text.writeString(out, dataStore.getClass().getCanonicalName());
+    dataStore.write(out);
+
+    IOUtils.writeNullFieldsInfo(out, queryString, (fields)
+        , startKey, endKey, filter);
+
+    if(queryString != null)
+      Text.writeString(out, queryString);
+    if(fields != null)
+      IOUtils.writeStringArray(out, fields);
+    if(startKey != null)
+      IOUtils.serialize(getConf(), out, startKey, dataStore.getKeyClass());
+    if(endKey != null)
+      IOUtils.serialize(getConf(), out, endKey, dataStore.getKeyClass());
+    if(filter != null)
+      Text.writeString(out, filter);
+
+    WritableUtils.writeVLong(out, getStartTime());
+    WritableUtils.writeVLong(out, getEndTime());
+    WritableUtils.writeVLong(out, getLimit());
+  }*/
+
+  @SuppressWarnings({ "rawtypes" })
+  @Override
+  public boolean equals(Object obj) {
+    if(obj instanceof QueryWSBase) {
+      QueryWSBase that = (QueryWSBase) obj;
+      /*EqualsBuilder builder = new EqualsBuilder();
+      builder.append(dataStore, that.dataStore);
+      builder.append(queryString, that.queryString);
+      builder.append(fields, that.fields);
+      builder.append(startKey, that.startKey);
+      builder.append(endKey, that.endKey);
+      builder.append(filter, that.filter);
+      builder.append(limit, that.limit);
+      return builder.isEquals();
+      */
+      if(that!=null)
+    	  return true;
+    }
+    return false;
+  }
+
+  @Override
+  public int hashCode() {
+    /*
+    HashCodeBuilder builder = new HashCodeBuilder();
+    builder.append(dataStore);
+    builder.append(queryString);
+    builder.append(fields);
+    builder.append(startKey);
+    builder.append(endKey);
+    builder.append(filter);
+    builder.append(limit);
+    return builder.toHashCode();
+    */
+	  return 0;
+  }
+
+  @Override
+  public String toString() {
+    /*
+    ToStringBuilder builder = new ToStringBuilder(this);
+    builder.append("dataStore", dataStore);
+    builder.append("fields", fields);
+    builder.append("startKey", startKey);
+    builder.append("endKey", endKey);
+    builder.append("filter", filter);
+    builder.append("limit", limit);
+
+    return builder.toString();
+    */
+    return "";
+  }
+}

Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.query.ws.impl;
+
+import java.io.IOException;
+
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.query.Query;
+import org.apache.gora.query.Result;
+import org.apache.gora.store.DataStore;
+
+/**
+ * Base class for {@link Result} implementations.
+ */
+public abstract class ResultWSBase<K, T extends Persistent> 
+  implements Result<K, T> {
+
+  protected final DataStore<K,T> dataStore;
+  
+  protected final Query<K, T> query;
+  
+  protected K key;
+  
+  protected T persistent;
+  
+  /** Query limit */
+  protected long limit;
+  
+  /** How far we have proceeded*/
+  protected long offset = 0;
+  
+  public ResultWSBase(DataStore<K,T> dataStore, Query<K,T> query) {
+    this.dataStore = dataStore;
+    this.query = query;
+    this.limit = query.getLimit();
+  }
+  
+  @Override
+  public DataStore<K, T> getDataStore() {
+    return dataStore;
+  }
+  
+  @Override
+  public Query<K, T> getQuery() {
+    return query;
+  }
+  
+  @Override
+  public T get() {
+    return persistent;
+  }
+  
+  @Override
+  public K getKey() {
+    return key;
+  }
+    
+  @Override
+  public Class<K> getKeyClass() {
+    return getDataStore().getKeyClass();
+  }
+  
+  @Override
+  public Class<T> getPersistentClass() {
+    return getDataStore().getPersistentClass();
+  }
+  
+  /**
+   * Returns whether the limit for the query is reached. 
+   */
+  protected boolean isLimitReached() {
+    if(limit > 0 && offset >= limit) {
+      return true;
+    }
+    return false;
+  }
+  
+  protected void clear() {
+    if(persistent != null) {
+      persistent.clear();
+    }
+    if(key != null && key instanceof Persistent) {
+      ((Persistent)key).clear();
+    }
+  }
+  
+  @Override
+  public final boolean next() throws Exception {
+	  if(isLimitReached()) {
+		  return false;
+	  }
+	    
+	  clear();
+    
+	  persistent = getOrCreatePersistent(persistent);
+	  boolean ret = nextInner();
+	  
+	  if(ret) ++offset;
+	  return ret;
+  }
+  
+  @Override
+  public long getOffset() {
+    return offset;
+  }
+  
+  /**
+   * {@link ResultWSBase#next()} calls this function to read the 
+   * actual results. 
+   */
+  protected abstract boolean nextInner() throws Exception; 
+  
+  protected T getOrCreatePersistent(T persistent) throws Exception, IOException {
+	  if(persistent != null) {
+			return persistent;
+		}
+		return dataStore.newPersistent();
+  }
+}

Modified: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStore.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStore.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStore.java (original)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStore.java Mon Jul  2 13:38:43 2012
@@ -17,9 +17,6 @@
  */
 package org.apache.gora.store;
 
-import java.io.Closeable;
-import java.io.DataInput;
-import java.io.DataOutput;
 import java.io.IOException;
 import java.util.List;
 import java.util.Properties;
@@ -29,9 +26,6 @@ import org.apache.gora.persistency.Persi
 import org.apache.gora.query.PartitionQuery;
 import org.apache.gora.query.Query;
 import org.apache.gora.query.Result;
-import org.apache.hadoop.conf.Configurable;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
 
 /**
  * DataStore handles actual object persistence. Objects can be persisted,
@@ -46,18 +40,17 @@ import org.apache.hadoop.io.Writable;
  * @param <K> the class of keys in the datastore
  * @param <T> the class of persistent objects in the datastore
  */
-public interface DataStore<K, T extends Persistent> extends Closeable,
-  Writable, Configurable {
+public interface DataStore<K, T> {
 
   /**
    * Initializes this DataStore.
    * @param keyClass the class of the keys
    * @param persistentClass the class of the persistent objects
    * @param properties extra metadata
-   * @throws IOException
+   * @throws Exception
    */
   void initialize(Class<K> keyClass, Class<T> persistentClass,
-      Properties properties) throws IOException;
+      Properties properties) throws Exception;
 
   /**
    * Sets the class of the keys
@@ -95,26 +88,26 @@ public interface DataStore<K, T extends 
    * or the underlying data model does not support
    * or need this operation, the operation is ignored.
    */
-  void createSchema() throws IOException;
+  void createSchema() throws Exception;
 
   /**
    * Deletes the underlying schema or table (or similar) in the datastore
    * that holds the objects. This also deletes all the data associated with
    * the schema.
    */
-  void deleteSchema() throws IOException;
+  void deleteSchema() throws Exception;
 
   /**
    * Deletes all the data associated with the schema, but keeps the
    * schema (table or similar) intact.
    */
-  void truncateSchema() throws IOException;
+  void truncateSchema() throws Exception;
 
   /**
    * Returns whether the schema that holds the data exists in the datastore.
    * @return whether schema exists
    */
-  boolean schemaExists() throws IOException;
+  boolean schemaExists() throws Exception;
 
   /**
    * Returns a new instance of the key object. If the object cannot be instantiated 
@@ -123,20 +116,20 @@ public interface DataStore<K, T extends 
    * make sure that the key class has a no-arg constructor.   
    * @return a new instance of the key object.
    */
-  K newKey() throws IOException;
+  K newKey() throws Exception;
 
   /**
    * Returns a new instance of the managed persistent object.
    * @return a new instance of the managed persistent object.
    */
-  T newPersistent() throws IOException;
+  T newPersistent() throws Exception;
 
   /**
    * Returns the object corresponding to the given key fetching all the fields.
    * @param key the key of the object
    * @return the Object corresponding to the key or null if it cannot be found
    */
-  T get(K key) throws IOException;
+  T get(K key) throws Exception;
 
   /**
    * Returns the object corresponding to the given key.
@@ -144,7 +137,7 @@ public interface DataStore<K, T extends 
    * @param fields the fields required in the object. Pass null, to retrieve all fields
    * @return the Object corresponding to the key or null if it cannot be found
    */
-  T get(K key, String[] fields) throws IOException;
+  T get(K key, String[] fields) throws Exception;
 
   /**
    * Inserts the persistent object with the given key. If an 
@@ -152,14 +145,14 @@ public interface DataStore<K, T extends 
    * be replaced. See also the note on 
    * <a href="#visibility">visibility</a>.
    */
-  void put(K key, T obj) throws IOException;
+  void put(K key, T obj) throws Exception;
 
   /**
    * Deletes the object with the given key
    * @param key the key of the object
    * @return whether the object was successfully deleted
    */
-  boolean delete(K key) throws IOException;
+  boolean delete(K key) throws Exception;
 
   /**
    * Deletes all the objects matching the query.
@@ -167,14 +160,14 @@ public interface DataStore<K, T extends 
    * @param query matching records to this query will be deleted
    * @return number of deleted records
    */
-  long deleteByQuery(Query<K, T> query) throws IOException;
+  long deleteByQuery(Query<K, T> query) throws Exception;
 
   /**
    * Executes the given query and returns the results.
    * @param query the query to execute.
    * @return the results as a {@link Result} object.
    */
-  Result<K,T> execute(Query<K, T> query) throws IOException;
+  Result<K,T> execute(Query<K, T> query) throws Exception;
 
   /**
    * Constructs and returns a new Query.
@@ -189,9 +182,9 @@ public interface DataStore<K, T extends 
    * is null, then the data store returns the partitions for the default query
    * (returning every object)
    * @return a List of PartitionQuery's
+   * @throws IOException 
    */
-  List<PartitionQuery<K,T>> getPartitions(Query<K,T> query)
-    throws IOException;
+  List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException;
 
   /**
    * Forces the write caches to be flushed. DataStore implementations may
@@ -199,7 +192,7 @@ public interface DataStore<K, T extends 
    * until this moment.
    * See also the note on <a href="#visibility">visibility</a>.
    */
-  void flush() throws IOException;
+  void flush() throws Exception;
 
   /**
    * Sets the {@link BeanFactory} to use by the DataStore.
@@ -219,14 +212,10 @@ public interface DataStore<K, T extends 
    * All other DataStore methods cannot be used after this
    * method was called. Subsequent calls of this method are ignored.
    */
-  void close() throws IOException;
+  void close()  throws IOException, InterruptedException, Exception;
 
-  Configuration getConf();
-
-  void setConf(Configuration conf);
-
-  void readFields(DataInput in) throws IOException;
-
-  void write(DataOutput out) throws IOException;
+  //void readFields() throws Exception;
+  
+  //void write() throws IOException;
 
 }

Modified: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java (original)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java Mon Jul  2 13:38:43 2012
@@ -34,7 +34,7 @@ import org.apache.hadoop.conf.Configurat
 /**
  * A Factory for {@link DataStore}s. DataStoreFactory instances are thread-safe.
  */
-public class DataStoreFactory {
+public class DataStoreFactory{
 
   public static final Logger log = LoggerFactory.getLogger(DataStoreFactory.class);
 
@@ -98,7 +98,7 @@ public class DataStoreFactory {
 
   private static <K, T extends Persistent> void initializeDataStore(
       DataStore<K, T> dataStore, Class<K> keyClass, Class<T> persistent,
-      Properties properties) throws IOException {
+      Properties properties) throws IOException, Exception {
     dataStore.initialize(keyClass, persistent, properties);
   }
 

Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/WebServiceBackedDataStore.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/WebServiceBackedDataStore.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/WebServiceBackedDataStore.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/WebServiceBackedDataStore.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.store;
+
+import org.apache.gora.persistency.Persistent;
+
+/** FileBackedDataStore supplies necessary interfaces to set input 
+ * and output paths for data stored which are file based.   
+ */
+public interface WebServiceBackedDataStore<K, T extends Persistent> extends DataStore<K, T> {
+
+  void setProvider(String provider);
+  
+  String getProvider();
+  
+}

Modified: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java (original)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java Mon Jul  2 13:38:43 2012
@@ -18,6 +18,7 @@
 
 package org.apache.gora.store.impl;
 
+import java.io.Closeable;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
@@ -31,8 +32,8 @@ import org.apache.commons.lang.builder.E
 import org.apache.gora.avro.PersistentDatumReader;
 import org.apache.gora.avro.PersistentDatumWriter;
 import org.apache.gora.persistency.BeanFactory;
-import org.apache.gora.persistency.Persistent;
 import org.apache.gora.persistency.impl.BeanFactoryImpl;
+import org.apache.gora.persistency.impl.PersistentBase;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.util.AvroUtils;
@@ -40,16 +41,17 @@ 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.conf.Configurable;
 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.
+ * A Base class for Avro persistent {@link DataStore}s.
  */
-public abstract class DataStoreBase<K, T extends Persistent>
-implements DataStore<K, T> {
-
+public abstract class DataStoreBase<K, T extends PersistentBase>
+implements DataStore<K, T>, Configurable, Writable, Closeable {
+	
   protected BeanFactory<K, T> beanFactory;
 
   protected Class<K> keyClass;
@@ -141,7 +143,7 @@ implements DataStore<K, T> {
   }
 
   @Override
-  public T get(K key) throws IOException {
+  public T get(K key) throws IOException, Exception {
     return get(key, getFieldsToQuery(null));
   };
 
@@ -174,7 +176,7 @@ implements DataStore<K, T> {
     return conf;
   }
 
-  @Override
+  //@Override
   @SuppressWarnings("unchecked")
   public void readFields(DataInput in) throws IOException {
     try {
@@ -187,7 +189,7 @@ implements DataStore<K, T> {
     }
   }
 
-  @Override
+  //@Override
   public void write(DataOutput out) throws IOException {
     Text.writeString(out, getKeyClass().getCanonicalName());
     Text.writeString(out, getPersistentClass().getCanonicalName());
@@ -209,7 +211,7 @@ implements DataStore<K, T> {
 
   @Override
   /** Default implementation deletes and recreates the schema*/
-  public void truncateSchema() throws IOException {
+  public void truncateSchema() throws IOException, Exception {
     deleteSchema();
     createSchema();
   }

Modified: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/FileBackedDataStoreBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/FileBackedDataStoreBase.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/FileBackedDataStoreBase.java (original)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/impl/FileBackedDataStoreBase.java Mon Jul  2 13:38:43 2012
@@ -28,7 +28,7 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.gora.mapreduce.GoraMapReduceUtils;
-import org.apache.gora.persistency.Persistent;
+import org.apache.gora.persistency.impl.PersistentBase;
 import org.apache.gora.query.PartitionQuery;
 import org.apache.gora.query.Query;
 import org.apache.gora.query.Result;
@@ -46,7 +46,7 @@ import org.apache.hadoop.mapreduce.lib.i
 /**
  * Base implementations for {@link FileBackedDataStore} methods.
  */
-public abstract class FileBackedDataStoreBase<K, T extends Persistent>
+public abstract class FileBackedDataStoreBase<K, T extends PersistentBase>
   extends DataStoreBase<K, T> implements FileBackedDataStore<K, T> {
 
   protected long inputSize; //input size in bytes

Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSBackedDataStoreBase.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.store.ws.impl;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.query.Query;
+import org.apache.gora.query.Result;
+import org.apache.gora.store.FileBackedDataStore;
+import org.apache.gora.store.WebServiceBackedDataStore;
+import org.apache.gora.util.OperationNotSupportedException;
+
+/**
+ * Base implementations for {@link FileBackedDataStore} methods.
+ */
+public abstract class WSBackedDataStoreBase<K, T extends Persistent>
+  extends WSDataStoreBase<K, T> implements WebServiceBackedDataStore<K, T> {
+
+  @Override
+  public void initialize(Class<K> keyClass, Class<T> persistentClass,
+      Properties properties) throws Exception {
+    super.initialize(keyClass, persistentClass, properties);
+    //if(properties != null) {
+    //}
+  }
+  @Override
+  public Result<K, T> execute(Query<K, T> query) throws Exception {
+   /* if(query instanceof PartitionWSQueryImpl) {
+        return executePartial((FileSplitPartitionQuery<K, T>) query);
+    } else {*/
+      return executeQuery(query);
+    //}
+  }
+
+  /**
+   * Executes a normal Query reading the whole data. #execute() calls this function
+   * for non-PartitionQuery's.
+   */
+  protected abstract Result<K,T> executeQuery(Query<K,T> query)
+    throws Exception;
+
+  /**
+   * Executes a PartitialQuery, reading the data between start and end.
+   */
+  //protected abstract Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query)
+  //  throws Exception;
+
+  @Override
+  public void flush() throws Exception {
+  }
+
+  @Override
+  public void createSchema() throws Exception{
+  }
+
+  @Override
+  public void deleteSchema() throws Exception {
+    throw new OperationNotSupportedException("delete schema is not supported for " +
+    		"file backed data stores");
+  }
+
+  @Override
+  public boolean schemaExists() throws Exception {
+    return true;
+  }
+
+  @Override
+  public void write(Object out) throws Exception {
+    super.write(out);
+    //if(wsProvider != null)
+      // make write request
+    
+  }
+
+  @Override
+  public void readFields(Object in) throws Exception {
+    super.readFields(in);
+    //if(wsProvider != null)
+    // make read request
+  }
+
+  // TODO this could be close connection
+  @Override
+  public void close() throws IOException, InterruptedException, Exception {
+  }
+}

Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreBase.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreBase.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreBase.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,220 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.store.ws.impl;
+
+import java.util.Properties;
+
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.store.DataStore;
+import org.apache.gora.util.StringUtils;
+
+/**
+ * A Base class for Avro persistent {@link DataStore}s.
+ */
+public abstract class WSDataStoreBase<K, T extends Persistent>
+implements DataStore<K, T>{
+	
+  //protected BeanFactory<K, T> beanFactory;
+
+  protected Class<K> keyClass;
+  protected Class<T> persistentClass;
+
+  /** The web service provider's name*/
+  private String wsProvider;
+
+  /** A map of field names to Field objects containing schema's fields 
+  protected Map<String, Field> fieldMap; */
+
+  /** The authentication object to be used for our provider*/
+  protected Object authentication;
+
+  /** Properties object */
+  protected Properties properties;
+  
+  //TODO see if a webservice database will have these persistent datums
+  //protected PersistentDatumReader<T> datumReader;
+  //protected PersistentDatumWriter<T> datumWriter;
+
+  public WSDataStoreBase() {
+  }
+
+  @Override
+  public void initialize(Class<K> keyClass, Class<T> persistentClass,
+      Properties properties) throws Exception {
+    setKeyClass(keyClass);
+    setPersistentClass(persistentClass);
+    //TODO See if we need to create a factory to manage our beans
+    //if(this.beanFactory == null)
+    //  this.beanFactory = new BeanFactoryImpl<K, T>(keyClass, persistentClass);
+  }
+
+  @Override
+  public void setPersistentClass(Class<T> persistentClass) {
+    this.persistentClass = persistentClass;
+  }
+
+  @Override
+  public Class<T> getPersistentClass() {
+    return persistentClass;
+  }
+
+  @Override
+  public Class<K> getKeyClass() {
+    return keyClass;
+  }
+
+  @Override
+  public void setKeyClass(Class<K> keyClass) {
+    if(keyClass != null)
+      this.keyClass = keyClass;
+  }
+  /*
+  @Override
+  public K newKey() throws IOException {
+    try {
+      return beanFactory.newKey();
+    } catch (Exception ex) {
+      throw new IOException(ex);
+    }
+  }
+
+  @Override
+  public T newPersistent() throws IOException {
+    try {
+      return beanFactory.newPersistent();
+    } catch (Exception ex) {
+      throw new IOException(ex);
+    }
+  }
+
+  @Override
+  public void setBeanFactory(BeanFactory<K, T> beanFactory) {
+    this.beanFactory = beanFactory;
+  }
+
+  @Override
+  public BeanFactory<K, T> getBeanFactory() {
+    return beanFactory;
+  }
+
+  @Override
+  public T get(K key) throws Exception {
+    return get(key, getFieldsToQuery(null));
+  };
+*/
+  /**
+   * Checks whether the fields argument is null, and if so
+   * returns all the fields of the Persistent object, else returns the
+   * argument.
+   */
+  /*protected String[] getFieldsToQuery(String[] fields) {
+    if(fields != null) {
+      return fields;
+    }
+    return beanFactory.getCachedPersistent().getFields();
+  }*/
+
+  /**
+   * Gets the configuration (authentication) object
+   * @return Object containing the authentication values
+   */
+  public Object getConf() {
+    return authentication;
+  }
+  
+  /**
+   * Sets the configuration (authentication) object
+   */
+  public void setConf(Object auth) {
+    this.authentication = auth;
+  }
+
+  //@Override
+  //@SuppressWarnings("unchecked")
+  public void readFields(Object in) throws Exception {
+  /*  try {
+      Class<K> keyClass = (Class<K>) ClassLoadingUtils.loadClass(Text.readString(in));
+      Class<T> persistentClass = (Class<T>)ClassLoadingUtils.loadClass(Text.readString(in));
+      Properties props = WritableUtils.readProperties(in);
+      initialize(keyClass, persistentClass, props);
+    } catch (ClassNotFoundException ex) {
+      throw new IOException(ex);
+    }
+    */
+  }
+
+  //@Override
+  public void write(Object obj) throws Exception {
+    /*Text.writeString(out, getKeyClass().getCanonicalName());
+    Text.writeString(out, getPersistentClass().getCanonicalName());
+    WritableUtils.writeProperties(out, properties);
+    */
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if(obj instanceof WSDataStoreBase) {
+      @SuppressWarnings("rawtypes")
+	  WSDataStoreBase that = (WSDataStoreBase) obj;
+      return that.equals(obj);
+     /* EqualsBuilder builder = new EqualsBuilder();
+      builder.append(this.keyClass, that.keyClass);
+      builder.append(this.persistentClass, that.persistentClass);
+      return builder.isEquals();*/
+    }
+    return false;
+  }
+
+  @Override
+  /** Default implementation deletes and recreates the schema*/
+  public void truncateSchema() throws Exception {
+    deleteSchema();
+    createSchema();
+  }
+
+  /**
+   * 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 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 schemaName = WSDataStoreFactory.getDefaultSchemaName(properties, this);
+    if(schemaName != null) {
+      return schemaName;
+    }
+
+    if(mappingSchemaName != null) {
+      return mappingSchemaName;
+    }
+
+    return StringUtils.getClassname(persistentClass);
+  }
+
+  public String getWSProvider() {
+	return wsProvider;
+  }
+
+  public void setWsProvider(String wsProvider) {
+	this.wsProvider = wsProvider;
+  }
+}

Added: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreFactory.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreFactory.java?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreFactory.java (added)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreFactory.java Mon Jul  2 13:38:43 2012
@@ -0,0 +1,427 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gora.store.ws.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.store.DataStore;
+import org.apache.gora.util.ClassLoadingUtils;
+import org.apache.gora.util.GoraException;
+import org.apache.gora.util.ReflectionUtils;
+
+/**
+ * A Factory for {@link DataStore}s. DataStoreFactory instances are thread-safe.
+ */
+public class WSDataStoreFactory{
+
+  public static final Logger log = LoggerFactory.getLogger(WSDataStoreFactory.class);
+
+  public static final String GORA_DEFAULT_PROPERTIES_FILE = "gora.properties";
+
+  public static final String GORA_DEFAULT_DATASTORE_KEY = "gora.datastore.default";
+
+  public static final String GORA = "gora";
+
+  public static final String DATASTORE = "datastore";
+
+  private static final String GORA_DATASTORE = GORA + "." + DATASTORE + ".";
+
+  public static final String AUTO_CREATE_SCHEMA = "autocreateschema";
+
+  public static final String INPUT_PATH  = "input.path";
+
+  public static final String OUTPUT_PATH = "output.path";
+
+  public static final String MAPPING_FILE = "mapping.file";
+
+	public static final String SCHEMA_NAME = "schema.name";
+
+  /**
+   * Do not use! Deprecated because it shares system wide state. 
+   * Use {@link #createProps()} instead.
+   */
+  @Deprecated()
+  public static final Properties properties = createProps();
+  
+  /**
+   * Creates a new {@link Properties}. It adds the default gora configuration
+   * resources. This properties object can be modified and used to instantiate
+   * store instances. It is recommended to use a properties object for a single
+   * store, because the properties object is passed on to store initialization
+   * methods that are able to store the properties as a field.   
+   * @return The new properties object.
+   */
+  public static Properties createProps() {
+    try {
+    Properties properties = new Properties();
+      InputStream stream = WSDataStoreFactory.class.getClassLoader()
+        .getResourceAsStream(GORA_DEFAULT_PROPERTIES_FILE);
+      if(stream != null) {
+        try {
+          properties.load(stream);
+          return properties;
+        } finally {
+          stream.close();
+        }
+      } else {
+        log.warn(GORA_DEFAULT_PROPERTIES_FILE + " not found, properties will be empty.");
+      }
+      return properties;
+    } catch(Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private WSDataStoreFactory() { }
+
+  private static <K, T extends Persistent> void initializeDataStore(
+      DataStore<K, T> dataStore, Class<K> keyClass, Class<T> persistent,
+      Properties properties) throws IOException, Exception {
+    dataStore.initialize(keyClass, persistent, properties);
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema.
+   * 
+   * @param dataStoreClass The datastore implementation class.
+   * @param keyClass The key class.
+   * @param persistent The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  public static <D extends DataStore<K,T>, K, T extends Persistent>
+  D createDataStore(Class<D> dataStoreClass
+      , Class<K> keyClass, Class<T> persistent, Object auth) throws GoraException {
+    return createDataStore(dataStoreClass, keyClass, persistent, auth, createProps(), null);
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}. Uses default properties.
+   * 
+   * @param dataStoreClass The datastore implementation class.
+   * @param keyClass The key class.
+   * @param persistent The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @param schemaName A default schemaname that will be put on the properties.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  public static <D extends DataStore<K,T>, K, T extends Persistent>
+  D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, 
+      Class<T> persistent, Object auth, String schemaName) throws GoraException {
+    return createDataStore(dataStoreClass, keyClass, persistent, auth, createProps(), schemaName);
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}.
+   * 
+   * @param dataStoreClass The datastore implementation class.
+   * @param keyClass The key class.
+   * @param persistent The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @param properties The properties to be used be the store.
+   * @param schemaName A default schemaname that will be put on the properties.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  public static <D extends DataStore<K,T>, K, T extends Persistent>
+  D createDataStore(Class<D> dataStoreClass, Class<K> keyClass
+      , Class<T> persistent, Object auth, Properties properties, String schemaName) 
+  throws GoraException {
+    try {
+      setDefaultSchemaName(properties, schemaName);
+      D dataStore =
+        ReflectionUtils.newInstance(dataStoreClass);
+      if ( auth != null) {
+        ((WSDataStoreBase<K, Persistent>)dataStore).setConf(auth);
+      }
+      initializeDataStore(dataStore, keyClass, persistent, properties);
+      return dataStore;
+
+    } catch (GoraException ex) {
+      throw ex;
+    } catch(Exception ex) {
+      throw new GoraException(ex);
+    }
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}. Uses 'null' schema.
+   * 
+   * @param dataStoreClass The datastore implementation class.
+   * @param keyClass The key class.
+   * @param persistent The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @param properties The properties to be used be the store.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  public static <D extends DataStore<K,T>, K, T extends Persistent>
+  D createDataStore(Class<D> dataStoreClass
+      , Class<K> keyClass, Class<T> persistent, Object auth, Properties properties) 
+  throws GoraException {
+    return createDataStore(dataStoreClass, keyClass, persistent, auth, properties, null);
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema.
+   * 
+   * @param dataStoreClass The datastore implementation class.
+   * @param keyClass The key class.
+   * @param persistentClass The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  public static <D extends DataStore<K,T>, K, T extends Persistent>
+  D getDataStore( Class<D> dataStoreClass, Class<K> keyClass,
+      Class<T> persistentClass, Object auth) throws GoraException {
+
+    return createDataStore(dataStoreClass, keyClass, persistentClass, auth, createProps(), null);
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema.
+   * 
+   * @param dataStoreClass The datastore implementation class <i>as string</i>.
+   * @param keyClass The key class.
+   * @param persistentClass The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  @SuppressWarnings("unchecked")
+  public static <K, T extends Persistent> DataStore<K, T> getDataStore(
+      String dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Object auth)
+      throws GoraException {
+    try {
+      Class<? extends DataStore<K,T>> c
+        = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass);
+      return createDataStore(c, keyClass, persistentClass, auth, createProps(), null);
+    } catch(GoraException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new GoraException(ex);
+    }
+  }
+
+  /**
+   * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema.
+   * 
+   * @param dataStoreClass The datastore implementation class <i>as string</i>.
+   * @param keyClass The key class <i>as string</i>.
+   * @param persistentClass The value class <i>as string</i>.
+   * @param conf {@link Configuration} to be used be the store.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  @SuppressWarnings({ "unchecked" })
+  public static <K, T extends Persistent> DataStore<K, T> getDataStore(
+      String dataStoreClass, String keyClass, String persistentClass, Object auth)
+    throws GoraException {
+
+    try {
+      Class<? extends DataStore<K,T>> c
+          = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass);
+      Class<K> k = (Class<K>) ClassLoadingUtils.loadClass(keyClass);
+      Class<T> p = (Class<T>) ClassLoadingUtils.loadClass(persistentClass);
+      return createDataStore(c, k, p, auth, createProps(), null);
+    } catch(GoraException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new GoraException(ex);
+    }
+  }
+
+  /**
+   * Instantiate <i>the default</i> {@link DataStore}. Uses default properties. Uses 'null' schema.
+   * 
+   * @param keyClass The key class.
+   * @param persistent The value class.
+   * @param conf {@link Configuration} to be used be the store.
+   * @return A new store instance.
+   * @throws GoraException
+   */
+  @SuppressWarnings("unchecked")
+  public static <K, T extends Persistent> DataStore<K, T> getDataStore(
+      Class<K> keyClass, Class<T> persistent, Object auth) throws GoraException {
+    Properties createProps = createProps();
+    Class<? extends DataStore<K, T>> c;
+    try {
+      c = (Class<? extends DataStore<K, T>>) Class.forName(getDefaultDataStore(createProps));
+    } catch (Exception ex) {
+      throw new GoraException(ex);
+    }
+    return createDataStore(c, keyClass, persistent, auth, createProps, null);
+  }
+
+  /**
+   * Tries to find a property with the given baseKey. First the property
+   * key constructed as "gora.&lt;classname&gt;.&lt;baseKey&gt;" is searched.
+   * If not found, the property keys for all superclasses is recursively
+   * tested. Lastly, the property key constructed as
+   * "gora.datastore.&lt;baseKey&gt;" is searched.
+   * @return the first found value, or defaultValue
+   */
+  public static String findProperty(Properties properties
+      , DataStore<?, ?> store, String baseKey, String defaultValue) {
+
+    //recursively try the class names until the base class
+    Class<?> clazz = store.getClass();
+    while(true) {
+      String fullKey = GORA + "." + org.apache.gora.util.StringUtils.getClassname(clazz) + "." + baseKey;
+      String value = getProperty(properties, fullKey);
+      if(value != null) {
+        return value;
+      }
+      //try once with lowercase
+      value = getProperty(properties, fullKey.toLowerCase());
+      if(value != null) {
+        return value;
+      }
+
+      if(clazz.equals(WSDataStoreBase.class)) {
+        break;
+      }
+      clazz = clazz.getSuperclass();
+      if(clazz == null) {
+        break;
+      }
+    }
+    //try with "datastore"
+    String fullKey = GORA + "." + DATASTORE + "." + baseKey;
+    String value = getProperty(properties, fullKey);
+    if(value != null) {
+      return value;
+    }
+    return defaultValue;
+  }
+
+  /**
+   * Tries to find a property with the given baseKey. First the property
+   * key constructed as "gora.&lt;classname&gt;.&lt;baseKey&gt;" is searched.
+   * If not found, the property keys for all superclasses is recursively
+   * tested. Lastly, the property key constructed as
+   * "gora.datastore.&lt;baseKey&gt;" is searched.
+   * @return the first found value, or throws IOException
+   */
+  public static String findPropertyOrDie(Properties properties
+      , DataStore<?, ?> store, String baseKey) throws IOException {
+    String val = findProperty(properties, store, baseKey, null);
+    if(val == null) {
+      throw new IOException("Property with base name \""+baseKey+"\" could not be found, make " +
+      		"sure to include this property in gora.properties file");
+    }
+    return val;
+  }
+
+  public static boolean findBooleanProperty(Properties properties
+      , DataStore<?, ?> store, String baseKey, String defaultValue) {
+    return Boolean.parseBoolean(findProperty(properties, store, baseKey, defaultValue));
+  }
+
+  public static boolean getAutoCreateSchema(Properties properties
+      , DataStore<?,?> store) {
+    return findBooleanProperty(properties, store, AUTO_CREATE_SCHEMA, "true");
+  }
+
+  /**
+   * Returns the input path as read from the properties for file-backed data stores.
+   */
+  public static String getInputPath(Properties properties, DataStore<?,?> store) {
+    return findProperty(properties, store, INPUT_PATH, null);
+  }
+
+  /**
+   * Returns the output path as read from the properties for file-backed data stores.
+   */
+  public static String getOutputPath(Properties properties, DataStore<?,?> store) {
+    return findProperty(properties, store, OUTPUT_PATH, null);
+  }
+
+  public static String getMappingFile(Properties properties, DataStore<?,?> store
+      , String defaultValue) {
+    return findProperty(properties, store, MAPPING_FILE, defaultValue);
+  }
+
+  private static String getDefaultDataStore(Properties properties) {
+    return getProperty(properties, GORA_DEFAULT_DATASTORE_KEY);
+  }
+
+  private static String getProperty(Properties properties, String key) {
+    return getProperty(properties, key, null);
+  }
+
+  private static String getProperty(Properties properties, String key, String defaultValue) {
+    if (properties == null) {
+      return defaultValue;
+    }
+    String result = properties.getProperty(key);
+    if (result == null) {
+      return defaultValue;
+    }
+    return result;
+  }
+
+  /**
+   * Set a property
+   */
+  private static void setProperty(Properties properties, String baseKey, String value) {
+    if(value != null) {
+      properties.setProperty(GORA_DATASTORE + baseKey, value);
+    }
+  }
+
+  /**
+   * Sets a property for the datastore of the given class
+   */
+  private static<D extends DataStore<K,T>, K, T extends Persistent>
+  void setProperty(Properties properties, Class<D> dataStoreClass, String baseKey, String value) {
+    properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value);
+  }
+
+  /**
+   * Gets the default schema name of a given store class 
+   */
+  public static String getDefaultSchemaName(Properties properties, DataStore<?,?> store) {
+    return findProperty(properties, store, SCHEMA_NAME, null);
+  }
+
+  /**
+   * Sets the default schema name.
+   */
+  public static void setDefaultSchemaName(Properties properties, String schemaName) {
+    if (schemaName != null) {
+      setProperty(properties, SCHEMA_NAME, schemaName);
+    }
+  }
+
+  /**
+   * Sets the default schema name to be used by the datastore of the given class
+   */
+  public static<D extends DataStore<K,T>, K, T extends Persistent>
+  void setDefaultSchemaName(Properties properties, Class<D> dataStoreClass, String schemaName) {
+    setProperty(properties, dataStoreClass, SCHEMA_NAME, schemaName);
+  }
+}

Modified: gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/util/IOUtils.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/util/IOUtils.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/util/IOUtils.java (original)
+++ gora/branches/goraamazon/gora-core/src/main/java/org/apache/gora/util/IOUtils.java Mon Jul  2 13:38:43 2012
@@ -43,6 +43,7 @@ import org.apache.avro.ipc.ByteBufferOut
 import org.apache.gora.avro.PersistentDatumReader;
 import org.apache.gora.avro.PersistentDatumWriter;
 import org.apache.gora.persistency.Persistent;
+import org.apache.gora.persistency.impl.PersistentBase;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.DataOutputBuffer;
@@ -162,7 +163,7 @@ public class IOUtils {
   /**
    * Serializes the field object using the datumWriter.
    */
-  public static<T extends Persistent> void serialize(OutputStream os,
+  public static<T extends PersistentBase> void serialize(OutputStream os,
       PersistentDatumWriter<T> datumWriter, Schema schema, Object object)
       throws IOException {
 
@@ -174,7 +175,7 @@ public class IOUtils {
   /**
    * Serializes the field object using the datumWriter.
    */
-  public static<T extends Persistent> byte[] serialize(PersistentDatumWriter<T> datumWriter
+  public static<T extends PersistentBase> byte[] serialize(PersistentDatumWriter<T> datumWriter
       , Schema schema, Object object) throws IOException {
     ByteArrayOutputStream os = new ByteArrayOutputStream();
     serialize(os, datumWriter, schema, object);
@@ -252,7 +253,7 @@ public class IOUtils {
    * Deserializes the field object using the datumReader.
    */
   @SuppressWarnings("unchecked")
-  public static<K, T extends Persistent> K deserialize(InputStream is,
+  public static<K, T extends PersistentBase> K deserialize(InputStream is,
       PersistentDatumReader<T> datumReader, Schema schema, K object)
       throws IOException {
     decoder = DecoderFactory.defaultFactory().createBinaryDecoder(is, decoder);
@@ -263,7 +264,7 @@ public class IOUtils {
    * Deserializes the field object using the datumReader.
    */
   @SuppressWarnings("unchecked")
-  public static<K, T extends Persistent> K deserialize(byte[] bytes,
+  public static<K, T extends PersistentBase> K deserialize(byte[] bytes,
       PersistentDatumReader<T> datumReader, Schema schema, K object)
       throws IOException {
     decoder = DecoderFactory.defaultFactory().createBinaryDecoder(bytes, decoder);
@@ -274,7 +275,7 @@ public class IOUtils {
   /**
    * Serializes the field object using the datumWriter.
    */
-  public static<T extends Persistent> byte[] deserialize(PersistentDatumWriter<T> datumWriter
+  public static<T extends PersistentBase> byte[] deserialize(PersistentDatumWriter<T> datumWriter
       , Schema schema, Object object) throws IOException {
     ByteArrayOutputStream os = new ByteArrayOutputStream();
     serialize(os, datumWriter, schema, object);

Modified: gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java (original)
+++ gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/TestPersistentDatumReader.java Mon Jul  2 13:38:43 2012
@@ -29,6 +29,7 @@ import org.apache.gora.examples.generate
 import org.apache.gora.examples.generated.WebPage;
 import org.apache.gora.memory.store.MemStore;
 import org.apache.gora.persistency.Persistent;
+import org.apache.gora.persistency.impl.PersistentBase;
 import org.apache.gora.query.Query;
 import org.apache.gora.query.Result;
 import org.apache.gora.store.DataStore;
@@ -46,12 +47,12 @@ public class TestPersistentDatumReader {
     = new PersistentDatumReader<WebPage>();
   private Configuration conf = new Configuration();
   
-  private void testClone(Persistent persistent) throws IOException {
-    Persistent cloned = webPageDatumReader.clone(persistent, persistent.getSchema());
+  private void testClone(PersistentBase persistent) throws IOException {
+    PersistentBase cloned = ((PersistentBase)webPageDatumReader.clone(persistent, persistent.getSchema()));
     assertClone(persistent, cloned);
   }
   
-  private void assertClone(Persistent persistent, Persistent cloned) {
+  private void assertClone(PersistentBase persistent, PersistentBase cloned) {
     Assert.assertNotNull("cloned object is null", cloned);
     Assert.assertEquals("cloned object is not equal to original object", persistent, cloned);
   }

Modified: gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java (original)
+++ gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/avro/store/TestAvroStore.java Mon Jul  2 13:38:43 2012
@@ -95,27 +95,27 @@ public class TestAvroStore {
   }
 
   @Test
-  public void testNewInstance() throws IOException {
+  public void testNewInstance() throws IOException, Exception {
     DataStoreTestUtil.testNewPersistent(employeeStore);
   }
 
   @Test
-  public void testCreateSchema() throws IOException {
+  public void testCreateSchema() throws IOException, Exception {
     DataStoreTestUtil.testCreateEmployeeSchema(employeeStore);
   }
 
   @Test
-  public void testAutoCreateSchema() throws IOException {
+  public void testAutoCreateSchema() throws IOException, Exception {
     DataStoreTestUtil.testAutoCreateSchema(employeeStore);
   }
 
   @Test
-  public void testPut() throws IOException {
+  public void testPut() throws IOException, Exception {
     DataStoreTestUtil.testPutEmployee(employeeStore);
   }
 
   @Test
-  public void testQuery() throws IOException {
+  public void testQuery() throws IOException, Exception {
     createWebPageData(webPageStore);
     webPageStore.close();
 
@@ -124,7 +124,7 @@ public class TestAvroStore {
   }
 
   @Test
-  public void testQueryBinaryEncoder() throws IOException {
+  public void testQueryBinaryEncoder() throws IOException, Exception {
     webPageStore.setCodecType(CodecType.BINARY);
     webPageStore.setInputPath(webPageStore.getOutputPath());
 
@@ -136,7 +136,7 @@ public class TestAvroStore {
   //AvroStore should be closed so that Hadoop file is completely flushed,
   //so below test is copied and modified to close the store after pushing data
   public static void testQueryWebPages(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
 
     Query<String, WebPage> query = store.newQuery();
     Result<String, WebPage> result = query.execute();

Modified: gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java (original)
+++ gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/mapreduce/MapReduceTestUtils.java Mon Jul  2 13:38:43 2012
@@ -31,6 +31,7 @@ import org.apache.gora.examples.mapreduc
 import org.apache.gora.examples.mapreduce.WordCount;
 import org.apache.gora.query.Query;
 import org.apache.gora.store.DataStore;
+import org.apache.gora.store.impl.DataStoreBase;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.Assert;
 
@@ -43,7 +44,7 @@ public class MapReduceTestUtils {
       , Configuration conf) 
   throws Exception {
     
-    dataStore.setConf(conf);
+	((DataStoreBase<String, WebPage>)dataStore).setConf(conf);
     
     //create input
     WebPageDataCreator.createWebPageData(dataStore);
@@ -69,8 +70,9 @@ public class MapReduceTestUtils {
   public static void testWordCount(Configuration conf, 
       DataStore<String,WebPage> inStore, DataStore<String, 
       TokenDatum> outStore) throws Exception {
-    inStore.setConf(conf);
-    outStore.setConf(conf);
+	  //Datastore now has to be a Hadoop based datastore
+    ((DataStoreBase<String,WebPage>)inStore).setConf(conf);
+    ((DataStoreBase<String,TokenDatum>)outStore).setConf(conf);
     
     //create input
     WebPageDataCreator.createWebPageData(inStore);
@@ -95,7 +97,7 @@ public class MapReduceTestUtils {
   }
   
   private static void assertTokenCount(DataStore<String, TokenDatum> outStore,
-      String token, int count) throws IOException {
+      String token, int count) throws IOException, Exception {
     TokenDatum datum = outStore.get(token, null);
     Assert.assertNotNull("token:" + token + " cannot be found in datastore", datum);
     Assert.assertEquals("count for token:" + token + " is wrong", count, datum.getCount());

Modified: gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java (original)
+++ gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java Mon Jul  2 13:38:43 2012
@@ -108,7 +108,7 @@ public class TestPersistentBase {
   }
   
   @Test
-  public void testClone() throws IOException {
+  public void testClone() throws IOException, Exception {
     //more tests for clone are in TestPersistentDatumReader
     @SuppressWarnings("unchecked")
     MemStore<String, Employee> store = DataStoreFactory.getDataStore(

Modified: gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestBase.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestBase.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestBase.java (original)
+++ gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestBase.java Mon Jul  2 13:38:43 2012
@@ -116,7 +116,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testNewInstance() throws IOException {
+  public void testNewInstance() throws IOException, Exception {
     log.info("test method: testNewInstance");
     DataStoreTestUtil.testNewPersistent(employeeStore);
   }
@@ -151,7 +151,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testDeleteSchema() throws IOException {
+  public void testDeleteSchema() throws IOException, Exception {
     log.info("test method: testDeleteSchema");
     DataStoreTestUtil.testDeleteSchema(webPageStore);
   }
@@ -163,7 +163,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testPut() throws IOException {
+  public void testPut() throws IOException, Exception {
     log.info("test method: testPut");
     Employee employee = DataStoreTestUtil.testPutEmployee(employeeStore);
     assertPut(employee);
@@ -173,7 +173,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testPutNested() throws IOException {
+  public void testPutNested() throws IOException, Exception {
     log.info("test method: testPutNested");
 
     String revUrl = "foo.com:http/";
@@ -199,7 +199,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testPutArray() throws IOException {
+  public void testPutArray() throws IOException, Exception {
     log.info("test method: testPutArray");
     webPageStore.createSchema();
     WebPage page = webPageStore.newPersistent();
@@ -220,7 +220,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testPutBytes() throws IOException {
+  public void testPutBytes() throws IOException, Exception {
     log.info("test method: testPutBytes");
     webPageStore.createSchema();
     WebPage page = webPageStore.newPersistent();
@@ -239,7 +239,7 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testPutMap() throws IOException {
+  public void testPutMap() throws IOException, Exception {
     log.info("test method: testPutMap");
     webPageStore.createSchema();
 
@@ -259,108 +259,108 @@ public abstract class DataStoreTestBase 
   }
 
   @Test
-  public void testUpdate() throws IOException {
+  public void testUpdate() throws IOException, Exception {
     log.info("test method: testUpdate");
     DataStoreTestUtil.testUpdateEmployee(employeeStore);
     DataStoreTestUtil.testUpdateWebPage(webPageStore);
   }
 
-  public void testEmptyUpdate() throws IOException {
+  public void testEmptyUpdate() throws IOException, Exception {
     DataStoreTestUtil.testEmptyUpdateEmployee(employeeStore);
   }
 
   @Test
-  public void testGet() throws IOException {
+  public void testGet() throws IOException, Exception {
     log.info("test method: testGet");
     DataStoreTestUtil.testGetEmployee(employeeStore);
   }
 
   @Test
-  public void testGetWithFields() throws IOException {
+  public void testGetWithFields() throws IOException, Exception {
     log.info("test method: testGetWithFields");
     DataStoreTestUtil.testGetEmployeeWithFields(employeeStore);
   }
 
   @Test
-  public void testGetWebPage() throws IOException {
+  public void testGetWebPage() throws IOException, Exception {
     log.info("test method: testGetWebPage");
     DataStoreTestUtil.testGetWebPage(webPageStore);
   }
 
   @Test
-  public void testGetWebPageDefaultFields() throws IOException {
+  public void testGetWebPageDefaultFields() throws IOException, Exception {
     log.info("test method: testGetWebPageDefaultFields");
     DataStoreTestUtil.testGetWebPageDefaultFields(webPageStore);
   }
 
   @Test
-  public void testGetNonExisting() throws Exception {
+  public void testGetNonExisting() throws Exception, Exception {
     log.info("test method: testGetNonExisting");
     DataStoreTestUtil.testGetEmployeeNonExisting(employeeStore);
   }
 
  @Test
-  public void testQuery() throws IOException {
+  public void testQuery() throws IOException, Exception {
     log.info("test method: testQuery");
     DataStoreTestUtil.testQueryWebPages(webPageStore);
   }
 
   @Test
-  public void testQueryStartKey() throws IOException {
+  public void testQueryStartKey() throws IOException, Exception {
     log.info("test method: testQueryStartKey");
     DataStoreTestUtil.testQueryWebPageStartKey(webPageStore);
   }
 
   @Test
-  public void testQueryEndKey() throws IOException {
+  public void testQueryEndKey() throws IOException, Exception {
     log.info("test method: testQueryEndKey");
     DataStoreTestUtil.testQueryWebPageEndKey(webPageStore);
   }
 
   @Test
-  public void testQueryKeyRange() throws IOException {
+  public void testQueryKeyRange() throws IOException, Exception {
     log.info("test method: testQueryKetRange");
     DataStoreTestUtil.testQueryWebPageKeyRange(webPageStore);
   }
 
  @Test
-  public void testQueryWebPageSingleKey() throws IOException {
+  public void testQueryWebPageSingleKey() throws IOException, Exception {
    log.info("test method: testQueryWebPageSingleKey");
     DataStoreTestUtil.testQueryWebPageSingleKey(webPageStore);
   }
 
   @Test
-  public void testQueryWebPageSingleKeyDefaultFields() throws IOException {
+  public void testQueryWebPageSingleKeyDefaultFields() throws IOException, Exception {
     log.info("test method: testQuerySingleKeyDefaultFields");
     DataStoreTestUtil.testQueryWebPageSingleKeyDefaultFields(webPageStore);
   }
 
   @Test
-  public void testQueryWebPageQueryEmptyResults() throws IOException {
+  public void testQueryWebPageQueryEmptyResults() throws IOException, Exception {
     log.info("test method: testQueryEmptyResults");
     DataStoreTestUtil.testQueryWebPageEmptyResults(webPageStore);
   }
 
   @Test
-  public void testDelete() throws IOException {
+  public void testDelete() throws IOException, Exception {
     log.info("test method: testDelete");
     DataStoreTestUtil.testDelete(webPageStore);
   }
 
   @Test
-  public void testDeleteByQuery() throws IOException {
+  public void testDeleteByQuery() throws IOException, Exception {
     log.info("test method: testDeleteByQuery");
     DataStoreTestUtil.testDeleteByQuery(webPageStore);
   }
 
   @Test
-  public void testDeleteByQueryFields() throws IOException {
+  public void testDeleteByQueryFields() throws IOException, Exception {
     log.info("test method: testQueryByQueryFields");
     DataStoreTestUtil.testDeleteByQueryFields(webPageStore);
   }
 
   @Test
-  public void testGetPartitions() throws IOException {
+  public void testGetPartitions() throws IOException, Exception {
     log.info("test method: testGetPartitions");
     DataStoreTestUtil.testGetPartitions(webPageStore);
   }

Modified: gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java?rev=1356215&r1=1356214&r2=1356215&view=diff
==============================================================================
--- gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java (original)
+++ gora/branches/goraamazon/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java Mon Jul  2 13:38:43 2012
@@ -68,7 +68,7 @@ public class DataStoreTestUtil {
   private static final int NUM_KEYS = 4;
 
   public static <K, T extends Persistent> void testNewPersistent(
-      DataStore<K,T> dataStore) throws IOException {
+      DataStore<K,T> dataStore) throws IOException, Exception {
 
     T obj1 = dataStore.newPersistent();
     T obj2 = dataStore.newPersistent();
@@ -81,7 +81,7 @@ public class DataStoreTestUtil {
   }
 
   public static <K> Employee createEmployee(
-      DataStore<K, Employee> dataStore) throws IOException {
+      DataStore<K, Employee> dataStore) throws IOException, Exception {
 
     Employee employee = dataStore.newPersistent();
     employee.setName(new Utf8("Random Joe"));
@@ -92,13 +92,13 @@ public class DataStoreTestUtil {
   }
 
   public static void testAutoCreateSchema(DataStore<String,Employee> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     //should not throw exception
     dataStore.put("foo", createEmployee(dataStore));
   }
 
   public static void testCreateEmployeeSchema(DataStore<String, Employee> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
 
     //should not throw exception
@@ -106,7 +106,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testTruncateSchema(DataStore<String, WebPage> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
     WebPageDataCreator.createWebPageData(dataStore);
     dataStore.truncateSchema();
@@ -115,7 +115,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testDeleteSchema(DataStore<String, WebPage> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
     WebPageDataCreator.createWebPageData(dataStore);
     dataStore.deleteSchema();
@@ -125,7 +125,7 @@ public class DataStoreTestUtil {
   }
 
   public static<K, T extends Persistent> void testSchemaExists(
-      DataStore<K, T> dataStore) throws IOException {
+      DataStore<K, T> dataStore) throws IOException, Exception {
     dataStore.createSchema();
 
     Assert.assertTrue(dataStore.schemaExists());
@@ -135,7 +135,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testGetEmployee(DataStore<String, Employee> dataStore)
-    throws IOException {
+    throws IOException, Exception {
     dataStore.createSchema();
     Employee employee = DataStoreTestUtil.createEmployee(dataStore);
     String ssn = employee.getSsn().toString();
@@ -148,13 +148,13 @@ public class DataStoreTestUtil {
   }
 
   public static void testGetEmployeeNonExisting(DataStore<String, Employee> dataStore)
-    throws IOException {
+    throws IOException, Exception {
     Employee employee = dataStore.get("_NON_EXISTING_SSN_FOR_EMPLOYEE_");
     Assert.assertNull(employee);
   }
 
   public static void testGetEmployeeWithFields(DataStore<String, Employee> dataStore)
-    throws IOException {
+    throws IOException, Exception {
     Employee employee = DataStoreTestUtil.createEmployee(dataStore);
     String ssn = employee.getSsn().toString();
     dataStore.put(ssn, employee);
@@ -176,14 +176,14 @@ public class DataStoreTestUtil {
   }
 
   public static Employee testPutEmployee(DataStore<String, Employee> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
     Employee employee = DataStoreTestUtil.createEmployee(dataStore);
     return employee;
   }
 
   public static void testEmptyUpdateEmployee(DataStore<String, Employee> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
     long ssn = 1234567890L;
     String ssnStr = Long.toString(ssn);
@@ -213,7 +213,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testUpdateEmployee(DataStore<String, Employee> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
     long ssn = 1234567890L;
     long now = System.currentTimeMillis();
@@ -250,7 +250,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testUpdateWebPage(DataStore<String, WebPage> dataStore)
-  throws IOException {
+  throws IOException, Exception {
     dataStore.createSchema();
 
     String[] urls = {"http://a.com/a", "http://b.com/b", "http://c.com/c",
@@ -332,7 +332,7 @@ public class DataStoreTestUtil {
     }
   }
 
-  public static void assertWebPage(WebPage page, int i) {
+  public static void assertWebPage(WebPage page, int i) throws Exception{
     Assert.assertNotNull(page);
 
     Assert.assertEquals(URLS[i], page.getUrl().toString());
@@ -364,7 +364,7 @@ public class DataStoreTestUtil {
   }
 
   private static void testGetWebPage(DataStore<String, WebPage> store, String[] fields)
-    throws IOException {
+    throws IOException, Exception {
     createWebPageData(store);
 
     for(int i=0; i<URLS.length; i++) {
@@ -373,17 +373,17 @@ public class DataStoreTestUtil {
     }
   }
 
-  public static void testGetWebPage(DataStore<String, WebPage> store) throws IOException {
+  public static void testGetWebPage(DataStore<String, WebPage> store) throws IOException, Exception {
     testGetWebPage(store, WebPage._ALL_FIELDS);
   }
 
   public static void testGetWebPageDefaultFields(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     testGetWebPage(store, null);
   }
 
   private static void testQueryWebPageSingleKey(DataStore<String, WebPage> store
-      , String[] fields) throws IOException {
+      , String[] fields) throws IOException, Exception {
 
     createWebPageData(store);
 
@@ -400,18 +400,18 @@ public class DataStoreTestUtil {
   }
 
   public static void testQueryWebPageSingleKey(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     testQueryWebPageSingleKey(store, WebPage._ALL_FIELDS);
   }
 
   public static void testQueryWebPageSingleKeyDefaultFields(
-      DataStore<String, WebPage> store) throws IOException {
+      DataStore<String, WebPage> store) throws IOException, Exception {
     testQueryWebPageSingleKey(store, null);
   }
 
   public static void testQueryWebPageKeyRange(DataStore<String, WebPage> store,
       boolean setStartKeys, boolean setEndKeys)
-  throws IOException {
+  throws IOException, Exception {
     createWebPageData(store);
 
     //create sorted set of urls
@@ -450,27 +450,27 @@ public class DataStoreTestUtil {
   }
 
   public static void testQueryWebPages(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     testQueryWebPageKeyRange(store, false, false);
   }
 
   public static void testQueryWebPageStartKey(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     testQueryWebPageKeyRange(store, true, false);
   }
 
   public static void testQueryWebPageEndKey(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     testQueryWebPageKeyRange(store, false, true);
   }
 
   public static void testQueryWebPageKeyRange(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     testQueryWebPageKeyRange(store, true, true);
   }
 
   public static void testQueryWebPageEmptyResults(DataStore<String, WebPage> store)
-    throws IOException {
+    throws IOException, Exception {
     createWebPageData(store);
 
     //query empty results
@@ -486,12 +486,12 @@ public class DataStoreTestUtil {
   }
 
   public static<K,T extends Persistent> void assertEmptyResults(Query<K, T> query)
-    throws IOException {
+    throws IOException, Exception {
     assertNumResults(query, 0);
   }
 
   public static<K,T extends Persistent> void assertNumResults(Query<K, T>query
-      , long numResults) throws IOException {
+      , long numResults) throws IOException, Exception {
     Result<K, T> result = query.execute();
     int actualNumResults = 0;
     while(result.next()) {
@@ -502,13 +502,13 @@ public class DataStoreTestUtil {
   }
 
   public static void testGetPartitions(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
     createWebPageData(store);
     testGetPartitions(store, store.newQuery());
   }
 
   public static void testGetPartitions(DataStore<String, WebPage> store
-      , Query<String, WebPage> query) throws IOException {
+      , Query<String, WebPage> query) throws IOException, Exception {
     List<PartitionQuery<String, WebPage>> partitions = store.getPartitions(query);
 
     Assert.assertNotNull(partitions);
@@ -523,7 +523,7 @@ public class DataStoreTestUtil {
 
   public static void assertPartitions(DataStore<String, WebPage> store,
       Query<String, WebPage> query, List<PartitionQuery<String,WebPage>> partitions)
-  throws IOException {
+  throws IOException, Exception {
 
     int count = 0, partitionsCount = 0;
     Map<String, Integer> results = new HashMap<String, Integer>();
@@ -571,7 +571,7 @@ public class DataStoreTestUtil {
     }
   }
 
-  public static void testDelete(DataStore<String, WebPage> store) throws IOException {
+  public static void testDelete(DataStore<String, WebPage> store) throws IOException, Exception {
     WebPageDataCreator.createWebPageData(store);
     //delete one by one
 
@@ -589,7 +589,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testDeleteByQuery(DataStore<String, WebPage> store)
-    throws IOException {
+    throws IOException, Exception {
 
     Query<String, WebPage> query;
 
@@ -643,7 +643,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testDeleteByQueryFields(DataStore<String, WebPage> store)
-  throws IOException {
+  throws IOException, Exception {
 
     Query<String, WebPage> query;
 

Added: gora/branches/goraamazon/gora-dynamodb/conf/AwsCredentials.properties
URL: http://svn.apache.org/viewvc/gora/branches/goraamazon/gora-dynamodb/conf/AwsCredentials.properties?rev=1356215&view=auto
==============================================================================
--- gora/branches/goraamazon/gora-dynamodb/conf/AwsCredentials.properties (added)
+++ gora/branches/goraamazon/gora-dynamodb/conf/AwsCredentials.properties Mon Jul  2 13:38:43 2012
@@ -0,0 +1,4 @@
+#Insert your AWS Credentials from http://aws.amazon.com/security-credentials
+#Thu Jun 07 15:36:04 PET 2012
+secretKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+accessKey=xxxxxxxxxxxxxxxxxxxx
\ No newline at end of file



Mime
View raw message