Skip to content

Commit 1c50978

Browse files
committed
Fix & enhancements to the Events API hierarchy
Summary of changes: - Turned `PolarisEventListener` into an interface to facilitate implementation / mocking - Added missing `implements PolarisEvent` to many event records - Removed unused method overrides - Added missing method overrides to `TestPolarisEventListener`
1 parent da8c9af commit 1c50978

File tree

8 files changed

+697
-275
lines changed

8 files changed

+697
-275
lines changed

runtime/service/src/main/java/org/apache/polaris/service/events/CatalogGenericTableServiceEvents.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,27 @@
2424

2525
public class CatalogGenericTableServiceEvents {
2626
public record BeforeCreateGenericTableEvent(
27-
String catalogName, String namespace, CreateGenericTableRequest request) {}
27+
String catalogName, String namespace, CreateGenericTableRequest request)
28+
implements PolarisEvent {}
2829

2930
public record AfterCreateGenericTableEvent(
30-
String catalogName, String namespace, GenericTable table) {}
31+
String catalogName, String namespace, GenericTable table) implements PolarisEvent {}
3132

32-
public record BeforeDropGenericTableEvent(
33-
String catalogName, String namespace, String tableName) {}
33+
public record BeforeDropGenericTableEvent(String catalogName, String namespace, String tableName)
34+
implements PolarisEvent {}
3435

35-
public record AfterDropGenericTableEvent(
36-
String catalogName, String namespace, String tableName) {}
36+
public record AfterDropGenericTableEvent(String catalogName, String namespace, String tableName)
37+
implements PolarisEvent {}
3738

38-
public record BeforeListGenericTablesEvent(String catalogName, String namespace) {}
39+
public record BeforeListGenericTablesEvent(String catalogName, String namespace)
40+
implements PolarisEvent {}
3941

40-
public record AfterListGenericTablesEvent(String catalogName, String namespace) {}
42+
public record AfterListGenericTablesEvent(String catalogName, String namespace)
43+
implements PolarisEvent {}
4144

42-
public record BeforeLoadGenericTableEvent(
43-
String catalogName, String namespace, String tableName) {}
45+
public record BeforeLoadGenericTableEvent(String catalogName, String namespace, String tableName)
46+
implements PolarisEvent {}
4447

45-
public record AfterLoadGenericTableEvent(
46-
String catalogName, String namespace, GenericTable table) {}
48+
public record AfterLoadGenericTableEvent(String catalogName, String namespace, GenericTable table)
49+
implements PolarisEvent {}
4750
}

runtime/service/src/main/java/org/apache/polaris/service/events/CatalogPolicyServiceEvents.java

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,68 +34,84 @@ public class CatalogPolicyServiceEvents {
3434

3535
// Policy CRUD Events
3636
public record BeforeCreatePolicyEvent(
37-
String catalogName, String namespace, CreatePolicyRequest createPolicyRequest) {}
37+
String catalogName, String namespace, CreatePolicyRequest createPolicyRequest)
38+
implements PolarisEvent {}
3839

3940
public record AfterCreatePolicyEvent(
40-
String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse) {}
41+
String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse)
42+
implements PolarisEvent {}
4143

42-
public record BeforeListPoliciesEvent(String catalogName, String namespace, String policyType) {}
44+
public record BeforeListPoliciesEvent(String catalogName, String namespace, String policyType)
45+
implements PolarisEvent {}
4346

44-
public record AfterListPoliciesEvent(String catalogName, String namespace, String policyType) {}
47+
public record AfterListPoliciesEvent(String catalogName, String namespace, String policyType)
48+
implements PolarisEvent {}
4549

46-
public record BeforeLoadPolicyEvent(String catalogName, String namespace, String policyName) {}
50+
public record BeforeLoadPolicyEvent(String catalogName, String namespace, String policyName)
51+
implements PolarisEvent {}
4752

4853
public record AfterLoadPolicyEvent(
49-
String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse) {}
54+
String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse)
55+
implements PolarisEvent {}
5056

5157
public record BeforeUpdatePolicyEvent(
5258
String catalogName,
5359
String namespace,
5460
String policyName,
55-
UpdatePolicyRequest updatePolicyRequest) {}
61+
UpdatePolicyRequest updatePolicyRequest)
62+
implements PolarisEvent {}
5663

5764
public record AfterUpdatePolicyEvent(
58-
String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse) {}
65+
String catalogName, String namespace, LoadPolicyResponse loadPolicyResponse)
66+
implements PolarisEvent {}
5967

6068
public record BeforeDropPolicyEvent(
61-
String catalogName, String namespace, String policyName, Boolean detachAll) {}
69+
String catalogName, String namespace, String policyName, Boolean detachAll)
70+
implements PolarisEvent {}
6271

6372
public record AfterDropPolicyEvent(
64-
String catalogName, String namespace, String policyName, Boolean detachAll) {}
73+
String catalogName, String namespace, String policyName, Boolean detachAll)
74+
implements PolarisEvent {}
6575

6676
// Policy Attachment Events
6777
public record BeforeAttachPolicyEvent(
6878
String catalogName,
6979
String namespace,
7080
String policyName,
71-
AttachPolicyRequest attachPolicyRequest) {}
81+
AttachPolicyRequest attachPolicyRequest)
82+
implements PolarisEvent {}
7283

7384
public record AfterAttachPolicyEvent(
7485
String catalogName,
7586
String namespace,
7687
String policyName,
77-
AttachPolicyRequest attachPolicyRequest) {}
88+
AttachPolicyRequest attachPolicyRequest)
89+
implements PolarisEvent {}
7890

7991
public record BeforeDetachPolicyEvent(
8092
String catalogName,
8193
String namespace,
8294
String policyName,
83-
DetachPolicyRequest detachPolicyRequest) {}
95+
DetachPolicyRequest detachPolicyRequest)
96+
implements PolarisEvent {}
8497

8598
public record AfterDetachPolicyEvent(
8699
String catalogName,
87100
String namespace,
88101
String policyName,
89-
DetachPolicyRequest detachPolicyRequest) {}
102+
DetachPolicyRequest detachPolicyRequest)
103+
implements PolarisEvent {}
90104

91105
// Policy Query Events
92106
public record BeforeGetApplicablePoliciesEvent(
93-
String catalogName, String namespace, String targetName, String policyType) {}
107+
String catalogName, String namespace, String targetName, String policyType)
108+
implements PolarisEvent {}
94109

95110
public record AfterGetApplicablePoliciesEvent(
96111
String catalogName,
97112
String namespace,
98113
String targetName,
99114
String policyType,
100-
GetApplicablePoliciesResponse getApplicablePoliciesResponse) {}
115+
GetApplicablePoliciesResponse getApplicablePoliciesResponse)
116+
implements PolarisEvent {}
101117
}

0 commit comments

Comments
 (0)