-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #115: Record build config and produce bean
- Loading branch information
Showing
8 changed files
with
187 additions
and
64 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
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
39 changes: 39 additions & 0 deletions
39
runtime/src/main/java/io/quarkiverse/jasperreports/JasperReportsBeanProducer.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,39 @@ | ||
package io.quarkiverse.jasperreports; | ||
|
||
import java.nio.file.Path; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.context.Dependent; | ||
import jakarta.enterprise.inject.Produces; | ||
|
||
import io.quarkiverse.jasperreports.repository.ReadOnlyStreamingService; | ||
|
||
/** | ||
* A bean producer for JasperReports-related services. | ||
* This class is responsible for initializing and producing the ReadOnlyStreamingService. | ||
*/ | ||
@ApplicationScoped | ||
public class JasperReportsBeanProducer { | ||
|
||
private volatile Path destinationPath; | ||
|
||
/** | ||
* Initializes the bean producer with the destination path for JasperReports files. | ||
* | ||
* @param destinationPath The path where compiled JasperReports files are located. | ||
*/ | ||
void initialize(Path destinationPath) { | ||
this.destinationPath = destinationPath; | ||
} | ||
|
||
/** | ||
* Produces a ReadOnlyStreamingService instance. | ||
* | ||
* @return A new ReadOnlyStreamingService initialized with the destination path. | ||
*/ | ||
@Dependent | ||
@Produces | ||
public ReadOnlyStreamingService readOnlyStreamingService() { | ||
return new ReadOnlyStreamingService(this.destinationPath); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
runtime/src/main/java/io/quarkiverse/jasperreports/JasperReportsRecorder.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,24 @@ | ||
package io.quarkiverse.jasperreports; | ||
|
||
import io.quarkiverse.jasperreports.config.ReportBuildTimeConfig; | ||
import io.quarkus.arc.runtime.BeanContainer; | ||
import io.quarkus.runtime.annotations.Recorder; | ||
|
||
/** | ||
* Recorder for JasperReports initialization. | ||
* This class is responsible for initializing the JasperReportsBeanProducer at runtime. | ||
*/ | ||
@Recorder | ||
public class JasperReportsRecorder { | ||
|
||
/** | ||
* Initializes the JasperReportsBeanProducer with the configured destination path. | ||
* | ||
* @param container The BeanContainer used to retrieve the JasperReportsBeanProducer instance. | ||
* @param config The ReportBuildTimeConfig containing the build configuration. | ||
*/ | ||
public void initProducer(BeanContainer container, ReportBuildTimeConfig config) { | ||
JasperReportsBeanProducer producer = container.beanInstance(JasperReportsBeanProducer.class); | ||
producer.initialize(config.build().destination()); | ||
} | ||
} |
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
Oops, something went wrong.