Skip to content

Commit

Permalink
Remove Liquibase as a dependency for managing the db schema for sever…
Browse files Browse the repository at this point in the history
…al engines (#3923)

* Removed Liquibase dependency and use manual SQL files
---------

Co-authored-by: Filip Hrisafov <[email protected]>
  • Loading branch information
tijsrademakers and filiphr committed Jul 15, 2024
1 parent ba411f3 commit 27ac566
Show file tree
Hide file tree
Showing 1,382 changed files with 12,346 additions and 13,538 deletions.
1 change: 0 additions & 1 deletion distro/src/notice.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ org.apache.geronimo.bundles json 20090211_1 The
org.apache.groovy groovy 4.0.17 The Apache Software License, Version 2.0
org.apache.groovy groovy-jsr223 4.0.17 The Apache Software License, Version 2.0
org.eclipse.angus angus-mail 2.0.2 EDL 1.0 / EPL 2.0
org.liquibase liquibase-core 4.5.0 Apache License, Version 2.0
org.mybatis mybatis 3.5.13 The Apache Software License, Version 2.0
org.mybatis mybatis-spring 3.0.3 The Apache Software License, Version 2.0
org.mvel mvel2 2.2.6.Final The Apache Software License, Version 2.0
Expand Down
4 changes: 4 additions & 0 deletions modules/flowable-app-engine-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<groupId>org.flowable</groupId>
<artifactId>flowable-engine-common-api</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-engine-common</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-variable-service-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.Collection;
import java.util.Map;

import org.flowable.common.engine.api.lock.LockManager;

/**
* @author Tijs Rademakers
*/
Expand All @@ -30,4 +32,15 @@ public interface AppManagementService {
*/
Collection<String> getTableNames();

/**
* Acquire a lock manager for the requested lock.
* This is a stateless call, this means that every time a lock manager
* is requested a new one would be created. Make sure that you release the lock
* once you are done.
*
* @param lockName the name of the lock that is being requested
*
* @return the lock manager for the given lock
*/
LockManager getLockManager(String lockName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,7 @@ protected void assertAndEnsureCleanDb() throws Throwable {
appEngineConfiguration,
TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK,
exception == null,
new Command<Void>() {
@Override
public Void execute(CommandContext commandContext) {
SchemaManager schemaManager = CommandContextUtil.getAppEngineConfiguration(commandContext).getSchemaManager();
schemaManager.schemaDrop();
schemaManager.schemaCreate();
return null;
}
}
appEngineConfiguration.getSchemaManagementCmd()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public SpringAppEngineConfiguration() {
}

@Override
public AppEngine buildAppEngine() {
AppEngine appEngine = super.buildAppEngine();
public AppEngine buildEngine() {
AppEngine appEngine = super.buildEngine();
AppEngines.setInitialized(true);
enginesBuild.add(appEngine.getName());
return appEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.flowable.app.api.repository.AppDeploymentBuilder;
import org.flowable.app.engine.AppEngine;
import org.flowable.common.engine.impl.lock.LockManager;
import org.flowable.common.engine.api.lock.LockManager;
import org.flowable.common.spring.CommonAutoDeploymentProperties;
import org.flowable.common.spring.CommonAutoDeploymentStrategy;
import org.springframework.core.io.Resource;
Expand Down
4 changes: 0 additions & 4 deletions modules/flowable-app-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@
<groupId>org.flowable</groupId>
<artifactId>flowable-identitylink-service</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import org.flowable.app.api.AppRepositoryService;
import org.flowable.app.api.repository.AppResourceConverter;
import org.flowable.app.engine.impl.AppEngineImpl;
import org.flowable.app.engine.impl.AppEnginePostEngineBuildConsumer;
import org.flowable.app.engine.impl.AppManagementServiceImpl;
import org.flowable.app.engine.impl.AppRepositoryServiceImpl;
import org.flowable.app.engine.impl.cfg.StandaloneInMemAppEngineConfiguration;
import org.flowable.app.engine.impl.cmd.SchemaOperationsAppEngineBuild;
import org.flowable.app.engine.impl.db.AppDbSchemaManager;
import org.flowable.app.engine.impl.db.EntityDependencyOrder;
import org.flowable.app.engine.impl.deployer.AppDeployer;
Expand All @@ -52,6 +52,7 @@
import org.flowable.app.engine.impl.persistence.entity.data.impl.MybatisResourceDataManager;
import org.flowable.app.engine.impl.persistence.entity.deploy.AppDefinitionCacheEntry;
import org.flowable.common.engine.api.scope.ScopeTypes;
import org.flowable.common.engine.impl.AbstractBuildableEngineConfiguration;
import org.flowable.common.engine.impl.AbstractEngineConfiguration;
import org.flowable.common.engine.impl.EngineConfigurator;
import org.flowable.common.engine.impl.EngineDeployer;
Expand All @@ -73,15 +74,13 @@
import org.flowable.common.engine.impl.persistence.entity.TableDataManager;
import org.flowable.eventregistry.impl.configurator.EventRegistryEngineConfigurator;
import org.flowable.identitylink.service.IdentityLinkServiceConfiguration;
import org.flowable.identitylink.service.impl.db.IdentityLinkDbSchemaManager;
import org.flowable.idm.api.IdmEngineConfigurationApi;
import org.flowable.idm.api.IdmIdentityService;
import org.flowable.idm.engine.configurator.IdmEngineConfigurator;
import org.flowable.variable.api.types.VariableType;
import org.flowable.variable.api.types.VariableTypes;
import org.flowable.variable.service.VariableServiceConfiguration;
import org.flowable.variable.service.impl.db.IbatisVariableTypeHandler;
import org.flowable.variable.service.impl.db.VariableDbSchemaManager;
import org.flowable.variable.service.impl.types.BooleanType;
import org.flowable.variable.service.impl.types.ByteArrayType;
import org.flowable.variable.service.impl.types.DateType;
Expand All @@ -103,11 +102,10 @@
import org.flowable.variable.service.impl.types.StringType;
import org.flowable.variable.service.impl.types.UUIDType;

public class AppEngineConfiguration extends AbstractEngineConfiguration implements
public class AppEngineConfiguration extends AbstractBuildableEngineConfiguration<AppEngine> implements
AppEngineConfigurationApi, HasExpressionManagerEngineConfiguration, HasVariableTypes {

public static final String DEFAULT_MYBATIS_MAPPING_FILE = "org/flowable/app/db/mapping/mappings.xml";
public static final String LIQUIBASE_CHANGELOG_PREFIX = "ACT_APP_";

protected String appEngineName = AppEngines.NAME_DEFAULT;

Expand All @@ -124,8 +122,6 @@ public class AppEngineConfiguration extends AbstractEngineConfiguration implemen

protected boolean disableIdmEngine;
protected boolean disableEventRegistry;

protected boolean executeServiceSchemaManagers = true;

protected AppDeployer appDeployer;
protected AppDeploymentManager deploymentManager;
Expand All @@ -136,8 +132,6 @@ public class AppEngineConfiguration extends AbstractEngineConfiguration implemen

protected ExpressionManager expressionManager;
protected Collection<Consumer<ExpressionManager>> expressionManagerConfigurers;
protected SchemaManager identityLinkSchemaManager;
protected SchemaManager variableSchemaManager;

// Identitylink support
protected IdentityLinkServiceConfiguration identityLinkServiceConfiguration;
Expand Down Expand Up @@ -191,11 +185,21 @@ public static AppEngineConfiguration createStandaloneInMemAppEngineConfiguration
return new StandaloneInMemAppEngineConfiguration();
}

public AppEngine buildAppEngine() {
init();
@Override
protected AppEngine createEngine() {
return new AppEngineImpl(this);
}

@Override
protected Consumer<AppEngine> createPostEngineBuildConsumer() {
return new AppEnginePostEngineBuildConsumer();
}

public AppEngine buildAppEngine() {
return buildEngine();
}

@Override
protected void init() {
initEngineConfigurations();
initConfigurators();
Expand Down Expand Up @@ -241,40 +245,8 @@ protected void init() {
}

@Override
public void initSchemaManager() {
super.initSchemaManager();
initAppSchemaManager();

if (executeServiceSchemaManagers) {
initIdentityLinkSchemaManager();
initVariableSchemaManager();
}
}

public void initSchemaManagementCommand() {
if (schemaManagementCmd == null) {
if (usingRelationalDatabase && databaseSchemaUpdate != null) {
this.schemaManagementCmd = new SchemaOperationsAppEngineBuild();
}
}
}

protected void initAppSchemaManager() {
if (this.schemaManager == null) {
this.schemaManager = new AppDbSchemaManager();
}
}

protected void initVariableSchemaManager() {
if (this.variableSchemaManager == null) {
this.variableSchemaManager = new VariableDbSchemaManager();
}
}

protected void initIdentityLinkSchemaManager() {
if (this.identityLinkSchemaManager == null) {
this.identityLinkSchemaManager = new IdentityLinkDbSchemaManager();
}
protected SchemaManager createEngineSchemaManager() {
return new AppDbSchemaManager();
}

@Override
Expand Down Expand Up @@ -675,14 +647,6 @@ public AppEngineConfiguration setDataSource(DataSource dataSource) {
return this;
}

public boolean isExecuteServiceSchemaManagers() {
return executeServiceSchemaManagers;
}

public void setExecuteServiceSchemaManagers(boolean executeServiceSchemaManagers) {
this.executeServiceSchemaManagers = executeServiceSchemaManagers;
}

@Override
public ExpressionManager getExpressionManager() {
return expressionManager;
Expand All @@ -707,24 +671,6 @@ public AbstractEngineConfiguration addExpressionManagerConfigurer(Consumer<Expre
return this;
}

public SchemaManager getIdentityLinkSchemaManager() {
return identityLinkSchemaManager;
}

public AppEngineConfiguration setIdentityLinkSchemaManager(SchemaManager identityLinkSchemaManager) {
this.identityLinkSchemaManager = identityLinkSchemaManager;
return this;
}

public SchemaManager getVariableSchemaManager() {
return variableSchemaManager;
}

public AppEngineConfiguration setVariableSchemaManager(SchemaManager variableSchemaManager) {
this.variableSchemaManager = variableSchemaManager;
return this;
}

@Override
public VariableTypes getVariableTypes() {
return variableTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ public AppEngineImpl(AppEngineConfiguration appEngineConfiguration) {
LOGGER.info("AppEngine {} created", name);

AppEngines.registerAppEngine(this);

if (appEngineConfiguration.getEngineLifecycleListeners() != null) {
for (EngineLifecycleListener engineLifecycleListener : appEngineConfiguration.getEngineLifecycleListeners()) {
engineLifecycleListener.onEngineBuilt(this);
}
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* 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 org.flowable.app.engine.impl;

import java.util.function.Consumer;

import org.flowable.app.engine.AppEngine;
import org.flowable.app.engine.AppEngineConfiguration;
import org.flowable.common.engine.api.engine.EngineLifecycleListener;

/**
* @author Filip Hrisafov
*/
public class AppEnginePostEngineBuildConsumer implements Consumer<AppEngine> {

@Override
public void accept(AppEngine appEngine) {
AppEngineConfiguration engineConfiguration = appEngine.getAppEngineConfiguration();
if (engineConfiguration.getEngineLifecycleListeners() != null) {
for (EngineLifecycleListener engineLifecycleListener : engineConfiguration.getEngineLifecycleListeners()) {
engineLifecycleListener.onEngineBuilt(appEngine);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import org.flowable.app.api.AppManagementService;
import org.flowable.app.engine.AppEngineConfiguration;
import org.flowable.app.engine.impl.cmd.GetTableNamesCmd;
import org.flowable.common.engine.api.lock.LockManager;
import org.flowable.common.engine.impl.cmd.GetTableCountCmd;
import org.flowable.common.engine.impl.lock.LockManagerImpl;
import org.flowable.common.engine.impl.service.CommonEngineServiceImpl;

/**
Expand All @@ -39,5 +41,9 @@ public Map<String, Long> getTableCounts() {
public Collection<String> getTableNames() {
return commandExecutor.execute(new GetTableNamesCmd());
}


@Override
public LockManager getLockManager(String lockName) {
return new LockManagerImpl(commandExecutor, lockName, getConfiguration().getLockPollRate(), configuration.getEngineCfgKey());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class FlowableAppRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
ResourceHints resourceHints = hints.resources();
resourceHints.registerPattern("org/flowable/app/db/liquibase/flowable-app-db-changelog.xml");
FlowableMyBatisResourceHintsRegistrar.registerMappingResources("org/flowable/app/db/mapping", hints, classLoader);
}
}

This file was deleted.

Loading

0 comments on commit 27ac566

Please sign in to comment.