Skip to content

Commit

Permalink
[#9344] google style import ordering
Browse files Browse the repository at this point in the history
Summary:
Dont use wildcard imports and use google style for import ordering
Using
https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml
schema and changing only import ordering.
For rest of the formatting we should continue to use sbt javafmtAll

Test Plan: N/A

Reviewers: arnav, spotachev, jvigil

Reviewed By: spotachev, jvigil

Subscribers: jenkins-bot, yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D12291
  • Loading branch information
sb-yb committed Jul 19, 2021
1 parent d1fa918 commit c31097a
Show file tree
Hide file tree
Showing 472 changed files with 8,048 additions and 7,333 deletions.
18 changes: 13 additions & 5 deletions managed/src/main/java/AppInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@
import com.google.inject.Singleton;
import com.yugabyte.yw.cloud.AWSInitializer;
import com.yugabyte.yw.commissioner.TaskGarbageCollector;
import com.yugabyte.yw.common.*;
import com.yugabyte.yw.common.CertificateHelper;
import com.yugabyte.yw.common.ConfigHelper;
import com.yugabyte.yw.common.CustomerTaskManager;
import com.yugabyte.yw.common.ExtraMigrationManager;
import com.yugabyte.yw.common.ReleaseManager;
import com.yugabyte.yw.common.YamlWrapper;
import com.yugabyte.yw.common.ha.PlatformReplicationManager;
import com.yugabyte.yw.models.*;
import com.yugabyte.yw.models.Customer;
import com.yugabyte.yw.models.ExtraMigration;
import com.yugabyte.yw.models.InstanceType;
import com.yugabyte.yw.models.MetricConfig;
import com.yugabyte.yw.models.Provider;
import io.ebean.Ebean;
import io.prometheus.client.hotspot.DefaultExports;
import java.util.List;
import java.util.Map;
import play.Application;
import play.Configuration;
import play.Environment;
import play.Logger;

import java.util.List;
import java.util.Map;

/** We will use this singleton to do actions specific to the app environment, like db seed etc. */
@Singleton
public class AppInit {
Expand Down
7 changes: 3 additions & 4 deletions managed/src/main/java/Filters.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) YugaByte, Inc.

import com.google.inject.Inject;
import play.mvc.EssentialFilter;
import java.util.ArrayList;
import java.util.List;
import play.filters.cors.CORSFilter;
import play.filters.csrf.CSRFFilter;
import play.http.HttpFilters;

import java.util.ArrayList;
import java.util.List;
import play.mvc.EssentialFilter;

public class Filters implements HttpFilters {

Expand Down
24 changes: 22 additions & 2 deletions managed/src/main/java/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,28 @@
import com.google.inject.Provides;
import com.yugabyte.yw.cloud.AWSInitializer;
import com.yugabyte.yw.cloud.aws.AWSCloudModule;
import com.yugabyte.yw.commissioner.*;
import com.yugabyte.yw.common.*;
import com.yugabyte.yw.commissioner.CallHome;
import com.yugabyte.yw.commissioner.HealthChecker;
import com.yugabyte.yw.commissioner.QueryAlerts;
import com.yugabyte.yw.commissioner.SetUniverseKey;
import com.yugabyte.yw.commissioner.TaskGarbageCollector;
import com.yugabyte.yw.common.AccessManager;
import com.yugabyte.yw.common.AlertManager;
import com.yugabyte.yw.common.ConfigHelper;
import com.yugabyte.yw.common.CustomerTaskManager;
import com.yugabyte.yw.common.ExtraMigrationManager;
import com.yugabyte.yw.common.HealthManager;
import com.yugabyte.yw.common.KubernetesManager;
import com.yugabyte.yw.common.NetworkManager;
import com.yugabyte.yw.common.NodeManager;
import com.yugabyte.yw.common.PlatformInstanceClientFactory;
import com.yugabyte.yw.common.ReleaseManager;
import com.yugabyte.yw.common.ShellProcessHandler;
import com.yugabyte.yw.common.SwamperHelper;
import com.yugabyte.yw.common.TemplateManager;
import com.yugabyte.yw.common.YamlWrapper;
import com.yugabyte.yw.common.YcqlQueryExecutor;
import com.yugabyte.yw.common.YsqlQueryExecutor;
import com.yugabyte.yw.common.alerts.AlertConfigurationWriter;
import com.yugabyte.yw.common.config.RuntimeConfigFactory;
import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory;
Expand Down
35 changes: 25 additions & 10 deletions managed/src/main/java/com/yugabyte/yw/cloud/AWSInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@

package com.yugabyte.yw.cloud;

import static com.yugabyte.yw.cloud.PublicCloudConstants.GP2_SIZE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_PIOPS;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_SIZE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_THROUGHPUT;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GROUP_EBS_IOPS;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GROUP_EBS_THROUGHPUT;
import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_PIOPS;
import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_SIZE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_COMPUTE_INSTANCE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_PROVISIONED_THROUGHPUT;
import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_STORAGE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_SYSTEM_OPERATION;
import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_GENERAL_PURPOSE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_NAME_GP2;
import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_NAME_GP3;
import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_NAME_IO1;
import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_TYPE_PROVISIONED_IOPS;
import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
Expand All @@ -22,22 +41,18 @@
import com.yugabyte.yw.models.PriceComponent;
import com.yugabyte.yw.models.Provider;
import com.yugabyte.yw.models.Region;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import play.Environment;
import play.libs.Json;
import play.mvc.Result;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;

import static com.yugabyte.yw.cloud.PublicCloudConstants.*;
import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import play.Environment;
import play.libs.Json;
import play.mvc.Result;

// TODO: move pricing data fetch to ybcloud.
@Singleton
Expand Down
17 changes: 10 additions & 7 deletions managed/src/main/java/com/yugabyte/yw/cloud/AZUInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@

package com.yugabyte.yw.cloud;

import static play.mvc.Http.Status.BAD_REQUEST;
import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.inject.Singleton;
import com.yugabyte.yw.commissioner.Common;
import com.yugabyte.yw.common.ApiResponse;
import com.yugabyte.yw.forms.YWResults;
import com.yugabyte.yw.models.*;
import com.yugabyte.yw.models.Customer;
import com.yugabyte.yw.models.InstanceType;
import com.yugabyte.yw.models.InstanceType.InstanceTypeDetails;
import com.yugabyte.yw.models.PriceComponent;
import com.yugabyte.yw.models.PriceComponent.PriceDetails;
import play.libs.Json;
import play.mvc.Result;

import com.yugabyte.yw.models.Provider;
import com.yugabyte.yw.models.Region;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;

import static play.mvc.Http.Status.BAD_REQUEST;
import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR;
import play.libs.Json;
import play.mvc.Result;

@Singleton
public class AZUInitializer extends AbstractInitializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
import com.yugabyte.yw.common.ApiHelper;
import com.yugabyte.yw.common.CloudQueryHelper;
import com.yugabyte.yw.models.Provider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.mvc.Result;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.mvc.Result;

public abstract class AbstractInitializer {
public static final Logger LOG = LoggerFactory.getLogger(AbstractInitializer.class);
Expand Down
9 changes: 4 additions & 5 deletions managed/src/main/java/com/yugabyte/yw/cloud/CloudAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

import com.yugabyte.yw.models.Provider;
import com.yugabyte.yw.models.Region;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public interface CloudAPI {

Expand Down
17 changes: 10 additions & 7 deletions managed/src/main/java/com/yugabyte/yw/cloud/GCPInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@

package com.yugabyte.yw.cloud;

import static play.mvc.Http.Status.BAD_REQUEST;
import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.inject.Singleton;
import com.yugabyte.yw.commissioner.Common;
import com.yugabyte.yw.common.ApiResponse;
import com.yugabyte.yw.forms.YWResults;
import com.yugabyte.yw.models.*;
import com.yugabyte.yw.models.Customer;
import com.yugabyte.yw.models.InstanceType;
import com.yugabyte.yw.models.InstanceType.InstanceTypeDetails;
import com.yugabyte.yw.models.PriceComponent;
import com.yugabyte.yw.models.PriceComponent.PriceDetails;
import play.libs.Json;
import play.mvc.Result;

import com.yugabyte.yw.models.Provider;
import com.yugabyte.yw.models.Region;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;

import static play.mvc.Http.Status.BAD_REQUEST;
import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR;
import play.libs.Json;
import play.mvc.Result;

@Singleton
public class GCPInitializer extends AbstractInitializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

package com.yugabyte.yw.cloud;

import static com.yugabyte.yw.cloud.PublicCloudConstants.GP2_SIZE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_PIOPS;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_SIZE;
import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_THROUGHPUT;
import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_PIOPS;
import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_SIZE;

import com.typesafe.config.Config;
import com.yugabyte.yw.commissioner.Common;
import com.yugabyte.yw.forms.UniverseDefinitionTaskParams;
Expand All @@ -22,14 +29,11 @@
import com.yugabyte.yw.models.helpers.NodeDetails;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collection;
import java.util.HashSet;
import java.util.UUID;

import static com.yugabyte.yw.cloud.PublicCloudConstants.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ApiModel(value = "UniverseResource", description = "Universe Resource")
public class UniverseResourceDetails {
Expand Down
22 changes: 15 additions & 7 deletions managed/src/main/java/com/yugabyte/yw/cloud/aws/AWSCloudImpl.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
package com.yugabyte.yw.cloud.aws;

import com.amazonaws.auth.*;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.mapping;
import static java.util.stream.Collectors.toSet;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.AmazonEC2ClientBuilder;
import com.amazonaws.services.ec2.model.*;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsRequest;
import com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsResult;
import com.amazonaws.services.ec2.model.DescribeInstancesRequest;
import com.amazonaws.services.ec2.model.DryRunResult;
import com.amazonaws.services.ec2.model.Filter;
import com.amazonaws.services.ec2.model.InstanceTypeOffering;
import com.amazonaws.services.ec2.model.LocationType;
import com.google.common.base.Strings;
import com.yugabyte.yw.cloud.CloudAPI;
import com.yugabyte.yw.models.Provider;
import com.yugabyte.yw.models.Region;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.util.stream.Collectors.*;

// TODO - Better handling of UnauthorizedOperation. Ideally we should trigger alert so that
// site admin knows about it
class AWSCloudImpl implements CloudAPI {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,27 @@
import com.yugabyte.yw.forms.CustomerRegisterFormData;
import com.yugabyte.yw.forms.ITaskParams;
import com.yugabyte.yw.forms.UniverseDefinitionTaskParams;
import com.yugabyte.yw.models.*;
import com.yugabyte.yw.models.Alert;
import com.yugabyte.yw.models.AlertDefinitionGroup;
import com.yugabyte.yw.models.Customer;
import com.yugabyte.yw.models.CustomerConfig;
import com.yugabyte.yw.models.CustomerTask;
import com.yugabyte.yw.models.Universe;
import com.yugabyte.yw.models.Universe.UniverseUpdater;
import com.yugabyte.yw.models.helpers.KnownAlertCodes;
import com.yugabyte.yw.models.helpers.NodeDetails;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import play.Application;
import play.api.Play;
import play.libs.Json;

import javax.inject.Inject;
import java.util.UUID;
import java.util.concurrent.*;

@Slf4j
public abstract class AbstractTaskBase implements ITask {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
import com.yugabyte.yw.common.alerts.AlertService;
import com.yugabyte.yw.common.config.RuntimeConfigFactory;
import com.yugabyte.yw.common.services.YBClientService;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import play.Application;

import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
@Getter
@RequiredArgsConstructor(onConstructor_ = {@Inject})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject;
import com.google.inject.Singleton;

import com.yugabyte.yw.common.CallHomeManager;
import com.yugabyte.yw.models.Customer;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import play.Environment;
import scala.concurrent.ExecutionContext;
import scala.concurrent.duration.Duration;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

@Singleton
public class CallHome {

Expand Down
Loading

0 comments on commit c31097a

Please sign in to comment.