-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref #4220: Add the camel-swift extension
- Loading branch information
Showing
33 changed files
with
1,686 additions
and
0 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,13 @@ | ||
# Do not edit directly! | ||
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
cqArtifactId: camel-quarkus-swift | ||
cqArtifactIdBase: swift | ||
cqNativeSupported: true | ||
cqStatus: Stable | ||
cqDeprecated: false | ||
cqJvmSince: 3.0.0 | ||
cqNativeSince: 3.0.0 | ||
cqCamelPartName: swiftMt | ||
cqCamelPartTitle: SWIFT MT | ||
cqCamelPartDescription: Encode and decode SWIFT MT messages. | ||
cqExtensionPageTitle: SWIFT |
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,13 @@ | ||
# Do not edit directly! | ||
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
cqArtifactId: camel-quarkus-swift | ||
cqArtifactIdBase: swift | ||
cqNativeSupported: true | ||
cqStatus: Stable | ||
cqDeprecated: false | ||
cqJvmSince: 3.0.0 | ||
cqNativeSince: 3.0.0 | ||
cqCamelPartName: swiftMx | ||
cqCamelPartTitle: SWIFT MX | ||
cqCamelPartDescription: Encode and decode SWIFT MX messages. | ||
cqExtensionPageTitle: SWIFT |
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,56 @@ | ||
// Do not edit directly! | ||
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
[id="extensions-swift"] | ||
= SWIFT | ||
:linkattrs: | ||
:cq-artifact-id: camel-quarkus-swift | ||
:cq-native-supported: true | ||
:cq-status: Stable | ||
:cq-status-deprecation: Stable | ||
:cq-description: Encode and decode SWIFT messages. | ||
:cq-deprecated: false | ||
:cq-jvm-since: 3.0.0 | ||
:cq-native-since: 3.0.0 | ||
|
||
ifeval::[{doc-show-badges} == true] | ||
[.badges] | ||
[.badge-key]##JVM since##[.badge-supported]##3.0.0## [.badge-key]##Native since##[.badge-supported]##3.0.0## | ||
endif::[] | ||
|
||
Encode and decode SWIFT messages. | ||
|
||
[id="extensions-swift-whats-inside"] | ||
== What's inside | ||
|
||
* xref:{cq-camel-components}:dataformats:swiftMt-dataformat.adoc[SWIFT MT data format] | ||
* xref:{cq-camel-components}:dataformats:swiftMx-dataformat.adoc[SWIFT MX data format] | ||
|
||
Please refer to the above links for usage and configuration details. | ||
|
||
[id="extensions-swift-maven-coordinates"] | ||
== Maven coordinates | ||
|
||
https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-swift[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"] | ||
|
||
Or add the coordinates to your existing project: | ||
|
||
[source,xml] | ||
---- | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-swift</artifactId> | ||
</dependency> | ||
---- | ||
ifeval::[{doc-show-user-guide-link} == true] | ||
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. | ||
endif::[] | ||
|
||
[id="extensions-swift-camel-quarkus-limitations"] | ||
== Camel Quarkus limitations | ||
|
||
[id="extensions-swift-limitations-mx-types"] | ||
=== MX types | ||
|
||
The MX message types are not supported in native mode because it drastically slows down the native image build due to an | ||
excessive amount of classes, methods, and fields to access by reflection that need to be registered. | ||
|
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,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You 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. | ||
--> | ||
<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.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-swift-parent</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>camel-quarkus-swift-deployment</artifactId> | ||
<name>Camel Quarkus :: SWIFT :: Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-core-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-jaxb-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-swift</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
100 changes: 100 additions & 0 deletions
100
...ent/src/main/java/org/apache/camel/quarkus/component/swift/deployment/SwiftProcessor.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,100 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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.apache.camel.quarkus.component.swift.deployment; | ||
|
||
import com.prowidesoftware.swift.model.AbstractMessage; | ||
import com.prowidesoftware.swift.model.MessageStandardType; | ||
import com.prowidesoftware.swift.model.SwiftBlock; | ||
import com.prowidesoftware.swift.model.Tag; | ||
import com.prowidesoftware.swift.model.UnparsedTextList; | ||
import com.prowidesoftware.swift.model.field.Field; | ||
import com.prowidesoftware.swift.model.field.Narrative; | ||
import com.prowidesoftware.swift.model.field.StructuredNarrative; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.CombinedIndexBuildItem; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.IndexDependencyBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; | ||
import org.jboss.jandex.DotName; | ||
import org.jboss.jandex.IndexView; | ||
|
||
class SwiftProcessor { | ||
|
||
private static final String FEATURE = "camel-swift"; | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(FEATURE); | ||
} | ||
|
||
@BuildStep | ||
void indexDependencies(BuildProducer<IndexDependencyBuildItem> indexedDependency) { | ||
// The dependency for MX message types | ||
// Adding this dependency slows down drastically the native image build since it brings a lot of reflection | ||
// indexedDependency.produce(new IndexDependencyBuildItem("com.prowidesoftware", "pw-iso20022")); | ||
// The dependency for MT message types | ||
indexedDependency.produce(new IndexDependencyBuildItem("com.prowidesoftware", "pw-swift-core")); | ||
} | ||
|
||
@BuildStep | ||
void registerOtherTypesForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) { | ||
|
||
reflectiveClass.produce( | ||
ReflectiveClassBuildItem | ||
.builder(Tag.class, UnparsedTextList.class, MessageStandardType.class, Narrative.class, | ||
StructuredNarrative.class) | ||
.fields() | ||
.build()); | ||
|
||
} | ||
|
||
@BuildStep | ||
void registerMessageTypesForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, | ||
CombinedIndexBuildItem combinedIndex) { | ||
reflectiveClass.produce(ReflectiveClassBuildItem.builder(AbstractMessage.class) | ||
.methods().fields().build()); | ||
registerForReflection(combinedIndex, AbstractMessage.class.getName(), reflectiveClass); | ||
} | ||
|
||
@BuildStep | ||
void registerFieldTypesForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, | ||
CombinedIndexBuildItem combinedIndex) { | ||
|
||
registerForReflection(combinedIndex, Field.class.getName(), reflectiveClass); | ||
} | ||
|
||
@BuildStep | ||
void registerSwiftBlocksForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, | ||
CombinedIndexBuildItem combinedIndex) { | ||
reflectiveClass.produce(ReflectiveClassBuildItem.builder(SwiftBlock.class).fields().build()); | ||
registerForReflection(combinedIndex, SwiftBlock.class.getName(), reflectiveClass); | ||
} | ||
|
||
private static void registerForReflection(CombinedIndexBuildItem combinedIndex, String className, | ||
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) { | ||
IndexView index = combinedIndex.getIndex(); | ||
|
||
String[] classes = index.getAllKnownSubclasses(DotName.createSimple(className)) | ||
.stream() | ||
.map(classInfo -> classInfo.name().toString()) | ||
.toArray(String[]::new); | ||
|
||
// Register classes for refection | ||
reflectiveClass.produce(ReflectiveClassBuildItem.builder(classes).fields().build()); | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You 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. | ||
--> | ||
<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.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-extensions</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>camel-quarkus-swift-parent</artifactId> | ||
<name>Camel Quarkus :: SWIFT</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>deployment</module> | ||
<module>runtime</module> | ||
</modules> | ||
</project> |
Oops, something went wrong.