File tree Expand file tree Collapse file tree 5 files changed +26
-11
lines changed
extensions/federation/hadoop
src/main/java/org/apache/polaris/extensions/federation/hadoop
polaris-core/src/main/java/org/apache/polaris/core/connection
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg Expand file tree Collapse file tree 5 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,3 @@ dependencies {
5555 // Logging
5656 implementation(libs.slf4j.api)
5757}
58-
59- java { toolchain { languageVersion.set(JavaLanguageVersion .of(21 )) } }
60-
61- tasks.withType<JavaCompile > { options.encoding = " UTF-8" }
62-
63- tasks.test { useJUnitPlatform() }
Original file line number Diff line number Diff line change 2727import org .apache .polaris .core .connection .AuthenticationParametersDpo ;
2828import org .apache .polaris .core .connection .AuthenticationType ;
2929import org .apache .polaris .core .connection .ConnectionConfigInfoDpo ;
30+ import org .apache .polaris .core .connection .ConnectionType ;
3031import org .apache .polaris .core .connection .hadoop .HadoopConnectionConfigInfoDpo ;
3132import org .apache .polaris .core .secrets .UserSecretsManager ;
3233import org .slf4j .Logger ;
3334import org .slf4j .LoggerFactory ;
3435
3536/** Factory class for creating a Hadoop catalog handle based on connection configuration. */
3637@ ApplicationScoped
37- @ Identifier ("hadoop" )
38+ @ Identifier (ConnectionType . HADOOP_FACTORY_IDENTIFIER )
3839public class HadoopFederatedCatalogFactory implements ExternalCatalogFactory {
3940 private static final Logger LOGGER = LoggerFactory .getLogger (HadoopFederatedCatalogFactory .class );
4041
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ public enum ConnectionType {
3535 HADOOP (2 ),
3636 ;
3737
38+ public static final String ICEBERG_REST_FACTORY_IDENTIFIER = "ICEBERG_REST" ;
39+ public static final String HADOOP_FACTORY_IDENTIFIER = "HADOOP" ;
40+
3841 private static final ConnectionType [] REVERSE_MAPPING_ARRAY ;
3942
4043 static {
@@ -77,4 +80,22 @@ public enum ConnectionType {
7780 public int getCode () {
7881 return this .code ;
7982 }
83+
84+ /**
85+ * Get the factory identifier string used for CDI injection of the appropriate
86+ * ExternalCatalogFactory.
87+ *
88+ * @return the factory identifier string
89+ */
90+ public String getFactoryIdentifier () {
91+ switch (this ) {
92+ case ICEBERG_REST :
93+ return ICEBERG_REST_FACTORY_IDENTIFIER ;
94+ case HADOOP :
95+ return HADOOP_FACTORY_IDENTIFIER ;
96+ default :
97+ throw new UnsupportedOperationException (
98+ "No factory identifier for connection type: " + this );
99+ }
100+ }
80101}
Original file line number Diff line number Diff line change @@ -222,10 +222,8 @@ protected void initializeCatalog() {
222222 String factoryIdentifier ;
223223 switch (connectionType ) {
224224 case ICEBERG_REST :
225- factoryIdentifier = "iceberg-rest" ;
226- break ;
227225 case HADOOP :
228- factoryIdentifier = "hadoop" ;
226+ factoryIdentifier = connectionType . getFactoryIdentifier () ;
229227 break ;
230228 default :
231229 throw new UnsupportedOperationException ("Unsupported connection type: " + connectionType );
Original file line number Diff line number Diff line change 2626import org .apache .iceberg .rest .RESTCatalog ;
2727import org .apache .polaris .core .catalog .ExternalCatalogFactory ;
2828import org .apache .polaris .core .connection .ConnectionConfigInfoDpo ;
29+ import org .apache .polaris .core .connection .ConnectionType ;
2930import org .apache .polaris .core .connection .iceberg .IcebergRestConnectionConfigInfoDpo ;
3031import org .apache .polaris .core .secrets .UserSecretsManager ;
3132
3233/** Factory class for creating an Iceberg REST catalog handle based on connection configuration. */
3334@ ApplicationScoped
34- @ Identifier ("iceberg-rest" )
35+ @ Identifier (ConnectionType . ICEBERG_REST_FACTORY_IDENTIFIER )
3536public class IcebergRESTExternalCatalogFactory implements ExternalCatalogFactory {
3637
3738 @ Override
You can’t perform that action at this time.
0 commit comments