Skip to content

Commit 3cb9528

Browse files
committed
feat: add IcebergConfigurationService
1 parent b8f8317 commit 3cb9528

8 files changed

Lines changed: 86 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ target/
77
*.iml
88
.bsp
99
.DS_Store
10+
stash/
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package kasanari.catalog.iceberg;
2+
3+
import org.apache.iceberg.rest.Endpoint;
4+
import org.apache.iceberg.rest.responses.ConfigResponse;
5+
6+
import java.util.List;
7+
8+
public class IcebergCatalogConfigurationService {
9+
private final List<Endpoint> endpoints;
10+
11+
public IcebergCatalogConfigurationService() {
12+
endpoints = List.of(
13+
// namespace
14+
Endpoint.V1_CREATE_NAMESPACE,
15+
Endpoint.V1_DELETE_NAMESPACE,
16+
Endpoint.V1_LIST_NAMESPACES,
17+
Endpoint.V1_LOAD_NAMESPACE,
18+
Endpoint.V1_NAMESPACE_EXISTS,
19+
Endpoint.V1_UPDATE_NAMESPACE,
20+
// table
21+
Endpoint.V1_CREATE_TABLE,
22+
Endpoint.V1_DELETE_TABLE,
23+
Endpoint.V1_LIST_TABLES,
24+
Endpoint.V1_LOAD_TABLE,
25+
Endpoint.V1_REGISTER_TABLE,
26+
Endpoint.V1_RENAME_TABLE,
27+
Endpoint.V1_UPDATE_TABLE,
28+
Endpoint.V1_TABLE_EXISTS,
29+
// view
30+
Endpoint.V1_CREATE_VIEW,
31+
Endpoint.V1_DELETE_VIEW,
32+
Endpoint.V1_LIST_VIEWS,
33+
Endpoint.V1_LOAD_VIEW,
34+
Endpoint.V1_UPDATE_VIEW,
35+
Endpoint.V1_RENAME_VIEW,
36+
Endpoint.V1_VIEW_EXISTS,
37+
// transactions
38+
Endpoint.V1_COMMIT_TRANSACTION,
39+
// other
40+
Endpoint.V1_REPORT_METRICS
41+
);
42+
}
43+
44+
public ConfigResponse getConfig(String warehouse) {
45+
return ConfigResponse
46+
.builder()
47+
.withEndpoints(endpoints)
48+
.withOverride("prefix", warehouse)
49+
.build();
50+
}
51+
}

modules/catalog/catalog-lance/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ dependencies {
2727
exclude(group = "org.apache.hive", module = "hive-service")
2828
exclude(group = "org.apache.hive", module = "hive-llap-server")
2929
exclude(group = "org.apache.hive", module = "hive-exec")
30+
exclude(group = "asm")
31+
exclude(group = "org.ow2.asm", module = "asm-all")
3032
}
3133

3234
// test

modules/server/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies {
1919
implementation(project(":modules:catalog:catalog-paimon"))
2020
// lance
2121
implementation(project(":modules:api:api-lance"))
22+
implementation(project(":modules:catalog:catalog-lance"))
2223
// management
2324
implementation(project(":modules:api:api-management"))
2425
implementation(project(":modules:management:management-catalog"))
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package kasanari.server.bootstrap;
2+
3+
import jakarta.enterprise.context.ApplicationScoped;
4+
import jakarta.enterprise.inject.Produces;
5+
import jakarta.inject.Singleton;
6+
import kasanari.catalog.iceberg.IcebergCatalogConfigurationService;
7+
8+
@ApplicationScoped
9+
public class IcebergCatalogBeans {
10+
@Singleton
11+
@Produces
12+
IcebergCatalogConfigurationService icebergCatalogConfigurationService() {
13+
return new IcebergCatalogConfigurationService();
14+
}
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package kasanari.server.bootstrap;
2+
3+
public class LanceCatalogBeans {
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package kasanari.server.bootstrap;
2+
3+
public class PaimonCatalogBeans {
4+
}

modules/server/src/main/java/kasanari/server/infrastructure/iceberg/IcebergConfigurationServiceHandler.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
import jakarta.enterprise.context.ApplicationScoped;
44
import jakarta.ws.rs.core.Response;
55
import jakarta.ws.rs.core.SecurityContext;
6+
import kasanari.catalog.iceberg.IcebergCatalogConfigurationService;
67
import kasanari.catalog.iceberg.api.IcebergRestConfigurationApiService;
7-
import kasanari.server.infrastructure.http.ApiFallbacks;
88

99
@ApplicationScoped
1010
public class IcebergConfigurationServiceHandler implements IcebergRestConfigurationApiService {
11+
private final IcebergCatalogConfigurationService configurationService;
12+
13+
public IcebergConfigurationServiceHandler(IcebergCatalogConfigurationService configurationService) {
14+
this.configurationService = configurationService;
15+
}
16+
1117
@Override
1218
public Response getConfig(String warehouse, SecurityContext securityContext) {
13-
return ApiFallbacks.notImplemented("IcebergConfigurationService.getConfig");
19+
return Response.ok().entity(configurationService.getConfig(warehouse)).build();
1420
}
1521
}

0 commit comments

Comments
 (0)