From 3428b43e65921e336a1d400a17c9ef1b6c941fdb Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Mon, 7 Dec 2020 15:27:41 -0500 Subject: [PATCH] update style, update web --- .../src/main/java/bubble/auth/BubbleAuthFilter.java | 2 +- .../cloud/compute/docker/DockerComputeDriver.java | 12 +++++++++--- .../bubble/cloud/storage/s3/S3StorageDriver.java | 4 ++-- .../java/bubble/model/account/AccountPolicy.java | 2 +- .../src/main/java/bubble/model/account/TotpBean.java | 2 +- .../java/bubble/model/cloud/BubbleFootprint.java | 2 +- ...tificationHandler_compute_driver_get_regions.java | 2 +- ...NotificationHandler_compute_driver_get_sizes.java | 2 +- .../java/bubble/rule/bblock/BubbleBlockConfig.java | 2 +- bubble-web | 2 +- utils/cobbzilla-utils | 2 +- utils/cobbzilla-wizard | 2 +- 12 files changed, 21 insertions(+), 15 deletions(-) diff --git a/bubble-server/src/main/java/bubble/auth/BubbleAuthFilter.java b/bubble-server/src/main/java/bubble/auth/BubbleAuthFilter.java index 56a47d57..8a999449 100644 --- a/bubble-server/src/main/java/bubble/auth/BubbleAuthFilter.java +++ b/bubble-server/src/main/java/bubble/auth/BubbleAuthFilter.java @@ -41,7 +41,7 @@ public class BubbleAuthFilter extends AuthFilter { AUTH_ENDPOINT + EP_RESTORE + "/", AUTH_ENDPOINT + EP_CONFIGS, AUTH_ENDPOINT + EP_READY, BUBBLE_MAGIC_ENDPOINT, NOTIFY_ENDPOINT, MESSAGES_ENDPOINT })); - public static final Set SKIP_AUTH_TEST = new HashSet<>(Arrays.asList(ArrayUtil.append(SKIP_AUTH_PREFIXES.toArray(new String[0]), + public static final Set SKIP_AUTH_TEST = new HashSet<>(Arrays.asList(ArrayUtil.append(SKIP_AUTH_PREFIXES.toArray(String[]::new), DEBUG_ENDPOINT ))); diff --git a/bubble-server/src/main/java/bubble/cloud/compute/docker/DockerComputeDriver.java b/bubble-server/src/main/java/bubble/cloud/compute/docker/DockerComputeDriver.java index 56b8191e..cb63e6df 100644 --- a/bubble-server/src/main/java/bubble/cloud/compute/docker/DockerComputeDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/compute/docker/DockerComputeDriver.java @@ -34,6 +34,7 @@ import java.util.stream.Collectors; import static bubble.service.packer.PackerJob.PACKER_IMAGE_PREFIX; import static java.lang.Boolean.parseBoolean; import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; import static java.util.concurrent.TimeUnit.SECONDS; import static org.cobbzilla.util.daemon.ZillaRuntime.*; import static org.cobbzilla.util.json.JsonUtil.json; @@ -51,9 +52,14 @@ public class DockerComputeDriver extends ComputeServiceDriverBase { }; public static final List CLOUD_REGIONS = Arrays.asList(CLOUD_REGIONS_ARRAY); - public static final List CLOUD_SIZES = Arrays.asList(new ComputeNodeSize[]{ - new ComputeNodeSize().setName(LOCAL).setInternalName(LOCAL).setType(ComputeNodeSizeType.local) - }); + public static final ComputeNodeSize LOCAL_SIZE = new ComputeNodeSize().setName(LOCAL).setInternalName(LOCAL).setType(ComputeNodeSizeType.local); + public static final List CLOUD_SIZES = singletonList(LOCAL_SIZE); + public static final Map NODE_SIZE_MAP = MapBuilder.build(LOCAL, LOCAL_SIZE); + + @Override public Map getSizesMap() { return NODE_SIZE_MAP; } + + @Override public ComputeNodeSize getSize(ComputeNodeSizeType type) { return LOCAL_SIZE; } + public static final List CLOUD_OS_IMAGES = Arrays.asList(new OsImage[]{ new OsImage().setName("ubuntu:20.04").setId("ubuntu:20.04").setRegion(LOCAL) }); diff --git a/bubble-server/src/main/java/bubble/cloud/storage/s3/S3StorageDriver.java b/bubble-server/src/main/java/bubble/cloud/storage/s3/S3StorageDriver.java index 953dba66..2587889e 100644 --- a/bubble-server/src/main/java/bubble/cloud/storage/s3/S3StorageDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/storage/s3/S3StorageDriver.java @@ -243,7 +243,7 @@ public class S3StorageDriver extends StorageServiceDriverBase { return new StorageListing() .setListingId(listRequestId) - .setKeys(keys.toArray(new String[0])) + .setKeys(keys.toArray(String[]::new)) .setTruncated(listing.isTruncated()); } @@ -263,7 +263,7 @@ public class S3StorageDriver extends StorageServiceDriverBase { return new StorageListing() .setListingId(listingId) - .setKeys(keys.toArray(new String[0])) + .setKeys(keys.toArray(String[]::new)) .setTruncated(listingRequest.objectListing.isTruncated()); } diff --git a/bubble-server/src/main/java/bubble/model/account/AccountPolicy.java b/bubble-server/src/main/java/bubble/model/account/AccountPolicy.java index adc9418e..5969354c 100644 --- a/bubble-server/src/main/java/bubble/model/account/AccountPolicy.java +++ b/bubble-server/src/main/java/bubble/model/account/AccountPolicy.java @@ -309,7 +309,7 @@ public class AccountPolicy extends IdentifiableBase implements HasAccount { for (AccountContact c : getAccountContacts()) { scrubbed.add(c.mask()); } - setAccountContacts(scrubbed.toArray(new AccountContact[0])); + setAccountContacts(scrubbed.toArray(AccountContact[]::new)); } return this; } diff --git a/bubble-server/src/main/java/bubble/model/account/TotpBean.java b/bubble-server/src/main/java/bubble/model/account/TotpBean.java index bd911248..42069074 100644 --- a/bubble-server/src/main/java/bubble/model/account/TotpBean.java +++ b/bubble-server/src/main/java/bubble/model/account/TotpBean.java @@ -19,7 +19,7 @@ public class TotpBean { public TotpBean(GoogleAuthenticatorKey creds, Account account, BubbleConfiguration configuration) { setKey(creds.getKey()); setUrl(getOtpAuthTotpURL(configuration.getThisNetwork().getNetworkDomain(), account.getEmail()+"/"+configuration.getThisNetwork().getNetworkDomain(), creds)); - setBackupCodes(creds.getScratchCodes().toArray(new Integer[0])); + setBackupCodes(creds.getScratchCodes().toArray(Integer[]::new)); } @Getter @Setter private String key; diff --git a/bubble-server/src/main/java/bubble/model/cloud/BubbleFootprint.java b/bubble-server/src/main/java/bubble/model/cloud/BubbleFootprint.java index 56d1c15d..bc2438b9 100644 --- a/bubble-server/src/main/java/bubble/model/cloud/BubbleFootprint.java +++ b/bubble-server/src/main/java/bubble/model/cloud/BubbleFootprint.java @@ -109,7 +109,7 @@ public class BubbleFootprint extends IdentifiableBase implements AccountTemplate public void addDisallowedCountries(String[] countries) { final Set disallowed = hasDisallowedCountries() ? new HashSet<>(Arrays.asList(getDisallowedCountries())) : new HashSet<>(); disallowed.addAll(Arrays.asList(countries)); - setDisallowedCountries(new ArrayList<>(disallowed).toArray(new String[0])); + setDisallowedCountries(new ArrayList<>(disallowed).toArray(String[]::new)); } public boolean isAllowedCountry (String country) { diff --git a/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_regions.java b/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_regions.java index 5d8698bd..21d5bc52 100644 --- a/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_regions.java +++ b/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_regions.java @@ -13,7 +13,7 @@ public class NotificationHandler_compute_driver_get_regions extends Notification @Override protected CloudRegion[] handle(ReceivedNotification n, ComputeDriverNotification notification, ComputeServiceDriver compute) { - return compute.getRegions().toArray(new CloudRegion[0]); + return compute.getRegions().toArray(CloudRegion[]::new); } } diff --git a/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_sizes.java b/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_sizes.java index 8288ed6d..3274ef64 100644 --- a/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_sizes.java +++ b/bubble-server/src/main/java/bubble/notify/compute/NotificationHandler_compute_driver_get_sizes.java @@ -13,7 +13,7 @@ public class NotificationHandler_compute_driver_get_sizes extends NotificationHa @Override protected ComputeNodeSize[] handle(ReceivedNotification n, ComputeDriverNotification notification, ComputeServiceDriver compute) { - return compute.getSizes().toArray(new ComputeNodeSize[0]); + return compute.getSizes().toArray(ComputeNodeSize[]::new); } } diff --git a/bubble-server/src/main/java/bubble/rule/bblock/BubbleBlockConfig.java b/bubble-server/src/main/java/bubble/rule/bblock/BubbleBlockConfig.java index 89c1de36..6c633627 100644 --- a/bubble-server/src/main/java/bubble/rule/bblock/BubbleBlockConfig.java +++ b/bubble-server/src/main/java/bubble/rule/bblock/BubbleBlockConfig.java @@ -67,7 +67,7 @@ public class BubbleBlockConfig extends RequestModifierConfig { } if (retained.size() < blockLists.length) { - blockLists = retained.toArray(new BubbleBlockList[0]); + blockLists = retained.toArray(BubbleBlockList[]::new); } else { log.warn("removeList: list not found, not removed: "+list.id()); } diff --git a/bubble-web b/bubble-web index 7c69c76e..b19222f0 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit 7c69c76eaae51ede299a3918873f0fca01e7f8fe +Subproject commit b19222f00bf9eb4071ed0925ded2c810f62e6e52 diff --git a/utils/cobbzilla-utils b/utils/cobbzilla-utils index 8647e5f4..8d2c6f1e 160000 --- a/utils/cobbzilla-utils +++ b/utils/cobbzilla-utils @@ -1 +1 @@ -Subproject commit 8647e5f4429377e033b4605ae37c55717fef3e44 +Subproject commit 8d2c6f1e9b4bac49688508bf3f9ac584a5b86619 diff --git a/utils/cobbzilla-wizard b/utils/cobbzilla-wizard index 50dbd434..228fa8d9 160000 --- a/utils/cobbzilla-wizard +++ b/utils/cobbzilla-wizard @@ -1 +1 @@ -Subproject commit 50dbd4340e4444916023e63d2d5e97469cc17de3 +Subproject commit 228fa8d952790d848d4551a7859766e3f23f74d9