Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create service-specific spi packages #742

Merged
merged 2 commits into from
Mar 11, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import com.google.common.collect.Sets;
import com.google.gcloud.Page;
import com.google.gcloud.Service;
import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpc;

import java.util.List;
import java.util.Set;
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
import com.google.gcloud.PageImpl.NextPageFetcher;
import com.google.gcloud.RetryHelper;
import com.google.gcloud.bigquery.InsertAllRequest.RowToInsert;
import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpc;

import java.util.List;
import java.util.Map;
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@

import com.google.common.collect.ImmutableSet;
import com.google.gcloud.ServiceOptions;
import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.spi.BigQueryRpcFactory;
import com.google.gcloud.spi.DefaultBigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpcFactory;
import com.google.gcloud.bigquery.spi.DefaultBigQueryRpc;

import java.util.Set;

Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;
import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpc;

import java.io.Serializable;
import java.util.Objects;
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.bigquery.spi;

import com.google.api.services.bigquery.model.Dataset;
import com.google.api.services.bigquery.model.GetQueryResultsResponse;
Original file line number Diff line number Diff line change
@@ -14,9 +14,10 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.bigquery.spi;

import com.google.gcloud.bigquery.BigQueryOptions;
import com.google.gcloud.spi.ServiceRpcFactory;

/**
* An interface for BigQuery RPC factory.
Original file line number Diff line number Diff line change
@@ -12,14 +12,14 @@
* the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.bigquery.spi;

import static com.google.gcloud.spi.BigQueryRpc.Option.DELETE_CONTENTS;
import static com.google.gcloud.spi.BigQueryRpc.Option.FIELDS;
import static com.google.gcloud.spi.BigQueryRpc.Option.MAX_RESULTS;
import static com.google.gcloud.spi.BigQueryRpc.Option.PAGE_TOKEN;
import static com.google.gcloud.spi.BigQueryRpc.Option.START_INDEX;
import static com.google.gcloud.spi.BigQueryRpc.Option.TIMEOUT;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.DELETE_CONTENTS;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.FIELDS;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.MAX_RESULTS;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.PAGE_TOKEN;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.START_INDEX;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.TIMEOUT;
import static java.net.HttpURLConnection.HTTP_CREATED;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static java.net.HttpURLConnection.HTTP_OK;
Original file line number Diff line number Diff line change
@@ -40,9 +40,9 @@
import com.google.gcloud.RetryParams;
import com.google.gcloud.WriteChannel;
import com.google.gcloud.bigquery.InsertAllRequest.RowToInsert;
import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.spi.BigQueryRpc.Tuple;
import com.google.gcloud.spi.BigQueryRpcFactory;
import com.google.gcloud.bigquery.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpc.Tuple;
import com.google.gcloud.bigquery.spi.BigQueryRpcFactory;

import org.easymock.Capture;
import org.easymock.EasyMock;
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@

import static org.junit.Assert.assertEquals;

import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpc;

import org.junit.Test;

Original file line number Diff line number Diff line change
@@ -32,8 +32,8 @@

import com.google.gcloud.RestorableState;
import com.google.gcloud.WriteChannel;
import com.google.gcloud.spi.BigQueryRpc;
import com.google.gcloud.spi.BigQueryRpcFactory;
import com.google.gcloud.bigquery.spi.BigQueryRpc;
import com.google.gcloud.bigquery.spi.BigQueryRpcFactory;

import org.easymock.Capture;
import org.easymock.CaptureType;
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
import com.google.gcloud.RetryHelper;
import com.google.gcloud.RetryHelper.RetryHelperException;
import com.google.gcloud.RetryParams;
import com.google.gcloud.spi.DatastoreRpc;
import com.google.gcloud.datastore.spi.DatastoreRpc;
import com.google.protobuf.ByteString;

import java.util.Arrays;
Original file line number Diff line number Diff line change
@@ -24,9 +24,9 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.gcloud.ServiceOptions;
import com.google.gcloud.spi.DatastoreRpc;
import com.google.gcloud.spi.DatastoreRpcFactory;
import com.google.gcloud.spi.DefaultDatastoreRpc;
import com.google.gcloud.datastore.spi.DatastoreRpc;
import com.google.gcloud.datastore.spi.DatastoreRpcFactory;
import com.google.gcloud.datastore.spi.DefaultDatastoreRpc;

import java.lang.reflect.Method;
import java.util.Iterator;
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.datastore.spi;

import com.google.api.services.datastore.DatastoreV1.AllocateIdsRequest;
import com.google.api.services.datastore.DatastoreV1.AllocateIdsResponse;
Original file line number Diff line number Diff line change
@@ -14,9 +14,10 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.datastore.spi;

import com.google.gcloud.datastore.DatastoreOptions;
import com.google.gcloud.spi.ServiceRpcFactory;

/**
* An interface for Datastore RPC factory.
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.datastore.spi;

import com.google.api.services.datastore.DatastoreV1.AllocateIdsRequest;
import com.google.api.services.datastore.DatastoreV1.AllocateIdsResponse;
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@
import static org.junit.Assert.assertTrue;

import com.google.gcloud.datastore.testing.LocalGcdHelper;
import com.google.gcloud.spi.DatastoreRpc;
import com.google.gcloud.spi.DatastoreRpcFactory;
import com.google.gcloud.datastore.spi.DatastoreRpc;
import com.google.gcloud.datastore.spi.DatastoreRpcFactory;

import org.easymock.EasyMock;
import org.junit.Before;
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@
import com.google.gcloud.datastore.StructuredQuery.Projection;
import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
import com.google.gcloud.datastore.testing.LocalGcdHelper;
import com.google.gcloud.spi.DatastoreRpc;
import com.google.gcloud.spi.DatastoreRpcFactory;
import com.google.gcloud.datastore.spi.DatastoreRpc;
import com.google.gcloud.datastore.spi.DatastoreRpcFactory;
import com.google.protobuf.ByteString;

import org.easymock.EasyMock;
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
import com.google.gcloud.bigquery.TableInfo;
import com.google.gcloud.bigquery.ViewDefinition;
import com.google.gcloud.bigquery.WriteChannelConfiguration;
import com.google.gcloud.spi.BigQueryRpc.Tuple;
import com.google.gcloud.bigquery.spi.BigQueryRpc.Tuple;

import java.nio.channels.FileChannel;
import java.nio.file.Paths;
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
import com.google.gcloud.ReadChannel;
import com.google.gcloud.WriteChannel;
import com.google.gcloud.spi.StorageRpc.Tuple;
import com.google.gcloud.storage.spi.StorageRpc.Tuple;
import com.google.gcloud.storage.Blob;
import com.google.gcloud.storage.BlobId;
import com.google.gcloud.storage.BlobInfo;
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;

import java.io.Serializable;
import java.util.Objects;
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import com.google.common.collect.Sets;
import com.google.gcloud.Page;
import com.google.gcloud.Service;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;

import java.util.Set;

Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@
import com.google.gcloud.PageImpl;
import com.google.gcloud.PageImpl.NextPageFetcher;
import com.google.gcloud.RetryHelper.RetryHelperException;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpc.Tuple;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Tuple;

import java.util.Map;
import java.util.concurrent.Callable;
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@

import com.google.common.collect.ImmutableSet;
import com.google.gcloud.ServiceOptions;
import com.google.gcloud.spi.DefaultResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpcFactory;
import com.google.gcloud.resourcemanager.spi.DefaultResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpcFactory;

import java.util.Set;

Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.google.gcloud.spi;
package com.google.gcloud.resourcemanager.spi;

import static com.google.gcloud.spi.ResourceManagerRpc.Option.FIELDS;
import static com.google.gcloud.spi.ResourceManagerRpc.Option.FILTER;
import static com.google.gcloud.spi.ResourceManagerRpc.Option.PAGE_SIZE;
import static com.google.gcloud.spi.ResourceManagerRpc.Option.PAGE_TOKEN;
import static java.net.HttpURLConnection.HTTP_FORBIDDEN;

This comment was marked as spam.

import static java.net.HttpURLConnection.HTTP_NOT_FOUND;

@@ -60,7 +56,7 @@ public Project get(String projectId, Map<Option, ?> options) {
try {
return resourceManager.projects()
.get(projectId)
.setFields(FIELDS.getString(options))
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
ResourceManagerException translated = translate(ex);
@@ -78,10 +74,10 @@ public Tuple<String, Iterable<Project>> list(Map<Option, ?> options) {
try {
ListProjectsResponse response = resourceManager.projects()
.list()
.setFields(FIELDS.getString(options))
.setFilter(FILTER.getString(options))
.setPageSize(PAGE_SIZE.getInt(options))
.setPageToken(PAGE_TOKEN.getString(options))
.setFields(Option.FIELDS.getString(options))
.setFilter(Option.FILTER.getString(options))
.setPageSize(Option.PAGE_SIZE.getInt(options))
.setPageToken(Option.PAGE_TOKEN.getString(options))
.execute();
return Tuple.<String, Iterable<Project>>of(
response.getNextPageToken(), response.getProjects());
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.resourcemanager.spi;

import com.google.api.services.cloudresourcemanager.model.Project;
import com.google.gcloud.resourcemanager.ResourceManagerException;
Original file line number Diff line number Diff line change
@@ -14,9 +14,10 @@
* limitations under the License.
*/

package com.google.gcloud.spi;
package com.google.gcloud.resourcemanager.spi;

import com.google.gcloud.resourcemanager.ResourceManagerOptions;
import com.google.gcloud.spi.ServiceRpcFactory;

/**
* An interface for Resource Manager RPC factory.
Original file line number Diff line number Diff line change
@@ -9,9 +9,9 @@

import com.google.common.collect.ImmutableMap;
import com.google.gcloud.resourcemanager.testing.LocalResourceManagerHelper;
import com.google.gcloud.spi.DefaultResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpc.Tuple;
import com.google.gcloud.resourcemanager.spi.DefaultResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Tuple;

import org.junit.AfterClass;
import org.junit.Before;
Original file line number Diff line number Diff line change
@@ -31,8 +31,8 @@
import com.google.gcloud.resourcemanager.ResourceManager.ProjectGetOption;
import com.google.gcloud.resourcemanager.ResourceManager.ProjectListOption;
import com.google.gcloud.resourcemanager.testing.LocalResourceManagerHelper;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpcFactory;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpcFactory;

import org.easymock.EasyMock;
import org.junit.AfterClass;
Original file line number Diff line number Diff line change
@@ -24,8 +24,8 @@
import com.google.common.base.Function;
import com.google.gcloud.ReadChannel;
import com.google.gcloud.WriteChannel;
import com.google.gcloud.spi.StorageRpc;
import com.google.gcloud.spi.StorageRpc.Tuple;
import com.google.gcloud.storage.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc.Tuple;
import com.google.gcloud.storage.Storage.BlobTargetOption;
import com.google.gcloud.storage.Storage.BlobWriteOption;
import com.google.gcloud.storage.Storage.CopyRequest;
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@
import com.google.gcloud.ReadChannel;
import com.google.gcloud.RestorableState;
import com.google.gcloud.RetryHelper;
import com.google.gcloud.spi.StorageRpc;
import com.google.gcloud.spi.StorageRpc.Tuple;
import com.google.gcloud.storage.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc.Tuple;

import java.io.IOException;
import java.io.Serializable;
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
import com.google.gcloud.RestorableState;
import com.google.gcloud.RetryHelper;
import com.google.gcloud.WriteChannel;
import com.google.gcloud.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc;

import java.util.Map;

Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.gcloud.Page;
import com.google.gcloud.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc;
import com.google.gcloud.storage.Storage.BlobGetOption;
import com.google.gcloud.storage.Storage.BucketTargetOption;

Original file line number Diff line number Diff line change
@@ -22,9 +22,9 @@
import com.google.gcloud.Restorable;
import com.google.gcloud.RestorableState;
import com.google.gcloud.RetryHelper;
import com.google.gcloud.spi.StorageRpc;
import com.google.gcloud.spi.StorageRpc.RewriteRequest;
import com.google.gcloud.spi.StorageRpc.RewriteResponse;
import com.google.gcloud.storage.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc.RewriteRequest;
import com.google.gcloud.storage.spi.StorageRpc.RewriteResponse;

import java.io.Serializable;
import java.util.Map;
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;
import com.google.gcloud.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc;

import java.io.Serializable;
import java.util.Objects;
Loading