This is an automated email from the ASF dual-hosted git repository.

fjtiradosarti pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git


The following commit(s) were added to refs/heads/main by this push:
     new b89e14ddca [Fix_#3353] Adding source to process definition data event 
(#3358)
b89e14ddca is described below

commit b89e14ddca73372a57ea8d7c4c921e6980b6116d
Author: Francisco Javier Tirado Sarti 
<[email protected]>
AuthorDate: Thu Jan 18 19:27:40 2024 +0100

    [Fix_#3353] Adding source to process definition data event (#3358)
    
    * [Fix_#3353] Adding source to process definition data event
    
    * [Fix_#3353] Tiagos comments
---
 addons/common/pom.xml                              |  1 -
 addons/common/source-files/README.md               |  8 ---
 addons/common/source-files/pom.xml                 | 58 ----------------------
 .../addon/source/files/SourceFilesException.java   | 26 ----------
 .../org/kie/kogito}/source/files/SourceFile.java   |  2 +-
 .../kogito}/source/files/SourceFilesProvider.java  |  2 +-
 .../registry/ProcessDefinitionEventRegistry.java   | 35 ++++++++++---
 .../source/files/SourceFilesProviderImpl.java      |  4 +-
 .../source/files/SourceFilesProviderImplTest.java  |  2 +-
 .../META-INF/resources/sources/hiring.bpmn         |  0
 .../META-INF/resources/sources/petstore.json       |  0
 .../META-INF/resources/sources/petstore.sw.json    |  0
 .../META-INF/resources/sources/ymlgreet.sw.yml     |  0
 kogito-bom/pom.xml                                 | 11 ----
 .../SourceFileCodegenBindListenerImpl.java         |  2 +-
 .../files/deployment/FakeSourceFilesRecorder.java  |  2 +-
 .../SourceFileCodegenBindListenerImplTest.java     |  2 +-
 quarkus/addons/source-files/runtime/pom.xml        |  6 +--
 .../source/files/SourceFilesProviderProducer.java  |  2 +
 .../addon/source/files/SourceFilesRecorder.java    |  3 ++
 .../addon/source/files/SourceFilesResource.java    |  2 +
 .../source/files/SourceFilesResourceTest.java      |  2 +
 .../registry/ProcessDefinitionRegistration.java    |  8 ++-
 23 files changed, 52 insertions(+), 126 deletions(-)

diff --git a/addons/common/pom.xml b/addons/common/pom.xml
index cd05d51aab..f5ce7ee0ea 100644
--- a/addons/common/pom.xml
+++ b/addons/common/pom.xml
@@ -41,7 +41,6 @@
     <module>rest-exception-handler</module>
     <module>process-svg</module>
     <module>process-management</module>
-    <module>source-files</module>
     <module>knative</module>
     <module>kubernetes</module>
     <module>kubernetes-service-catalog</module>
diff --git a/addons/common/source-files/README.md 
b/addons/common/source-files/README.md
deleted file mode 100644
index e7b83e3c40..0000000000
--- a/addons/common/source-files/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Kogito Source Files Add-on
-
-The Kogito Source Files Add-on adds the capability of listing and downloading 
source files to Kogito projects. See
-the [official 
documentation](https://docs.jboss.org/kogito/release/latest/html_single/#_kogito_source_files_add_on)
-to find out more.
-
-> **⚠️**
-This add-on isn't supposed to be used by end-users, if not needed for internal 
integrations, since it can be a potential security breach for some users' use 
cases.
\ No newline at end of file
diff --git a/addons/common/source-files/pom.xml 
b/addons/common/source-files/pom.xml
deleted file mode 100644
index 40c0475815..0000000000
--- a/addons/common/source-files/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?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";>
-    <parent>
-        <artifactId>kogito-addons-common-parent</artifactId>
-        <groupId>org.kie.kogito</groupId>
-        <version>999-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>kogito-addons-source-files</artifactId>
-    <name>Kogito :: Add-Ons :: Source Files :: Common</name>
-
-  <properties>
-      <java.module.name>org.kie.kogito.addon.source.files</java.module.name>
-  </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-api</artifactId>
-        </dependency>
-        <!-- Test -->
-
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.assertj</groupId>
-            <artifactId>assertj-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-</project>
\ No newline at end of file
diff --git 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesException.java
 
b/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesException.java
deleted file mode 100644
index e0547471be..0000000000
--- 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.kie.kogito.addon.source.files;
-
-public class SourceFilesException extends RuntimeException {
-
-    public SourceFilesException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
diff --git 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFile.java
 b/api/kogito-api/src/main/java/org/kie/kogito/source/files/SourceFile.java
similarity index 98%
rename from 
addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFile.java
rename to 
api/kogito-api/src/main/java/org/kie/kogito/source/files/SourceFile.java
index ef76d122f1..2c555e22a6 100644
--- 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFile.java
+++ b/api/kogito-api/src/main/java/org/kie/kogito/source/files/SourceFile.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.kie.kogito.addon.source.files;
+package org.kie.kogito.source.files;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
diff --git 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProvider.java
 
b/api/kogito-api/src/main/java/org/kie/kogito/source/files/SourceFilesProvider.java
similarity index 97%
rename from 
addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProvider.java
rename to 
api/kogito-api/src/main/java/org/kie/kogito/source/files/SourceFilesProvider.java
index 0d5791b093..155ad36fdc 100644
--- 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProvider.java
+++ 
b/api/kogito-api/src/main/java/org/kie/kogito/source/files/SourceFilesProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.kie.kogito.addon.source.files;
+package org.kie.kogito.source.files;
 
 import java.util.Collection;
 import java.util.Optional;
diff --git 
a/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java
 
b/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java
index 768cccb744..e3cb1f01f9 100644
--- 
a/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java
+++ 
b/api/kogito-services/src/main/java/org/kie/kogito/services/registry/ProcessDefinitionEventRegistry.java
@@ -18,9 +18,11 @@
  */
 package org.kie.kogito.services.registry;
 
+import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.function.Function;
 import java.util.function.Supplier;
@@ -32,9 +34,12 @@ import org.kie.kogito.event.impl.ProcessEventBatch;
 import org.kie.kogito.event.process.NodeDefinition;
 import org.kie.kogito.event.process.ProcessDefinitionDataEvent;
 import org.kie.kogito.event.process.ProcessDefinitionEventBody;
+import 
org.kie.kogito.event.process.ProcessDefinitionEventBody.ProcessDefinitionEventBodyBuilder;
 import org.kie.kogito.internal.utils.ConversionUtils;
 import org.kie.kogito.process.Process;
 import org.kie.kogito.process.Processes;
+import org.kie.kogito.source.files.SourceFile;
+import org.kie.kogito.source.files.SourceFilesProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,12 +50,18 @@ public class ProcessDefinitionEventRegistry {
 
     private static final Logger LOGGER = 
LoggerFactory.getLogger(ProcessDefinitionEventRegistry.class);
 
-    private Application app;
-    private String serviceUrl;
+    private final Application app;
+    private final String serviceUrl;
+    private final Optional<SourceFilesProvider> sourceFilesProvider;
 
     public ProcessDefinitionEventRegistry(Application app, String serviceUrl) {
+        this(app, serviceUrl, Optional.empty());
+    }
+
+    public ProcessDefinitionEventRegistry(Application app, String serviceUrl, 
Optional<SourceFilesProvider> sourceFilesProvider) {
         this.app = app;
         this.serviceUrl = serviceUrl;
+        this.sourceFilesProvider = sourceFilesProvider;
     }
 
     public void register(Processes processes) {
@@ -78,8 +89,8 @@ public class ProcessDefinitionEventRegistry {
             }
             Set<String> annotations = ((List<String>) 
metadata.getOrDefault("annotations", emptyList())).stream().collect(toSet());
             String description = (String) metadata.get("Description");
-            ProcessDefinitionDataEvent definitionDataEvent = new 
ProcessDefinitionDataEvent(ProcessDefinitionEventBody.builder()
-                    .setId(p.id())
+
+            ProcessDefinitionEventBodyBuilder builder = 
ProcessDefinitionEventBody.builder().setId(p.id())
                     .setName(p.name())
                     .setVersion(p.version())
                     .setType(p.type())
@@ -88,12 +99,22 @@ public class ProcessDefinitionEventRegistry {
                     .setNodes(getNodesDefinitions(p))
                     .setAnnotations(annotations)
                     .setDescription(description)
-                    .setMetadata(metadata)
-                    .build());
-            return definitionDataEvent;
+                    .setMetadata(metadata);
+            sourceFilesProvider.flatMap(provider -> 
provider.getProcessSourceFile(p.id())).map(this::readSourceFile).ifPresentOrElse(builder::setSource,
+                    () -> LOGGER.warn("Not source found for process id {}", 
p.id()));
+            return new ProcessDefinitionDataEvent(builder.build());
         };
     }
 
+    private String readSourceFile(SourceFile s) {
+        try {
+            return new String(s.readContents());
+        } catch (IOException e) {
+            LOGGER.warn("Error reading content for source file {}", s, e);
+            return null;
+        }
+    }
+
     private static String getEndpoint(String endpoint, Process<?> p) {
         //sanitize process path in case of fqdn org.acme.ProcessExample -> 
ProcessExample
         String processPath = ConversionUtils.sanitizeToSimpleName(p.id());
diff --git 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderImpl.java
 
b/api/kogito-services/src/main/java/org/kie/kogito/source/files/SourceFilesProviderImpl.java
similarity index 96%
rename from 
addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderImpl.java
rename to 
api/kogito-services/src/main/java/org/kie/kogito/source/files/SourceFilesProviderImpl.java
index 336a1da4d1..b531f8d4a9 100644
--- 
a/addons/common/source-files/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderImpl.java
+++ 
b/api/kogito-services/src/main/java/org/kie/kogito/source/files/SourceFilesProviderImpl.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.kie.kogito.addon.source.files;
+package org.kie.kogito.source.files;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -50,7 +50,7 @@ public final class SourceFilesProviderImpl implements 
SourceFilesProvider {
     }
 
     @Override
-    public Optional<SourceFile> getProcessSourceFile(String processId) throws 
SourceFilesException {
+    public Optional<SourceFile> getProcessSourceFile(String processId) {
         return getProcessSourceFiles(processId).stream()
                 .filter(this::isValidDefinitionSource)
                 .findFirst();
diff --git 
a/addons/common/source-files/src/test/java/org/kie/kogito/addon/source/files/SourceFilesProviderImplTest.java
 
b/api/kogito-services/src/test/java/org/kie/kogito/source/files/SourceFilesProviderImplTest.java
similarity index 98%
rename from 
addons/common/source-files/src/test/java/org/kie/kogito/addon/source/files/SourceFilesProviderImplTest.java
rename to 
api/kogito-services/src/test/java/org/kie/kogito/source/files/SourceFilesProviderImplTest.java
index 402d860269..c919bc7cb7 100644
--- 
a/addons/common/source-files/src/test/java/org/kie/kogito/addon/source/files/SourceFilesProviderImplTest.java
+++ 
b/api/kogito-services/src/test/java/org/kie/kogito/source/files/SourceFilesProviderImplTest.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.kie.kogito.addon.source.files;
+package org.kie.kogito.source.files;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
diff --git 
a/addons/common/source-files/src/test/resources/META-INF/resources/sources/hiring.bpmn
 b/api/kogito-services/src/test/resources/META-INF/resources/sources/hiring.bpmn
similarity index 100%
rename from 
addons/common/source-files/src/test/resources/META-INF/resources/sources/hiring.bpmn
rename to 
api/kogito-services/src/test/resources/META-INF/resources/sources/hiring.bpmn
diff --git 
a/addons/common/source-files/src/test/resources/META-INF/resources/sources/petstore.json
 
b/api/kogito-services/src/test/resources/META-INF/resources/sources/petstore.json
similarity index 100%
rename from 
addons/common/source-files/src/test/resources/META-INF/resources/sources/petstore.json
rename to 
api/kogito-services/src/test/resources/META-INF/resources/sources/petstore.json
diff --git 
a/addons/common/source-files/src/test/resources/META-INF/resources/sources/petstore.sw.json
 
b/api/kogito-services/src/test/resources/META-INF/resources/sources/petstore.sw.json
similarity index 100%
rename from 
addons/common/source-files/src/test/resources/META-INF/resources/sources/petstore.sw.json
rename to 
api/kogito-services/src/test/resources/META-INF/resources/sources/petstore.sw.json
diff --git 
a/addons/common/source-files/src/test/resources/META-INF/resources/sources/ymlgreet.sw.yml
 
b/api/kogito-services/src/test/resources/META-INF/resources/sources/ymlgreet.sw.yml
similarity index 100%
rename from 
addons/common/source-files/src/test/resources/META-INF/resources/sources/ymlgreet.sw.yml
rename to 
api/kogito-services/src/test/resources/META-INF/resources/sources/ymlgreet.sw.yml
diff --git a/kogito-bom/pom.xml b/kogito-bom/pom.xml
index d38f4e4a77..d916bb9eee 100755
--- a/kogito-bom/pom.xml
+++ b/kogito-bom/pom.xml
@@ -1185,17 +1185,6 @@
         <classifier>sources</classifier>
       </dependency>
 
-      <dependency>
-        <groupId>org.kie.kogito</groupId>
-        <artifactId>kogito-addons-source-files</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.kie.kogito</groupId>
-        <artifactId>kogito-addons-source-files</artifactId>
-        <version>${project.version}</version>
-        <classifier>sources</classifier>
-      </dependency>
       <dependency>
         <groupId>org.kie.kogito</groupId>
         <artifactId>kogito-addons-quarkus-source-files</artifactId>
diff --git 
a/quarkus/addons/source-files/deployment/src/main/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImpl.java
 
b/quarkus/addons/source-files/deployment/src/main/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImpl.java
index d295429ecb..280b1f580e 100644
--- 
a/quarkus/addons/source-files/deployment/src/main/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImpl.java
+++ 
b/quarkus/addons/source-files/deployment/src/main/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImpl.java
@@ -22,10 +22,10 @@ import java.io.File;
 import java.nio.file.Path;
 import java.util.Arrays;
 
-import org.kie.kogito.addon.source.files.SourceFile;
 import org.kie.kogito.addon.source.files.SourceFilesRecorder;
 import org.kie.kogito.codegen.api.SourceFileCodegenBindEvent;
 import org.kie.kogito.codegen.api.SourceFileCodegenBindListener;
+import org.kie.kogito.source.files.SourceFile;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git 
a/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/FakeSourceFilesRecorder.java
 
b/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/FakeSourceFilesRecorder.java
index 674b57acfa..454f5c837d 100644
--- 
a/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/FakeSourceFilesRecorder.java
+++ 
b/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/FakeSourceFilesRecorder.java
@@ -24,8 +24,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.kie.kogito.addon.source.files.SourceFile;
 import org.kie.kogito.addon.source.files.SourceFilesRecorder;
+import org.kie.kogito.source.files.SourceFile;
 
 final class FakeSourceFilesRecorder extends SourceFilesRecorder {
 
diff --git 
a/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImplTest.java
 
b/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImplTest.java
index 8edb01fa43..fe3525efa9 100644
--- 
a/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImplTest.java
+++ 
b/quarkus/addons/source-files/deployment/src/test/java/org/kie/kogito/addon/source/files/deployment/SourceFileCodegenBindListenerImplTest.java
@@ -24,8 +24,8 @@ import java.util.stream.Stream;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
-import org.kie.kogito.addon.source.files.SourceFile;
 import org.kie.kogito.codegen.api.SourceFileCodegenBindEvent;
+import org.kie.kogito.source.files.SourceFile;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
diff --git a/quarkus/addons/source-files/runtime/pom.xml 
b/quarkus/addons/source-files/runtime/pom.xml
index e297424892..9cdc09cc4e 100644
--- a/quarkus/addons/source-files/runtime/pom.xml
+++ b/quarkus/addons/source-files/runtime/pom.xml
@@ -53,14 +53,10 @@
     <dependency>
       <groupId>io.quarkus</groupId>
       <artifactId>quarkus-arc</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.kie.kogito</groupId>
-      <artifactId>kogito-addons-source-files</artifactId>
     </dependency>
         <dependency>
             <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-api</artifactId>
+            <artifactId>kogito-services</artifactId>
         </dependency>
         <dependency>
             <groupId>org.kie.kogito</groupId>
diff --git 
a/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderProducer.java
 
b/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderProducer.java
index dc4ac4d01d..19ab1f0ebe 100644
--- 
a/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderProducer.java
+++ 
b/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesProviderProducer.java
@@ -18,6 +18,8 @@
  */
 package org.kie.kogito.addon.source.files;
 
+import org.kie.kogito.source.files.SourceFilesProviderImpl;
+
 import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.enterprise.inject.Default;
 import jakarta.enterprise.inject.Produces;
diff --git 
a/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesRecorder.java
 
b/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesRecorder.java
index 4cadb22c29..44c137a1e2 100644
--- 
a/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesRecorder.java
+++ 
b/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesRecorder.java
@@ -18,6 +18,9 @@
  */
 package org.kie.kogito.addon.source.files;
 
+import org.kie.kogito.source.files.SourceFile;
+import org.kie.kogito.source.files.SourceFilesProviderImpl;
+
 import io.quarkus.runtime.annotations.Recorder;
 
 import jakarta.enterprise.inject.spi.CDI;
diff --git 
a/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesResource.java
 
b/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesResource.java
index a347cf8293..6165d773ab 100644
--- 
a/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesResource.java
+++ 
b/quarkus/addons/source-files/runtime/src/main/java/org/kie/kogito/addon/source/files/SourceFilesResource.java
@@ -24,6 +24,8 @@ import java.io.InputStream;
 import java.util.Collection;
 
 import org.kie.kogito.resource.exceptions.ExceptionsHandler;
+import org.kie.kogito.source.files.SourceFile;
+import org.kie.kogito.source.files.SourceFilesProvider;
 
 import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.inject.Inject;
diff --git 
a/quarkus/addons/source-files/runtime/src/test/java/org/kie/kogito/addon/source/files/SourceFilesResourceTest.java
 
b/quarkus/addons/source-files/runtime/src/test/java/org/kie/kogito/addon/source/files/SourceFilesResourceTest.java
index 234b555d94..642bf95be8 100644
--- 
a/quarkus/addons/source-files/runtime/src/test/java/org/kie/kogito/addon/source/files/SourceFilesResourceTest.java
+++ 
b/quarkus/addons/source-files/runtime/src/test/java/org/kie/kogito/addon/source/files/SourceFilesResourceTest.java
@@ -22,6 +22,8 @@ import java.util.Optional;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.kie.kogito.source.files.SourceFile;
+import org.kie.kogito.source.files.SourceFilesProvider;
 import org.mockito.Mock;
 
 import io.quarkus.test.junit.QuarkusTest;
diff --git 
a/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/src/main/java/org/kie/kogito/quarkus/registry/ProcessDefinitionRegistration.java
 
b/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/src/main/java/org/kie/kogito/quarkus/registry/ProcessDefinitionRegistration.java
index a9bc0fa236..9350eabc4c 100644
--- 
a/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/src/main/java/org/kie/kogito/quarkus/registry/ProcessDefinitionRegistration.java
+++ 
b/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/src/main/java/org/kie/kogito/quarkus/registry/ProcessDefinitionRegistration.java
@@ -18,10 +18,13 @@
  */
 package org.kie.kogito.quarkus.registry;
 
+import java.util.Optional;
+
 import org.kie.kogito.Application;
 import org.kie.kogito.process.Processes;
 import org.kie.kogito.quarkus.config.KogitoRuntimeConfig;
 import org.kie.kogito.services.registry.ProcessDefinitionEventRegistry;
+import org.kie.kogito.source.files.SourceFilesProvider;
 
 import io.quarkus.runtime.StartupEvent;
 
@@ -37,9 +40,10 @@ public class ProcessDefinitionRegistration {
     ProcessDefinitionEventRegistry processDefinitionRegistry;
 
     @Inject
-    public ProcessDefinitionRegistration(Application application, 
KogitoRuntimeConfig runtimeConfig, Instance<Processes> processes) {
+    public ProcessDefinitionRegistration(Application application, 
KogitoRuntimeConfig runtimeConfig, Instance<Processes> processes, 
Instance<SourceFilesProvider> sourceFilesProvider) {
         this.processes = processes;
-        this.processDefinitionRegistry = new 
ProcessDefinitionEventRegistry(application, 
runtimeConfig.serviceUrl.orElse(null));
+        this.processDefinitionRegistry =
+                new ProcessDefinitionEventRegistry(application, 
runtimeConfig.serviceUrl.orElse(null), sourceFilesProvider.isResolvable() ? 
Optional.of(sourceFilesProvider.get()) : Optional.empty());
     }
 
     void onStartUp(@Observes StartupEvent startupEvent) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to