collado-mike commented on code in PR #889: URL: https://github.com/apache/polaris/pull/889#discussion_r1931553575
########## quarkus/admin/src/main/java/org/apache/polaris/admintool/RealmIdConverter.java: ########## @@ -0,0 +1,30 @@ +/* + * 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.admintool; + +import org.apache.polaris.core.context.RealmId; +import picocli.CommandLine.ITypeConverter; + +public class RealmIdConverter implements ITypeConverter<RealmId> { Review Comment: Javadoc comments are extremely helpful for people ramping up on the frameworks being used here ########## polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java: ########## @@ -96,37 +97,40 @@ private void initializeForRealm( } @Override - public synchronized Map<String, PrincipalSecretsResult> bootstrapRealms( - List<String> realms, PolarisCredentialsBootstrap credentialsBootstrap) { - Map<String, PrincipalSecretsResult> results = new HashMap<>(); - - for (String realm : realms) { - RealmId realmId = RealmId.newRealmId(realm); - if (!metaStoreManagerMap.containsKey(realmId.id())) { - initializeForRealm(realmId, credentialsBootstrap); + public synchronized Map<RealmId, PrincipalSecretsResult> bootstrapRealms( + List<RealmId> realms, PolarisCredentialsBootstrap credentialsBootstrap) { + Map<RealmId, PrincipalSecretsResult> results = new HashMap<>(); + + for (RealmId realm : realms) { + if (!metaStoreManagerMap.containsKey(realm.id())) { + initializeForRealm(realm, credentialsBootstrap); PrincipalSecretsResult secretsResult = bootstrapServiceAndCreatePolarisPrincipalForRealm( - realmId, metaStoreManagerMap.get(realmId.id())); - results.put(realmId.id(), secretsResult); + realm, metaStoreManagerMap.get(realm.id())); + results.put(ImmutableRealmId.copyOf(realm), secretsResult); Review Comment: I worry that this is an extremely easy mistake to make. I dislike proxies for this and other reasons. A person has to have a lot of context in their head before they do simple things like add keys to maps. ########## quarkus/service/src/main/java/org/apache/polaris/service/quarkus/context/RealmIdConverter.java: ########## @@ -0,0 +1,30 @@ +/* + * 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.quarkus.context; + +import org.apache.polaris.core.context.RealmId; +import org.eclipse.microprofile.config.spi.Converter; + +public class RealmIdConverter implements Converter<RealmId> { Review Comment: Same re: javadoc comments -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org