Skip to content
Closed
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 @@ -17,6 +17,7 @@
package com.google.cloud.grpc;

import com.google.api.client.http.HttpResponseException;
import com.google.api.core.InternalApi;
import com.google.api.gax.grpc.ApiException;
import com.google.cloud.BaseServiceException;
import com.google.common.base.MoreObjects;
Expand All @@ -30,12 +31,14 @@ public class BaseGrpcServiceException extends BaseServiceException {

private static final long serialVersionUID = -2685197215731335549L;

public BaseGrpcServiceException(String message, Throwable cause, int code, boolean retryable) {
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseGrpcServiceException(String message, Throwable cause, int code, boolean retryable) {
super(ExceptionData.newBuilder().setMessage(message).setCause(cause).setCode(code)
.setRetryable(retryable).build());
}

public BaseGrpcServiceException(IOException exception, boolean idempotent) {
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseGrpcServiceException(IOException exception, boolean idempotent) {
super(makeExceptionData(exception, idempotent));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.HttpResponseException;
import com.google.api.core.InternalApi;
import com.google.cloud.BaseServiceException;
import com.google.common.base.MoreObjects;
import java.io.IOException;
Expand All @@ -32,7 +33,8 @@ public class BaseHttpServiceException extends BaseServiceException {
private static final long serialVersionUID = -5793034110344127954L;
public static final int UNKNOWN_CODE = 0;

public BaseHttpServiceException(IOException exception, boolean idempotent,
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseHttpServiceException(IOException exception, boolean idempotent,
Set<BaseServiceException.Error> retryableErrors) {
super(makeExceptionData(exception, idempotent, retryableErrors));
}
Expand Down Expand Up @@ -80,7 +82,8 @@ private static ExceptionData makeExceptionData(IOException exception, boolean id
.build();
}

public BaseHttpServiceException(GoogleJsonError googleJsonError, boolean idempotent,
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseHttpServiceException(GoogleJsonError googleJsonError, boolean idempotent,
Set<BaseServiceException.Error> retryableErrors) {
super(makeExceptionData(googleJsonError, idempotent, retryableErrors));
}
Expand Down Expand Up @@ -108,12 +111,14 @@ private static ExceptionData makeExceptionData(GoogleJsonError googleJsonError,
return exceptionData.build();
}

public BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
Set<BaseServiceException.Error> retryableErrors) {
this(code, message, reason, idempotent, retryableErrors, null);
}

public BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
Set<BaseServiceException.Error> retryableErrors, Throwable cause) {
super(ExceptionData.newBuilder()
.setMessage(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.core.InternalApi;
import com.google.auth.Credentials;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.http.HttpTransportFactory;
Expand Down Expand Up @@ -122,7 +123,7 @@ public Builder setReadTimeout(int readTimeout) {
}
}

protected HttpTransportOptions(Builder builder) {
private HttpTransportOptions(Builder builder) {
httpTransportFactory = firstNonNull(builder.httpTransportFactory,
ServiceOptions.getFromServiceLoader(HttpTransportFactory.class,
DefaultHttpTransportFactory.INSTANCE));
Expand Down
1 change: 0 additions & 1 deletion google-cloud-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<version>${api-common.version}</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud;

import com.google.api.core.InternalApi;
import com.google.cloud.ExceptionHandler.Interceptor;

/**
Expand Down Expand Up @@ -51,6 +52,7 @@ public RetryResult beforeEval(Exception exception) {

private final OptionsT options;

@InternalApi("This class should only be extended within google-cloud-java")
protected BaseService(OptionsT options) {
this.options = options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ public static void translate(RetryHelper.RetryHelperException ex) {
}
}

public BaseServiceException(ExceptionData exceptionData) {
@InternalApi("This class should only be extended within google-cloud-java")
protected BaseServiceException(ExceptionData exceptionData) {
super(exceptionData.getMessage(), exceptionData.getCause());
this.code = exceptionData.getCode();
this.reason = exceptionData.getReason();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud;

import com.google.api.core.InternalApi;
import java.io.IOException;
import java.io.Serializable;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -107,6 +108,7 @@ public final void setChunkSize(int chunkSize) {
this.chunkSize = Math.max(getMinChunkSize(), chunkSize);
}

@InternalApi("This class should only be extended within google-cloud-java")
protected BaseWriteChannel(ServiceOptionsT options, EntityT entity, String uploadId) {
this.options = options;
this.entity = entity;
Expand Down Expand Up @@ -209,6 +211,7 @@ protected abstract static class BaseState<
protected final boolean isOpen;
protected final int chunkSize;

@InternalApi("This class should only be extended within google-cloud-java")
protected BaseState(Builder<ServiceOptionsT, EntityT> builder) {
this.serviceOptions = builder.serviceOptions;
this.entity = builder.entity;
Expand Down Expand Up @@ -238,6 +241,7 @@ public abstract static class Builder<
private boolean isOpen;
private int chunkSize;

@InternalApi("This class should only be extended within google-cloud-java")
protected Builder(ServiceOptionsT options, EntityT entity, String uploadId) {
this.serviceOptions = options;
this.entity = entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import com.google.api.core.InternalApi;
import java.util.LinkedList;
import java.util.List;

Expand All @@ -36,6 +37,10 @@ public abstract class BatchResult<T, E extends BaseServiceException> {
private E error;
private final List<Callback<T, E>> toBeNotified = new LinkedList<>();

@InternalApi("This class should only be extended within google-cloud-java")
protected BatchResult() {
}

/**
* Returns {@code true} if the batch has been completed and the result is available; {@code false}
* otherwise.
Expand Down
11 changes: 1 addition & 10 deletions google-cloud-core/src/main/java/com/google/cloud/ByteArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ public class ByteArray implements Iterable<Byte>, Serializable {

private final ByteString byteString;

protected ByteArray(ByteString byteString) {
ByteArray(ByteString byteString) {
this.byteString = byteString;
}

protected ByteArray(ByteArray byteArray) {
this.byteString = byteArray.getByteString();
}

@Override
public final Iterator<Byte> iterator() {
return byteString.iterator();
Expand Down Expand Up @@ -117,11 +113,6 @@ public final InputStream asInputStream() {
return byteString.newInput();
}


protected ByteString getByteString() {
return byteString;
}

/**
* Copies the content of this {@code ByteArray} into an existing {@code ByteBuffer}.
*
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-core/src/main/java/com/google/cloud/Date.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Represents a Date without time, such as 2017-03-17. Date is timezone independent.
*/
@BetaApi
@BetaApi("This is going to be replaced with LocalDate from threetenbp")
public final class Date implements Comparable<Date>, Serializable {

// Date format "yyyy-mm-dd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.api.core.BetaApi;
import com.google.api.gax.retrying.ExceptionRetryAlgorithm;
import com.google.api.gax.retrying.TimedAttemptSettings;
import com.google.common.annotations.VisibleForTesting;
Expand All @@ -35,6 +36,7 @@
/**
* Exception retry algorithm implementation used by {@link RetryHelper}.
*/
@BetaApi
public final class ExceptionHandler implements ExceptionRetryAlgorithm, Serializable {

private static final long serialVersionUID = -2460707015779532919L;
Expand Down Expand Up @@ -263,7 +265,7 @@ public boolean accept(Throwable prevThrowable) {
@Override
public TimedAttemptSettings createNextAttempt(Throwable prevThrowable,
TimedAttemptSettings prevSettings) {
// Return null to indicate that this implementaiton does not provide any specific attempt
// Return null to indicate that this implementation does not provide any specific attempt
// settings, so by default the TimedRetryAlgorithm options can be used instead.
return null;
}
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-core/src/main/java/com/google/cloud/Policy.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.api.core.ApiFunction;
import com.google.api.core.InternalApi;
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -58,6 +59,10 @@ public final class Policy implements Serializable {

public abstract static class Marshaller<T> {

@InternalApi("This class should only be extended within google-cloud-java")
protected Marshaller() {
}

protected static final ApiFunction<String, Identity> IDENTITY_VALUE_OF_FUNCTION =
new ApiFunction<String, Identity>() {
@Override
Expand Down Expand Up @@ -135,9 +140,11 @@ public static class Builder {
private String etag;
private int version;

@InternalApi("This class should only be extended within google-cloud-java")
protected Builder() {
}

@InternalApi("This class should only be extended within google-cloud-java")
protected Builder(Policy policy) {
setBindings(policy.bindings);
setEtag(policy.etag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud;

import com.google.api.core.ApiClock;
import com.google.api.core.BetaApi;
import com.google.api.gax.retrying.RetrySettings;

import com.google.api.gax.retrying.DirectRetryingExecutor;
Expand All @@ -31,6 +32,7 @@
* RetrySettings}. In case if retrying is unsuccessful, {@link RetryHelperException} will be
* thrown.
*/
@BetaApi
public class RetryHelper {
public static <V> V runWithRetries(
Callable<V> callable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ public abstract static class Builder<ServiceT extends Service<OptionsT>,
private ApiClock clock;
private TransportOptions transportOptions;

@InternalApi("This class should only be extended within google-cloud-java")
protected Builder() {}

@InternalApi("This class should only be extended within google-cloud-java")
protected Builder(ServiceOptions<ServiceT, OptionsT> options) {
projectId = options.projectId;
host = options.host;
Expand Down Expand Up @@ -226,6 +228,7 @@ public B setTransportOptions(TransportOptions transportOptions) {
}
}

@InternalApi("This class should only be extended within google-cloud-java")
protected ServiceOptions(Class<? extends ServiceFactory<ServiceT, OptionsT>> serviceFactoryClass,
Class<? extends ServiceRpcFactory<OptionsT>> rpcFactoryClass,
Builder<ServiceT, OptionsT, ?> builder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public abstract class StringEnumValue implements Serializable {
/**
* Don't create subclasses outside of google-cloud-java.
*/
@InternalApi
@InternalApi("This class should only be extended within google-cloud-java")
protected StringEnumValue(String constant) {
this.constant = Preconditions.checkNotNull(constant);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public abstract class BaseEmulatorHelper<T extends ServiceOptions> {
protected static final String DEFAULT_HOST = "localhost";
protected static final int DEFAULT_PORT = 8080;

@InternalApi("This class should only be extended within google-cloud-java")
protected BaseEmulatorHelper(String emulator, int port, String projectId) {
this.emulator = emulator;
this.port = port > 0 ? port : DEFAULT_PORT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class BaseDatastoreBatchWriter implements DatastoreBatchWriter {
private final Set<Key> toDelete = new LinkedHashSet<>();
private boolean active = true;

protected BaseDatastoreBatchWriter(String name) {
BaseDatastoreBatchWriter(String name) {
this.name = name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

package com.google.cloud.datastore;

import com.google.api.core.BetaApi;
import com.google.cloud.ExceptionHandler;
import com.google.cloud.ExceptionHandler.Interceptor;

@BetaApi
public class TransactionExceptionHandler {
public static final Interceptor TRANSACTION_EXCEPTION_HANDLER_INTERCEPTOR =
new Interceptor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public final com.google.datastore.v1.Value toProto(P value) {
return builder.build();
}

BaseMarshaller() {
}

protected abstract V getValue(com.google.datastore.v1.Value from);

protected abstract void setValue(P from, com.google.datastore.v1.Value.Builder to);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud.logging;

import com.google.api.core.InternalApi;
import com.google.cloud.grpc.GrpcTransportOptions;
import com.google.cloud.ServiceDefaults;
import com.google.cloud.ServiceOptions;
Expand Down Expand Up @@ -96,6 +97,7 @@ public LoggingOptions build() {
}
}

@InternalApi("This class should only be extended within google-cloud-java")
protected LoggingOptions(Builder builder) {
super(LoggingFactory.class, LoggingRpcFactory.class, builder, new LoggingDefaults());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class MetricInfo implements Serializable {
*/
public abstract static class Builder {

Builder() {
}

/**
* Sets the name of the metric. Example: {@code severe-errors}. Metric identifiers are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ void populateCondition(Rule.Condition condition) {
* Builder for {@code BucketInfo}.
*/
public abstract static class Builder {
Builder() {
}

/**
* Sets the bucket's name.
*/
Expand Down
Loading