sririshindra commented on code in PR #4225: URL: https://github.com/apache/polaris/pull/4225#discussion_r3231021194
########## runtime/service/src/main/java/org/apache/polaris/service/events/listeners/DefaultPersistenceEventHandler.java: ########## @@ -0,0 +1,249 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.polaris.service.events.listeners; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.apache.iceberg.catalog.Namespace; +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.rest.requests.RenameTableRequest; +import org.apache.polaris.core.admin.model.Catalog; +import org.apache.polaris.core.admin.model.Principal; +import org.apache.polaris.core.auth.PolarisPrincipal; +import org.apache.polaris.core.entity.PolarisEvent.ResourceType; +import org.apache.polaris.service.events.EventAttributeMap; +import org.apache.polaris.service.events.EventAttributes; +import org.apache.polaris.service.events.PolarisEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +final class DefaultPersistenceEventHandler implements PersistenceEventHandler { + + private static final Logger LOGGER = + LoggerFactory.getLogger(DefaultPersistenceEventHandler.class); + private static final String SERIALIZATION_ERROR_PAYLOAD = "{\"error\":\"Serialization failed\"}"; + + static final String ALL_CATALOGS_SCOPE = "_all_catalogs"; + static final String ROOT_NAMESPACE_SCOPE = "_root_namespace"; + static final String TABLE_SCOPE = "_table_scope"; + static final String VIEW_SCOPE = "_view_scope"; + + private final PersistenceAttributeSecurityFilter securityFilter; + private final ObjectMapper objectMapper; + + DefaultPersistenceEventHandler() { + this(new PersistenceAttributeSecurityFilter(), new ObjectMapper()); Review Comment: Addressed. The static ObjectMapper is removed. The EventPayloadPruner and EventAttributeFilter are now CDI beans injected into PolarisPersistenceEventListener. The entity's own setAdditionalProperties(Map) handles JSON serialization using its internal mapper, so the listener no longer needs a direct ObjectMapper reference. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
