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
Show file tree
Hide file tree
Changes from all commits
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
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
* 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.ALL_DATASETS;
import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.ALL_USERS;
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.STATE_FILTER;
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;
Expand Down Expand Up @@ -110,9 +113,10 @@ public Tuple<String, Iterable<Dataset>> listDatasets(Map<Option, ?> options) {
try {
DatasetList datasetsList = bigquery.datasets()
.list(this.options.projectId())
.setAll(Option.ALL_DATASETS.getBoolean(options))
.setAll(ALL_DATASETS.getBoolean(options))
.setMaxResults(MAX_RESULTS.getLong(options))
.setPageToken(PAGE_TOKEN.getString(options))
.setPageToken(PAGE_TOKEN.getString(options))
.execute();
Iterable<DatasetList.Datasets> datasets = datasetsList.getDatasets();
return Tuple.of(datasetsList.getNextPageToken(),
Expand Down Expand Up @@ -322,9 +326,9 @@ public Tuple<String, Iterable<Job>> listJobs(Map<Option, ?> options) {
try {
JobList jobsList = bigquery.jobs()
.list(this.options.projectId())
.setAllUsers(Option.ALL_USERS.getBoolean(options))
.setFields(Option.FIELDS.getString(options))
.setStateFilter(Option.STATE_FILTER.<List<String>>get(options))
.setAllUsers(ALL_USERS.getBoolean(options))
.setFields(FIELDS.getString(options))
.setStateFilter(STATE_FILTER.<List<String>>get(options))
.setMaxResults(MAX_RESULTS.getLong(options))
.setPageToken(PAGE_TOKEN.getString(options))
.setProjection(DEFAULT_PROJECTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

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

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

import org.easymock.EasyMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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.Blob;
import com.google.gcloud.storage.BlobId;
import com.google.gcloud.storage.BlobInfo;
Expand All @@ -31,6 +30,7 @@
import com.google.gcloud.storage.Storage.CopyRequest;
import com.google.gcloud.storage.Storage.SignUrlOption;
import com.google.gcloud.storage.StorageOptions;
import com.google.gcloud.storage.spi.StorageRpc.Tuple;

import java.io.FileOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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 com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Option.FIELDS;

This comment was marked as spam.

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import static org.junit.Assert.fail;

import com.google.common.collect.ImmutableMap;
import com.google.gcloud.resourcemanager.spi.DefaultResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Tuple;
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 org.junit.AfterClass;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
import com.google.gcloud.resourcemanager.ResourceManager.ProjectField;
import com.google.gcloud.resourcemanager.ResourceManager.ProjectGetOption;
import com.google.gcloud.resourcemanager.ResourceManager.ProjectListOption;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
import com.google.gcloud.resourcemanager.spi.ResourceManagerRpcFactory;
import com.google.gcloud.resourcemanager.testing.LocalResourceManagerHelper;
import com.google.gcloud.spi.ResourceManagerRpc;
import com.google.gcloud.spi.ResourceManagerRpcFactory;

import org.easymock.EasyMock;
import org.junit.AfterClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
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.Storage.BlobTargetOption;
import com.google.gcloud.storage.Storage.BlobWriteOption;
import com.google.gcloud.storage.Storage.CopyRequest;
import com.google.gcloud.storage.Storage.SignUrlOption;
import com.google.gcloud.storage.spi.StorageRpc;
import com.google.gcloud.storage.spi.StorageRpc.Tuple;

import java.io.IOException;
import java.io.ObjectInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
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.Storage.BlobGetOption;
import com.google.gcloud.storage.Storage.BucketTargetOption;
import com.google.gcloud.storage.spi.StorageRpc;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Loading