-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from flyway/archetype
Add a flyway-community-db-support-archetype to help development
- Loading branch information
Showing
10 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<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> | ||
<groupId>org.flywaydb</groupId> | ||
<artifactId>flyway-community-db-support-archetype</artifactId> | ||
<version>10.12.0</version> | ||
<packaging>maven-archetype</packaging> | ||
|
||
<name>Archetype - flyway-community-db-support-archetype</name> | ||
<description>An archetype for creating a new Flyway Community Database Support module</description> | ||
<url>https://flywaydb.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
</properties> | ||
|
||
<build> | ||
<extensions> | ||
<extension> | ||
<groupId>org.apache.maven.archetype</groupId> | ||
<artifactId>archetype-packaging</artifactId> | ||
<version>3.2.1</version> | ||
</extension> | ||
</extensions> | ||
</build> | ||
</project> |
24 changes: 24 additions & 0 deletions
24
...y-community-db-support-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" | ||
name="${artifactId}"> | ||
|
||
<requiredProperties> | ||
<requiredProperty key="parentVersion"> | ||
<defaultValue>10.8.0</defaultValue> | ||
</requiredProperty> | ||
<requiredProperty key="artifactId"> | ||
<defaultValue>flyway-database-example</defaultValue> | ||
<validationRegex>flyway-database-\w+</validationRegex> | ||
</requiredProperty> | ||
</requiredProperties> | ||
|
||
<fileSets> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/*.java</include> | ||
</includes> | ||
</fileSet> | ||
</fileSets> | ||
</archetype-descriptor> |
43 changes: 43 additions & 0 deletions
43
flyway-community-db-support-archetype/src/main/resources/archetype-resources/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<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.flywaydb</groupId> | ||
<artifactId>flyway-community-db-support</artifactId> | ||
<version>${parentVersion}</version> | ||
</parent> | ||
|
||
<artifactId>${artifactId}</artifactId> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>flyway-core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
39 changes: 39 additions & 0 deletions
39
...ype-resources/src/main/java/org/flywaydb/community/database/ExampleDatabaseExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) Red Gate Software Ltd 2010-2024 | ||
* | ||
* 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.flywaydb.community.database; | ||
|
||
import org.flywaydb.core.api.FlywayException; | ||
import org.flywaydb.core.extensibility.PluginMetadata; | ||
import org.flywaydb.core.internal.util.FileUtils; | ||
|
||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
public class ExampleDatabaseExtension implements PluginMetadata { | ||
public String getDescription() { | ||
return "Community-contributed Example database support extension " + readVersion() + " by Redgate"; | ||
} | ||
|
||
public static String readVersion() { | ||
try { | ||
return FileUtils.copyToString( | ||
ExampleDatabaseExtension.class.getClassLoader().getResourceAsStream("org/flywaydb/community/database/example/version.txt"), | ||
StandardCharsets.UTF_8); | ||
} catch (IOException e) { | ||
throw new FlywayException("Unable to read extension version: " + e.getMessage(), e); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...-resources/src/main/java/org/flywaydb/community/database/example/ExampleDatabaseType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.flywaydb.community.database.example; | ||
|
||
import java.sql.Connection; | ||
import org.flywaydb.community.database.ExampleDatabaseExtension; | ||
import org.flywaydb.core.api.ResourceProvider; | ||
import org.flywaydb.core.api.configuration.Configuration; | ||
import org.flywaydb.core.internal.database.base.BaseDatabaseType; | ||
import org.flywaydb.core.internal.database.base.CommunityDatabaseType; | ||
import org.flywaydb.core.internal.database.base.Database; | ||
import org.flywaydb.core.internal.jdbc.JdbcConnectionFactory; | ||
import org.flywaydb.core.internal.jdbc.StatementInterceptor; | ||
import org.flywaydb.core.internal.parser.Parser; | ||
import org.flywaydb.core.internal.parser.ParsingContext; | ||
|
||
public class ExampleDatabaseType extends BaseDatabaseType implements CommunityDatabaseType { | ||
|
||
@Override | ||
public String getName() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int getNullType() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean handlesJDBCUrl(final String url) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getDriverClass(final String url, final ClassLoader classLoader) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean handlesDatabaseProductNameAndVersion(final String databaseProductName, | ||
final String databaseProductVersion, | ||
final Connection connection) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Database createDatabase(final Configuration configuration, final JdbcConnectionFactory jdbcConnectionFactory, | ||
final StatementInterceptor statementInterceptor) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Parser createParser(final Configuration configuration, final ResourceProvider resourceProvider, | ||
final ParsingContext parsingContext) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getPluginVersion(Configuration config) { | ||
return ExampleDatabaseExtension.readVersion(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ype-resources/src/main/resources/META-INF/services/org.flywaydb.core.extensibility.Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.flywaydb.community.database.example.ExampleDatabaseType |
1 change: 1 addition & 0 deletions
1
...rchetype-resources/src/main/resources/org/flywaydb/community/database/example/version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${pom.version} |
2 changes: 2 additions & 0 deletions
2
...upport-archetype/src/test/resources/projects/flyway-database-example/archetype.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
artifactId=flyway-database-example | ||
parentVersion=10.12.0 |
1 change: 1 addition & 0 deletions
1
...mmunity-db-support-archetype/src/test/resources/projects/flyway-database-example/goal.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters