Skip to content

Commit e13b0d9

Browse files
committed
Bump Java from 11 to 17
1 parent b61f0db commit e13b0d9

13 files changed

+57
-34
lines changed

pom.xml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
<packaging>jar</packaging>
88
<name>Postgres Lambda Trigger Demo</name>
99
<properties>
10-
<maven.compiler.source>11</maven.compiler.source>
11-
<maven.compiler.target>11</maven.compiler.target>
10+
<maven.compiler.source>17</maven.compiler.source>
11+
<maven.compiler.target>17</maven.compiler.target>
1212
</properties>
1313

1414
<dependencyManagement>
1515
<dependencies>
1616
<dependency>
1717
<groupId>software.amazon.awssdk</groupId>
1818
<artifactId>bom</artifactId>
19-
<version>2.16.104</version>
19+
<version>2.20.129</version>
2020
<type>pom</type>
2121
<scope>import</scope>
2222
<exclusions>
@@ -33,17 +33,17 @@
3333
<dependency>
3434
<groupId>com.amazonaws</groupId>
3535
<artifactId>aws-lambda-java-core</artifactId>
36-
<version>1.2.1</version>
36+
<version>1.2.3</version>
3737
</dependency>
3838
<dependency>
3939
<groupId>com.amazonaws</groupId>
4040
<artifactId>aws-lambda-java-events</artifactId>
41-
<version>3.11.0</version>
41+
<version>3.11.3</version>
4242
</dependency>
4343
<dependency>
4444
<groupId>com.amazonaws.secretsmanager</groupId>
4545
<artifactId>aws-secretsmanager-jdbc</artifactId>
46-
<version>1.0.11</version>
46+
<version>2.0.0</version>
4747
</dependency>
4848

4949

@@ -83,17 +83,17 @@
8383
<dependency>
8484
<groupId>org.postgresql</groupId>
8585
<artifactId>postgresql</artifactId>
86-
<version>42.5.4</version>
86+
<version>42.6.0</version>
8787
</dependency>
8888
<dependency>
8989
<groupId>org.jooq</groupId>
9090
<artifactId>jooq</artifactId>
91-
<version>3.15.12</version>
91+
<version>3.18.6</version>
9292
</dependency>
9393
<dependency>
9494
<groupId>software.amazon.lambda</groupId>
9595
<artifactId>powertools-cloudformation</artifactId>
96-
<version>1.14.0</version>
96+
<version>1.17.0</version>
9797
</dependency>
9898
</dependencies>
9999

@@ -102,10 +102,7 @@
102102
<plugin>
103103
<groupId>org.apache.maven.plugins</groupId>
104104
<artifactId>maven-shade-plugin</artifactId>
105-
<version>3.2.4</version>
106-
<configuration>
107-
108-
</configuration>
105+
<version>3.5.0</version>
109106
<executions>
110107
<execution>
111108
<phase>package</phase>

postgres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Resources:
6868
Properties:
6969
Engine: aurora-postgresql
7070
Port: 5432
71-
EngineVersion: '13.11'
71+
EngineVersion: '15.3'
7272
DatabaseName: !Ref DBNAMEPARAM
7373
ManageMasterUserPassword: true
7474
MasterUsername: !Ref DBUSERPARAM

src/main/java/demo/AbstractActionFrontEnd.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ public abstract class AbstractActionFrontEnd implements RequestHandler<APIGatewa
2222
// Initialize the Log4j logger.
2323
Logger log = LogManager.getLogger();
2424

25-
final static DSLContext dsl = PostgresDataSource.getDSL();
2625

2726
protected final static Table<Record> ADDRESS_TABLE = DSL.table("address");
2827

28+
final static Map<String, String> headers = new HashMap<>();
29+
30+
static {
31+
headers.put("Cache-Control", "no-cache");
32+
33+
// Redirect back to main page
34+
headers.put("Location", "/");
35+
}
36+
2937
protected abstract void performAction();
3038

3139
@Override
3240
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
3341
log.debug(input);
34-
Map<String, String> headers = new HashMap<>();
35-
headers.put("Cache-Control", "no-cache");
36-
37-
// Redirect back to main page
38-
headers.put("Location", "/");
3942

4043
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
4144
.withHeaders(headers)

src/main/java/demo/CreateAddressFrontEnd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class CreateAddressFrontEnd extends AbstractActionFrontEnd {
1010
@Override
1111
protected void performAction() {
1212
// Just Insert One address and return
13+
var dsl = PostgresDataSource.getDSL();
1314
dsl.insertInto(ADDRESS_TABLE)
1415
.set(DSL.field("address_1"), "1 Apple Park Way")
1516
.set(DSL.field("city"), "Cupertino")

src/main/java/demo/CreateMultipleAddressFrontEnd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class CreateMultipleAddressFrontEnd extends AbstractActionFrontEnd {
1010
@Override
1111
protected void performAction() {
1212
// Insert 5 addresses in one transaction so they all hit at once
13+
var dsl = PostgresDataSource.getDSL();
1314
dsl.transaction((configuration) -> {
1415
var dslT = configuration.dsl();
1516
dslT.insertInto(ADDRESS_TABLE)

src/main/java/demo/DeleteAddressFrontEnd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class DeleteAddressFrontEnd extends AbstractActionFrontEnd {
1111
protected void performAction() {
1212
// Delete the last row
1313
var id = DSL.field("id", Integer.class);
14-
14+
var dsl = PostgresDataSource.getDSL();
1515
dsl.deleteFrom(ADDRESS_TABLE)
1616
.where(id.eq(DSL.select(DSL.max(id)).from(ADDRESS_TABLE)))
1717
.execute();

src/main/java/demo/DeleteAuditLogFrontEnd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class DeleteAuditLogFrontEnd extends AbstractActionFrontEnd {
88
@Override
99
protected void performAction() {
1010
// Clear out the audit log
11+
var dsl = PostgresDataSource.getDSL();
1112
dsl.truncate("audit_log").execute();
1213
dsl.truncate("audit_log_sqs").execute();
1314
}

src/main/java/demo/FrontEnd.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ public class FrontEnd implements RequestHandler<APIGatewayProxyRequestEvent, API
2020
// Initialize the Log4j logger.
2121
Logger log = LogManager.getLogger();
2222

23-
final static DSLContext dsl = PostgresDataSource.getDSL();
23+
final static Map<String, String> headers = new HashMap<>();
24+
25+
static {
26+
headers.put("Content-Type", "text/html");
27+
}
28+
2429

2530
@Override
2631
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
2732
log.debug(input);
28-
Map<String, String> headers = new HashMap<>();
29-
headers.put("Content-Type", "text/html");
30-
//headers.put("X-Custom-Header", "application/json");
31-
33+
var dsl = PostgresDataSource.getDSL();
3234
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
3335
.withHeaders(headers);
3436

src/main/java/demo/PostgresAbstractTrigger.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public abstract class PostgresAbstractTrigger implements RequestStreamHandler {
2727

2828
final Logger log = LogManager.getLogger();
2929

30-
final static DSLContext dsl = PostgresDataSource.getDSL();
31-
3230
final static ObjectMapper mapper = new ObjectMapper();
3331

3432
@Override

src/main/java/demo/PostgresAddressTrigger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void geoCodeAddress(JsonNode addr) {
8989

9090
// Take the response and create a serializable version that we can later convert to JSON
9191
var last_coding = mapper.convertValue(response.toBuilder(), SearchPlaceIndexForTextResponse.serializableBuilderClass());
92-
92+
var dsl = PostgresDataSource.getDSL();
9393
var statement = dsl.update(DSL.table("address"))
9494
// Make sure we set this to false so we don't trigger ourselves again
9595
.set(DSL.field("requires_geo_coding", Boolean.class), false)

0 commit comments

Comments
 (0)