Skip to content

Commit 4dd6322

Browse files
cleanup: remove some dependencies that are easy to replace (#4408)
1 parent 2e12661 commit 4dd6322

File tree

8 files changed

+11
-40
lines changed

8 files changed

+11
-40
lines changed

backend/common/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@
202202
<groupId>software.amazon.awssdk</groupId>
203203
<artifactId>s3</artifactId>
204204
</dependency>
205-
<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
206205
<dependency>
207-
<groupId>com.google.cloud</groupId>
208-
<artifactId>google-cloud-storage</artifactId>
206+
<groupId>com.google.protobuf</groupId>
207+
<artifactId>protobuf-java-util</artifactId>
208+
<version>3.25.1</version>
209209
</dependency>
210210
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
211211
<dependency>

backend/common/src/main/java/ai/verta/modeldb/common/artifactStore/storageservice/nfs/NFSService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import ai.verta.modeldb.common.exceptions.InvalidArgumentException;
66
import ai.verta.modeldb.common.exceptions.ModelDBException;
77
import com.amazonaws.services.s3.model.PartETag;
8-
import com.google.api.client.util.IOUtils;
98
import com.google.rpc.Code;
109
import jakarta.servlet.http.HttpServletRequest;
1110
import java.io.File;
@@ -106,7 +105,7 @@ String storeFile(
106105
}
107106
LOGGER.trace("NFSService - storeFile - file found : {}", foldersExists.getAbsolutePath());
108107
var fileOutputStream = new FileOutputStream(destinationFile);
109-
IOUtils.copy(uploadedFileInputStream, fileOutputStream);
108+
uploadedFileInputStream.transferTo(fileOutputStream);
110109
fileOutputStream.close();
111110
uploadedFileInputStream.close();
112111
LOGGER.trace(

backend/common/src/main/java/ai/verta/modeldb/common/artifactStore/storageservice/s3/S3Service.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import com.amazonaws.SdkClientException;
1414
import com.amazonaws.services.s3.model.*;
1515
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
16-
import com.google.api.client.http.HttpStatusCodes;
1716
import com.google.rpc.Code;
1817
import jakarta.servlet.http.HttpServletRequest;
1918
import java.io.*;
@@ -159,7 +158,7 @@ public void commitMultipart(String s3Key, String uploadId, List<PartETag> partET
159158
client.getClient().completeMultipartUpload(completeMultipartUploadRequest);
160159
LOGGER.info("upload result: {}", result);
161160
} catch (AmazonS3Exception e) {
162-
if (e.getStatusCode() == HttpStatusCodes.STATUS_CODE_BAD_REQUEST) {
161+
if (e.getStatusCode() == 400) {
163162
LOGGER.info("message: {} additional details: {}", e.getMessage(), e.getAdditionalDetails());
164163
throw new ModelDBException(e.getErrorMessage(), Code.FAILED_PRECONDITION);
165164
}

backend/server/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@
101101
<scope>TEST</scope>
102102
</dependency>
103103

104-
<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
105-
<dependency>
106-
<groupId>com.google.cloud</groupId>
107-
<artifactId>google-cloud-storage</artifactId>
108-
</dependency>
109104
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
110105
<dependency>
111106
<groupId>org.apache.logging.log4j</groupId>

backend/server/src/main/java/ai/verta/modeldb/entities/versioning/RepositoryEntity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import ai.verta.uac.GetResourcesResponseItem.OwnerTrackingCase;
1919
import ai.verta.uac.ResourceVisibility;
2020
import ai.verta.uac.Workspace;
21-
import com.google.api.client.util.Objects;
2221
import java.io.Serializable;
2322
import java.util.*;
2423
import javax.persistence.*;
@@ -350,6 +349,6 @@ public boolean isDataset() {
350349
}
351350

352351
public boolean isProtected() {
353-
return Objects.equal(repositoryAccessModifier, RepositoryModifierEnum.PROTECTED.ordinal());
352+
return Objects.equals(repositoryAccessModifier, RepositoryModifierEnum.PROTECTED.ordinal());
354353
}
355354
}

backend/server/src/main/java/ai/verta/modeldb/telemetry/TelemetryCron.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import ai.verta.modeldb.utils.ModelDBHibernateUtil;
99
import ai.verta.modeldb.utils.ModelDBUtils;
1010
import ai.verta.uac.CollectTelemetry;
11-
import com.google.api.client.http.HttpMethods;
1211
import com.google.protobuf.Value;
1312
import java.io.BufferedReader;
1413
import java.io.FileNotFoundException;
@@ -58,7 +57,7 @@ public void run() {
5857

5958
HttpURLConnection httpClient =
6059
(HttpURLConnection) new URL(telemetryUtils.getConsumer()).openConnection();
61-
httpClient.setRequestMethod(HttpMethods.POST);
60+
httpClient.setRequestMethod("POST");
6261
httpClient.setDoOutput(true);
6362
httpClient.setRequestProperty("Content-Type", "application/json");
6463
httpClient.setRequestProperty("Accept", "application/json");

backend/server/src/test/java/ai/verta/modeldb/ArtifactStore/NFSArtifactStoreTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import ai.verta.uac.UserInfo;
4545
import ai.verta.uac.VertaUserInfo;
4646
import ai.verta.uac.Workspace;
47-
import com.google.api.client.util.IOUtils;
4847
import com.google.common.util.concurrent.Futures;
4948
import io.grpc.Context;
5049
import io.grpc.ManagedChannel;
@@ -331,7 +330,7 @@ private void loggedArtifactByUrlExperimentRun() throws IOException {
331330
httpClient.setDoOutput(true);
332331
httpClient.setRequestProperty("Content-Type", "application/json");
333332
try (OutputStream out = httpClient.getOutputStream()) {
334-
IOUtils.copy(inputStream, out);
333+
inputStream.transferTo(out);
335334
out.flush();
336335
}
337336

@@ -367,7 +366,7 @@ private void loggedArtifactByUrlProject() throws IOException {
367366
httpClient.setDoOutput(true);
368367
httpClient.setRequestProperty("Content-Type", "application/json");
369368
try (OutputStream out = httpClient.getOutputStream()) {
370-
IOUtils.copy(inputStream, out);
369+
inputStream.transferTo(out);
371370
out.flush();
372371
}
373372

@@ -400,7 +399,7 @@ public void getArtifactByUrlExperimentRunTest() throws IOException {
400399
String rootPath = System.getProperty("user.dir");
401400
FileOutputStream fileOutputStream =
402401
new FileOutputStream(rootPath + File.separator + artifactKey);
403-
IOUtils.copy(inputStream, fileOutputStream);
402+
inputStream.transferTo(fileOutputStream);
404403
fileOutputStream.close();
405404
inputStream.close();
406405

@@ -437,7 +436,7 @@ public void getArtifactByUrlProjectTest() throws IOException {
437436
String rootPath = System.getProperty("user.dir");
438437
FileOutputStream fileOutputStream =
439438
new FileOutputStream(rootPath + File.separator + artifactKey);
440-
IOUtils.copy(inputStream, fileOutputStream);
439+
inputStream.transferTo(fileOutputStream);
441440
fileOutputStream.close();
442441
inputStream.close();
443442

pom.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -267,25 +267,6 @@
267267
<scope>import</scope>
268268
</dependency>
269269

270-
271-
<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
272-
<dependency>
273-
<groupId>com.google.cloud</groupId>
274-
<artifactId>google-cloud-storage</artifactId>
275-
<version>2.35.0</version>
276-
<exclusions>
277-
<exclusion>
278-
<groupId>io.grpc</groupId>
279-
<artifactId>*</artifactId>
280-
</exclusion>
281-
</exclusions>
282-
</dependency>
283-
<!-- pin this dependency of ^^^ to upgrade for a CVE (https://snyk.io/vuln/SNYK-JAVA-COMGOOGLEOAUTHCLIENT-2807808) -->
284-
<dependency>
285-
<groupId>com.google.oauth-client</groupId>
286-
<artifactId>google-oauth-client</artifactId>
287-
<version>1.35.0</version>
288-
</dependency>
289270
<!-- https://mvnrepository.com/artifact/io.prometheus/simpleclient_servlet -->
290271
<dependency>
291272
<groupId>io.prometheus</groupId>

0 commit comments

Comments
 (0)