-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update dependencies versions * Add sonatype deployment * Add github action * tag version 0.2
- Loading branch information
1 parent
97e579e
commit b7385e0
Showing
9 changed files
with
382 additions
and
235 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish release to the Maven Central Repository | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up then Maven Central Repository | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
- name: Publish to OSS with maven | ||
run: mvn --batch-mode clean deploy -Dgpg.passphrase=${{ secrets.CI_GPG_PASSPHRASE }} -Psonatype-oss-release | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
MAVEN_OPTS: --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED |
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 |
---|---|---|
|
@@ -5,66 +5,189 @@ | |
<modelVersion>4.0.0</modelVersion> | ||
<groupId>ch.galinet.xml</groupId> | ||
<artifactId>xsd-hierarchy</artifactId> | ||
<version>0.2-SNAPSHOT</version> | ||
<version>0.2</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>${project.groupId}:${project.artifactId}</name> | ||
<description>Navigate through the hierarchy of an XSD file</description> | ||
<url>https://github.com/nilsaellen/xsd-hierarchy</url> | ||
|
||
<developers> | ||
<developer> | ||
<name>Nils Aellen</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
</developers> | ||
|
||
<licenses> | ||
<license> | ||
<name>Apache License, Version 2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
|
||
<scm> | ||
<connection>scm:git:git://github.com/nilsaellen/xsd-hierarchy.git</connection> | ||
<developerConnection>scm:git:ssh://github.com:nilsaellen/xsd-hierarchy.git</developerConnection> | ||
<url>http://github.com/nilsaellen/xsd-hierarchy/tree/master</url> | ||
</scm> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
<source>17</source> | ||
<target>17</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>3.2.1</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>3.4.1</version> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>artifactory-releases</id> | ||
<name>artifactory.pnet.ch-releases</name> | ||
<url>http://artifactory.pnet.ch/artifactory/libs-release-local</url> | ||
</repository> | ||
<snapshotRepository> | ||
<id>artifactory-snapshots</id> | ||
<name>artifactory.pnet.ch-snapshots</name> | ||
<url>http://artifactory.pnet.ch/artifactory/libs-snapshot-local</url> | ||
<id>ossrh</id> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
|
||
<properties> | ||
<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version> | ||
<maven-source-plugin.version>3.2.1</maven-source-plugin.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<junit-jupiter.version>5.9.2</junit-jupiter.version> | ||
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Third party tools --> | ||
<dependency> | ||
<groupId>com.sun.xml.bind</groupId> | ||
<artifactId>jaxb-osgi</artifactId> | ||
<version>2.3.0-b170127.1453</version> | ||
<version>4.0.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>jdom</groupId> | ||
<artifactId>jdom</artifactId> | ||
<version>1.0</version> | ||
<groupId>org.jdom</groupId> | ||
<artifactId>jdom2</artifactId> | ||
<version>2.0.6.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.5</version> | ||
<version>3.12.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<licenses> | ||
<license> | ||
<name>Apache License, Version 2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
|
||
<profiles> | ||
<profile> | ||
<id>sonatype-oss-release</id> | ||
<build> | ||
<plugins> | ||
|
||
<!-- Generate source attachment --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven-source-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<!-- Generate javadoc attachment --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>${maven-javadoc-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<!-- Sign the artifacts --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-gpg-plugin</artifactId> | ||
<version>${maven-gpg-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>sign-artifacts</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>sign</goal> | ||
</goals> | ||
<configuration> | ||
<homedir>${session.executionRootDirectory}</homedir> | ||
<keyname>eb11bc74</keyname> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.sonatype.plugins</groupId> | ||
<artifactId>nexus-staging-maven-plugin</artifactId> | ||
<version>1.6.7</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<serverId>ossrh</serverId> | ||
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl> | ||
<autoReleaseAfterClose>false</autoReleaseAfterClose> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> | ||
|
||
|
||
|
Binary file not shown.
Binary file not shown.
46 changes: 20 additions & 26 deletions
46
src/main/java/ch/galinet/xml/xsdhierarchy/MapNamespaceContext.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 |
---|---|---|
@@ -1,38 +1,32 @@ | ||
package ch.galinet.xml.xsdhierarchy; | ||
|
||
import javax.xml.namespace.NamespaceContext; | ||
import java.util.HashMap; | ||
import java.util.Iterator; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Created by aellenn on 28.04.2017. | ||
*/ | ||
import javax.xml.namespace.NamespaceContext; | ||
|
||
public class MapNamespaceContext implements NamespaceContext { | ||
private final HashMap<String, String> map = new HashMap(); | ||
private final HashMap<String, String> map = new HashMap<>(); | ||
|
||
public void register(String prefix, String namespace) { | ||
map.put(prefix, namespace); | ||
} | ||
public void register(final String prefix, final String namespace) { | ||
map.put(prefix, namespace); | ||
} | ||
|
||
@Override | ||
public String getNamespaceURI(String prefix) { | ||
return map.get(prefix); | ||
} | ||
@Override | ||
public String getNamespaceURI(final String prefix) { | ||
return map.get(prefix); | ||
} | ||
|
||
@Override | ||
public String getPrefix(String namespaceURI) { | ||
Optional<Map.Entry<String, String>> optElement = map.entrySet().stream().filter(e -> e.getValue().equals(namespaceURI)).findFirst(); | ||
if (optElement.isPresent()) { | ||
return optElement.get().getKey(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
@Override | ||
public String getPrefix(final String namespaceURI) { | ||
Optional<Map.Entry<String, String>> optElement = map.entrySet().stream().filter(e -> e.getValue().equals(namespaceURI)).findFirst(); | ||
return optElement.map(Map.Entry::getKey).orElse(null); | ||
} | ||
|
||
@Override | ||
public Iterator getPrefixes(String namespaceURI) { | ||
return map.keySet().iterator(); | ||
} | ||
} | ||
@Override | ||
public Iterator getPrefixes(final String namespaceURI) { | ||
return map.keySet().iterator(); | ||
} | ||
} |
51 changes: 24 additions & 27 deletions
51
src/main/java/ch/galinet/xml/xsdhierarchy/XsdElement.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 |
---|---|---|
@@ -1,38 +1,35 @@ | ||
package ch.galinet.xml.xsdhierarchy; | ||
|
||
/** | ||
* Created by aellenn on 28.04.2017. | ||
*/ | ||
public class XsdElement { | ||
private String namespace; | ||
private String name; | ||
private String namespace; | ||
private String name; | ||
|
||
public XsdElement() { | ||
} | ||
public XsdElement() { | ||
} | ||
|
||
public XsdElement(String namespace, String name) { | ||
this.namespace = namespace; | ||
this.name = name; | ||
} | ||
public XsdElement(String namespace, String name) { | ||
this.namespace = namespace; | ||
this.name = name; | ||
} | ||
|
||
public String getNamespace() { | ||
return namespace; | ||
} | ||
public String getNamespace() { | ||
return namespace; | ||
} | ||
|
||
public void setNamespace(String namespace) { | ||
this.namespace = namespace; | ||
} | ||
public void setNamespace(final String namespace) { | ||
this.namespace = namespace; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
public void setName(final String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("{%s}:%s", this.getNamespace(), this.getName()); | ||
} | ||
@Override | ||
public String toString() { | ||
return String.format("{%s}:%s", this.getNamespace(), this.getName()); | ||
} | ||
} |
Oops, something went wrong.