From 73dd313fe2944c4f0adf6e20247bcfc70f23fb03 Mon Sep 17 00:00:00 2001 From: Alexandre Dutra Date: Tue, 10 Dec 2024 14:02:25 +0100 Subject: [PATCH] Isolate Dropwizard and HK2 dependencies --- .dockerignore | 4 +- .github/workflows/gradle.yml | 2 +- aggregated-license-report/build.gradle.kts | 2 +- build.gradle.kts | 4 +- gradle/libs.versions.toml | 5 +- gradle/projects.main.properties | 3 +- polaris-core/build.gradle.kts | 1 - polaris-service/{ => common}/build.gradle.kts | 120 +---------- .../service/admin/PolarisAdminService.java | 0 .../service/admin/PolarisServiceImpl.java | 0 .../polaris/service/auth/Authenticator.java} | 10 +- .../auth/BasePolarisAuthenticator.java | 12 +- .../polaris/service/auth/DecodedToken.java | 0 .../service/auth/DefaultOAuth2ApiService.java | 0 .../auth/DefaultPolarisAuthenticator.java | 0 .../polaris/service/auth/JWTBroker.java | 0 .../polaris/service/auth/JWTRSAKeyPair.java | 0 .../service/auth/JWTRSAKeyPairFactory.java | 0 .../service/auth/JWTSymmetricKeyBroker.java | 0 .../service/auth/JWTSymmetricKeyFactory.java | 0 .../polaris/service/auth/KeyProvider.java | 0 .../service/auth/LocalRSAKeyProvider.java | 0 .../service/auth/OAuthTokenErrorResponse.java | 0 .../polaris/service/auth/OAuthUtils.java | 0 .../apache/polaris/service/auth/PemUtils.java | 0 ...InlineBearerTokenPolarisAuthenticator.java | 8 +- .../service/auth/TestOAuth2ApiService.java | 0 .../polaris/service/auth/TokenBroker.java | 0 .../service/auth/TokenBrokerFactory.java | 0 .../auth/TokenInfoExchangeResponse.java | 0 .../service/auth/TokenRequestValidator.java | 0 .../polaris/service/auth/TokenResponse.java | 0 .../service/catalog/AccessDelegationMode.java | 0 .../service/catalog/BasePolarisCatalog.java | 0 .../catalog/IcebergCatalogAdapter.java | 0 .../catalog/PolarisCatalogHandlerWrapper.java | 0 .../catalog/SupportsCredentialDelegation.java | 0 .../catalog/SupportsNotifications.java | 0 .../catalog/io/DefaultFileIOFactory.java | 0 .../service/catalog/io/FileIOFactory.java | 0 .../catalog/io/WasbTranslatingFileIO.java | 0 .../io/WasbTranslatingFileIOFactory.java | 0 .../config/DefaultConfigurationStore.java | 0 .../service/config/OAuth2ApiService.java | 0 .../config/RealmEntityManagerFactory.java | 0 .../polaris/service/config/Serializers.java | 0 .../config/TaskHandlerConfiguration.java | 0 .../context/CallContextCatalogFactory.java | 0 .../service/context/CallContextResolver.java | 0 .../context/DefaultContextResolver.java | 0 .../PolarisCallContextCatalogFactory.java | 0 .../service/context/RealmContextResolver.java | 0 ...rgConstraintViolationExceptionMapper.java} | 12 +- .../exception/IcebergExceptionMapper.java | 2 + .../IcebergJsonProcessingExceptionMapper.java | 47 +++-- .../exception/PolarisExceptionMapper.java | 0 ...nMemoryPolarisMetaStoreManagerFactory.java | 0 .../service/ratelimiter/NoOpRateLimiter.java | 0 .../service/ratelimiter/RateLimiter.java | 0 .../ratelimiter/RateLimiterFilter.java | 0 .../RealmTokenBucketRateLimiter.java | 0 .../ratelimiter/TokenBucketRateLimiter.java | 0 ...PolarisStorageIntegrationProviderImpl.java | 0 .../task/ManifestFileCleanupTaskHandler.java | 0 .../service/task/TableCleanupTaskHandler.java | 0 .../polaris/service/task/TaskExecutor.java | 0 .../service/task/TaskExecutorImpl.java | 0 .../service/task/TaskFileIOSupplier.java | 0 .../polaris/service/task/TaskHandler.java | 0 .../polaris/service/task/TaskUtils.java | 0 .../service/types/CommitTableRequest.java | 0 .../service/types/CommitViewRequest.java | 0 .../service/types/NotificationRequest.java | 0 .../service/types/NotificationType.java | 0 .../types/TableUpdateNotification.java | 0 .../polaris/service/types/TokenType.java | 0 .../org/apache/polaris/service/banner.txt | 0 polaris-service/dropwizard/build.gradle.kts | 187 ++++++++++++++++++ .../dropwizard}/BootstrapRealmsCommand.java | 4 +- .../dropwizard}/PolarisApplication.java | 22 +-- .../dropwizard}/PolarisHealthCheck.java | 2 +- .../dropwizard}/PurgeRealmsCommand.java | 4 +- .../TimedApplicationEventListener.java | 4 +- .../dropwizard}/config/CorsConfiguration.java | 2 +- .../config/PolarisApplicationConfig.java | 7 +- .../context/RealmScopeContext.java | 2 +- .../JerseyViolationExceptionMapper.java} | 31 +-- .../logging/PolarisJsonLayoutFactory.java | 2 +- .../persistence/cache/EntityCacheFactory.java | 2 +- .../RequestThrottlingErrorResponse.java | 2 +- .../StreamReadConstraintsExceptionMapper.java | 4 +- .../tracing/HeadersMapAccessor.java | 2 +- .../dropwizard}/tracing/TracingFilter.java | 2 +- .../resources/META-INF/hk2-locator/default | 4 +- ...ng.common.layout.DiscoverableLayoutFactory | 2 +- .../src/main/resources/log4j.properties | 0 .../PolarisApplicationConfigurationTest.java | 3 +- .../PolarisApplicationIntegrationTest.java | 7 +- .../TimedApplicationEventListenerTest.java | 8 +- .../admin/PolarisAdminServiceAuthzTest.java | 0 .../service/admin/PolarisAuthzTestBase.java | 0 .../admin/PolarisOverlappingCatalogTest.java | 4 +- .../admin/PolarisOverlappingTableTest.java | 4 +- .../admin/PolarisRealmEntityCacheTest.java | 10 +- .../PolarisServiceImplIntegrationTest.java | 4 +- .../service/auth/JWTRSAKeyPairTest.java | 0 .../auth/JWTSymmetricKeyGeneratorTest.java | 0 .../auth/TokenRequestValidatorTest.java | 0 .../polaris/service/auth/TokenUtils.java | 0 .../catalog/AccessDelegationModeTest.java | 0 .../catalog/BasePolarisCatalogTest.java | 0 .../catalog/BasePolarisCatalogViewTest.java | 0 ...PolarisCatalogHandlerWrapperAuthzTest.java | 0 .../PolarisPassthroughResolutionView.java | 0 .../PolarisRestCatalogIntegrationTest.java | 4 +- ...arisRestCatalogViewAwsIntegrationTest.java | 0 ...isRestCatalogViewAzureIntegrationTest.java | 0 ...risRestCatalogViewFileIntegrationTest.java | 0 ...arisRestCatalogViewGcpIntegrationTest.java | 0 ...PolarisRestCatalogViewIntegrationTest.java | 4 +- .../catalog/PolarisSparkIntegrationTest.java | 4 +- .../polaris/service/catalog/TestUtil.java | 2 +- .../catalog/io/FileIOIntegrationTest.java | 4 +- .../service/catalog/io/TestFileIO.java | 0 .../service/catalog/io/TestFileIOFactory.java | 0 .../service/catalog/io/TestInputFile.java | 0 .../config/DefaultConfigurationStoreTest.java | 0 .../service/entity/CatalogEntityTest.java | 0 .../MockRealmTokenBucketRateLimiter.java | 0 .../ratelimiter/RateLimitResultAsserter.java | 0 .../ratelimiter/RateLimiterFilterTest.java | 8 +- .../RealmTokenBucketRateLimiterTest.java | 0 .../polaris/service/ratelimiter/TestUtil.java | 2 +- .../TokenBucketRateLimiterTest.java | 0 .../ManifestFileCleanupTaskHandlerTest.java | 0 .../task/TableCleanupTaskHandlerTest.java | 0 .../polaris/service/task/TaskTestUtils.java | 0 .../polaris/service/task/TestSnapshot.java | 0 .../DropwizardTestEnvironmentResolver.java | 0 .../test/PolarisConnectionExtension.java | 2 +- .../polaris/service/test/PolarisRealm.java | 0 .../test/SnowmanCredentialsExtension.java | 0 .../polaris/service/test/TestEnvironment.java | 0 .../test/TestEnvironmentExtension.java | 0 .../service/test/TestEnvironmentResolver.java | 0 .../polaris/service/test/TestMetricsUtil.java | 2 +- .../resources/META-INF/hk2-locator/default | 0 .../polaris-server-integrationtest.yml | 0 site/content/in-dev/unreleased/metastores.md | 4 +- 149 files changed, 357 insertions(+), 236 deletions(-) rename polaris-service/{ => common}/build.gradle.kts (65%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java (100%) rename polaris-service/{src/main/java/org/apache/polaris/service/config/HasMetaStoreManagerFactory.java => common/src/main/java/org/apache/polaris/service/auth/Authenticator.java} (77%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java (89%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/DecodedToken.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/DefaultPolarisAuthenticator.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/JWTBroker.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPair.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPairFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyBroker.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/KeyProvider.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/LocalRSAKeyProvider.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/OAuthTokenErrorResponse.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/OAuthUtils.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/PemUtils.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java (93%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TokenBroker.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TokenBrokerFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TokenInfoExchangeResponse.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TokenRequestValidator.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/auth/TokenResponse.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapper.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/SupportsCredentialDelegation.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/SupportsNotifications.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/io/FileIOFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIO.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/config/Serializers.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/config/TaskHandlerConfiguration.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/context/CallContextCatalogFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/context/CallContextResolver.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/context/DefaultContextResolver.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/context/PolarisCallContextCatalogFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/context/RealmContextResolver.java (100%) rename polaris-service/{src/main/java/org/apache/polaris/service/exception/IcebergJerseyViolationExceptionMapper.java => common/src/main/java/org/apache/polaris/service/exception/IcebergConstraintViolationExceptionMapper.java} (80%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java (99%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java (59%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/ratelimiter/NoOpRateLimiter.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiter.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiterFilter.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiter.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiter.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandler.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/TaskExecutor.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/TaskExecutorImpl.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/TaskFileIOSupplier.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/TaskHandler.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/task/TaskUtils.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/types/CommitTableRequest.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/types/CommitViewRequest.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/types/NotificationRequest.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/types/NotificationType.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/types/TableUpdateNotification.java (100%) rename polaris-service/{ => common}/src/main/java/org/apache/polaris/service/types/TokenType.java (100%) rename polaris-service/{ => common}/src/main/resources/org/apache/polaris/service/banner.txt (100%) create mode 100644 polaris-service/dropwizard/build.gradle.kts rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/BootstrapRealmsCommand.java (95%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/PolarisApplication.java (96%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/PolarisHealthCheck.java (95%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/PurgeRealmsCommand.java (93%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/TimedApplicationEventListener.java (98%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/config/CorsConfiguration.java (98%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/config/PolarisApplicationConfig.java (98%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/context/RealmScopeContext.java (98%) rename polaris-service/{src/main/java/org/apache/polaris/service/auth/DiscoverableAuthenticator.java => dropwizard/src/main/java/org/apache/polaris/service/dropwizard/exception/JerseyViolationExceptionMapper.java} (50%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/logging/PolarisJsonLayoutFactory.java (99%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/persistence/cache/EntityCacheFactory.java (96%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/throttling/RequestThrottlingErrorResponse.java (95%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/throttling/StreamReadConstraintsExceptionMapper.java (88%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/tracing/HeadersMapAccessor.java (97%) rename polaris-service/{src/main/java/org/apache/polaris/service => dropwizard/src/main/java/org/apache/polaris/service/dropwizard}/tracing/TracingFilter.java (98%) rename polaris-service/{ => dropwizard}/src/main/resources/META-INF/hk2-locator/default (96%) rename polaris-service/{ => dropwizard}/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory (91%) rename polaris-service/{ => dropwizard}/src/main/resources/log4j.properties (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java (95%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java (98%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java (95%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/admin/PolarisAdminServiceAuthzTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/admin/PolarisAuthzTestBase.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java (98%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java (98%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java (96%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java (99%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/auth/JWTRSAKeyPairTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/auth/JWTSymmetricKeyGeneratorTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/auth/TokenRequestValidatorTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/auth/TokenUtils.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogViewTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapperAuthzTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisPassthroughResolutionView.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java (99%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAwsIntegrationTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAzureIntegrationTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewFileIntegrationTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewGcpIntegrationTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java (98%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java (99%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/TestUtil.java (99%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java (98%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/io/TestFileIO.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/io/TestFileIOFactory.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/catalog/io/TestInputFile.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/config/DefaultConfigurationStoreTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/entity/CatalogEntityTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/ratelimiter/MockRealmTokenBucketRateLimiter.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/ratelimiter/RateLimitResultAsserter.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java (93%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiterTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java (96%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiterTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandlerTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/task/TaskTestUtils.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/task/TestSnapshot.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/DropwizardTestEnvironmentResolver.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java (99%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/PolarisRealm.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/SnowmanCredentialsExtension.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/TestEnvironment.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/TestEnvironmentExtension.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/TestEnvironmentResolver.java (100%) rename polaris-service/{ => dropwizard}/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java (97%) rename polaris-service/{ => dropwizard}/src/test/resources/META-INF/hk2-locator/default (100%) rename polaris-service/{ => dropwizard}/src/test/resources/polaris-server-integrationtest.yml (100%) diff --git a/.dockerignore b/.dockerignore index d27babc72..958f10a9c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,8 +17,6 @@ # under the License. # -polaris-service/logs -polaris-service/build -polaris-core/build +polaris-service/dropwizard/logs build .idea diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b3d9cd623..1486a6245 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -69,7 +69,7 @@ jobs: name: upload-test-artifacts path: | polaris-core/build/test-results/test - polaris-service/build/test-results/test + polaris-service/dropwizard/build/test-results/test # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. diff --git a/aggregated-license-report/build.gradle.kts b/aggregated-license-report/build.gradle.kts index f249a1988..8a888e2c1 100644 --- a/aggregated-license-report/build.gradle.kts +++ b/aggregated-license-report/build.gradle.kts @@ -22,7 +22,7 @@ import org.gradle.kotlin.dsl.support.unzipTo val licenseReports by configurations.creating { description = "Used to generate license reports" } dependencies { - licenseReports(project(":polaris-service", "licenseReports")) + licenseReports(project(":polaris-service-dropwizard", "licenseReports")) } val collectLicenseReportJars by diff --git a/build.gradle.kts b/build.gradle.kts index 2e7784955..e29d2e790 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -84,8 +84,8 @@ tasks.named("rat").configure { excludes.add("gradle/wrapper/gradle-wrapper*.jar*") excludes.add("logs/**") - excludes.add("polaris-service/src/**/banner.txt") - excludes.add("polaris-service/logs") + excludes.add("polaris-service/common/src/**/banner.txt") + excludes.add("polaris-service/dropwizard/logs") excludes.add("site/node_modules/**") excludes.add("site/layouts/robots.txt") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 67fefba6d..aaa459ae9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,10 +53,11 @@ iceberg-bom = { module = "org.apache.iceberg:iceberg-bom", version.ref = "iceber jackson-bom = { module = "com.fasterxml.jackson:jackson-bom", version = "2.17.2" } jakarta-annotation-api = { module = "jakarta.annotation:jakarta.annotation-api", version = "3.0.0" } jakarta-inject-api = { module = "jakarta.inject:jakarta.inject-api", version = "2.0.1" } -jakarta-validation-api = { module = "jakarta.validation:jakarta.validation-api", version = "3.1.0" } jakarta-persistence-api = { module = "jakarta.persistence:jakarta.persistence-api", version = "3.1.0" } +jakarta-servlet-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } +jakarta-validation-api = { module = "jakarta.validation:jakarta.validation-api", version = "3.0.2" } +jakarta-ws-rs-api = { module = "jakarta.ws.rs:jakarta.ws.rs-api", version = "3.1.0" } javax-annotation-api = { module = "javax.annotation:javax.annotation-api", version = "1.3.2" } -javax-inject = { module = "javax.inject:javax.inject", version = "1" } jetbrains-annotations = { module = "org.jetbrains:annotations", version = "24.1.0" } junit-bom = { module = "org.junit:junit-bom", version = "5.10.3" } logback-core = { module = "ch.qos.logback:logback-core", version = "1.4.14" } diff --git a/gradle/projects.main.properties b/gradle/projects.main.properties index 2dcf675c1..3b4c9c320 100644 --- a/gradle/projects.main.properties +++ b/gradle/projects.main.properties @@ -19,7 +19,8 @@ # polaris-core=polaris-core -polaris-service=polaris-service +polaris-service-common=polaris-service/common +polaris-service-dropwizard=polaris-service/dropwizard polaris-eclipselink=extension/persistence/eclipselink polaris-jpa-model=extension/persistence/jpa-model aggregated-license-report=aggregated-license-report diff --git a/polaris-core/build.gradle.kts b/polaris-core/build.gradle.kts index f07b12cc6..145a5ae30 100644 --- a/polaris-core/build.gradle.kts +++ b/polaris-core/build.gradle.kts @@ -64,7 +64,6 @@ dependencies { } } - implementation(libs.javax.inject) implementation(libs.swagger.annotations) implementation(libs.swagger.jaxrs) implementation(libs.jakarta.inject.api) diff --git a/polaris-service/build.gradle.kts b/polaris-service/common/build.gradle.kts similarity index 65% rename from polaris-service/build.gradle.kts rename to polaris-service/common/build.gradle.kts index 5ed865e21..aa307fe48 100644 --- a/polaris-service/build.gradle.kts +++ b/polaris-service/common/build.gradle.kts @@ -17,15 +17,11 @@ * under the License. */ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.openapitools.generator.gradle.plugin.tasks.GenerateTask plugins { alias(libs.plugins.openapi.generator) id("polaris-server") - id("polaris-license-report") - id("polaris-shadow-jar") - id("application") } dependencies { @@ -35,6 +31,7 @@ dependencies { implementation("org.apache.iceberg:iceberg-api") implementation("org.apache.iceberg:iceberg-core") implementation("org.apache.iceberg:iceberg-aws") + implementation(libs.hadoop.common) { exclude("org.slf4j", "slf4j-reload4j") exclude("org.slf4j", "slf4j-log4j12") @@ -48,36 +45,26 @@ dependencies { exclude("com.sun.jersey", "jersey-servlet") } implementation(libs.hadoop.hdfs.client) - implementation(libs.smallrye.common.annotation) - implementation(platform(libs.dropwizard.bom)) - implementation("io.dropwizard:dropwizard-core") - implementation("io.dropwizard:dropwizard-auth") - implementation("io.dropwizard:dropwizard-json-logging") + compileOnly(libs.jakarta.annotation.api) + compileOnly(libs.jakarta.inject.api) + compileOnly(libs.jakarta.servlet.api) + compileOnly(libs.jakarta.validation.api) + compileOnly(libs.jakarta.ws.rs.api) + + compileOnly(libs.smallrye.common.annotation) implementation(platform(libs.jackson.bom)) implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") implementation("com.fasterxml.jackson.core:jackson-annotations") - implementation(platform(libs.opentelemetry.bom)) - implementation("io.opentelemetry:opentelemetry-api") - implementation("io.opentelemetry:opentelemetry-sdk-trace") - implementation("io.opentelemetry:opentelemetry-exporter-logging") - implementation(libs.opentelemetry.semconv) - implementation(libs.caffeine) implementation(libs.guava) implementation(libs.slf4j.api) - implementation(libs.prometheus.metrics.exporter.servlet.jakarta) - implementation(platform(libs.micrometer.bom)) - implementation("io.micrometer:micrometer-core") - implementation("io.micrometer:micrometer-registry-prometheus") - compileOnly(libs.swagger.annotations) compileOnly(libs.spotbugs.annotations) implementation(libs.swagger.jaxrs) - implementation(libs.javax.annotation.api) implementation(libs.hadoop.client.api) @@ -86,49 +73,16 @@ dependencies { implementation(libs.logback.core) implementation(libs.bouncycastle.bcprov) - compileOnly(libs.jakarta.annotation.api) - compileOnly(libs.spotbugs.annotations) - implementation(platform(libs.google.cloud.storage.bom)) implementation("com.google.cloud:google-cloud-storage") + implementation(platform(libs.awssdk.bom)) implementation("software.amazon.awssdk:sts") implementation("software.amazon.awssdk:iam-policy-builder") implementation("software.amazon.awssdk:s3") + implementation(platform(libs.azuresdk.bom)) implementation("com.azure:azure-core") - - testImplementation("org.apache.iceberg:iceberg-api:${libs.versions.iceberg.get()}:tests") - testImplementation("org.apache.iceberg:iceberg-core:${libs.versions.iceberg.get()}:tests") - testImplementation("io.dropwizard:dropwizard-testing") - testImplementation(platform(libs.testcontainers.bom)) - testImplementation("org.testcontainers:testcontainers") - testImplementation(libs.s3mock.testcontainers) - - testImplementation("org.apache.iceberg:iceberg-spark-3.5_2.12") - testImplementation("org.apache.iceberg:iceberg-spark-extensions-3.5_2.12") - testImplementation("org.apache.spark:spark-sql_2.12:3.5.1") { - // exclude log4j dependencies - exclude("org.apache.logging.log4j", "log4j-slf4j2-impl") - exclude("org.apache.logging.log4j", "log4j-api") - exclude("org.apache.logging.log4j", "log4j-1.2-api") - } - - testImplementation("software.amazon.awssdk:glue") - testImplementation("software.amazon.awssdk:kms") - testImplementation("software.amazon.awssdk:dynamodb") - - testImplementation(platform(libs.junit.bom)) - testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation(libs.assertj.core) - testImplementation(libs.mockito.core) - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - testImplementation(project(":polaris-eclipselink")) -} - -if (project.properties.get("eclipseLink") == "true") { - dependencies { implementation(project(":polaris-eclipselink")) } } openApiGenerate { @@ -223,57 +177,3 @@ listOf("sourcesJar", "compileJava").forEach { task -> sourceSets { main { java { srcDir(project.layout.buildDirectory.dir("generated/src/main/java")) } } } - -tasks.named("test").configure { - if (System.getenv("AWS_REGION") == null) { - environment("AWS_REGION", "us-west-2") - } - jvmArgs("--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED") - useJUnitPlatform() - maxParallelForks = 4 -} - -tasks.register("runApp").configure { - if (System.getenv("AWS_REGION") == null) { - environment("AWS_REGION", "us-west-2") - } - classpath = sourceSets["main"].runtimeClasspath - mainClass = "org.apache.polaris.service.PolarisApplication" - args("server", "$rootDir/polaris-server.yml") -} - -application { mainClass = "org.apache.polaris.service.PolarisApplication" } - -tasks.named("jar") { - manifest { attributes["Main-Class"] = "org.apache.polaris.service.PolarisApplication" } -} - -tasks.register("testJar") { - archiveClassifier.set("tests") - from(sourceSets.test.get().output) -} - -val shadowJar = - tasks.named("shadowJar") { - manifest { attributes["Main-Class"] = "org.apache.polaris.service.PolarisApplication" } - mergeServiceFiles() - append("META-INF/hk2-locator/default") - isZip64 = true - finalizedBy("startScripts") - } - -val startScripts = - tasks.named("startScripts") { - classpath = files(provider { shadowJar.get().archiveFileName }) - } - -tasks.register("prepareDockerDist") { - into(project.layout.buildDirectory.dir("docker-dist")) - from(startScripts) { into("bin") } - from(shadowJar) { into("lib") } - doFirst { delete(project.layout.buildDirectory.dir("regtest-dist")) } -} - -tasks.named("build").configure { dependsOn("prepareDockerDist") } - -tasks.named("assemble").configure { dependsOn("testJar") } diff --git a/polaris-service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java b/polaris-service/common/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java b/polaris-service/common/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/HasMetaStoreManagerFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/Authenticator.java similarity index 77% rename from polaris-service/src/main/java/org/apache/polaris/service/config/HasMetaStoreManagerFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/Authenticator.java index d2c8cc05b..a808dc679 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/config/HasMetaStoreManagerFactory.java +++ b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/Authenticator.java @@ -16,10 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.config; +package org.apache.polaris.service.auth; -import org.apache.polaris.core.persistence.MetaStoreManagerFactory; +import java.security.Principal; +import java.util.Optional; -public interface HasMetaStoreManagerFactory { - void setMetaStoreManagerFactory(MetaStoreManagerFactory metaStoreManagerFactory); +public interface Authenticator { + + Optional

authenticate(String credentials); } diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java similarity index 89% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java index 313ff4c55..28dd9e0ef 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java +++ b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/BasePolarisAuthenticator.java @@ -18,7 +18,6 @@ */ package org.apache.polaris.service.auth; -import io.dropwizard.auth.Authenticator; import jakarta.inject.Inject; import java.util.Arrays; import java.util.HashSet; @@ -40,12 +39,11 @@ import org.slf4j.LoggerFactory; /** - * Base implementation of {@link DiscoverableAuthenticator} constructs a {@link - * AuthenticatedPolarisPrincipal} from the token parsed by subclasses. The {@link - * AuthenticatedPolarisPrincipal} is read from the {@link PolarisMetaStoreManager} for the current - * {@link RealmContext}. If the token defines a non-empty set of scopes, only the principal roles - * specified in the scopes will be active for the current principal. Only the grants assigned to - * these roles will be active in the current request. + * Base implementation of {@link Authenticator} constructs a {@link AuthenticatedPolarisPrincipal} + * from the token parsed by subclasses. The {@link AuthenticatedPolarisPrincipal} is read from the + * {@link PolarisMetaStoreManager} for the current {@link RealmContext}. If the token defines a + * non-empty set of scopes, only the principal roles specified in the scopes will be active for the + * current principal. Only the grants assigned to these roles will be active in the current request. */ public abstract class BasePolarisAuthenticator implements Authenticator { diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/DecodedToken.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/DecodedToken.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/DecodedToken.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/DecodedToken.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/DefaultOAuth2ApiService.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/DefaultPolarisAuthenticator.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/DefaultPolarisAuthenticator.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/DefaultPolarisAuthenticator.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/DefaultPolarisAuthenticator.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/JWTBroker.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTBroker.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/JWTBroker.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTBroker.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPair.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPair.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPair.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPair.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPairFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPairFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPairFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTRSAKeyPairFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyBroker.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyBroker.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyBroker.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyBroker.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/JWTSymmetricKeyFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/KeyProvider.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/KeyProvider.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/KeyProvider.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/KeyProvider.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/LocalRSAKeyProvider.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/LocalRSAKeyProvider.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/LocalRSAKeyProvider.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/LocalRSAKeyProvider.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/OAuthTokenErrorResponse.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/OAuthTokenErrorResponse.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/OAuthTokenErrorResponse.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/OAuthTokenErrorResponse.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/OAuthUtils.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/OAuthUtils.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/OAuthUtils.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/OAuthUtils.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/PemUtils.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/PemUtils.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/PemUtils.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/PemUtils.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java similarity index 93% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java index d43fffb4c..26e35f344 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java +++ b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TestInlineBearerTokenPolarisAuthenticator.java @@ -19,7 +19,6 @@ package org.apache.polaris.service.auth; import com.google.common.base.Splitter; -import io.dropwizard.auth.AuthenticationException; import io.smallrye.common.annotation.Identifier; import java.util.Arrays; import java.util.HashMap; @@ -35,8 +34,8 @@ import org.slf4j.LoggerFactory; /** - * {@link io.dropwizard.auth.Authenticator} that parses a token as a sequence of key/value pairs. - * Specifically, we expect to find + * {@link Authenticator} that parses a token as a sequence of key/value pairs. Specifically, we + * expect to find * *

    *
  • principal - the clientId of the principal @@ -52,8 +51,7 @@ public class TestInlineBearerTokenPolarisAuthenticator extends BasePolarisAuthen LoggerFactory.getLogger(TestInlineBearerTokenPolarisAuthenticator.class); @Override - public Optional authenticate(String credentials) - throws AuthenticationException { + public Optional authenticate(String credentials) { Map properties = extractPrincipal(credentials); PolarisMetaStoreManager metaStoreManager = metaStoreManagerFactory.getOrCreateMetaStoreManager( diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TestOAuth2ApiService.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TokenBroker.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenBroker.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TokenBroker.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenBroker.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TokenBrokerFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenBrokerFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TokenBrokerFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenBrokerFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TokenInfoExchangeResponse.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenInfoExchangeResponse.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TokenInfoExchangeResponse.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenInfoExchangeResponse.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TokenRequestValidator.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenRequestValidator.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TokenRequestValidator.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenRequestValidator.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/TokenResponse.java b/polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenResponse.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/TokenResponse.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/auth/TokenResponse.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapper.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapper.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapper.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapper.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/SupportsCredentialDelegation.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/SupportsCredentialDelegation.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/SupportsCredentialDelegation.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/SupportsCredentialDelegation.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/SupportsNotifications.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/SupportsNotifications.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/SupportsNotifications.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/SupportsNotifications.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/io/FileIOFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/io/FileIOFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIO.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIO.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIO.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIO.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java b/polaris-service/common/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java b/polaris-service/common/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/config/OAuth2ApiService.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/Serializers.java b/polaris-service/common/src/main/java/org/apache/polaris/service/config/Serializers.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/config/Serializers.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/config/Serializers.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/TaskHandlerConfiguration.java b/polaris-service/common/src/main/java/org/apache/polaris/service/config/TaskHandlerConfiguration.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/config/TaskHandlerConfiguration.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/config/TaskHandlerConfiguration.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/context/CallContextCatalogFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/context/CallContextCatalogFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/context/CallContextCatalogFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/context/CallContextCatalogFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/context/CallContextResolver.java b/polaris-service/common/src/main/java/org/apache/polaris/service/context/CallContextResolver.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/context/CallContextResolver.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/context/CallContextResolver.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/context/DefaultContextResolver.java b/polaris-service/common/src/main/java/org/apache/polaris/service/context/DefaultContextResolver.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/context/DefaultContextResolver.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/context/DefaultContextResolver.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/context/PolarisCallContextCatalogFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/context/PolarisCallContextCatalogFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/context/PolarisCallContextCatalogFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/context/PolarisCallContextCatalogFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/context/RealmContextResolver.java b/polaris-service/common/src/main/java/org/apache/polaris/service/context/RealmContextResolver.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/context/RealmContextResolver.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/context/RealmContextResolver.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergJerseyViolationExceptionMapper.java b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergConstraintViolationExceptionMapper.java similarity index 80% rename from polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergJerseyViolationExceptionMapper.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergConstraintViolationExceptionMapper.java index e26e89a2b..d1cf986e1 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergJerseyViolationExceptionMapper.java +++ b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergConstraintViolationExceptionMapper.java @@ -18,22 +18,18 @@ */ package org.apache.polaris.service.exception; -import io.dropwizard.jersey.validation.JerseyViolationException; +import jakarta.validation.ConstraintViolationException; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; import org.apache.iceberg.rest.responses.ErrorResponse; -/** - * Override of the default JerseyViolationExceptionMapper to provide an Iceberg ErrorResponse with - * the exception details. - */ @Provider -public class IcebergJerseyViolationExceptionMapper - implements ExceptionMapper { +public class IcebergConstraintViolationExceptionMapper + implements ExceptionMapper { @Override - public Response toResponse(JerseyViolationException exception) { + public Response toResponse(ConstraintViolationException exception) { final String message = "Invalid value: " + exception.getMessage(); ErrorResponse icebergErrorResponse = ErrorResponse.builder() diff --git a/polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java similarity index 99% rename from polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java index e0c3523ea..6a2107830 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java +++ b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java @@ -26,6 +26,7 @@ import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; import java.util.Arrays; import java.util.Collection; import java.util.Locale; @@ -56,6 +57,7 @@ import org.slf4j.LoggerFactory; import software.amazon.awssdk.services.s3.model.S3Exception; +@Provider public class IcebergExceptionMapper implements ExceptionMapper { private static final Logger LOGGER = LoggerFactory.getLogger(IcebergExceptionMapper.class); diff --git a/polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java similarity index 59% rename from polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java index 929453ae1..8fc1d7e71 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java +++ b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/IcebergJsonProcessingExceptionMapper.java @@ -18,25 +18,40 @@ */ package org.apache.polaris.service.exception; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.exc.InvalidDefinitionException; import com.fasterxml.jackson.databind.exc.ValueInstantiationException; -import io.dropwizard.jersey.errors.LoggingExceptionMapper; +import jakarta.annotation.Nullable; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; +import java.util.Locale; +import java.util.concurrent.ThreadLocalRandom; import org.apache.iceberg.rest.responses.ErrorResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -/** - * Override of the default JsonProcessingExceptionMapper to provide an Iceberg ErrorResponse with - * the exception details. This code mostly comes from Dropwizard's {@link - * io.dropwizard.jersey.jackson.JsonProcessingExceptionMapper} - */ +/** See Dropwizard's {@code io.dropwizard.jersey.jackson.JsonProcessingExceptionMapper} */ @Provider public final class IcebergJsonProcessingExceptionMapper - extends LoggingExceptionMapper { + implements ExceptionMapper { + + private static final Logger LOGGER = + LoggerFactory.getLogger(IcebergJsonProcessingExceptionMapper.class); + + @JsonInclude(Include.NON_NULL) + public record ErrorMessage( + @JsonProperty("code") int code, + @JsonProperty("message") @Nullable String message, + @JsonProperty("details") @Nullable String details) {} + @Override public Response toResponse(JsonProcessingException exception) { /* @@ -44,13 +59,23 @@ public Response toResponse(JsonProcessingException exception) { */ if (exception instanceof JsonGenerationException || exception instanceof InvalidDefinitionException) { - return super.toResponse(exception); // LoggingExceptionMapper will log exception + long id = ThreadLocalRandom.current().nextLong(); + LOGGER.error(String.format(Locale.ROOT, "Error handling a request: %016x", id), exception); + String message = + String.format( + Locale.ROOT, + "There was an error processing your request. It has been logged (ID %016x).", + id); + return Response.status(Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .type(MediaType.APPLICATION_JSON_TYPE) + .entity(new ErrorMessage(500, message, null)) + .build(); } /* * Otherwise, it's those pesky users. */ - logger.info("Unable to process JSON: {}", exception.getMessage()); + LOGGER.info("Unable to process JSON: {}", exception.getMessage()); String messagePrefix = switch (exception) { @@ -61,11 +86,11 @@ public Response toResponse(JsonProcessingException exception) { final String message = messagePrefix + exception.getOriginalMessage(); ErrorResponse icebergErrorResponse = ErrorResponse.builder() - .responseCode(Response.Status.BAD_REQUEST.getStatusCode()) + .responseCode(Status.BAD_REQUEST.getStatusCode()) .withType(exception.getClass().getSimpleName()) .withMessage(message) .build(); - return Response.status(Response.Status.BAD_REQUEST) + return Response.status(Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON_TYPE) .entity(icebergErrorResponse) .build(); diff --git a/polaris-service/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java b/polaris-service/common/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java b/polaris-service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/NoOpRateLimiter.java b/polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/NoOpRateLimiter.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/NoOpRateLimiter.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/NoOpRateLimiter.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiter.java b/polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiter.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiter.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiter.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiterFilter.java b/polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiterFilter.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiterFilter.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiterFilter.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiter.java b/polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiter.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiter.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiter.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiter.java b/polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiter.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiter.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiter.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java b/polaris-service/common/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandler.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandler.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandler.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandler.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/TaskExecutor.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskExecutor.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/TaskExecutor.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskExecutor.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/TaskExecutorImpl.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskExecutorImpl.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/TaskExecutorImpl.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskExecutorImpl.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/TaskFileIOSupplier.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskFileIOSupplier.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/TaskFileIOSupplier.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskFileIOSupplier.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/TaskHandler.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskHandler.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/TaskHandler.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskHandler.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/task/TaskUtils.java b/polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskUtils.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/task/TaskUtils.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/task/TaskUtils.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/types/CommitTableRequest.java b/polaris-service/common/src/main/java/org/apache/polaris/service/types/CommitTableRequest.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/types/CommitTableRequest.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/types/CommitTableRequest.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/types/CommitViewRequest.java b/polaris-service/common/src/main/java/org/apache/polaris/service/types/CommitViewRequest.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/types/CommitViewRequest.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/types/CommitViewRequest.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/types/NotificationRequest.java b/polaris-service/common/src/main/java/org/apache/polaris/service/types/NotificationRequest.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/types/NotificationRequest.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/types/NotificationRequest.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/types/NotificationType.java b/polaris-service/common/src/main/java/org/apache/polaris/service/types/NotificationType.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/types/NotificationType.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/types/NotificationType.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/types/TableUpdateNotification.java b/polaris-service/common/src/main/java/org/apache/polaris/service/types/TableUpdateNotification.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/types/TableUpdateNotification.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/types/TableUpdateNotification.java diff --git a/polaris-service/src/main/java/org/apache/polaris/service/types/TokenType.java b/polaris-service/common/src/main/java/org/apache/polaris/service/types/TokenType.java similarity index 100% rename from polaris-service/src/main/java/org/apache/polaris/service/types/TokenType.java rename to polaris-service/common/src/main/java/org/apache/polaris/service/types/TokenType.java diff --git a/polaris-service/src/main/resources/org/apache/polaris/service/banner.txt b/polaris-service/common/src/main/resources/org/apache/polaris/service/banner.txt similarity index 100% rename from polaris-service/src/main/resources/org/apache/polaris/service/banner.txt rename to polaris-service/common/src/main/resources/org/apache/polaris/service/banner.txt diff --git a/polaris-service/dropwizard/build.gradle.kts b/polaris-service/dropwizard/build.gradle.kts new file mode 100644 index 000000000..87ba38f0d --- /dev/null +++ b/polaris-service/dropwizard/build.gradle.kts @@ -0,0 +1,187 @@ +/* + * 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. + */ + +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + alias(libs.plugins.openapi.generator) + id("polaris-server") + id("polaris-license-report") + id("polaris-shadow-jar") + id("application") +} + +dependencies { + implementation(project(":polaris-core")) + implementation(project(":polaris-service-common")) + + implementation(platform(libs.dropwizard.bom)) + implementation("io.dropwizard:dropwizard-core") + implementation("io.dropwizard:dropwizard-auth") + implementation("io.dropwizard:dropwizard-json-logging") + + implementation(platform(libs.iceberg.bom)) + implementation("org.apache.iceberg:iceberg-api") + implementation("org.apache.iceberg:iceberg-core") + implementation("org.apache.iceberg:iceberg-aws") + + implementation(libs.hadoop.common) { + exclude("org.slf4j", "slf4j-reload4j") + exclude("org.slf4j", "slf4j-log4j12") + exclude("ch.qos.reload4j", "reload4j") + exclude("log4j", "log4j") + exclude("org.apache.zookeeper", "zookeeper") + exclude("org.apache.hadoop.thirdparty", "hadoop-shaded-protobuf_3_25") + exclude("com.github.pjfanning", "jersey-json") + exclude("com.sun.jersey", "jersey-core") + exclude("com.sun.jersey", "jersey-server") + exclude("com.sun.jersey", "jersey-servlet") + } + + compileOnly(libs.jakarta.annotation.api) + compileOnly(libs.jakarta.inject.api) + compileOnly(libs.jakarta.servlet.api) + compileOnly(libs.jakarta.validation.api) + compileOnly(libs.jakarta.ws.rs.api) + + compileOnly(libs.smallrye.common.annotation) + + implementation(platform(libs.google.cloud.storage.bom)) + implementation("com.google.cloud:google-cloud-storage") + + implementation(platform(libs.awssdk.bom)) + implementation("software.amazon.awssdk:sts") + implementation("software.amazon.awssdk:iam-policy-builder") + implementation("software.amazon.awssdk:s3") + + implementation(platform(libs.azuresdk.bom)) + implementation("com.azure:azure-core") + + implementation(platform(libs.micrometer.bom)) + implementation("io.micrometer:micrometer-core") + implementation("io.micrometer:micrometer-registry-prometheus") + implementation(libs.prometheus.metrics.exporter.servlet.jakarta) + + implementation(platform(libs.opentelemetry.bom)) + implementation("io.opentelemetry:opentelemetry-api") + implementation("io.opentelemetry:opentelemetry-sdk-trace") + implementation("io.opentelemetry:opentelemetry-exporter-logging") + implementation(libs.opentelemetry.semconv) + + implementation(libs.smallrye.common.annotation) + + compileOnly(libs.swagger.annotations) + compileOnly(libs.spotbugs.annotations) + compileOnly(libs.jakarta.annotation.api) + compileOnly(libs.spotbugs.annotations) + + testImplementation("org.apache.iceberg:iceberg-api:${libs.versions.iceberg.get()}:tests") + testImplementation("org.apache.iceberg:iceberg-core:${libs.versions.iceberg.get()}:tests") + testImplementation("io.dropwizard:dropwizard-testing") + testImplementation(platform(libs.testcontainers.bom)) + testImplementation("org.testcontainers:testcontainers") + testImplementation(libs.s3mock.testcontainers) + + testImplementation("org.apache.iceberg:iceberg-spark-3.5_2.12") + testImplementation("org.apache.iceberg:iceberg-spark-extensions-3.5_2.12") + testImplementation("org.apache.spark:spark-sql_2.12:3.5.1") { + // exclude log4j dependencies + exclude("org.apache.logging.log4j", "log4j-slf4j2-impl") + exclude("org.apache.logging.log4j", "log4j-api") + exclude("org.apache.logging.log4j", "log4j-1.2-api") + } + + testImplementation(platform(libs.awssdk.bom)) + testImplementation("software.amazon.awssdk:glue") + testImplementation("software.amazon.awssdk:kms") + testImplementation("software.amazon.awssdk:dynamodb") + + testImplementation(libs.auth0.jwt) + + testCompileOnly(libs.smallrye.common.annotation) + + testImplementation(platform(libs.junit.bom)) + testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation(libs.assertj.core) + testImplementation(libs.mockito.core) + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + + testImplementation(project(":polaris-eclipselink")) +} + +if (project.properties.get("eclipseLink") == "true") { + dependencies { implementation(project(":polaris-eclipselink")) } +} + +tasks.named("test").configure { + if (System.getenv("AWS_REGION") == null) { + environment("AWS_REGION", "us-west-2") + } + jvmArgs("--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED") + useJUnitPlatform() + maxParallelForks = 4 +} + +tasks.register("runApp").configure { + if (System.getenv("AWS_REGION") == null) { + environment("AWS_REGION", "us-west-2") + } + classpath = sourceSets["main"].runtimeClasspath + mainClass = "org.apache.polaris.service.dropwizard.PolarisApplication" + args("server", "$rootDir/polaris-server.yml") +} + +application { mainClass = "org.apache.polaris.service.dropwizard.PolarisApplication" } + +tasks.named("jar") { + manifest { attributes["Main-Class"] = "org.apache.polaris.service.dropwizard.PolarisApplication" } +} + +tasks.register("testJar") { + archiveClassifier.set("tests") + from(sourceSets.test.get().output) +} + +val shadowJar = + tasks.named("shadowJar") { + manifest { + attributes["Main-Class"] = "org.apache.polaris.service.dropwizard.PolarisApplication" + } + mergeServiceFiles() + append("META-INF/hk2-locator/default") + isZip64 = true + finalizedBy("startScripts") + } + +val startScripts = + tasks.named("startScripts") { + classpath = files(provider { shadowJar.get().archiveFileName }) + applicationName = "polaris-service" + } + +tasks.register("prepareDockerDist") { + into(project.layout.buildDirectory.dir("docker-dist")) + from(startScripts) { into("bin") } + from(shadowJar) { into("lib") } + doFirst { delete(project.layout.buildDirectory.dir("regtest-dist")) } +} + +tasks.named("build").configure { dependsOn("prepareDockerDist") } + +tasks.named("assemble").configure { dependsOn("testJar") } diff --git a/polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/BootstrapRealmsCommand.java similarity index 95% rename from polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/BootstrapRealmsCommand.java index 338e687c7..b68d2d761 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/BootstrapRealmsCommand.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service; +package org.apache.polaris.service.dropwizard; import io.dropwizard.core.cli.ConfiguredCommand; import io.dropwizard.core.setup.Bootstrap; @@ -25,7 +25,7 @@ import org.apache.polaris.core.PolarisConfigurationStore; import org.apache.polaris.core.auth.PolarisSecretsManager.PrincipalSecretsResult; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/PolarisApplication.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PolarisApplication.java similarity index 96% rename from polaris-service/src/main/java/org/apache/polaris/service/PolarisApplication.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PolarisApplication.java index be55259ca..ce5bf6911 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/PolarisApplication.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PolarisApplication.java @@ -16,11 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service; +package org.apache.polaris.service.dropwizard; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; -import static org.apache.polaris.service.config.PolarisApplicationConfig.REQUEST_BODY_BYTES_NO_LIMIT; +import static org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig.REQUEST_BODY_BYTES_NO_LIMIT; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; @@ -38,7 +38,6 @@ import com.fasterxml.jackson.databind.type.TypeFactory; import io.dropwizard.auth.AuthDynamicFeature; import io.dropwizard.auth.AuthFilter; -import io.dropwizard.auth.Authenticator; import io.dropwizard.auth.oauth.OAuthCredentialAuthFilter; import io.dropwizard.configuration.EnvironmentVariableSubstitutor; import io.dropwizard.configuration.SubstitutingSourceProvider; @@ -102,6 +101,7 @@ import org.apache.polaris.service.admin.api.PolarisPrincipalRolesApiService; import org.apache.polaris.service.admin.api.PolarisPrincipalsApi; import org.apache.polaris.service.admin.api.PolarisPrincipalsApiService; +import org.apache.polaris.service.auth.Authenticator; import org.apache.polaris.service.catalog.IcebergCatalogAdapter; import org.apache.polaris.service.catalog.api.IcebergRestCatalogApi; import org.apache.polaris.service.catalog.api.IcebergRestCatalogApiService; @@ -109,7 +109,6 @@ import org.apache.polaris.service.catalog.api.IcebergRestConfigurationApiService; import org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api; import org.apache.polaris.service.catalog.io.FileIOFactory; -import org.apache.polaris.service.config.PolarisApplicationConfig; import org.apache.polaris.service.config.RealmEntityManagerFactory; import org.apache.polaris.service.config.Serializers; import org.apache.polaris.service.config.TaskHandlerConfiguration; @@ -117,21 +116,22 @@ import org.apache.polaris.service.context.CallContextResolver; import org.apache.polaris.service.context.PolarisCallContextCatalogFactory; import org.apache.polaris.service.context.RealmContextResolver; -import org.apache.polaris.service.context.RealmScopeContext; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.context.RealmScopeContext; +import org.apache.polaris.service.dropwizard.exception.JerseyViolationExceptionMapper; +import org.apache.polaris.service.dropwizard.persistence.cache.EntityCacheFactory; +import org.apache.polaris.service.dropwizard.throttling.StreamReadConstraintsExceptionMapper; +import org.apache.polaris.service.dropwizard.tracing.TracingFilter; import org.apache.polaris.service.exception.IcebergExceptionMapper; -import org.apache.polaris.service.exception.IcebergJerseyViolationExceptionMapper; import org.apache.polaris.service.exception.IcebergJsonProcessingExceptionMapper; import org.apache.polaris.service.exception.PolarisExceptionMapper; import org.apache.polaris.service.persistence.InMemoryPolarisMetaStoreManagerFactory; -import org.apache.polaris.service.persistence.cache.EntityCacheFactory; import org.apache.polaris.service.ratelimiter.RateLimiterFilter; import org.apache.polaris.service.task.ManifestFileCleanupTaskHandler; import org.apache.polaris.service.task.TableCleanupTaskHandler; import org.apache.polaris.service.task.TaskExecutor; import org.apache.polaris.service.task.TaskExecutorImpl; import org.apache.polaris.service.task.TaskFileIOSupplier; -import org.apache.polaris.service.throttling.StreamReadConstraintsExceptionMapper; -import org.apache.polaris.service.tracing.TracingFilter; import org.eclipse.jetty.servlets.CrossOriginFilter; import org.glassfish.hk2.api.Context; import org.glassfish.hk2.api.Factory; @@ -396,7 +396,7 @@ protected void configure() { configuration.findService(new TypeLiteral<>() {}); AuthFilter oauthCredentialAuthFilter = new OAuthCredentialAuthFilter.Builder() - .setAuthenticator(authenticator) + .setAuthenticator(authenticator::authenticate) .setPrefix("Bearer") .buildAuthFilter(); environment.jersey().register(new AuthDynamicFeature(oauthCredentialAuthFilter)); @@ -428,7 +428,7 @@ protected void configure() { RESTSerializers.registerAll(objectMapper); Serializers.registerSerializers(objectMapper); environment.jersey().register(IcebergJsonProcessingExceptionMapper.class); - environment.jersey().register(IcebergJerseyViolationExceptionMapper.class); + environment.jersey().register(JerseyViolationExceptionMapper.class); // for tests, we have to instantiate the TimedApplicationEventListener directly environment.jersey().register(new TimedApplicationEventListener(polarisMetricRegistry)); diff --git a/polaris-service/src/main/java/org/apache/polaris/service/PolarisHealthCheck.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PolarisHealthCheck.java similarity index 95% rename from polaris-service/src/main/java/org/apache/polaris/service/PolarisHealthCheck.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PolarisHealthCheck.java index 6f7a897af..32174bc87 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/PolarisHealthCheck.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PolarisHealthCheck.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service; +package org.apache.polaris.service.dropwizard; import com.codahale.metrics.health.HealthCheck; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/PurgeRealmsCommand.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PurgeRealmsCommand.java similarity index 93% rename from polaris-service/src/main/java/org/apache/polaris/service/PurgeRealmsCommand.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PurgeRealmsCommand.java index 5cc05c6ac..259f1f07d 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/PurgeRealmsCommand.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/PurgeRealmsCommand.java @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service; +package org.apache.polaris.service.dropwizard; import io.dropwizard.core.cli.ConfiguredCommand; import io.dropwizard.core.setup.Bootstrap; import net.sourceforge.argparse4j.inf.Namespace; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/TimedApplicationEventListener.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/TimedApplicationEventListener.java similarity index 98% rename from polaris-service/src/main/java/org/apache/polaris/service/TimedApplicationEventListener.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/TimedApplicationEventListener.java index 52d7dbaa7..bf2161f18 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/TimedApplicationEventListener.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/TimedApplicationEventListener.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service; +package org.apache.polaris.service.dropwizard; import static org.apache.polaris.core.monitor.PolarisMetricRegistry.TAG_RESP_CODE; @@ -24,10 +24,10 @@ import com.google.common.base.Stopwatch; import io.micrometer.core.instrument.Tag; import jakarta.inject.Inject; +import jakarta.ws.rs.ext.Provider; import java.lang.reflect.Method; import java.util.List; import java.util.concurrent.TimeUnit; -import javax.ws.rs.ext.Provider; import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.monitor.PolarisMetricRegistry; import org.apache.polaris.core.resource.TimedApi; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/CorsConfiguration.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/config/CorsConfiguration.java similarity index 98% rename from polaris-service/src/main/java/org/apache/polaris/service/config/CorsConfiguration.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/config/CorsConfiguration.java index f1154ea7d..9055d73a7 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/config/CorsConfiguration.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/config/CorsConfiguration.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.config; +package org.apache.polaris.service.dropwizard.config; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/config/PolarisApplicationConfig.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java similarity index 98% rename from polaris-service/src/main/java/org/apache/polaris/service/config/PolarisApplicationConfig.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java index 5f05961f0..763f6aeb3 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/config/PolarisApplicationConfig.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/config/PolarisApplicationConfig.java @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.config; +package org.apache.polaris.service.dropwizard.config; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.common.base.Preconditions; -import io.dropwizard.auth.Authenticator; import io.dropwizard.core.Configuration; import jakarta.annotation.Nonnull; import jakarta.annotation.PostConstruct; @@ -41,12 +40,16 @@ import org.apache.polaris.core.auth.AuthenticatedPolarisPrincipal; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.storage.PolarisStorageIntegrationProvider; +import org.apache.polaris.service.auth.Authenticator; import org.apache.polaris.service.auth.DecodedToken; import org.apache.polaris.service.auth.TokenBroker; import org.apache.polaris.service.auth.TokenBrokerFactory; import org.apache.polaris.service.auth.TokenResponse; import org.apache.polaris.service.catalog.api.IcebergRestOAuth2ApiService; import org.apache.polaris.service.catalog.io.FileIOFactory; +import org.apache.polaris.service.config.DefaultConfigurationStore; +import org.apache.polaris.service.config.OAuth2ApiService; +import org.apache.polaris.service.config.TaskHandlerConfiguration; import org.apache.polaris.service.context.CallContextResolver; import org.apache.polaris.service.context.RealmContextResolver; import org.apache.polaris.service.ratelimiter.RateLimiter; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/context/RealmScopeContext.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/context/RealmScopeContext.java similarity index 98% rename from polaris-service/src/main/java/org/apache/polaris/service/context/RealmScopeContext.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/context/RealmScopeContext.java index f5b33fa3f..f89ea64e7 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/context/RealmScopeContext.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/context/RealmScopeContext.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.context; +package org.apache.polaris.service.dropwizard.context; import jakarta.inject.Inject; import jakarta.inject.Singleton; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/auth/DiscoverableAuthenticator.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/exception/JerseyViolationExceptionMapper.java similarity index 50% rename from polaris-service/src/main/java/org/apache/polaris/service/auth/DiscoverableAuthenticator.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/exception/JerseyViolationExceptionMapper.java index ff76e7de3..4885b3a54 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/auth/DiscoverableAuthenticator.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/exception/JerseyViolationExceptionMapper.java @@ -16,19 +16,26 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.auth; +package org.apache.polaris.service.dropwizard.exception; -import io.dropwizard.auth.Authenticator; -import io.dropwizard.jackson.Discoverable; -import java.security.Principal; +import io.dropwizard.jersey.validation.JerseyViolationException; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; +import org.apache.polaris.service.exception.IcebergConstraintViolationExceptionMapper; /** - * Extension of the {@link Authenticator} interface that extends {@link Discoverable} so - * implementations can be discovered using the mechanisms described in the - * manual. The default implementation is {@link TestInlineBearerTokenPolarisAuthenticator}. - * - * @param - * @param

    + * Override of the default JerseyViolationExceptionMapper to provide an Iceberg ErrorResponse with + * the exception details. */ -public interface DiscoverableAuthenticator extends Authenticator {} +@Provider +public class JerseyViolationExceptionMapper implements ExceptionMapper { + + private IcebergConstraintViolationExceptionMapper icebergMapper = + new IcebergConstraintViolationExceptionMapper(); + + @Override + public Response toResponse(JerseyViolationException exception) { + return icebergMapper.toResponse(exception); + } +} diff --git a/polaris-service/src/main/java/org/apache/polaris/service/logging/PolarisJsonLayoutFactory.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/logging/PolarisJsonLayoutFactory.java similarity index 99% rename from polaris-service/src/main/java/org/apache/polaris/service/logging/PolarisJsonLayoutFactory.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/logging/PolarisJsonLayoutFactory.java index 476c5a997..26aec8bcc 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/logging/PolarisJsonLayoutFactory.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/logging/PolarisJsonLayoutFactory.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.logging; +package org.apache.polaris.service.dropwizard.logging; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.pattern.ExtendedThrowableProxyConverter; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/persistence/cache/EntityCacheFactory.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/persistence/cache/EntityCacheFactory.java similarity index 96% rename from polaris-service/src/main/java/org/apache/polaris/service/persistence/cache/EntityCacheFactory.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/persistence/cache/EntityCacheFactory.java index 13be186c7..0313fd85c 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/persistence/cache/EntityCacheFactory.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/persistence/cache/EntityCacheFactory.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.persistence.cache; +package org.apache.polaris.service.dropwizard.persistence.cache; import jakarta.inject.Inject; import org.apache.polaris.core.context.CallContext; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/throttling/RequestThrottlingErrorResponse.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/throttling/RequestThrottlingErrorResponse.java similarity index 95% rename from polaris-service/src/main/java/org/apache/polaris/service/throttling/RequestThrottlingErrorResponse.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/throttling/RequestThrottlingErrorResponse.java index 137875341..fa07647c1 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/throttling/RequestThrottlingErrorResponse.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/throttling/RequestThrottlingErrorResponse.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.throttling; +package org.apache.polaris.service.dropwizard.throttling; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/throttling/StreamReadConstraintsExceptionMapper.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/throttling/StreamReadConstraintsExceptionMapper.java similarity index 88% rename from polaris-service/src/main/java/org/apache/polaris/service/throttling/StreamReadConstraintsExceptionMapper.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/throttling/StreamReadConstraintsExceptionMapper.java index 27a4f07e3..d29f2de5d 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/throttling/StreamReadConstraintsExceptionMapper.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/throttling/StreamReadConstraintsExceptionMapper.java @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.throttling; +package org.apache.polaris.service.dropwizard.throttling; -import static org.apache.polaris.service.throttling.RequestThrottlingErrorResponse.RequestThrottlingErrorType.REQUEST_TOO_LARGE; +import static org.apache.polaris.service.dropwizard.throttling.RequestThrottlingErrorResponse.RequestThrottlingErrorType.REQUEST_TOO_LARGE; import com.fasterxml.jackson.core.exc.StreamConstraintsException; import jakarta.ws.rs.core.MediaType; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/tracing/HeadersMapAccessor.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/tracing/HeadersMapAccessor.java similarity index 97% rename from polaris-service/src/main/java/org/apache/polaris/service/tracing/HeadersMapAccessor.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/tracing/HeadersMapAccessor.java index 7c73aea81..f6e52ac55 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/tracing/HeadersMapAccessor.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/tracing/HeadersMapAccessor.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.tracing; +package org.apache.polaris.service.dropwizard.tracing; import io.opentelemetry.context.propagation.TextMapGetter; import io.opentelemetry.context.propagation.TextMapSetter; diff --git a/polaris-service/src/main/java/org/apache/polaris/service/tracing/TracingFilter.java b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/tracing/TracingFilter.java similarity index 98% rename from polaris-service/src/main/java/org/apache/polaris/service/tracing/TracingFilter.java rename to polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/tracing/TracingFilter.java index f5d968296..30f5919a5 100644 --- a/polaris-service/src/main/java/org/apache/polaris/service/tracing/TracingFilter.java +++ b/polaris-service/dropwizard/src/main/java/org/apache/polaris/service/dropwizard/tracing/TracingFilter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.polaris.service.tracing; +package org.apache.polaris.service.dropwizard.tracing; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; diff --git a/polaris-service/src/main/resources/META-INF/hk2-locator/default b/polaris-service/dropwizard/src/main/resources/META-INF/hk2-locator/default similarity index 96% rename from polaris-service/src/main/resources/META-INF/hk2-locator/default rename to polaris-service/dropwizard/src/main/resources/META-INF/hk2-locator/default index 58dec4c27..0fac0023d 100644 --- a/polaris-service/src/main/resources/META-INF/hk2-locator/default +++ b/polaris-service/dropwizard/src/main/resources/META-INF/hk2-locator/default @@ -17,12 +17,12 @@ * under the License. */ [org.apache.polaris.service.auth.DefaultPolarisAuthenticator]S -contract={org.apache.polaris.service.auth.BasePolarisAuthenticator} +contract={org.apache.polaris.service.auth.Authenticator} name=default qualifier={io.smallrye.common.annotation.Identifier} [org.apache.polaris.service.auth.TestInlineBearerTokenPolarisAuthenticator]S -contract={io.dropwizard.auth.Authenticator} +contract={org.apache.polaris.service.auth.Authenticator} name=test qualifier={io.smallrye.common.annotation.Identifier} diff --git a/polaris-service/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory b/polaris-service/dropwizard/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory similarity index 91% rename from polaris-service/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory rename to polaris-service/dropwizard/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory index aa766ac70..2e1cd0210 100644 --- a/polaris-service/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory +++ b/polaris-service/dropwizard/src/main/resources/META-INF/services/io.dropwizard.logging.common.layout.DiscoverableLayoutFactory @@ -17,4 +17,4 @@ # under the License. # -org.apache.polaris.service.logging.PolarisJsonLayoutFactory \ No newline at end of file +org.apache.polaris.service.dropwizard.logging.PolarisJsonLayoutFactory \ No newline at end of file diff --git a/polaris-service/src/main/resources/log4j.properties b/polaris-service/dropwizard/src/main/resources/log4j.properties similarity index 100% rename from polaris-service/src/main/resources/log4j.properties rename to polaris-service/dropwizard/src/main/resources/log4j.properties diff --git a/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java similarity index 95% rename from polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java index f92f1ef00..1569c32ca 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java @@ -26,7 +26,8 @@ import io.dropwizard.testing.junit5.DropwizardExtensionsSupport; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.extension.persistence.impl.eclipselink.EclipseLinkPolarisMetaStoreManagerFactory; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.persistence.InMemoryPolarisMetaStoreManagerFactory; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java similarity index 98% rename from polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java index 465b34d51..c16fedb23 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java @@ -19,7 +19,7 @@ package org.apache.polaris.service; import static org.apache.polaris.service.context.DefaultContextResolver.REALM_PROPERTY_KEY; -import static org.apache.polaris.service.throttling.RequestThrottlingErrorResponse.RequestThrottlingErrorType.REQUEST_TOO_LARGE; +import static org.apache.polaris.service.dropwizard.throttling.RequestThrottlingErrorResponse.RequestThrottlingErrorType.REQUEST_TOO_LARGE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.spy; @@ -80,12 +80,13 @@ import org.apache.polaris.core.entity.CatalogEntity; import org.apache.polaris.core.entity.PolarisEntityConstants; import org.apache.polaris.service.auth.BasePolarisAuthenticator; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.throttling.RequestThrottlingErrorResponse; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.SnowmanCredentialsExtension; import org.apache.polaris.service.test.TestEnvironmentExtension; -import org.apache.polaris.service.throttling.RequestThrottlingErrorResponse; import org.assertj.core.api.Assertions; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.AfterAll; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java similarity index 95% rename from polaris-service/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java index c0218b6a4..4c796ca6f 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/TimedApplicationEventListenerTest.java @@ -19,9 +19,9 @@ package org.apache.polaris.service; import static org.apache.polaris.core.monitor.PolarisMetricRegistry.*; -import static org.apache.polaris.service.TimedApplicationEventListener.SINGLETON_METRIC_NAME; -import static org.apache.polaris.service.TimedApplicationEventListener.TAG_API_NAME; import static org.apache.polaris.service.context.DefaultContextResolver.REALM_PROPERTY_KEY; +import static org.apache.polaris.service.dropwizard.TimedApplicationEventListener.SINGLETON_METRIC_NAME; +import static org.apache.polaris.service.dropwizard.TimedApplicationEventListener.TAG_API_NAME; import io.dropwizard.testing.ConfigOverride; import io.dropwizard.testing.ResourceHelpers; @@ -36,7 +36,9 @@ import org.apache.polaris.core.monitor.PolarisMetricRegistry; import org.apache.polaris.core.resource.TimedApi; import org.apache.polaris.service.admin.api.PolarisPrincipalsApi; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.TimedApplicationEventListener; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.SnowmanCredentialsExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisAdminServiceAuthzTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisAdminServiceAuthzTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisAdminServiceAuthzTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisAdminServiceAuthzTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisAuthzTestBase.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisAuthzTestBase.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisAuthzTestBase.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisAuthzTestBase.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java similarity index 98% rename from polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java index 47be13e48..574b2feb2 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingCatalogTest.java @@ -38,8 +38,8 @@ import org.apache.polaris.core.admin.model.CatalogProperties; import org.apache.polaris.core.admin.model.CreateCatalogRequest; import org.apache.polaris.core.admin.model.StorageConfigInfo; -import org.apache.polaris.service.PolarisApplication; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.TestEnvironmentExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java similarity index 98% rename from polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java index 7e040a4da..964138ef7 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisOverlappingTableTest.java @@ -42,8 +42,8 @@ import org.apache.polaris.core.admin.model.CreateCatalogRequest; import org.apache.polaris.core.admin.model.FileStorageConfigInfo; import org.apache.polaris.core.admin.model.StorageConfigInfo; -import org.apache.polaris.service.PolarisApplication; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.TestEnvironmentExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java similarity index 96% rename from polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java index f35747ce3..4ad99f5bc 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisRealmEntityCacheTest.java @@ -49,8 +49,9 @@ import org.apache.polaris.core.persistence.cache.EntityCache; import org.apache.polaris.core.persistence.cache.EntityCacheByNameKey; import org.apache.polaris.core.persistence.cache.EntityCacheEntry; -import org.apache.polaris.service.PolarisApplication; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.persistence.cache.EntityCacheFactory; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.TestEnvironmentExtension; @@ -61,9 +62,8 @@ import org.junit.jupiter.api.extension.ExtendWith; /** - * tests around the {@link org.apache.polaris.service.persistence.cache.EntityCacheFactory} and - * ensuring that the {@link org.apache.polaris.core.persistence.cache.EntityCache} is managed per - * realm. + * tests around the {@link EntityCacheFactory} and ensuring that the {@link + * org.apache.polaris.core.persistence.cache.EntityCache} is managed per realm. */ @ExtendWith({ DropwizardExtensionsSupport.class, diff --git a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java similarity index 99% rename from polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java index d20fd37f4..5f4830a55 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/admin/PolarisServiceImplIntegrationTest.java @@ -86,10 +86,10 @@ import org.apache.polaris.core.admin.model.UpdatePrincipalRoleRequest; import org.apache.polaris.core.entity.PolarisEntityConstants; import org.apache.polaris.core.entity.PolarisPrincipalSecrets; -import org.apache.polaris.service.PolarisApplication; import org.apache.polaris.service.auth.BasePolarisAuthenticator; import org.apache.polaris.service.auth.TokenUtils; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.TestEnvironmentExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/auth/JWTRSAKeyPairTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/JWTRSAKeyPairTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/auth/JWTRSAKeyPairTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/JWTRSAKeyPairTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/auth/JWTSymmetricKeyGeneratorTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/JWTSymmetricKeyGeneratorTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/auth/JWTSymmetricKeyGeneratorTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/JWTSymmetricKeyGeneratorTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/auth/TokenRequestValidatorTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/TokenRequestValidatorTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/auth/TokenRequestValidatorTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/TokenRequestValidatorTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/auth/TokenUtils.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/TokenUtils.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/auth/TokenUtils.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/auth/TokenUtils.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogViewTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogViewTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogViewTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/BasePolarisCatalogViewTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapperAuthzTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapperAuthzTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapperAuthzTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapperAuthzTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisPassthroughResolutionView.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisPassthroughResolutionView.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisPassthroughResolutionView.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisPassthroughResolutionView.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java similarity index 99% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java index 27646faa9..b2f270c27 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java @@ -79,9 +79,9 @@ import org.apache.polaris.core.admin.model.ViewPrivilege; import org.apache.polaris.core.entity.CatalogEntity; import org.apache.polaris.core.entity.PolarisEntityConstants; -import org.apache.polaris.service.PolarisApplication; import org.apache.polaris.service.auth.TokenUtils; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisConnectionExtension.PolarisToken; import org.apache.polaris.service.test.PolarisRealm; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAwsIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAwsIntegrationTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAwsIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAwsIntegrationTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAzureIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAzureIntegrationTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAzureIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewAzureIntegrationTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewFileIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewFileIntegrationTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewFileIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewFileIntegrationTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewGcpIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewGcpIntegrationTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewGcpIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewGcpIntegrationTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java similarity index 98% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java index e9897a1f7..a77dc55bc 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogViewIntegrationTest.java @@ -34,8 +34,8 @@ import org.apache.polaris.core.admin.model.PolarisCatalog; import org.apache.polaris.core.admin.model.StorageConfigInfo; import org.apache.polaris.core.entity.CatalogEntity; -import org.apache.polaris.service.PolarisApplication; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisConnectionExtension.PolarisToken; import org.apache.polaris.service.test.PolarisRealm; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java similarity index 99% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java index 35bb96096..e26010df0 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/PolarisSparkIntegrationTest.java @@ -41,8 +41,8 @@ import org.apache.polaris.core.admin.model.ExternalCatalog; import org.apache.polaris.core.admin.model.PolarisCatalog; import org.apache.polaris.core.admin.model.StorageConfigInfo; -import org.apache.polaris.service.PolarisApplication; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.TestEnvironmentExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/TestUtil.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/TestUtil.java similarity index 99% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/TestUtil.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/TestUtil.java index 37c13f4a1..5150a0746 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/catalog/TestUtil.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/TestUtil.java @@ -38,7 +38,7 @@ import org.apache.polaris.core.admin.model.CatalogRole; import org.apache.polaris.core.admin.model.GrantResource; import org.apache.polaris.service.auth.BasePolarisAuthenticator; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.SnowmanCredentialsExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java similarity index 98% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java index 30a2d9e2e..b6bffb0c0 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/FileIOIntegrationTest.java @@ -51,9 +51,9 @@ import org.apache.polaris.core.admin.model.FileStorageConfigInfo; import org.apache.polaris.core.admin.model.PolarisCatalog; import org.apache.polaris.core.admin.model.StorageConfigInfo; -import org.apache.polaris.service.PolarisApplication; import org.apache.polaris.service.catalog.TestUtil; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.exception.IcebergExceptionMapper; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestFileIO.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/TestFileIO.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestFileIO.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/TestFileIO.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestFileIOFactory.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/TestFileIOFactory.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestFileIOFactory.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/TestFileIOFactory.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestInputFile.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/TestInputFile.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestInputFile.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/catalog/io/TestInputFile.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/config/DefaultConfigurationStoreTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/config/DefaultConfigurationStoreTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/config/DefaultConfigurationStoreTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/config/DefaultConfigurationStoreTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/entity/CatalogEntityTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/entity/CatalogEntityTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/entity/CatalogEntityTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/entity/CatalogEntityTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/MockRealmTokenBucketRateLimiter.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/MockRealmTokenBucketRateLimiter.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/MockRealmTokenBucketRateLimiter.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/MockRealmTokenBucketRateLimiter.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimitResultAsserter.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RateLimitResultAsserter.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimitResultAsserter.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RateLimitResultAsserter.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java similarity index 93% rename from polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java index 772fc6aac..e4495ce11 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java @@ -19,8 +19,8 @@ package org.apache.polaris.service.ratelimiter; import static org.apache.polaris.core.monitor.PolarisMetricRegistry.*; -import static org.apache.polaris.service.TimedApplicationEventListener.SINGLETON_METRIC_NAME; -import static org.apache.polaris.service.TimedApplicationEventListener.TAG_API_NAME; +import static org.apache.polaris.service.dropwizard.TimedApplicationEventListener.SINGLETON_METRIC_NAME; +import static org.apache.polaris.service.dropwizard.TimedApplicationEventListener.TAG_API_NAME; import static org.junit.jupiter.api.Assertions.assertTrue; import io.dropwizard.testing.ConfigOverride; @@ -32,8 +32,8 @@ import java.time.Duration; import java.util.List; import java.util.function.Consumer; -import org.apache.polaris.service.PolarisApplication; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.PolarisApplication; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.test.PolarisConnectionExtension; import org.apache.polaris.service.test.PolarisRealm; import org.apache.polaris.service.test.SnowmanCredentialsExtension; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiterTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiterTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiterTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/RealmTokenBucketRateLimiterTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java similarity index 96% rename from polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java index 43404be2e..7fecd97de 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/TestUtil.java @@ -24,7 +24,7 @@ import io.dropwizard.testing.junit5.DropwizardAppExtension; import jakarta.ws.rs.core.Response; import java.util.function.Consumer; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; /** Common test utils for testing rate limiting */ public class TestUtil { diff --git a/polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiterTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiterTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiterTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/ratelimiter/TokenBucketRateLimiterTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandlerTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandlerTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandlerTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/ManifestFileCleanupTaskHandlerTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/TableCleanupTaskHandlerTest.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/task/TaskTestUtils.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/TaskTestUtils.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/task/TaskTestUtils.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/TaskTestUtils.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/task/TestSnapshot.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/TestSnapshot.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/task/TestSnapshot.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/task/TestSnapshot.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/DropwizardTestEnvironmentResolver.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/DropwizardTestEnvironmentResolver.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/test/DropwizardTestEnvironmentResolver.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/DropwizardTestEnvironmentResolver.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java similarity index 99% rename from polaris-service/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java index 8d49c0836..de685e5ee 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/PolarisConnectionExtension.java @@ -41,9 +41,9 @@ import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; import org.apache.polaris.service.auth.TokenUtils; -import org.apache.polaris.service.config.PolarisApplicationConfig; import org.apache.polaris.service.context.CallContextResolver; import org.apache.polaris.service.context.RealmContextResolver; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; import org.apache.polaris.service.persistence.InMemoryPolarisMetaStoreManagerFactory; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/PolarisRealm.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/PolarisRealm.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/test/PolarisRealm.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/PolarisRealm.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/SnowmanCredentialsExtension.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/SnowmanCredentialsExtension.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/test/SnowmanCredentialsExtension.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/SnowmanCredentialsExtension.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/TestEnvironment.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestEnvironment.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/test/TestEnvironment.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestEnvironment.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/TestEnvironmentExtension.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestEnvironmentExtension.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/test/TestEnvironmentExtension.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestEnvironmentExtension.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/TestEnvironmentResolver.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestEnvironmentResolver.java similarity index 100% rename from polaris-service/src/test/java/org/apache/polaris/service/test/TestEnvironmentResolver.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestEnvironmentResolver.java diff --git a/polaris-service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java similarity index 97% rename from polaris-service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java rename to polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java index f76de83fa..8fa8ea5e4 100644 --- a/polaris-service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java +++ b/polaris-service/dropwizard/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java @@ -26,7 +26,7 @@ import java.util.Collection; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.apache.polaris.service.config.PolarisApplicationConfig; +import org.apache.polaris.service.dropwizard.config.PolarisApplicationConfig; /** Utils for working with metrics in tests */ public class TestMetricsUtil { diff --git a/polaris-service/src/test/resources/META-INF/hk2-locator/default b/polaris-service/dropwizard/src/test/resources/META-INF/hk2-locator/default similarity index 100% rename from polaris-service/src/test/resources/META-INF/hk2-locator/default rename to polaris-service/dropwizard/src/test/resources/META-INF/hk2-locator/default diff --git a/polaris-service/src/test/resources/polaris-server-integrationtest.yml b/polaris-service/dropwizard/src/test/resources/polaris-server-integrationtest.yml similarity index 100% rename from polaris-service/src/test/resources/polaris-server-integrationtest.yml rename to polaris-service/dropwizard/src/test/resources/polaris-server-integrationtest.yml diff --git a/site/content/in-dev/unreleased/metastores.md b/site/content/in-dev/unreleased/metastores.md index 978e4a415..8b2485bff 100644 --- a/site/content/in-dev/unreleased/metastores.md +++ b/site/content/in-dev/unreleased/metastores.md @@ -76,7 +76,7 @@ A single `persistence.xml` can describe multiple [persistence units](https://ecl To build Polaris with the necessary H2 dependency and start the Polaris service, run the following: ```bash polaris> ./gradlew --no-daemon --info -PeclipseLink=true -PeclipseLinkDeps=com.h2database:h2:2.3.232 clean shadowJar -polaris> java -jar polaris-service/build/libs/polaris-service-*.jar server ./polaris-server.yml +polaris> java -jar polaris-service/dropwizard/build/libs/polaris-service-*.jar server ./polaris-server.yml ``` ### Postgres @@ -108,5 +108,5 @@ The following shows a sample configuration for integrating Polaris with Postgres To build Polaris with the necessary Postgres dependency and start the Polaris service, run the following: ```bash polaris> ./gradlew --no-daemon --info -PeclipseLink=true -PeclipseLinkDeps=org.postgresql:postgresql:42.7.4 clean shadowJar -polaris> java -jar polaris-service/build/libs/polaris-service-*.jar server ./polaris-server.yml +polaris> java -jar polaris-service/dropwizard/build/libs/polaris-service-*.jar server ./polaris-server.yml ``` \ No newline at end of file