Skip to content

Commit be95586

Browse files
committed
changed amazon dependencies to quarkus dependencies
1 parent e50f2ad commit be95586

File tree

4 files changed

+6
-59
lines changed

4 files changed

+6
-59
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ kotlin {
116116
implementation("com.amazonaws:aws-java-sdk-sts:1.12.364")
117117
implementation("com.amazonaws:aws-java-sdk-lambda:1.12.364")
118118
// implementation("com.amazonaws:aws-java-sdk-dynamodb:1.12.364")
119-
implementation("software.amazon.awssdk:dynamodb:2.19.21")
120-
implementation("software.amazon.awssdk:dynamodb-enhanced:2.19.21")
119+
implementation("io.quarkiverse.amazonservices:quarkus-amazon-dynamodb:1.4.0")
120+
implementation("io.quarkiverse.amazonservices:quarkus-amazon-dynamodb-enhanced:1.4.0")
121121
implementation("com.amazonaws:aws-java-sdk-sns:1.12.351")
122122
implementation("org.apache.logging.log4j:log4j-core:2.19.0")
123123
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")

src/jvmMain/kotlin/bbs/priorityqueue/appdata/PriorityQueueElement.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonInclude
77
import com.fasterxml.jackson.annotation.JsonProperty
88
import org.joda.time.DateTime
99
import org.joda.time.LocalDate
10-
import java.util.logging.Logger
1110

1211
@JsonInclude(JsonInclude.Include.NON_NULL)
1312
@DynamoDbBean

src/jvmMain/kotlin/bbs/priorityqueue/sdk/Dynamodb.kt

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,20 @@
11
package bbs.priorityqueue.sdk
22

3-
//import com.amazonaws.retry.PredefinedRetryPolicies
4-
//import com.amazonaws.retry.RetryPolicy
5-
6-
7-
//import com.amazonaws.services.dynamodbv2.AmazonDynamoDB
8-
//import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder
9-
//import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper
10-
//import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig
11-
//import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig.TableNameOverride
12-
//import com.amazonaws.services.dynamodbv2.document.DynamoDB
13-
//import com.amazonaws.services.dynamodbv2.document.UpdateItemOutcome
14-
//import com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec
15-
//import com.amazonaws.services.dynamodbv2.document.utils.NameMap
16-
//import com.amazonaws.services.dynamodbv2.document.utils.ValueMap
17-
//import com.amazonaws.services.dynamodbv2.model.AttributeValue
18-
//import com.amazonaws.services.dynamodbv2.model.QueryRequest
19-
//import com.amazonaws.services.dynamodbv2.model.ReturnValue
20-
21-
223
import bbs.priorityqueue.Constants
234
import bbs.priorityqueue.appdata.PriorityQueueElement
245
import bbs.priorityqueue.model.QueueStats
256
import bbs.priorityqueue.model.ReturnResult
267
import bbs.priorityqueue.model.ReturnStatusEnum
278
import bbs.priorityqueue.model.SystemInfo
289
import bbs.priorityqueue.utils.Utils
29-
import com.amazonaws.auth.*
10+
3011
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider
3112
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient
3213
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable
3314
import software.amazon.awssdk.enhanced.dynamodb.Key
3415
import software.amazon.awssdk.enhanced.dynamodb.TableSchema
3516
import software.amazon.awssdk.enhanced.dynamodb.model.GetItemEnhancedRequest
36-
import software.amazon.awssdk.enhanced.dynamodb.model.UpdateItemEnhancedRequest
17+
3718
import software.amazon.awssdk.regions.Region
3819
import software.amazon.awssdk.services.dynamodb.DynamoDbClient
3920
import software.amazon.awssdk.services.dynamodb.model.AttributeValue
@@ -66,49 +47,16 @@ class Dynamodb(builder: Builder) : Database {
6647

6748
override fun initialize() : Database {
6849
Locale.setDefault(Locale.ENGLISH)
69-
// var accessKey = System.getenv("AWS_ACCESS_KEY_ID")
70-
// var secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
71-
//
72-
// // If the aws credentials aren't given via cli then checks Environment variables
73-
// if (Utils.checkIfNotNullAndNotEmptyString(accessKey) && Utils.checkIfNotNullAndNotEmptyString(secretKey)) {
74-
// if (Utils.checkIfNullOrEmptyString(accessKey)) accessKey = System.getenv("AWS_ACCESS_KEY_ID")
75-
// if (Utils.checkIfNullOrEmptyString(secretKey)) secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
76-
// credentials = BasicAWSCredentials(accessKey, secretKey)
77-
// } else if (Utils.checkIfNotNullAndNotEmptyString(awsCredentialsProfileName)) {
78-
// !!//(awsCredentialsProfileName).credentials
79-
// }
80-
81-
// val credentialProvider: ProfileCredentialsProvider= ProfileCredentialsProvider.create(awsCredentialsProfileName
82-
// Creates a new instance of secure random everytime Dynamodb is instantiated
83-
// Fix? to Random/SplittableRandom being stored in heap when library is being compiled for a native-image
8450

8551
dynamoDB =DynamoDbClient.builder()
8652
.credentialsProvider(credentialProvider)
8753
.region(awsRegion)
8854
.build()
8955

90-
91-
9256
dynamoDBEnhanced = DynamoDbEnhancedClient.builder()
9357
.dynamoDbClient(dynamoDB)
9458
.build()
9559

96-
97-
98-
// .clientconfiguration(
99-
// ClientConfiguration()
100-
// .withMaxConnections(100)
101-
// .withConnectionTimeout(30000)
102-
// .withSecureRandom(secureRandom))
103-
104-
105-
// val mapperConfig = DynamoDBMapperConfig.builder()
106-
// .withSaveBehavior(DynamoDBMapperConfig.SaveBehavior.CLOBBER)
107-
// .withConsistentReads(DynamoDBMapperConfig.ConsistentReads.CONSISTENT) //.withConsistentReads(DynamoDBMapperConfig.ConsistentReads.EVENTUAL)
108-
// .withTableNameOverride(TableNameOverride(tableName))
109-
// .withPaginationLoadingStrategy(DynamoDBMapperConfig.PaginationLoadingStrategy.EAGER_LOADING)
110-
// .build()
111-
11260
dbMapper = dynamoDBEnhanced?.table(tableName, TableSchema.fromBean(PriorityQueueElement::class.java))
11361
return this
11462
}

src/jvmTest/kotlin/bbs/priorityqueue/DynamoDBTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package bbs.priorityqueue
22

3-
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration
43
import bbs.priorityqueue.appdata.PriorityQueueElement
54
import bbs.priorityqueue.sdk.Database
65
import bbs.priorityqueue.sdk.Dynamodb
@@ -17,10 +16,11 @@ import java.net.URI
1716

1817
class DynamoDBTests : AnnotationSpec() {
1918

20-
private final val endpoint = URI.create("http://localhost:4566/")
19+
private val endpoint = URI.create("http://localhost:4566/")
2120
val client: Database? = Dynamodb.Builder()
2221
.withRegion(Region.US_EAST_2)
2322
.withTableName("priority_queue_table")
23+
//.withCredentialsProfileName("default")
2424
.build(endpoint)
2525

2626
// Data to Insert

0 commit comments

Comments
 (0)