-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IcebergCatalogPrefixParser (#923)
This is an extension point to allow customizing the relationship between realm / catalog and Iceberg REST API prefix.
- Loading branch information
Showing
4 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...n/src/main/java/org/apache/polaris/service/catalog/DefaultIcebergCatalogPrefixParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.catalog; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.apache.polaris.core.context.RealmContext; | ||
|
||
@ApplicationScoped | ||
public class DefaultIcebergCatalogPrefixParser implements IcebergCatalogPrefixParser { | ||
@Override | ||
public String prefixToCatalogName(RealmContext realm, String prefix) { | ||
return prefix; | ||
} | ||
|
||
@Override | ||
public String catalogNameToPrefix(RealmContext realm, String catalogName) { | ||
return catalogName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...e/common/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogPrefixParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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.catalog; | ||
|
||
import org.apache.polaris.core.context.RealmContext; | ||
|
||
/** An extension point for converting Iceberg REST API "prefix" values to Polaris Catalog names. */ | ||
public interface IcebergCatalogPrefixParser { | ||
|
||
/** | ||
* Produces the name of a Polaris catalog from the given Iceberg Catalog REST API "prefix" for the | ||
* specified realm. | ||
* | ||
* @param realm identifies the realm where the API request is to be served. | ||
* @param prefix the "prefix" according to the Iceberg REST Catalog API specification. | ||
* @return Polaris Catalog name | ||
*/ | ||
String prefixToCatalogName(RealmContext realm, String prefix); | ||
|
||
/** | ||
* Produces the "prefix" according to the Iceberg REST Catalog API specification for the given | ||
* Polaris catalog name in the specified realm. | ||
* | ||
* @param realm identifies the realm owning the catalog | ||
* @param catalogName name of a Polaris catalog. | ||
* @return the "prefix" for the Iceberg REST client to be used for requests to the given catalog. | ||
*/ | ||
String catalogNameToPrefix(RealmContext realm, String catalogName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters