Skip to content

Commit

Permalink
Move com.sun.xml.messaging.saaj:saaj-impl related build steps to a se…
Browse files Browse the repository at this point in the history
…parate SaajImplProcessor class
  • Loading branch information
ppalaga committed Aug 16, 2022
1 parent 4ea578f commit 018d584
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.deployment.pkg.PackageConfig;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;
Expand Down Expand Up @@ -142,32 +141,6 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE_CXF);
}

@BuildStep
void serviceProviders(BuildProducer<ServiceProviderBuildItem> serviceProvider) {
String[] soapVersions = new String[] { "1_1", "1_2" };
for (String version : soapVersions) {
serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.MessageFactory",
"com.sun.xml.messaging.saaj.soap.ver" + version + ".SOAPMessageFactory" + version + "Impl"));

serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.SOAPFactory",
"com.sun.xml.messaging.saaj.soap.ver" + version + ".SOAPFactory" + version + "Impl"));
}

serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.SOAPConnectionFactory",
"com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory"));

serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.SAAJMetaFactory",
"com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl"));
}

@BuildStep
public void generateSysProps(BuildProducer<SystemPropertyBuildItem> props) {
props.produce(new SystemPropertyBuildItem("com.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize", "true"));
Expand Down Expand Up @@ -981,8 +954,6 @@ public void registerReflectionItems(BuildProducer<ReflectiveClassBuildItem> refl
"com.sun.xml.bind.v2.runtime.CompositeStructureBeanInfo",
"com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl",
"com.sun.xml.bind.v2.runtime.MarshallerImpl",
"com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl",
"com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl",
"com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl",
"javax.wsdl.Types",
"javax.wsdl.extensions.mime.MIMEPart",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package io.quarkiverse.cxf.deployment;

import java.util.stream.Stream;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;

/**
* {@link BuildStep}s related to {@code com.sun.xml.messaging.saaj:saaj-impl}
*/
class SaajImplProcessor {

@BuildStep
void indexDependencies(BuildProducer<IndexDependencyBuildItem> indexDependencies) {
Stream.of(
"com.sun.xml.messaging.saaj:saaj-impl")
.forEach(ga -> {
String[] coords = ga.split(":");
indexDependencies.produce(new IndexDependencyBuildItem(coords[0], coords[1]));
});
}

@BuildStep
void serviceProviders(BuildProducer<ServiceProviderBuildItem> serviceProvider) {
String[] soapVersions = new String[] { "1_1", "1_2" };
for (String version : soapVersions) {
serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.MessageFactory",
"com.sun.xml.messaging.saaj.soap.ver" + version + ".SOAPMessageFactory" + version + "Impl"));

serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.SOAPFactory",
"com.sun.xml.messaging.saaj.soap.ver" + version + ".SOAPFactory" + version + "Impl"));
}

serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.SOAPConnectionFactory",
"com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory"));

serviceProvider.produce(
new ServiceProviderBuildItem(
"javax.xml.soap.SAAJMetaFactory",
"com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl"));
}

@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {

// TODO check whether these are required at all or whether some can be registered with false, false
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true,
"com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl"));

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class QuarkusCxfWsSecurityProcessor {
private static final List<String> indexDepedenciesClasses = Arrays.asList(
"javax.xml.bind.annotation.W3CDomHandler",
"org.ehcache.xml.model.ObjectFactory",
"com.sun.xml.messaging.saaj.soap.impl.BodyImpl",
"javax.xml.soap.SOAPBodyElement",
"org.apache.wss4j.dom.WSConstants");

Expand Down Expand Up @@ -62,7 +61,6 @@ void registerWsSecurityReflectionItems(CombinedIndexBuildItem combinedIndexBuild
c.startsWith("org.apache.wss4j.dom.transform.") ||
c.startsWith("org.apache.wss4j.dom.action.") ||
c.startsWith("org.apache.wss4j.dom.processor.") ||
c.startsWith("com.sun.xml.messaging.saaj.") ||
c.startsWith("org.apache.wss4j.dom.validate.")) && !c.contains("$"))
.forEach(c -> reflectiveItems.produce(new ReflectiveClassBuildItem(true, false, c)));

Expand Down

0 comments on commit 018d584

Please sign in to comment.