Skip to content

Commit

Permalink
Reformat to google checkstyle with google-java-format (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
elefeint authored Jan 11, 2022
1 parent 6ec6e83 commit e04f755
Show file tree
Hide file tree
Showing 835 changed files with 68,183 additions and 66,413 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<javadoc.failOnWarnings>false</javadoc.failOnWarnings>
<maven-checkstyle-plugin.failOnViolation>true</maven-checkstyle-plugin.failOnViolation>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
<maven-checkstyle-plugin.skip>false</maven-checkstyle-plugin.skip>
<maven-checkstyle-plugin.skip>true</maven-checkstyle-plugin.skip>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.cloud.spring.autoconfigure.bigquery;

import java.io.IOException;

import com.google.api.gax.core.CredentialsProvider;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
Expand All @@ -26,7 +24,7 @@
import com.google.cloud.spring.core.DefaultCredentialsProvider;
import com.google.cloud.spring.core.GcpProjectIdProvider;
import com.google.cloud.spring.core.UserAgentHeaderProvider;

import java.io.IOException;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand All @@ -35,52 +33,54 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* Provides client objects for interfacing with BigQuery.
*/
/** Provides client objects for interfacing with BigQuery. */
@Configuration(proxyBeanMethods = false)
@AutoConfigureAfter(GcpContextAutoConfiguration.class)
@ConditionalOnProperty(value = "spring.cloud.gcp.bigquery.enabled", matchIfMissing = true)
@ConditionalOnClass({ BigQuery.class, BigQueryTemplate.class })
@ConditionalOnClass({BigQuery.class, BigQueryTemplate.class})
@EnableConfigurationProperties(GcpBigQueryProperties.class)
public class GcpBigQueryAutoConfiguration {

private final String projectId;
private final String projectId;

private final CredentialsProvider credentialsProvider;
private final CredentialsProvider credentialsProvider;

private final String datasetName;
private final String datasetName;

GcpBigQueryAutoConfiguration(
GcpBigQueryProperties gcpBigQueryProperties,
GcpProjectIdProvider projectIdProvider,
CredentialsProvider credentialsProvider) throws IOException {
GcpBigQueryAutoConfiguration(
GcpBigQueryProperties gcpBigQueryProperties,
GcpProjectIdProvider projectIdProvider,
CredentialsProvider credentialsProvider)
throws IOException {

this.projectId = (gcpBigQueryProperties.getProjectId() != null)
? gcpBigQueryProperties.getProjectId()
: projectIdProvider.getProjectId();
this.projectId =
(gcpBigQueryProperties.getProjectId() != null)
? gcpBigQueryProperties.getProjectId()
: projectIdProvider.getProjectId();

this.credentialsProvider = (gcpBigQueryProperties.getCredentials().hasKey()
? new DefaultCredentialsProvider(gcpBigQueryProperties)
: credentialsProvider);
this.credentialsProvider =
(gcpBigQueryProperties.getCredentials().hasKey()
? new DefaultCredentialsProvider(gcpBigQueryProperties)
: credentialsProvider);

this.datasetName = gcpBigQueryProperties.getDatasetName();
}
this.datasetName = gcpBigQueryProperties.getDatasetName();
}

@Bean
@ConditionalOnMissingBean
public BigQuery bigQuery() throws IOException {
BigQueryOptions bigQueryOptions = BigQueryOptions.newBuilder()
.setProjectId(this.projectId)
.setCredentials(this.credentialsProvider.getCredentials())
.setHeaderProvider(new UserAgentHeaderProvider(GcpBigQueryAutoConfiguration.class))
.build();
return bigQueryOptions.getService();
}
@Bean
@ConditionalOnMissingBean
public BigQuery bigQuery() throws IOException {
BigQueryOptions bigQueryOptions =
BigQueryOptions.newBuilder()
.setProjectId(this.projectId)
.setCredentials(this.credentialsProvider.getCredentials())
.setHeaderProvider(new UserAgentHeaderProvider(GcpBigQueryAutoConfiguration.class))
.build();
return bigQueryOptions.getService();
}

@Bean
@ConditionalOnMissingBean
public BigQueryTemplate bigQueryTemplate(BigQuery bigQuery) {
return new BigQueryTemplate(bigQuery, this.datasetName);
}
@Bean
@ConditionalOnMissingBean
public BigQueryTemplate bigQueryTemplate(BigQuery bigQuery) {
return new BigQueryTemplate(bigQuery, this.datasetName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,40 @@
import com.google.cloud.spring.core.Credentials;
import com.google.cloud.spring.core.CredentialsSupplier;
import com.google.cloud.spring.core.GcpScope;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

/**
* Properties for configuring BigQuery.
*/
/** Properties for configuring BigQuery. */
@ConfigurationProperties("spring.cloud.gcp.bigquery")
public class GcpBigQueryProperties implements CredentialsSupplier {

/**
* Overrides the GCP OAuth2 credentials specified in the Core module.
*/
@NestedConfigurationProperty
private final Credentials credentials = new Credentials(GcpScope.BIG_QUERY.getUrl());
/** Overrides the GCP OAuth2 credentials specified in the Core module. */
@NestedConfigurationProperty
private final Credentials credentials = new Credentials(GcpScope.BIG_QUERY.getUrl());

/**
* Overrides the GCP project ID specified in the Core module to use for BigQuery.
*/
private String projectId;
/** Overrides the GCP project ID specified in the Core module to use for BigQuery. */
private String projectId;

/**
* Name of the BigQuery dataset to use.
*/
private String datasetName;
/** Name of the BigQuery dataset to use. */
private String datasetName;

public Credentials getCredentials() {
return this.credentials;
}
public Credentials getCredentials() {
return this.credentials;
}

public String getProjectId() {
return this.projectId;
}
public String getProjectId() {
return this.projectId;
}

public void setProjectId(String projectId) {
this.projectId = projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}

public String getDatasetName() {
return this.datasetName;
}
public String getDatasetName() {
return this.datasetName;
}

public void setDatasetName(String datasetName) {
this.datasetName = datasetName;
}
public void setDatasetName(String datasetName) {
this.datasetName = datasetName;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/**
* Auto-configuration for Spring Cloud GCP BigQuery module.
*/
/** Auto-configuration for Spring Cloud GCP BigQuery module. */
package com.google.cloud.spring.autoconfigure.bigquery;
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

package com.google.cloud.spring.autoconfigure.config;

import java.io.IOException;

import com.google.cloud.spring.core.DefaultCredentialsProvider;
import com.google.cloud.spring.core.DefaultGcpProjectIdProvider;

import java.io.IOException;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand All @@ -37,12 +35,13 @@
@EnableConfigurationProperties(GcpConfigProperties.class)
public class GcpConfigBootstrapConfiguration {

@Bean
@ConditionalOnMissingBean
public GoogleConfigPropertySourceLocator googleConfigPropertySourceLocator(
GcpConfigProperties configProperties) throws IOException {
return new GoogleConfigPropertySourceLocator(new DefaultGcpProjectIdProvider(),
new DefaultCredentialsProvider(configProperties), configProperties);
}
@Bean
@ConditionalOnMissingBean
public GoogleConfigPropertySourceLocator googleConfigPropertySourceLocator(
GcpConfigProperties configProperties) throws IOException {
return new GoogleConfigPropertySourceLocator(
new DefaultGcpProjectIdProvider(),
new DefaultCredentialsProvider(configProperties),
configProperties);
}
}

Loading

0 comments on commit e04f755

Please sign in to comment.