Skip to content

Commit

Permalink
created new extra submodule for the tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnul97 authored and Coduz committed Jan 15, 2023
1 parent 445116e commit cdb56e0
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ public void update() {
}
}

public void forceReleaseChangelogLock() {
LOG.info("Trying to release changelog lock...");
try (Connection connection = DriverManager.getConnection(jdbcUrl, username, password)) {
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
Liquibase liquibase = new Liquibase((String) null, new FileSystemResourceAccessor(), database);
liquibase.forceReleaseLocks();
} catch (LiquibaseException | SQLException e) {
LOG.error("Running release changelog lock... ERROR! Error: {}", e.getMessage(), e);
throw new RuntimeException(e); // TODO: throw an appropriate exception!
}
}

protected static synchronized File loadChangelogs() throws IOException {
String tmpDirectory = SystemUtils.getJavaIoTmpDir().getAbsolutePath();

Expand Down
117 changes: 117 additions & 0 deletions extras/liquibaseUnlocker/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 Eurotech and/or its affiliates and others
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
Eurotech - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-extras</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>liquibaseUnlocker</artifactId>

<dependencies>
<!-- -->
<!-- Kapua -->
<dependency>
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua-commons</artifactId>
</dependency>

<!-- -->
<!-- External-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>

<!-- -->
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>bundle.properties</exclude>
<exclude>about.*</exclude>
<exclude>OSGI-OPT/**</exclude>
<exclude>LICENSE</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.eclipse.kapua.extras.liquibaseUnlocker.Application</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
<addHeader>false</addHeader>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>app</shadedClassifierName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- <properties>-->
<!-- <maven.compiler.source>8</maven.compiler.source>-->
<!-- <maven.compiler.target>8</maven.compiler.target>-->
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
<!-- </properties>-->

</project>
1 change: 1 addition & 0 deletions extras/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<module>foreignkeys</module>
<module>es-migrator</module>
<module>encryption-migrator</module>
<module>liquibaseUnlocker</module>
</modules>

</project>

0 comments on commit cdb56e0

Please sign in to comment.