-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add module archetype and module postprocessing plugin
- Loading branch information
Tsimafei Raro
committed
Jun 27, 2022
1 parent
85f7fd6
commit e256576
Showing
13 changed files
with
462 additions
and
2 deletions.
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
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
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,31 @@ | ||
<?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"> | ||
<parent> | ||
<relativePath>../s-pipes-parent</relativePath> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-parent</artifactId> | ||
<version>0.3.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>s-pipes-modules-utils</artifactId> | ||
<name>SPipes Module Utils</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>s-pipes-module-archetype</module> | ||
<module>s-pipes-module-creator-maven-plugin</module> | ||
</modules> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-core</artifactId> | ||
<version>${project.parent.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
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,23 @@ | ||
#!/bin/bash | ||
BASEDIR="/Users/qwerty/Documents/documents/university/masters/semester-4/semestral-project/personal-fork/s-pipes-modulegen/s-pipes-modules-utils/" | ||
SPIPESDIR="/Users/qwerty/Documents/documents/university/masters/semester-4/semestral-project/personal-fork/s-pipes-modulegen/s-pipes-modules/" | ||
|
||
cd $BASEDIR/s-pipes-module-archetype | ||
mvn clean install | ||
echo "Updated archetype in local maven repository" | ||
|
||
cd $SPIPESDIR | ||
# Cleanup of old versions | ||
rm -rf test-own-artifact | ||
sed -i '' 's/<module>test-own-artifact<\/module>//' pom.xml | ||
|
||
mvn archetype:generate \ | ||
-DinteractiveMode=false \ | ||
-DarchetypeGroupId=cz.cvut.kbss \ | ||
-DarchetypeArtifactId=s-pipes-module-archetype \ | ||
-DarchetypeVersion=1.0-SNAPSHOT \ | ||
-DgroupId=cz.cvut.spipes.modules \ | ||
-DartifactId=test-own-artifact \ | ||
-DmoduleName=foobar | ||
cd $BASEDIR | ||
echo "Regenerated the test module" |
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,30 @@ | ||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-modules-utils</artifactId> | ||
<version>0.3.0</version> | ||
</parent> | ||
|
||
<name>SPipes Module Archetype</name> | ||
<artifactId>s-pipes-module-archetype</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>maven-archetype</packaging> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<archetype-packaging.version>3.1.1</archetype-packaging.version> | ||
</properties> | ||
<build> | ||
<extensions> | ||
<extension> | ||
<groupId>org.apache.maven.archetype</groupId> | ||
<artifactId>archetype-packaging</artifactId> | ||
<version>${archetype-packaging.version}</version> | ||
</extension> | ||
</extensions> | ||
</build> | ||
</project> |
31 changes: 31 additions & 0 deletions
31
...s-utils/s-pipes-module-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,31 @@ | ||
<archetype-descriptor | ||
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 https://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd" | ||
name="basic-archetype"> | ||
<fileSets> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/main/java</directory> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/main/resources</directory> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/test/java</directory> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true"> | ||
<directory>src/test/resources</directory> | ||
</fileSet> | ||
</fileSets> | ||
|
||
<requiredProperties> | ||
<requiredProperty key="moduleName"> | ||
<defaultValue>${artifactId}</defaultValue> | ||
</requiredProperty> | ||
<requiredProperty key="moduleNameCamelCase"> | ||
<defaultValue> | ||
${moduleName.replaceAll("^a|-a", "A").replaceAll("^b|-b", "B").replaceAll("^c|-c", "C").replaceAll("^d|-d", "D").replaceAll("^e|-e", "E").replaceAll("^f|-f", "F").replaceAll("^g|-g", "G").replaceAll("^h|-h", "H").replaceAll("^i|-i", "I").replaceAll("^j|-j", "J").replaceAll("^k|-k", "K").replaceAll("^l|-l", "L").replaceAll("^m|-m", "M").replaceAll("^n|-n", "N").replaceAll("^o|-o", "O").replaceAll("^p|-p", "P").replaceAll("^q|-q", "Q").replaceAll("^r|-r", "R").replaceAll("^s|-s", "S").replaceAll("^t|-t", "T").replaceAll("^u|-u", "U").replaceAll("^v|-v", "V").replaceAll("^w|-w", "W").replaceAll("^x|-x", "X").replaceAll("^y|-y", "Y").replaceAll("^z|-z", "Z")} | ||
</defaultValue> | ||
</requiredProperty> | ||
</requiredProperties> | ||
</archetype-descriptor> |
60 changes: 60 additions & 0 deletions
60
...pes-modules-utils/s-pipes-module-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,60 @@ | ||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>s-pipes-modules</artifactId> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<version>0.3.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>${groupId}</groupId> | ||
<artifactId>${artifactId}</artifactId> | ||
<version>${version}</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>SPipes Generated Module - ${artifactId}</name> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>RELEASE</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-module-creator-maven-plugin</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>process-annotations</goal> | ||
</goals> | ||
<configuration> | ||
<moduleClassName>${moduleNameCamelCase}Module</moduleClassName> | ||
<ontologyFilename>${artifactId}-generated.ttl</ontologyFilename> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
55 changes: 55 additions & 0 deletions
55
...e/src/main/resources/archetype-resources/src/main/java/__moduleNameCamelCase__Module.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,55 @@ | ||
## Convenience variables for Maven Archetype | ||
#set($className = "${moduleNameCamelCase}Module") | ||
## | ||
package cz.cvut.spipes.modules; | ||
|
||
import cz.cvut.spipes.constants.KBSS_MODULE; | ||
import cz.cvut.spipes.engine.ExecutionContext; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class $className extends AnnotatedAbstractModule { | ||
private static final Logger LOG = LoggerFactory.getLogger(${className}.class); | ||
|
||
private static final String TYPE_URI = KBSS_MODULE.uri + "$artifactId"; | ||
private static final String TYPE_PREFIX = TYPE_URI + "/"; | ||
|
||
// todo remove | ||
// @Parameter(urlPrefix = TYPE_PREFIX, name = "endpoint-url") | ||
// private String endpointUrl; | ||
// | ||
// @Parameter(urlPrefix = TYPE_PREFIX, name = "output-resource-variable") | ||
// private String outputResourceVariable; | ||
// | ||
// public String getEndpointUrl() { | ||
// return endpointUrl; | ||
// } | ||
// | ||
// public void setEndpointUrl(String endpointUrl) { | ||
// this.endpointUrl = endpointUrl; | ||
// } | ||
// | ||
// public String getOutputResourceVariable() { | ||
// return outputResourceVariable; | ||
// } | ||
// | ||
// public void setOutputResourceVariable(String outputResourceVariable) { | ||
// this.outputResourceVariable = outputResourceVariable; | ||
// } | ||
|
||
|
||
@Override | ||
protected ExecutionContext executeSelf() { | ||
return executionContext; | ||
} | ||
|
||
@Override | ||
public String getTypeURI() { | ||
return KBSS_MODULE.getURI() + "$className"; | ||
} | ||
|
||
@Override | ||
public void loadConfiguration() { | ||
LOG.info("Configuration loaded successfully."); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...pe/src/main/resources/archetype-resources/src/main/resources/__artifactId__-generated.ttl
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,17 @@ | ||
@prefix kbss-module: <http://onto.fel.cvut.cz/ontologies/lib/module/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix sm: <http://topbraid.org/sparqlmotion#> . | ||
@prefix spin: <http://spinrdf.org/spin#> . | ||
@prefix spl: <http://spinrdf.org/spl#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
kbss-module:${artifactId}-generated-ontology | ||
rdf:type owl:Ontology ; | ||
. | ||
kbss-module:${moduleName} | ||
rdf:type sm:Module ; | ||
rdfs:comment "Automatically generated s-pipes module. For more information, see ${moduleNameCamelCase}Module.java." ; | ||
rdfs:label "${moduleName}" ; | ||
. |
9 changes: 9 additions & 0 deletions
9
...le-archetype/src/main/resources/archetype-resources/src/main/resources/__artifactId__.ttl
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,9 @@ | ||
@prefix kbss-module: <http://onto.fel.cvut.cz/ontologies/lib/module/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
|
||
kbss-module:${artifactId}-ontology | ||
rdf:type owl:Ontology ; | ||
owl:imports kbss-module:${artifactId}-generated-ontology ; | ||
owl:versionInfo "Created via Maven Archetype" ; | ||
. |
28 changes: 28 additions & 0 deletions
28
...c/main/resources/archetype-resources/src/test/java/__moduleNameCamelCase__ModuleTest.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,28 @@ | ||
## Convenience variables for Maven Archetype | ||
#set($testClassName = "${moduleNameCamelCase}ModuleTest") | ||
#set($className = "${moduleNameCamelCase}Module") | ||
## | ||
package cz.cvut.spipes.modules; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
|
||
/** | ||
* @see cz.cvut.spipes.modules.$className | ||
*/ | ||
public class $testClassName { | ||
|
||
private $className module; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
module = new $className(); | ||
} | ||
|
||
@Test | ||
public void loadConfiguration_doesNotThrow() { | ||
assertDoesNotThrow(() -> module.loadConfiguration()); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
s-pipes-modules-utils/s-pipes-module-creator-maven-plugin/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,66 @@ | ||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-modules-utils</artifactId> | ||
<version>0.3.0</version> | ||
</parent> | ||
|
||
<name>SPipes Module Annotation Processor</name> | ||
<artifactId>s-pipes-module-creator-maven-plugin</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>maven-plugin</packaging> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-plugin-api</artifactId> | ||
<version>3.6.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.plugin-tools</groupId> | ||
<artifactId>maven-plugin-annotations</artifactId> | ||
<version>3.6.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-project</artifactId> | ||
<version>2.2.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>cz.cvut.kbss</groupId> | ||
<artifactId>s-pipes-core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<configuration> | ||
<!-- see http://jira.codehaus.org/browse/MNG-5346 --> | ||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>mojo-descriptor</id> | ||
<goals> | ||
<goal>descriptor</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.