From 046ec90324dd69123725dc8c3eb808f9cb7601e4 Mon Sep 17 00:00:00 2001 From: Antonio Perez Dieppa Date: Sat, 21 Mar 2026 20:30:00 +0800 Subject: [PATCH] refactor: extract flamingock-core-api out to independent repo --- .github/workflows/license-check.yml | 4 +- .github/workflows/release.yml | 14 -- build.gradle.kts | 5 +- .../flamingock.project-structure.gradle.kts | 1 - cloud/flamingock-cloud/build.gradle.kts | 3 +- .../flamingock-community/build.gradle.kts | 3 +- core/flamingock-core-api/build.gradle.kts | 19 --- .../io/flamingock/api/NonLockGuardedType.java | 34 ----- .../io/flamingock/api/RecoveryStrategy.java | 47 ------- .../java/io/flamingock/api/StageType.java | 44 ------ .../io/flamingock/api/annotations/Apply.java | 56 -------- .../io/flamingock/api/annotations/Change.java | 80 ----------- .../api/annotations/EnableFlamingock.java | 131 ------------------ .../api/annotations/FlamingockCliBuilder.java | 67 --------- .../annotations/FlamingockConstructor.java | 26 ---- .../api/annotations/NonLockGuarded.java | 42 ------ .../flamingock/api/annotations/Nullable.java | 29 ---- .../flamingock/api/annotations/Recovery.java | 70 ---------- .../flamingock/api/annotations/Rollback.java | 62 --------- .../io/flamingock/api/annotations/Stage.java | 52 ------- .../api/annotations/TargetSystem.java | 64 --------- .../api/external/ExternalSystem.java | 21 --- .../flamingock/api/external/TargetSystem.java | 20 --- core/flamingock-core-commons/build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../sql-external-system-api/build.gradle.kts | 3 +- legacy/mongock-support/build.gradle.kts | 3 +- settings.gradle.kts | 3 - 30 files changed, 21 insertions(+), 894 deletions(-) delete mode 100644 core/flamingock-core-api/build.gradle.kts delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/NonLockGuardedType.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/RecoveryStrategy.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/StageType.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Apply.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Change.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/EnableFlamingock.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockCliBuilder.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockConstructor.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/NonLockGuarded.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Nullable.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Recovery.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Rollback.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Stage.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/TargetSystem.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/external/ExternalSystem.java delete mode 100644 core/flamingock-core-api/src/main/java/io/flamingock/api/external/TargetSystem.java diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml index 097a543a9..574cc2c98 100644 --- a/.github/workflows/license-check.yml +++ b/.github/workflows/license-check.yml @@ -2,9 +2,9 @@ name: License Header Check on: pull_request: - branches: [ master, develop ] + branches: [ master, release/* ] push: - branches: [ master, develop ] + branches: [ master, release/* ] jobs: license-check: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index edcf95c5f..726b391b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,19 +44,6 @@ jobs: FLAMINGOCK_JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }} FLAMINGOCK_JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }} - flamingock-core-api: - needs: [ build ] - uses: ./.github/workflows/module-release-graalvm.yml - with: - module: flamingock-core-api - secrets: - FLAMINGOCK_JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }} - FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }} - FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }} - FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }} - FLAMINGOCK_JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }} - FLAMINGOCK_JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }} - flamingock-core-commons: needs: [ build ] uses: ./.github/workflows/module-release-graalvm.yml @@ -530,7 +517,6 @@ jobs: needs: [ flamingock-core, flamingock-core-commons, - flamingock-core-api, flamingock-processor, flamingock-graalvm, flamingock-cloud, diff --git a/build.gradle.kts b/build.gradle.kts index c4490b3ba..8606ac4da 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,8 +18,9 @@ allprojects { group = "io.flamingock" version = "1.2.0-beta.3" - extra["templateApiVersion"] = "1.3.0" - extra["generalUtilVersion"] = "1.3.0" + extra["templateApiVersion"] = "1.3.1" + extra["generalUtilVersion"] = "1.5.0" + extra["coreApiVersion"] = "1.3.0" repositories { mavenLocal() diff --git a/buildSrc/src/main/kotlin/flamingock.project-structure.gradle.kts b/buildSrc/src/main/kotlin/flamingock.project-structure.gradle.kts index d110bc4d6..ca15eaae0 100644 --- a/buildSrc/src/main/kotlin/flamingock.project-structure.gradle.kts +++ b/buildSrc/src/main/kotlin/flamingock.project-structure.gradle.kts @@ -7,7 +7,6 @@ val coreProjects = setOf( "flamingock-core", "flamingock-core-commons", - "flamingock-core-api", "flamingock-processor", "flamingock-graalvm", "flamingock-test-support" diff --git a/cloud/flamingock-cloud/build.gradle.kts b/cloud/flamingock-cloud/build.gradle.kts index 53bf844e3..5b8c7ed6c 100644 --- a/cloud/flamingock-cloud/build.gradle.kts +++ b/cloud/flamingock-cloud/build.gradle.kts @@ -1,7 +1,8 @@ +val coreApiVersion: String by extra dependencies { // Core implementation(project(":core:flamingock-core")) - api(project(":core:flamingock-core-api")) + api("io.flamingock:flamingock-core-api:${coreApiVersion}") // target systems api(project(":core:target-systems:nontransactional-target-system")) api(project(":core:target-systems:couchbase-target-system")) diff --git a/community/flamingock-community/build.gradle.kts b/community/flamingock-community/build.gradle.kts index de7b1aa50..8bf75ed16 100644 --- a/community/flamingock-community/build.gradle.kts +++ b/community/flamingock-community/build.gradle.kts @@ -1,7 +1,8 @@ +val coreApiVersion: String by extra dependencies { // Core api(project(":core:flamingock-core")) - api(project(":core:flamingock-core-api")) + api("io.flamingock:flamingock-core-api:${coreApiVersion}") // target systems api(project(":core:target-systems:nontransactional-target-system")) api(project(":core:target-systems:couchbase-target-system")) diff --git a/core/flamingock-core-api/build.gradle.kts b/core/flamingock-core-api/build.gradle.kts deleted file mode 100644 index 65e44df30..000000000 --- a/core/flamingock-core-api/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -val jacksonVersion = "2.16.0" -val templateApiVersion: String by extra -val generalUtilVersion: String by extra -dependencies { - api("io.flamingock:flamingock-template-api:${templateApiVersion}") - implementation("io.flamingock:flamingock-general-util:${generalUtilVersion}") - api("jakarta.annotation:jakarta.annotation-api:2.1.1")//todo can this be implementation? - - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") -} - -description = "Public API annotations and interfaces for defining changes, stages, and templates" - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - } -} \ No newline at end of file diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/NonLockGuardedType.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/NonLockGuardedType.java deleted file mode 100644 index d630174fe..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/NonLockGuardedType.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api; - -public enum NonLockGuardedType { - /** - * Indicates the returned object shouldn't be decorated for lock guard. So clean instance is returned. - * But still the method needs to bbe lock-guarded - */ - RETURN, - - /** - * Indicates the method shouldn't be lock-guarded, but still should decorate the returned object(if applies) - */ - METHOD, - - /** - * Indicates the method shouldn't be lock-guarded neither the returned object should be decorated for lock guard. - */ - NONE -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/RecoveryStrategy.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/RecoveryStrategy.java deleted file mode 100644 index e2569c8b3..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/RecoveryStrategy.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api; - -/** - * Defines how Flamingock handles change execution failures. - * Determines whether failed changes should be automatically retried - * or require manual intervention before proceeding. - * - * @see io.flamingock.api.annotations.Recovery - * @see io.flamingock.api.annotations.Change - */ -public enum RecoveryStrategy { - /** - * Automatically retry the change on subsequent runs until successful. - * Use for idempotent operations with transient failure modes. - */ - ALWAYS_RETRY, - - /** - * Require manual intervention before retrying. - * Use for critical operations where failures need investigation. - */ - MANUAL_INTERVENTION; - - /** - * Checks if this strategy allows automatic retries. - * - * @return {@code true} if automatic retry is enabled - */ - public boolean isAlwaysRetry() { - return this == ALWAYS_RETRY; - } -} \ No newline at end of file diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/StageType.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/StageType.java deleted file mode 100644 index bf64b6039..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/StageType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api; - -public enum StageType { - DEFAULT, - LEGACY("legacy"), - SYSTEM("importer"); - - private final String alias; - - StageType(String alias) { - this.alias = alias; - } - - StageType() { - this.alias = null; - } - - public static StageType from(String name) { - if (name == null || name.isEmpty()) { - return DEFAULT; - } - for (StageType stageType : StageType.values()) { - if (name.equals(stageType.alias)) { - return stageType; - } - } - throw new IllegalArgumentException("No such stage type: " + name); - } -} \ No newline at end of file diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Apply.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Apply.java deleted file mode 100644 index 07d15fd55..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Apply.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks the method that applies a change to the target system. - * This method contains the forward migration logic that evolves your system state. - * - *

The method can accept dependency-injected parameters from the Flamingock context, - * including database connections, repositories, and custom dependencies. - * - *

Example usage: - *

{@code
- * @Change(id = "add-user-email-index", order = "2024-11-15-002", author = "team@example.com")
- * public class AddUserEmailIndex {
- *
- *     @Apply
- *     public void addIndex(MongoDatabase database) {
- *         database.getCollection("users")
- *                 .createIndex(Indexes.ascending("email"));
- *     }
- *
- *     @Rollback
- *     public void removeIndex(MongoDatabase database) {
- *         database.getCollection("users")
- *                 .dropIndex("email_1");
- *     }
- * }
- * }
- * - * @see Change - * @see Rollback - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Apply { - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Change.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Change.java deleted file mode 100644 index 7c511ea1e..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Change.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -/** - * Marks a class as a change that encapsulates a system evolution operation. - * Each change represents an atomic, versioned modification to your distributed system. - * - *

Example usage: - *

{@code
- * @Change(id = "create-user-index", order = "2024-11-15-001", author = "john.doe")
- * public class CreateUserIndexChange {
- *     @Apply
- *     public void createIndex(MongoDatabase db) {
- *         // Implementation
- *     }
- * }
- * }
- * - * @see Apply - * @see Rollback - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Change { - - /** - * Unique identifier for this change. Must be globally unique across all changes. - * Typically, follows a kebab-case naming convention describing the operation. - * - * @return the unique change identifier - */ - String id(); - -// /** -// * Execution order for this change. Changes are applied in lexicographical order. -// * Minimum 4 characters required. Recommended format: date-based with index (e.g., "2024-05-19-001"). -// * This format provides optimal sorting, clarity, and sequential indexing within the same day. -// * Alternative formats like zero-padded numbers ("0001", "0002") are also supported. -// * -// * @return the execution order string -// */ -// String order() default "NULL_VALUE"; - - /** - * Author of this change. Required for audit trail and accountability. - * Typically, an email, username, or team identifier. - * - * @return the change author identifier - */ - String author(); - - /** - * Whether this change should run within a transaction if supported by the target system. - * Set to {@code false} for operations that cannot be transactional (e.g., DDL in some databases). - * - * @return {@code true} if transactional execution is required, {@code false} otherwise - */ - boolean transactional() default true; - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/EnableFlamingock.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/EnableFlamingock.java deleted file mode 100644 index f10058051..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/EnableFlamingock.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Core annotation for configuring Flamingock pipeline execution. - * This annotation must be placed on a class to enable Flamingock processing and define - * how the pipeline should be configured. - * - *

Pipeline Configuration

- * - * The annotation supports two mutually exclusive pipeline configuration modes: - * - *

1. File-based Configuration

- * Use {@link #configFile()} to reference a YAML pipeline definition: - *
- * @EnableFlamingock(configFile = "config/pipeline.yaml")
- * public class MyMigrationConfig {
- *     // Configuration class
- * }
- * 
- * - *

2. Annotation-based Configuration

- * Use {@link #stages()} to define the pipeline inline: - *
- * @EnableFlamingock(
- *     stages = {
- *         @Stage(type = StageType.SYSTEM, location = "com.example.system"),
- *         @Stage(type = StageType.LEGACY, location = "com.example.init"),
- *         @Stage(location = "com.example.migrations")
- *     }
- * )
- * public class MyMigrationConfig {
- *     // Configuration class
- * }
- * 
- * - *

Validation Rules

- * - * - * @since 1.0 - * @see Stage - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface EnableFlamingock { - - - /** - * Defines the pipeline stages. - * Each stage represents a logical grouping of changes that execute in sequence. - * - *

Mutually exclusive with {@link #configFile()}. When using stages, - * do not specify a pipeline file. - * - *

Stage type restrictions: - *

- * - *

Example: - *

-     * stages = {
-     *     @Stage(type = StageType.SYSTEM, location = "com.example.system"),
-     *     @Stage(type = StageType.LEGACY, location = "com.example.init"),
-     *     @Stage(type = StageType.DEFAULT, location = "com.example.changes")
-     * }
-     * 
- * - * @return array of stage configurations - * @see Stage - */ - Stage[] stages() default {}; - - /** - * Specifies the path to a YAML pipeline configuration file for file-based configuration. - * The file path supports both absolute paths and classpath resources. - * - *

Mutually exclusive with {@link #stages()}. When using a pipeline file, - * do not specify stages in the annotation. - * - *

File resolution order: - *

    - *
  1. Direct file path (absolute or relative to working directory)
  2. - *
  3. Classpath resource in {@code src/main/resources/}
  4. - *
  5. Classpath resource in {@code src/test/resources/}
  6. - *
- * - *

Example: - *

-     * configFile = "config/flamingock-pipeline.yaml"
-     * 
- * - * @return the pipeline file path, or empty string for annotation-based configuration - */ - String configFile() default ""; - - /** - * If true, the annotation processor will validate that all code-based changes - * (classes annotated with @Change) are mapped to some stage. When unmapped changes - * are found and this flag is true**(default)**, a RuntimeException is thrown at compilation time. - * When false, only a warning is emitted. - */ - boolean strictStageMapping() default true; - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockCliBuilder.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockCliBuilder.java deleted file mode 100644 index 33012cdd5..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockCliBuilder.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks a static method that provides a configured Flamingock builder for CLI execution. - * - *

The annotated method must: - *

- * - *

Example without arguments: - *

- * @FlamingockCliBuilder
- * public static AbstractChangeRunnerBuilder flamingockBuilder() {
- *     return Flamingock.builder()
- *         .setAuditStore(auditStore)
- *         .addTargetSystem(targetSystem);
- * }
- * 
- * - *

Example with arguments (for configuration based on CLI args): - *

- * @FlamingockCliBuilder
- * public static AbstractChangeRunnerBuilder flamingockBuilder(String[] args) {
- *     // args can be used during builder configuration
- *     return Flamingock.builder()
- *         .setAuditStore(auditStore)
- *         .addTargetSystem(targetSystem);
- * }
- * 
- * - *

The CLI will invoke this method to get the builder, add CLI arguments - * via {@code setApplicationArguments(args)}, build, and run the Flamingock pipeline. - * - *

Note: When using the {@code String[] args} parameter, you can access - * the arguments during builder creation. The CLI will still call - * {@code setApplicationArguments(args)} after your method returns, ensuring - * Flamingock's internal argument parsing always occurs. - * - * @since 1.1.0 - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface FlamingockCliBuilder { -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockConstructor.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockConstructor.java deleted file mode 100644 index f96186220..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/FlamingockConstructor.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.CONSTRUCTOR) -@Retention(RetentionPolicy.RUNTIME) -public @interface FlamingockConstructor { -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/NonLockGuarded.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/NonLockGuarded.java deleted file mode 100644 index 1588a33a6..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/NonLockGuarded.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - - -import io.flamingock.api.NonLockGuardedType; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER}) -@Retention(RetentionPolicy.RUNTIME) -public @interface NonLockGuarded { - - - /** - *

Indicates the grade of non-lock-guard applied to a method. - * Does not have any effect at class level. - *

- * - * @return value - */ - NonLockGuardedType[] value() default {NonLockGuardedType.METHOD, NonLockGuardedType.RETURN}; - - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Nullable.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Nullable.java deleted file mode 100644 index fd86d6b84..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Nullable.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -@Target({ElementType.PARAMETER}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Nullable { - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Recovery.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Recovery.java deleted file mode 100644 index 618cd1fc6..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Recovery.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import io.flamingock.api.RecoveryStrategy; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Configures the recovery behavior for a change when execution fails. - * Determines whether Flamingock should automatically retry or require manual intervention. - * - *

Recovery strategies help maintain system consistency during failures by defining - * clear policies for handling transient vs. permanent errors. - * - *

Example usage: - *

{@code
- * @Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
- * @Change(id = "populate-cache", order = "2024-11-18-001", author = "cache-team")
- * public class PopulateCacheChange {
- *     @Apply
- *     public void populateCache(CacheManager cache, ExternalAPI api) {
- *         // Might fail due to transient network issues - safe to retry
- *         cache.put("data", api.fetchData());
- *     }
- * }
- *
- * @Recovery(strategy = RecoveryStrategy.MANUAL_INTERVENTION)
- * @Change(id = "critical-data-migration", order = "2024-11-18-002", author = "data-team")
- * public class CriticalDataMigration {
- *     @Apply
- *     public void migrateData(Database db) {
- *         // Complex migration requiring human verification on failure
- *         db.executeMigration();
- *     }
- * }
- * }
- * - * @see Change - * @see RecoveryStrategy - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Recovery { - - /** - * The recovery strategy to apply when this change fails. - * Defaults to {@link RecoveryStrategy#MANUAL_INTERVENTION} for safety. - * - * @return the recovery strategy - */ - RecoveryStrategy strategy() default RecoveryStrategy.MANUAL_INTERVENTION; - -} \ No newline at end of file diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Rollback.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Rollback.java deleted file mode 100644 index 546f8cbb5..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Rollback.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks the method that rolls back a change in case of failure or manual reversion. - * This method should undo the operations performed by the corresponding {@link Apply} method. - * - *

Rollback methods are optional but recommended for production systems to ensure - * safe change reversibility. They receive the same dependency injection as Apply methods. - * - *

Example usage: - *

{@code
- * @Change(id = "migrate-user-schema", order = "2024-11-16-001", author = "ops-team")
- * public class MigrateUserSchema {
- *
- *     @Apply
- *     public void migrateSchema(MongoDatabase db) {
- *         // Add new field and migrate data
- *         db.getCollection("users").updateMany(
- *             new Document(),
- *             Updates.set("createdAt", new Date())
- *         );
- *     }
- *
- *     @Rollback
- *     public void revertSchema(MongoDatabase db) {
- *         // Remove the added field
- *         db.getCollection("users").updateMany(
- *             new Document(),
- *             Updates.unset("createdAt")
- *         );
- *     }
- * }
- * }
- * - * @see Change - * @see Apply - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Rollback { - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Stage.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Stage.java deleted file mode 100644 index b2cdc47eb..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/Stage.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -public @interface Stage { - /** - * Specifies the location where changes are found. This field is mandatory. - * - *

The location format determines how it's interpreted: - *

- * - * @return the location where changes are found (mandatory) - */ - String location(); - - /** - * The name of the stage. If not specified, the name will be automatically derived from the location. - * - *

Name derivation rules: - *

- * - * @return the stage name, or empty string for auto-derived name - */ - String name() default ""; - - String description() default ""; - -} \ No newline at end of file diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/TargetSystem.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/TargetSystem.java deleted file mode 100644 index fdf536daf..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/TargetSystem.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2023 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Associates a change class with a specific target system or subsystem. - * Use this when managing multiple systems (databases, message queues, etc.) within the same pipeline. - * - *

Target systems allow fine-grained control over which changes apply to which components - * of your distributed architecture, enabling selective execution and rollback. - * - *

Example usage: - *

{@code
- * @TargetSystem(id = "user-database")
- * @Change(id = "add-user-preferences", order = "2024-11-17-001", author = "backend-team")
- * public class AddUserPreferences {
- *     @Apply
- *     public void addPreferencesTable(Connection conn) {
- *         // Create preferences table in user database
- *     }
- * }
- *
- * @TargetSystem(id = "analytics-database")
- * @Change(id = "create-metrics-view", order = "2024-11-17-002", author = "analytics-team")
- * public class CreateMetricsView {
- *     @Apply
- *     public void createView(Connection conn) {
- *         // Create materialized view in analytics database
- *     }
- * }
- * }
- * - * @see Change - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface TargetSystem { - - /** - * Identifier for the target system this change applies to. - * Must match a system configured in your Flamingock setup. - * - * @return the target system identifier - */ - String id(); -} \ No newline at end of file diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/external/ExternalSystem.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/external/ExternalSystem.java deleted file mode 100644 index 0d588b560..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/external/ExternalSystem.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2026 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.external; - -public interface ExternalSystem { - String getId(); - -} diff --git a/core/flamingock-core-api/src/main/java/io/flamingock/api/external/TargetSystem.java b/core/flamingock-core-api/src/main/java/io/flamingock/api/external/TargetSystem.java deleted file mode 100644 index 85c9fa771..000000000 --- a/core/flamingock-core-api/src/main/java/io/flamingock/api/external/TargetSystem.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2025 Flamingock (https://www.flamingock.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.flamingock.api.external; - - -public interface TargetSystem extends ExternalSystem { -} diff --git a/core/flamingock-core-commons/build.gradle.kts b/core/flamingock-core-commons/build.gradle.kts index 7d1ef14c8..355b3feb3 100644 --- a/core/flamingock-core-commons/build.gradle.kts +++ b/core/flamingock-core-commons/build.gradle.kts @@ -1,7 +1,8 @@ val jacksonVersion = "2.16.0" val generalUtilVersion: String by extra +val coreApiVersion: String by extra dependencies { - api(project(":core:flamingock-core-api")) + api("io.flamingock:flamingock-core-api:${coreApiVersion}") api("io.flamingock:flamingock-general-util:${generalUtilVersion}")//todo implementation api("jakarta.annotation:jakarta.annotation-api:2.1.1")//todo can this be implementation? diff --git a/core/target-systems/couchbase-external-system-api/build.gradle.kts b/core/target-systems/couchbase-external-system-api/build.gradle.kts index a86c664e2..827c0ae61 100644 --- a/core/target-systems/couchbase-external-system-api/build.gradle.kts +++ b/core/target-systems/couchbase-external-system-api/build.gradle.kts @@ -1,5 +1,6 @@ +val coreApiVersion: String by extra dependencies { - implementation(project(":core:flamingock-core-api")) + implementation("io.flamingock:flamingock-core-api:${coreApiVersion}") //General compileOnly("com.couchbase.client:java-client:3.6.0") diff --git a/core/target-systems/dynamodb-external-system-api/build.gradle.kts b/core/target-systems/dynamodb-external-system-api/build.gradle.kts index de080713d..1e99c314d 100644 --- a/core/target-systems/dynamodb-external-system-api/build.gradle.kts +++ b/core/target-systems/dynamodb-external-system-api/build.gradle.kts @@ -1,5 +1,6 @@ +val coreApiVersion: String by extra dependencies { - implementation(project(":core:flamingock-core-api")) + implementation("io.flamingock:flamingock-core-api:${coreApiVersion}") //General compileOnly("software.amazon.awssdk:dynamodb-enhanced:2.25.29") diff --git a/core/target-systems/mongodb-external-system-api/build.gradle.kts b/core/target-systems/mongodb-external-system-api/build.gradle.kts index d919696a9..9937d7fbe 100644 --- a/core/target-systems/mongodb-external-system-api/build.gradle.kts +++ b/core/target-systems/mongodb-external-system-api/build.gradle.kts @@ -1,5 +1,6 @@ +val coreApiVersion: String by extra dependencies { - implementation(project(":core:flamingock-core-api")) + implementation("io.flamingock:flamingock-core-api:${coreApiVersion}") // MongoDB driver for storage implementations compileOnly("org.mongodb:mongodb-driver-sync:4.0.0") diff --git a/core/target-systems/sql-external-system-api/build.gradle.kts b/core/target-systems/sql-external-system-api/build.gradle.kts index a27ac301b..cdce66c77 100644 --- a/core/target-systems/sql-external-system-api/build.gradle.kts +++ b/core/target-systems/sql-external-system-api/build.gradle.kts @@ -1,5 +1,6 @@ +val coreApiVersion: String by extra dependencies { - implementation(project(":core:flamingock-core-api")) + implementation("io.flamingock:flamingock-core-api:${coreApiVersion}") implementation(project(":utils:sql-util")) //General diff --git a/legacy/mongock-support/build.gradle.kts b/legacy/mongock-support/build.gradle.kts index db20e408c..808216221 100644 --- a/legacy/mongock-support/build.gradle.kts +++ b/legacy/mongock-support/build.gradle.kts @@ -1,6 +1,7 @@ +val coreApiVersion: String by extra dependencies { api(project(":core:flamingock-core"))//todo implementation - api(project(":core:flamingock-core-api"))//todo remove. This should be imported by core + api("io.flamingock:flamingock-core-api:${coreApiVersion}")//todo remove. This should be imported by core } description = "Provides a compatibility layer for Mongock-based applications, including drop-in annotations and audit store migration utilities to Flamingock." diff --git a/settings.gradle.kts b/settings.gradle.kts index e74205ae5..6888f68b0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,9 +23,6 @@ project(":core:flamingock-core-commons").projectDir = file("core/flamingock-core -include("core:flamingock-core-api") -project(":core:flamingock-core-api").name = "flamingock-core-api" -project(":core:flamingock-core-api").projectDir = file("core/flamingock-core-api") include("core:flamingock-test-support") project(":core:flamingock-test-support").name = "flamingock-test-support"