lihaosky commented on code in PR #28085: URL: https://github.com/apache/flink/pull/28085#discussion_r3282456896
########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/ConnectionFactory.java: ########## @@ -0,0 +1,101 @@ +/* + * 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.flink.table.factories; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.table.catalog.CatalogConnection; +import org.apache.flink.table.catalog.SensitiveConnection; +import org.apache.flink.table.secret.ReadableSecretStore; +import org.apache.flink.table.secret.WritableSecretStore; +import org.apache.flink.table.secret.exceptions.SecretException; + +/** + * Factory for creating and resolving connections, handling the encryption and decryption of + * sensitive connection fields. + * + * <p>A {@code ConnectionFactory} is responsible for: + * + * <ul> + * <li>Extracting sensitive fields from a {@link SensitiveConnection} and storing them in a {@link + * WritableSecretStore}, returning a {@link CatalogConnection} that is safe to persist in a + * catalog. + * <li>Resolving a {@link CatalogConnection} from a catalog by retrieving its secrets from a + * {@link ReadableSecretStore} and returning a complete {@link SensitiveConnection}. + * </ul> + * + * @see org.apache.flink.table.factories.DefaultConnectionFactory + */ +@PublicEvolving +public interface ConnectionFactory extends Factory { + + /** + * The option key that identifies the connection type in a {@link SensitiveConnection}'s or + * {@link CatalogConnection}'s options. The value of this option is matched against the {@link + * #factoryIdentifier()} of registered {@code ConnectionFactory} implementations to discover the + * factory that handles a given connection (see FLIP-529). + */ + String CONNECTION_TYPE_KEY = "type"; Review Comment: But that will defeat the purpose of putting the type in Connection options during connection creation. And you can only have one Factory type for all connection? In the FLIP, type is an option in connection option during creation -- 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]
