From 0ae2558b6deef58f2c93896d7f86115d8fef0d1b Mon Sep 17 00:00:00 2001 From: aozarov Date: Mon, 9 Feb 2015 16:10:11 -0800 Subject: [PATCH] return the datastore service from Batch and Transation --- src/main/java/com/google/gcloud/datastore/Batch.java | 5 +++++ src/main/java/com/google/gcloud/datastore/BatchImpl.java | 5 +++++ src/main/java/com/google/gcloud/datastore/Transaction.java | 5 +++++ .../java/com/google/gcloud/datastore/TransactionImpl.java | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/main/java/com/google/gcloud/datastore/Batch.java b/src/main/java/com/google/gcloud/datastore/Batch.java index a6ba78160ef4..f74ccc288808 100644 --- a/src/main/java/com/google/gcloud/datastore/Batch.java +++ b/src/main/java/com/google/gcloud/datastore/Batch.java @@ -46,4 +46,9 @@ interface Response { * @throws DatastoreServiceException if there was any failure or if batch is not longer active */ Response submit(); + + /** + * Returns the batch associated {@link DatastoreService}. + */ + DatastoreService datastore(); } diff --git a/src/main/java/com/google/gcloud/datastore/BatchImpl.java b/src/main/java/com/google/gcloud/datastore/BatchImpl.java index 7139ca3bb1c6..305bf4fbcf9f 100644 --- a/src/main/java/com/google/gcloud/datastore/BatchImpl.java +++ b/src/main/java/com/google/gcloud/datastore/BatchImpl.java @@ -72,4 +72,9 @@ public Batch.Response submit() { deactivate(); return new ResponseImpl(responsePb); } + + @Override + public DatastoreService datastore() { + return datastore; + } } diff --git a/src/main/java/com/google/gcloud/datastore/Transaction.java b/src/main/java/com/google/gcloud/datastore/Transaction.java index 543d82b2d75b..28592552787b 100644 --- a/src/main/java/com/google/gcloud/datastore/Transaction.java +++ b/src/main/java/com/google/gcloud/datastore/Transaction.java @@ -109,4 +109,9 @@ interface Response { */ @Override boolean active(); + + /** + * Returns the transaction associated {@link DatastoreService}. + */ + DatastoreService datastore(); } diff --git a/src/main/java/com/google/gcloud/datastore/TransactionImpl.java b/src/main/java/com/google/gcloud/datastore/TransactionImpl.java index bb19e25a2b8f..859f637d4c72 100644 --- a/src/main/java/com/google/gcloud/datastore/TransactionImpl.java +++ b/src/main/java/com/google/gcloud/datastore/TransactionImpl.java @@ -117,4 +117,9 @@ public void rollback() { deactivate(); rolledback = true; } + + @Override + public DatastoreService datastore() { + return datastore; + } }