Skip to content

Commit

Permalink
introduce generics and deploy quarkus parent pom
Browse files Browse the repository at this point in the history
  • Loading branch information
sboeckelmann committed Jun 12, 2024
1 parent 6ad06ce commit 6855cf4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ public InputStream xmlConverter(
InputStream inputStream, Conversion conversion)
throws UnsupportedOperationException, IOException;

static XmlVersionTransformer newInstance() {
static <T extends XmlVersionTransformer> T newInstance() {
return newInstance(Executors.newWorkStealingPool());
}

static XmlVersionTransformer newInstance(Class<? extends XmlVersionTransformerFactory> factory) {
static <T extends XmlVersionTransformer> T newInstance(Class<? extends XmlVersionTransformerFactory> factory) {
return newInstance(Executors.newWorkStealingPool(), factory);
}

static XmlVersionTransformer newInstance(final ExecutorService executorService) {
static <T extends XmlVersionTransformer> T newInstance(final ExecutorService executorService) {
final Optional<XmlVersionTransformerFactory> optionalFactory =
ServiceLoader.load(XmlVersionTransformerFactory.class).findFirst();
if (optionalFactory.isPresent()) {
return optionalFactory.get().newXmlVersionTransformer(executorService);
}
return new DefaultXmlVersionTransformer(executorService);
return (T) new DefaultXmlVersionTransformer(executorService);
}

static XmlVersionTransformer newInstance(
static <T extends XmlVersionTransformer> T newInstance(
final ExecutorService executorService, Class<? extends XmlVersionTransformerFactory> factory)
throws IllegalArgumentException {
final Optional<ServiceLoader.Provider<XmlVersionTransformerFactory>> optionalFactory =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@

public interface XmlVersionTransformerFactory {

public XmlVersionTransformer newXmlVersionTransformer(final ExecutorService executorService);
public <T extends XmlVersionTransformer> T newXmlVersionTransformer(final ExecutorService executorService);
}
14 changes: 1 addition & 13 deletions quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<groupId>io.openepcis.quarkus</groupId>
<artifactId>quarkus-document-converter-parent</artifactId>
<packaging>pom</packaging>
<name>quarkus-document-converter-deployment-parent</name>
<name>quarkus-document-converter-parent</name>
<description>Quarkus OpenEPCIS Document Converter Parent</description>
<url>https://github.com/openepcis/openepcis-document-converter</url>

Expand Down Expand Up @@ -61,18 +61,6 @@
<module>deployment</module>
</modules>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>


<repositories>
<!-- sonatype releases -->
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public OpenEPCISConverterHealthCheck(final VersionTransformer versionTransformer
@Override
public HealthCheckResponse call() {
HealthCheckResponseBuilder builder = HealthCheckResponse.named("OpenEPCIS Document Converter health check").up();
builder.up().withData("xmlVersionTransformer", versionTransformer.getXmlVersionTransformer().getClass().getName() );
builder.up().withData("xmlToJsonConverter", versionTransformer.getXmlToJsonConverter().getClass().getName() );
return builder.build();
}
Expand Down

0 comments on commit 6855cf4

Please sign in to comment.