Skip to content

Commit

Permalink
Merge pull request #79 from aozarov/temp1
Browse files Browse the repository at this point in the history
s/XXXService/XXX/g
  • Loading branch information
ludoch committed May 29, 2015
2 parents e77e0bb + 19f3350 commit 930a52d
Show file tree
Hide file tree
Showing 50 changed files with 345 additions and 346 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ See the ``gcloud-java`` API [datastore documentation][datastore-api] to learn ho
with the Cloud Datastore using this Client Library.

```java
import com.google.gcloud.datastore.DatastoreService;
import com.google.gcloud.datastore.DatastoreServiceFactory;
import com.google.gcloud.datastore.DatastoreServiceOptions;
import com.google.gcloud.datastore.Datastore;
import com.google.gcloud.datastore.DatastoreFactory;
import com.google.gcloud.datastore.DatastoreOptions;
import com.google.gcloud.datastore.DateTime;
import com.google.gcloud.datastore.Entity;
import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.KeyFactory;

DatastoreServiceOptions options = DatastoreServiceOptions.builder().projectId(PROJECT_ID).build();
DatastoreService datastore = DatastoreServiceFactory.instance().get(options);
DatastoreOptions options = DatastoreOptions.builder().projectId(PROJECT_ID).build();
Datastore datastore = DatastoreFactory.instance().get(options);
KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
Key key = keyFactory.newKey(keyName);
Entity entity = datastore.get(key);
Expand Down
10 changes: 5 additions & 5 deletions gcloud-java-datastore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ See the ``gcloud-java`` API [datastore documentation][datastore-api] to learn ho
with the Cloud Datastore using this Client Library.

```java
import com.google.gcloud.datastore.DatastoreService;
import com.google.gcloud.datastore.DatastoreServiceFactory;
import com.google.gcloud.datastore.DatastoreServiceOptions;
import com.google.gcloud.datastore.Datastore;
import com.google.gcloud.datastore.DatastoreFactory;
import com.google.gcloud.datastore.DatastoreOptions;
import com.google.gcloud.datastore.DateTime;
import com.google.gcloud.datastore.Entity;
import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.KeyFactory;

DatastoreServiceOptions options = DatastoreServiceOptions.builder().projectId(PROJECT_ID).build();
DatastoreService datastore = DatastoreServiceFactory.instance().get(options);
DatastoreOptions options = DatastoreOptions.builder().projectId(PROJECT_ID).build();
Datastore datastore = DatastoreFactory.instance().get(options);
KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
Key key = keyFactory.newKey(keyName);
Entity entity = datastore.get(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ protected void validateActive() {
}
}

protected DatastoreServiceException newInvalidRequest(String msg, Object... params) {
return DatastoreServiceException.throwInvalidRequest(String.format(msg, params));
protected DatastoreException newInvalidRequest(String msg, Object... params) {
return DatastoreException.throwInvalidRequest(String.format(msg, params));
}

protected DatastoreV1.Mutation.Builder toMutationPb() {
Expand All @@ -219,5 +219,5 @@ protected DatastoreV1.Mutation.Builder toMutationPb() {
return mutationPb;
}

protected abstract DatastoreService datastore();
protected abstract Datastore datastore();
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,21 @@ public boolean contains(String name) {
/**
* Returns the {@link Value} for the given property {@code name}.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
*/
public <V extends Value<?>> V getValue(String name) {
@SuppressWarnings("unchecked")
V property = (V) properties.get(name);
if (property == null) {
throw DatastoreServiceException.throwInvalidRequest("No such property %s", name);
throw DatastoreException.throwInvalidRequest("No such property %s", name);
}
return property;
}

/**
* Returns true if property is instanceof NullValue.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
*/
public boolean isNull(String name) {
return getValue(name) instanceof NullValue;
Expand All @@ -266,7 +266,7 @@ public boolean isNull(String name) {
/**
* Returns the property value as a string.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a string.
*/
@SuppressWarnings("unchecked")
Expand All @@ -277,7 +277,7 @@ public String getString(String name) {
/**
* Returns the property value as long.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a long.
*/
@SuppressWarnings("unchecked")
Expand All @@ -288,7 +288,7 @@ public long getLong(String name) {
/**
* Returns the property value as a double.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a double.
*/
@SuppressWarnings("unchecked")
Expand All @@ -299,7 +299,7 @@ public double getDouble(String name) {
/**
* Returns the property value as a boolean.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a boolean.
*/
@SuppressWarnings("unchecked")
Expand All @@ -310,7 +310,7 @@ public boolean getBoolean(String name) {
/**
* Returns the property value as a DateTime.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a DateTime.
*/
@SuppressWarnings("unchecked")
Expand All @@ -321,7 +321,7 @@ public DateTime getDateTime(String name) {
/**
* Returns the property value as a Key.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a Key.
*/
@SuppressWarnings("unchecked")
Expand All @@ -332,7 +332,7 @@ public Key getKey(String name) {
/**
* Returns the property value as an entity.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not an entity.
*/
@SuppressWarnings("unchecked")
Expand All @@ -343,7 +343,7 @@ public <K extends IncompleteKey> FullEntity<K> getEntity(String name) {
/**
* Returns the property value as a list of values.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a list of values.
*/
@SuppressWarnings("unchecked")
Expand All @@ -354,7 +354,7 @@ public List<? extends Value<?>> getList(String name) {
/**
* Returns the property value as a blob.
*
* @throws DatastoreServiceException if not such property.
* @throws DatastoreException if not such property.
* @throws ClassCastException if value is not a blob.
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ interface Response {
/**
* Submit the batch to the Datastore.
*
* @throws DatastoreServiceException if there was any failure or if batch is not longer active
* @throws DatastoreException if there was any failure or if batch is not longer active
*/
Response submit();

/**
* Returns the batch associated {@link DatastoreService}.
* Returns the batch associated {@link Datastore}.
*/
DatastoreService datastore();
Datastore datastore();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class BatchImpl extends BaseDatastoreBatchWriter implements Batch {

private final DatastoreServiceImpl datastore;
private final DatastoreImpl datastore;
private final boolean force;

static class ResponseImpl implements Batch.Response {
Expand All @@ -49,7 +49,7 @@ public List<Key> generatedKeys() {
}
}

BatchImpl(DatastoreServiceImpl datastore, BatchOption... options) {
BatchImpl(DatastoreImpl datastore, BatchOption... options) {
super("batch");
this.datastore = datastore;
Map<Class<? extends BatchOption>, BatchOption> optionsMap = BatchOption.asImmutableMap(options);
Expand All @@ -76,7 +76,7 @@ public Batch.Response submit() {
}

@Override
public DatastoreService datastore() {
public Datastore datastore() {
return datastore;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
/**
* An interface for Google Cloud Datastore.
*/
public interface DatastoreService extends Service<DatastoreServiceOptions>, DatastoreReaderWriter {
public interface Datastore extends Service<DatastoreOptions>, DatastoreReaderWriter {

/**
* Returns a new Datastore transaction.
*
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
*/
Transaction newTransaction(TransactionOption... options);

Expand All @@ -47,15 +47,15 @@ interface TransactionCallable<T> {


/**
* Invokes the callback's {@link DatastoreService.TransactionCallable#run} method with a
* Invokes the callback's {@link Datastore.TransactionCallable#run} method with a
* {@link DatastoreReaderWriter} that is associated with a new transaction.
* The transaction will be committed upon successful invocation.
* Any thrown exception will cause the transaction to rollback and will be propagated
* as a {@link DatastoreServiceException} with the original exception as its root cause.
* as a {@link DatastoreException} with the original exception as its root cause.
*
* @param callable the callback to call with a newly created transactional readerWriter
* @param options the options for the created transaction
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
*/
<T> T runInTransaction(TransactionCallable<T> callable, TransactionOption... options);

Expand All @@ -69,35 +69,35 @@ interface TransactionCallable<T> {
* The returned key will have the same information (projectId, kind, namespace and ancestors)
* as the given key and will have a newly assigned id.
*
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
*/
Key allocateId(IncompleteKey key);

/**
* Returns a list of keys using the allocated ids ordered by the input.
*
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
* @see #allocateId(IncompleteKey)
*/
List<Key> allocateId(IncompleteKey... key);

/**
* {@inheritDoc}
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
*/
@Override
void update(Entity... entity);

/**
* {@inheritDoc}
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
*/
@Override
void put(Entity... entity);

/**
* {@inheritDoc}
* @throws DatastoreServiceException upon failure
* @throws DatastoreException upon failure
*/
@Override
void delete(Key... key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface DatastoreBatchWriter extends DatastoreWriter {
* to submit time.
*
* @throws IllegalArgumentException if any of the given entities is missing a key
* @throws com.google.gcloud.datastore.DatastoreServiceException if a given entity with a
* @throws DatastoreException if a given entity with a
* complete key was already added to this writer or if not active
*/
void addWithDeferredIdAllocation(FullEntity<?>... entity);
Expand All @@ -40,7 +40,7 @@ interface DatastoreBatchWriter extends DatastoreWriter {
* {@inheritDoc}
* For entities with complete keys that were marked for deletion in this writer the operation
* will be changed to {@link #put}.
* @throws com.google.gcloud.datastore.DatastoreServiceException if a given entity with the
* @throws DatastoreException if a given entity with the
* same complete key was already added to this writer, if writer is not active or
* if id allocation for an entity with an incomplete key failed.
*/
Expand All @@ -51,7 +51,7 @@ interface DatastoreBatchWriter extends DatastoreWriter {
* {@inheritDoc}
* This operation will be converted to {@link #put} operation for entities that were already
* added or put in this writer
* @throws com.google.gcloud.datastore.DatastoreServiceException if an entity is marked for
* @throws DatastoreException if an entity is marked for
* deletion in this writer or if not active
*/
@Override
Expand All @@ -61,15 +61,15 @@ interface DatastoreBatchWriter extends DatastoreWriter {
* {@inheritDoc}
* This operation will also remove from this batch any prior writes for entities with the same
* keys
* @throws com.google.gcloud.datastore.DatastoreServiceException if not active
* @throws DatastoreException if not active
*/
@Override
void delete(Key... key);

/**
* {@inheritDoc}
* This operation will also remove from this writer any prior writes for the same entities.
* @throws com.google.gcloud.datastore.DatastoreServiceException if not active
* @throws DatastoreException if not active
*/
@Override
void put(Entity... entity);
Expand Down
Loading

0 comments on commit 930a52d

Please sign in to comment.