Skip to content

Commit

Permalink
Move JPA types to separate module (#500)
Browse files Browse the repository at this point in the history
`polaris-core` should be rather generic and not depend on JPA per se, so moving the types to a new module + package.
  • Loading branch information
snazy authored Nov 29, 2024
1 parent a6197bd commit aee3a02
Show file tree
Hide file tree
Showing 18 changed files with 79 additions and 49 deletions.
1 change: 1 addition & 0 deletions extension/persistence/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ plugins {

dependencies {
implementation(project(":polaris-core"))
implementation(project(":polaris-jpa-model"))
implementation(libs.eclipselink)
implementation(platform(libs.dropwizard.bom))
implementation("io.dropwizard:dropwizard-jackson")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
import org.apache.polaris.core.persistence.PolarisMetaStoreSession;
import org.apache.polaris.core.persistence.PrincipalSecretsGenerator;
import org.apache.polaris.core.persistence.RetryOnConcurrencyException;
import org.apache.polaris.core.persistence.models.ModelEntity;
import org.apache.polaris.core.persistence.models.ModelEntityActive;
import org.apache.polaris.core.persistence.models.ModelEntityChangeTracking;
import org.apache.polaris.core.persistence.models.ModelGrantRecord;
import org.apache.polaris.core.persistence.models.ModelPrincipalSecrets;
import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo;
import org.apache.polaris.core.storage.PolarisStorageIntegration;
import org.apache.polaris.core.storage.PolarisStorageIntegrationProvider;
import org.apache.polaris.jpa.models.ModelEntity;
import org.apache.polaris.jpa.models.ModelEntityActive;
import org.apache.polaris.jpa.models.ModelEntityChangeTracking;
import org.apache.polaris.jpa.models.ModelGrantRecord;
import org.apache.polaris.jpa.models.ModelPrincipalSecrets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
import org.apache.polaris.core.entity.PolarisEntityType;
import org.apache.polaris.core.entity.PolarisGrantRecord;
import org.apache.polaris.core.entity.PolarisPrincipalSecrets;
import org.apache.polaris.core.persistence.models.ModelEntity;
import org.apache.polaris.core.persistence.models.ModelEntityActive;
import org.apache.polaris.core.persistence.models.ModelEntityChangeTracking;
import org.apache.polaris.core.persistence.models.ModelEntityDropped;
import org.apache.polaris.core.persistence.models.ModelGrantRecord;
import org.apache.polaris.core.persistence.models.ModelPrincipalSecrets;
import org.apache.polaris.jpa.models.ModelEntity;
import org.apache.polaris.jpa.models.ModelEntityActive;
import org.apache.polaris.jpa.models.ModelEntityChangeTracking;
import org.apache.polaris.jpa.models.ModelEntityDropped;
import org.apache.polaris.jpa.models.ModelGrantRecord;
import org.apache.polaris.jpa.models.ModelPrincipalSecrets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import jakarta.persistence.*;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.polaris.core.persistence.models.ModelSequenceId;
import org.apache.polaris.jpa.models.ModelSequenceId;
import org.eclipse.persistence.internal.jpa.EntityManagerImpl;
import org.eclipse.persistence.platform.database.DatabasePlatform;
import org.eclipse.persistence.platform.database.PostgreSQLPlatform;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@

<persistence-unit name="polaris" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.apache.polaris.core.persistence.models.ModelEntity</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityActive</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityDropped</class>
<class>org.apache.polaris.core.persistence.models.ModelGrantRecord</class>
<class>org.apache.polaris.core.persistence.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.core.persistence.models.ModelSequenceId</class>
<class>org.apache.polaris.jpa.models.ModelEntity</class>
<class>org.apache.polaris.jpa.models.ModelEntityActive</class>
<class>org.apache.polaris.jpa.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.jpa.models.ModelEntityDropped</class>
<class>org.apache.polaris.jpa.models.ModelGrantRecord</class>
<class>org.apache.polaris.jpa.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.jpa.models.ModelSequenceId</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="jakarta.persistence.jdbc.url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.polaris.core.persistence.BasePolarisMetaStoreManagerTest;
import org.apache.polaris.core.persistence.PolarisMetaStoreManagerImpl;
import org.apache.polaris.core.persistence.PolarisTestMetaStoreManager;
import org.apache.polaris.core.persistence.models.ModelPrincipalSecrets;
import org.apache.polaris.jpa.models.ModelPrincipalSecrets;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtensionContext;
Expand Down
29 changes: 29 additions & 0 deletions extension/persistence/jpa-model/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.
*/

plugins {
id("java-library")
}

dependencies {
implementation(project(":polaris-core"))
compileOnly(libs.jakarta.validation.api)
compileOnly(libs.jakarta.annotation.api)
compileOnly(libs.jakarta.persistence.api)
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.core.persistence.models;
package org.apache.polaris.jpa.models;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand Down
1 change: 1 addition & 0 deletions gradle/projects.main.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
polaris-core=polaris-core
polaris-service=polaris-service
polaris-eclipselink=extension/persistence/eclipselink
polaris-jpa-model=extension/persistence/jpa-model
aggregated-license-report=aggregated-license-report
14 changes: 7 additions & 7 deletions helm/polaris/ci/fixtures/persistence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ stringData:
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="polaris" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.apache.polaris.core.persistence.models.ModelEntity</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityActive</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityDropped</class>
<class>org.apache.polaris.core.persistence.models.ModelGrantRecord</class>
<class>org.apache.polaris.core.persistence.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.core.persistence.models.ModelSequenceId</class>
<class>org.apache.polaris.jpa.models.ModelEntity</class>
<class>org.apache.polaris.jpa.models.ModelEntityActive</class>
<class>org.apache.polaris.jpa.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.jpa.models.ModelEntityDropped</class>
<class>org.apache.polaris.jpa.models.ModelGrantRecord</class>
<class>org.apache.polaris.jpa.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.jpa.models.ModelSequenceId</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="jakarta.persistence.jdbc.url" value="jdbc:h2:mem:polaris-{realm}"/>
Expand Down
1 change: 0 additions & 1 deletion polaris-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ dependencies {
testFixturesApi(libs.jakarta.annotation.api)

compileOnly(libs.jakarta.annotation.api)
compileOnly(libs.jakarta.persistence.api)
}

openApiValidate { inputSpec = "$rootDir/spec/polaris-management-service.yml" }
Expand Down
28 changes: 14 additions & 14 deletions site/content/in-dev/unreleased/metastores.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ Polaris creates and connects to a separate database for each realm. Specifically
```xml
<persistence-unit name="polaris" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.apache.polaris.core.persistence.models.ModelEntity</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityActive</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityDropped</class>
<class>org.apache.polaris.core.persistence.models.ModelGrantRecord</class>
<class>org.apache.polaris.core.persistence.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.core.persistence.models.ModelSequenceId</class>
<class>org.apache.polaris.jpa.models.ModelEntity</class>
<class>org.apache.polaris.jpa.models.ModelEntityActive</class>
<class>org.apache.polaris.jpa.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.jpa.models.ModelEntityDropped</class>
<class>org.apache.polaris.jpa.models.ModelGrantRecord</class>
<class>org.apache.polaris.jpa.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.jpa.models.ModelSequenceId</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="jakarta.persistence.jdbc.url"
Expand All @@ -86,13 +86,13 @@ The following shows a sample configuration for integrating Polaris with Postgres
```xml
<persistence-unit name="polaris" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.apache.polaris.core.persistence.models.ModelEntity</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityActive</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.core.persistence.models.ModelEntityDropped</class>
<class>org.apache.polaris.core.persistence.models.ModelGrantRecord</class>
<class>org.apache.polaris.core.persistence.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.core.persistence.models.ModelSequenceId</class>
<class>org.apache.polaris.jpa.models.ModelEntity</class>
<class>org.apache.polaris.jpa.models.ModelEntityActive</class>
<class>org.apache.polaris.jpa.models.ModelEntityChangeTracking</class>
<class>org.apache.polaris.jpa.models.ModelEntityDropped</class>
<class>org.apache.polaris.jpa.models.ModelGrantRecord</class>
<class>org.apache.polaris.jpa.models.ModelPrincipalSecrets</class>
<class>org.apache.polaris.jpa.models.ModelSequenceId</class>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="jakarta.persistence.jdbc.url"
Expand Down

0 comments on commit aee3a02

Please sign in to comment.