Skip to content

Commit 16960b3

Browse files
committed
Revision based on comments from @adutra
1 parent 430a8e7 commit 16960b3

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

runtime/service/src/main/java/org/apache/polaris/service/catalog/policy/CatalogPolicyEventServiceDelegator.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Response createPolicy(
5454
CreatePolicyRequest createPolicyRequest,
5555
RealmContext realmContext,
5656
SecurityContext securityContext) {
57-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
57+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
5858
polarisEventListener.onBeforeCreatePolicy(
5959
new CatalogPolicyServiceEvents.BeforeCreatePolicyEvent(
6060
catalogName, namespace, createPolicyRequest));
@@ -76,7 +76,7 @@ public Response listPolicies(
7676
String policyType,
7777
RealmContext realmContext,
7878
SecurityContext securityContext) {
79-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
79+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
8080
polarisEventListener.onBeforeListPolicies(
8181
new CatalogPolicyServiceEvents.BeforeListPoliciesEvent(catalogName, namespace, policyType));
8282
Response resp =
@@ -94,7 +94,7 @@ public Response loadPolicy(
9494
String policyName,
9595
RealmContext realmContext,
9696
SecurityContext securityContext) {
97-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
97+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
9898
polarisEventListener.onBeforeLoadPolicy(
9999
new CatalogPolicyServiceEvents.BeforeLoadPolicyEvent(catalogName, namespace, policyName));
100100
Response resp =
@@ -113,7 +113,7 @@ public Response updatePolicy(
113113
UpdatePolicyRequest updatePolicyRequest,
114114
RealmContext realmContext,
115115
SecurityContext securityContext) {
116-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
116+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
117117
polarisEventListener.onBeforeUpdatePolicy(
118118
new CatalogPolicyServiceEvents.BeforeUpdatePolicyEvent(
119119
catalogName, namespace, policyName, updatePolicyRequest));
@@ -134,7 +134,7 @@ public Response dropPolicy(
134134
Boolean detachAll,
135135
RealmContext realmContext,
136136
SecurityContext securityContext) {
137-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
137+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
138138
polarisEventListener.onBeforeDropPolicy(
139139
new CatalogPolicyServiceEvents.BeforeDropPolicyEvent(
140140
catalogName, namespace, policyName, detachAll));
@@ -155,7 +155,7 @@ public Response attachPolicy(
155155
AttachPolicyRequest attachPolicyRequest,
156156
RealmContext realmContext,
157157
SecurityContext securityContext) {
158-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
158+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
159159
polarisEventListener.onBeforeAttachPolicy(
160160
new CatalogPolicyServiceEvents.BeforeAttachPolicyEvent(
161161
catalogName, namespace, policyName, attachPolicyRequest));
@@ -176,7 +176,7 @@ public Response detachPolicy(
176176
DetachPolicyRequest detachPolicyRequest,
177177
RealmContext realmContext,
178178
SecurityContext securityContext) {
179-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
179+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
180180
polarisEventListener.onBeforeDetachPolicy(
181181
new CatalogPolicyServiceEvents.BeforeDetachPolicyEvent(
182182
catalogName, namespace, policyName, detachPolicyRequest));
@@ -199,7 +199,7 @@ public Response getApplicablePolicies(
199199
String policyType,
200200
RealmContext realmContext,
201201
SecurityContext securityContext) {
202-
String catalogName = getCatalogFromPrefix(prefix, realmContext);
202+
String catalogName = prefixParser.prefixToCatalogName(realmContext, prefix);
203203
polarisEventListener.onBeforeGetApplicablePolicies(
204204
new CatalogPolicyServiceEvents.BeforeGetApplicablePoliciesEvent(
205205
catalogName, namespace, targetName, policyType));
@@ -222,8 +222,4 @@ public Response getApplicablePolicies(
222222
(GetApplicablePoliciesResponse) resp.getEntity()));
223223
return resp;
224224
}
225-
226-
private String getCatalogFromPrefix(String prefix, RealmContext realmContext) {
227-
return prefixParser.prefixToCatalogName(realmContext, prefix);
228-
}
229225
}

0 commit comments

Comments
 (0)