diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatabaseConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatabaseConfiguration.java deleted file mode 100644 index 0b7cfcb17..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatabaseConfiguration.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.configuration; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import javax.validation.constraints.NotNull; - -import io.dropwizard.db.DataSourceFactory; - -public class DatabaseConfiguration extends DataSourceFactory { - - @NotNull - @JsonProperty - private CircuitBreakerConfiguration circuitBreaker = new CircuitBreakerConfiguration(); - - public CircuitBreakerConfiguration getCircuitBreakerConfiguration() { - return circuitBreaker; - } - -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GraphiteConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GraphiteConfiguration.java deleted file mode 100644 index 8d4ea3947..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/GraphiteConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ -package org.whispersystems.textsecuregcm.configuration; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class GraphiteConfiguration { - @JsonProperty - private String host; - - @JsonProperty - private int port; - - public String getHost() { - return host; - } - - public int getPort() { - return port; - } - - public boolean isEnabled() { - return host != null && port != 0; - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/SqsConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/SqsConfiguration.java deleted file mode 100644 index 9db5343c8..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/SqsConfiguration.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ -package org.whispersystems.textsecuregcm.configuration; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import javax.validation.constraints.NotEmpty; - -public class SqsConfiguration { - @NotEmpty - @JsonProperty - private String accessKey; - - @NotEmpty - @JsonProperty - private String accessSecret; - - @NotEmpty - @JsonProperty - private List queueUrls; - - @NotEmpty - @JsonProperty - private String region = "us-east-1"; - - public String getAccessKey() { - return accessKey; - } - - public String getAccessSecret() { - return accessSecret; - } - - public List getQueueUrls() { - return queueUrls; - } - - public String getRegion() { - return region; - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCount.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCount.java deleted file mode 100644 index c1caf6fb5..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCount.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ -package org.whispersystems.textsecuregcm.entities; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class AccountCount { - - @JsonProperty - private int count; - - public AccountCount(int count) { - this.count = count; - } - - public AccountCount() {} - - public int getCount() { - return count; - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/AcknowledgeWebsocketMessage.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/AcknowledgeWebsocketMessage.java deleted file mode 100644 index 8393ba342..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/AcknowledgeWebsocketMessage.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.entities; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class AcknowledgeWebsocketMessage extends IncomingWebsocketMessage { - - @JsonProperty - private long id; - - public AcknowledgeWebsocketMessage() {} - - public AcknowledgeWebsocketMessage(long id) { - this.type = TYPE_ACKNOWLEDGE_MESSAGE; - this.id = id; - } - - public long getId() { - return id; - } - -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/MessageResponse.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/MessageResponse.java deleted file mode 100644 index a5c04df3a..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/MessageResponse.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ -package org.whispersystems.textsecuregcm.entities; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -public class MessageResponse { - private List success; - private List failure; - private Set missingDeviceIds; - - public MessageResponse(List success, List failure) { - this.success = success; - this.failure = failure; - this.missingDeviceIds = new HashSet<>(); - } - - public MessageResponse(Set missingDeviceIds) { - this.success = new LinkedList<>(); - this.failure = new LinkedList<>(missingDeviceIds); - this.missingDeviceIds = missingDeviceIds; - } - - public MessageResponse() {} - - public List getSuccess() { - return success; - } - - public void setSuccess(List success) { - this.success = success; - } - - public List getFailure() { - return failure; - } - - public void setFailure(List failure) { - this.failure = failure; - } - - public Set getNumbersMissingDevices() { - return missingDeviceIds; - } - - public void setNumbersMissingDevices(Set numbersMissingDevices) { - this.missingDeviceIds = numbersMissingDevices; - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/http/FormDataBodyPublisher.java b/service/src/main/java/org/whispersystems/textsecuregcm/http/FormDataBodyPublisher.java deleted file mode 100644 index b2935e499..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/http/FormDataBodyPublisher.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.http; - -import java.net.URLEncoder; -import java.net.http.HttpRequest; -import java.nio.charset.StandardCharsets; -import java.util.Map; - -public class FormDataBodyPublisher { - - public static HttpRequest.BodyPublisher of(Map data) { - StringBuilder builder = new StringBuilder(); - - for (Map.Entry entry : data.entrySet()) { - if (builder.length() > 0) { - builder.append("&"); - } - - builder.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8)); - builder.append("="); - builder.append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8)); - } - - return HttpRequest.BodyPublishers.ofString(builder.toString()); - } - -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/push/TransientPushFailureException.java b/service/src/main/java/org/whispersystems/textsecuregcm/push/TransientPushFailureException.java deleted file mode 100644 index cedf9c837..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/push/TransientPushFailureException.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.push; - -public class TransientPushFailureException extends Exception { - public TransientPushFailureException(String s) { - super(s); - } - - public TransientPushFailureException(Exception e) { - super(e); - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountChangeValidator.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountChangeValidator.java index 507b6c0a8..2ddcc6213 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountChangeValidator.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountChangeValidator.java @@ -5,12 +5,10 @@ package org.whispersystems.textsecuregcm.storage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.whispersystems.textsecuregcm.util.Optionals; import java.security.MessageDigest; import java.security.SecureRandom; -import java.util.Arrays; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class AccountChangeValidator { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/util/ExecutorUtils.java b/service/src/main/java/org/whispersystems/textsecuregcm/util/ExecutorUtils.java deleted file mode 100644 index c380be717..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/util/ExecutorUtils.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.util; - -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -public class ExecutorUtils { - - public static Executor newFixedThreadBoundedQueueExecutor(int threadCount, int queueSize) { - ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount, - Long.MAX_VALUE, TimeUnit.NANOSECONDS, - new ArrayBlockingQueue<>(queueSize), - new ThreadPoolExecutor.AbortPolicy()); - - executor.prestartAllCoreThreads(); - - return executor; - } - -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/util/IterablePair.java b/service/src/main/java/org/whispersystems/textsecuregcm/util/IterablePair.java deleted file mode 100644 index 7f94099d5..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/util/IterablePair.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2013-2020 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ -package org.whispersystems.textsecuregcm.util; - -import java.util.Iterator; -import java.util.List; - -public class IterablePair implements Iterable> { - private final List first; - private final List second; - - public IterablePair(List first, List second) { - this.first = first; - this.second = second; - } - - @Override - public Iterator> iterator(){ - return new ParallelIterator<>( first.iterator(), second.iterator() ); - } - - public static class ParallelIterator implements Iterator> { - - private final Iterator it1; - private final Iterator it2; - - public ParallelIterator(Iterator it1, Iterator it2) { - this.it1 = it1; this.it2 = it2; - } - - @Override - public boolean hasNext() { return it1.hasNext() && it2.hasNext(); } - - @Override - public Pair next() { - return new Pair<>(it1.next(), it2.next()); - } - - @Override - public void remove(){ - it1.remove(); - it2.remove(); - } - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/util/Optionals.java b/service/src/main/java/org/whispersystems/textsecuregcm/util/Optionals.java deleted file mode 100644 index 4e3e49038..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/util/Optionals.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.whispersystems.textsecuregcm.util; - -import java.util.Optional; -import java.util.function.BiFunction; - -public class Optionals { - - private Optionals() {} - - /** - * Apply a function to two optional arguments, returning empty if either argument is empty - * - * @param optionalT Optional of type T - * @param optionalU Optional of type U - * @param fun Function of T and U that returns R - * @return The function applied to the values of optionalT and optionalU, or empty - */ - public static Optional zipWith(Optional optionalT, Optional optionalU, BiFunction fun) { - return optionalT.flatMap(t -> optionalU.map(u -> fun.apply(t, u))); - } -}