lasdf1234 commented on code in PR #11127: URL: https://github.com/apache/gravitino/pull/11127#discussion_r3258496603
########## plugins/idp-basic/src/main/java/org/apache/gravitino/idp/storage/mapper/IdpGroupMetaSQLProviderFactory.java: ########## @@ -0,0 +1,80 @@ +/* + * 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.gravitino.idp.storage.mapper; + +import java.util.List; +import org.apache.gravitino.idp.storage.mapper.provider.base.IdpGroupMetaBaseSQLProvider; +import org.apache.gravitino.idp.storage.mapper.provider.h2.IdpGroupMetaH2Provider; +import org.apache.gravitino.idp.storage.mapper.provider.postgresql.IdpGroupMetaPostgreSQLProvider; +import org.apache.gravitino.idp.storage.po.IdpGroupPO; +import org.apache.ibatis.annotations.Param; + +public class IdpGroupMetaSQLProviderFactory + extends IdpBaseSQLProviderFactory<IdpGroupMetaBaseSQLProvider> { + private static final IdpGroupMetaSQLProviderFactory INSTANCE = + new IdpGroupMetaSQLProviderFactory(); + + private IdpGroupMetaSQLProviderFactory() { + super( + "IdP group SQL provider", + new IdpGroupMetaBaseSQLProvider(), + new IdpGroupMetaH2Provider(), + new IdpGroupMetaPostgreSQLProvider()); + } + + public static IdpGroupMetaBaseSQLProvider h2Provider() { + return INSTANCE.h2ProviderInstance(); + } + + public static IdpGroupMetaBaseSQLProvider mysqlProvider() { + return INSTANCE.mysqlProviderInstance(); + } + + public static IdpGroupMetaBaseSQLProvider postgresqlProvider() { + return INSTANCE.postgresqlProviderInstance(); + } + + static IdpGroupMetaBaseSQLProvider getProvider(String databaseId) { + return INSTANCE.resolveProvider(databaseId); + } + + public static String selectIdpGroup(@Param("groupName") String groupName) { + return INSTANCE.currentProviderInstance().selectIdpGroup(groupName); Review Comment: Got I use currentProvider() instead of instance ########## plugins/idp-basic/src/main/java/org/apache/gravitino/idp/storage/mapper/IdpGroupMetaSQLProviderFactory.java: ########## @@ -0,0 +1,80 @@ +/* + * 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.gravitino.idp.storage.mapper; + +import java.util.List; +import org.apache.gravitino.idp.storage.mapper.provider.base.IdpGroupMetaBaseSQLProvider; +import org.apache.gravitino.idp.storage.mapper.provider.h2.IdpGroupMetaH2Provider; +import org.apache.gravitino.idp.storage.mapper.provider.postgresql.IdpGroupMetaPostgreSQLProvider; +import org.apache.gravitino.idp.storage.po.IdpGroupPO; +import org.apache.ibatis.annotations.Param; + +public class IdpGroupMetaSQLProviderFactory + extends IdpBaseSQLProviderFactory<IdpGroupMetaBaseSQLProvider> { + private static final IdpGroupMetaSQLProviderFactory INSTANCE = + new IdpGroupMetaSQLProviderFactory(); + + private IdpGroupMetaSQLProviderFactory() { + super( + "IdP group SQL provider", + new IdpGroupMetaBaseSQLProvider(), + new IdpGroupMetaH2Provider(), + new IdpGroupMetaPostgreSQLProvider()); + } + + public static IdpGroupMetaBaseSQLProvider h2Provider() { + return INSTANCE.h2ProviderInstance(); + } + + public static IdpGroupMetaBaseSQLProvider mysqlProvider() { + return INSTANCE.mysqlProviderInstance(); + } + + public static IdpGroupMetaBaseSQLProvider postgresqlProvider() { + return INSTANCE.postgresqlProviderInstance(); + } + + static IdpGroupMetaBaseSQLProvider getProvider(String databaseId) { + return INSTANCE.resolveProvider(databaseId); + } + + public static String selectIdpGroup(@Param("groupName") String groupName) { + return INSTANCE.currentProviderInstance().selectIdpGroup(groupName); Review Comment: Got I use currentProvider() instead of INSTANCE -- 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]
