From d12e735947b0c2c25d984e14f859b54d38c8adaf Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Fri, 10 Nov 2023 13:21:57 +0530 Subject: [PATCH 1/5] Add missing dependencies --- ballerina/build.gradle | 12 ++++++++++++ build-config/resources/Ballerina.toml | 18 ++++++++++++++++++ gradle.properties | 1 + 3 files changed, 31 insertions(+) diff --git a/ballerina/build.gradle b/ballerina/build.gradle index 3b1cce2..39fab32 100644 --- a/ballerina/build.gradle +++ b/ballerina/build.gradle @@ -75,16 +75,28 @@ dependencies { externalJars(group: 'com.ibm.mq', name: 'com.ibm.mq.allclient', version: "${ibmMQVersion}") { transitive = false } + /* Jackson dependencies */ + externalJars(group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: "${jacksonVersion}") { + transitive = false + } + externalJars(group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: "${jacksonVersion}") { + transitive = false + } + externalJars(group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jacksonVersion}") { + transitive = false + } } task updateTomlFiles { doLast { def stdlibDependentIbmMQVersion = project.ibmMQVersion def stdlibDependentJsonVersion = project.jsonVersion + def stdlibDependentJacksonVersion = project.jacksonVersion; def newConfig = ballerinaTomlFilePlaceHolder.text.replace("@project.version@", project.version) newConfig = newConfig.replace("@toml.version@", tomlVersion) newConfig = newConfig.replace("@ibmmq.version@", stdlibDependentIbmMQVersion) newConfig = newConfig.replace("@json.version@", stdlibDependentJsonVersion) + newConfig = newConfig.replace("@jackson.version@", stdlibDependentJacksonVersion) ballerinaTomlFile.text = newConfig } } diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index e071688..769c8d8 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -26,3 +26,21 @@ groupId = "com.ibm.mq" artifactId = "com.ibm.mq.allclient" version = "@ibmmq.version@" path = "./lib/com.ibm.mq.allclient-@ibmmq.version@.jar" + +[[platform.java17.dependency]] +groupId = "com.fasterxml.jackson.core" +artifactId = "jackson-annotations" +version = "@jackson.version@" +path = "./lib/jackson-annotations-@jackson.version@.jar" + +[[platform.java17.dependency]] +groupId = "com.fasterxml.jackson.core" +artifactId = "jackson-core" +version = "@jackson.version@" +path = "./lib/jackson-core-@jackson.version@.jar" + +[[platform.java17.dependency]] +groupId = "com.fasterxml.jackson.core" +artifactId = "jackson-databind" +version = "@jackson.version@" +path = "./lib/jackson-databind-@jackson.version@.jar" diff --git a/gradle.properties b/gradle.properties index 8a6cff9..91358ea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,7 @@ ballerinaGradlePluginVersion=2.0.1 # IBM MQ dependencies ibmMQVersion=9.3.4.0 jsonVersion=20231013 +jacksonVersion=2.15.3 #stdlib dependencies From 359ecdc646a5bd94bffe86baeabd4fb7386349e1 Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Fri, 10 Nov 2023 13:23:57 +0530 Subject: [PATCH 2/5] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 18 ++++++++++++++++++ ballerina/Dependencies.toml | 23 ----------------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 0d78e9c..b1d4b09 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -26,3 +26,21 @@ groupId = "com.ibm.mq" artifactId = "com.ibm.mq.allclient" version = "9.3.4.0" path = "./lib/com.ibm.mq.allclient-9.3.4.0.jar" + +[[platform.java17.dependency]] +groupId = "com.fasterxml.jackson.core" +artifactId = "jackson-annotations" +version = "2.15.3" +path = "./lib/jackson-annotations-2.15.3.jar" + +[[platform.java17.dependency]] +groupId = "com.fasterxml.jackson.core" +artifactId = "jackson-core" +version = "2.15.3" +path = "./lib/jackson-core-2.15.3.jar" + +[[platform.java17.dependency]] +groupId = "com.fasterxml.jackson.core" +artifactId = "jackson-databind" +version = "2.15.3" +path = "./lib/jackson-databind-2.15.3.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index d21012b..97b8e3e 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -7,19 +7,6 @@ dependencies-toml-version = "2" distribution-version = "2201.8.0" -[[package]] -org = "ballerina" -name = "io" -version = "1.6.0" -scope = "testOnly" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.value"} -] -modules = [ - {org = "ballerina", packageName = "io", moduleName = "io"} -] - [[package]] org = "ballerina" name = "jballerina.java" @@ -37,15 +24,6 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"} ] -[[package]] -org = "ballerina" -name = "lang.value" -version = "0.0.0" -scope = "testOnly" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - [[package]] org = "ballerina" name = "test" @@ -76,7 +54,6 @@ org = "ballerinax" name = "ibm.ibmmq" version = "0.1.1" dependencies = [ - {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "test"}, {org = "ballerina", name = "time"} From 99d899f22c6466942e4be36df22b1f93a6c8c5be Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Mon, 13 Nov 2023 11:24:02 +0530 Subject: [PATCH 3/5] Add missing license headers --- .../lib/ibm.ibmmq/headers/HeaderUtils.java | 18 ++++++++++++++++++ .../lib/ibm.ibmmq/headers/MQCHIHHeader.java | 18 ++++++++++++++++++ .../lib/ibm.ibmmq/headers/MQRFH2Header.java | 18 ++++++++++++++++++ .../lib/ibm.ibmmq/headers/MQRFHHeader.java | 18 ++++++++++++++++++ 4 files changed, 72 insertions(+) diff --git a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/HeaderUtils.java b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/HeaderUtils.java index d743f51..456810f 100644 --- a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/HeaderUtils.java +++ b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/HeaderUtils.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. 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 io.ballerina.lib.ibm.ibmmq.headers; import com.ibm.mq.MQMessage; diff --git a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQCHIHHeader.java b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQCHIHHeader.java index 8930f9f..02abec7 100644 --- a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQCHIHHeader.java +++ b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQCHIHHeader.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. 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 io.ballerina.lib.ibm.ibmmq.headers; import com.ibm.mq.MQMessage; diff --git a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFH2Header.java b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFH2Header.java index b57c6dd..b761cc6 100644 --- a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFH2Header.java +++ b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFH2Header.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. 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 io.ballerina.lib.ibm.ibmmq.headers; import com.ibm.mq.MQMessage; diff --git a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFHHeader.java b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFHHeader.java index de7e9b8..5084548 100644 --- a/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFHHeader.java +++ b/native/src/main/java/io/ballerina/lib/ibm.ibmmq/headers/MQRFHHeader.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. 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 io.ballerina.lib.ibm.ibmmq.headers; import com.ibm.mq.MQMessage; From b1af824a6c40f01815271cdd64c10e73772965cf Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Mon, 13 Nov 2023 11:25:13 +0530 Subject: [PATCH 4/5] Refactor the code-base --- ballerina/tests/topic_publisher_subscriber_tests.bal | 1 + 1 file changed, 1 insertion(+) diff --git a/ballerina/tests/topic_publisher_subscriber_tests.bal b/ballerina/tests/topic_publisher_subscriber_tests.bal index 3fc84c4..6ad34de 100644 --- a/ballerina/tests/topic_publisher_subscriber_tests.bal +++ b/ballerina/tests/topic_publisher_subscriber_tests.bal @@ -13,6 +13,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + import ballerina/test; @test:Config { From d5215d0129725dd0404fb2faf34dcc2bc1d0eee1 Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Mon, 13 Nov 2023 11:27:04 +0530 Subject: [PATCH 5/5] Refactor the code-base --- ballerina/utils.bal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/utils.bal b/ballerina/utils.bal index 1e1916b..b1858f4 100644 --- a/ballerina/utils.bal +++ b/ballerina/utils.bal @@ -15,7 +15,7 @@ // under the License. // This class is used by the native implementation to add the MQRFH2 fields to a table. -class NativeUtils { +isolated class NativeUtils { // This method is invoked by the native runtime to add the MQRFH2 fields to a table. function addMQRFH2FieldsToTable(MQRFH2Field[] fields) returns table key(folder, 'field) {