Skip to content

Commit 50e49d5

Browse files
committed
⬆️ Updated JBang scripts to use Java 25 and latest dependencies
1 parent 167f052 commit 50e49d5

5 files changed

Lines changed: 57 additions & 37 deletions

File tree

jbang_scripts/GrabBundles.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22
//REPOS mavencentral,github=https://maven.pkg.github.com/rmcdouga/*
3-
//DEPS info.picocli:picocli:4.6.3
4-
//DEPS com.github.rmcdouga:github-package-repo:0.0.1-SNAPSHOT
5-
//DEPS org.slf4j:slf4j-simple:1.7.36
6-
//JAVA 17+
3+
//DEPS info.picocli:picocli:4.7.7
4+
//DEPS com.github.rmcdouga:github-package-repo:0.0.2-SNAPSHOT
5+
//DEPS org.slf4j:slf4j-simple:2.0.17
6+
//JAVA 25+
77

88
import picocli.CommandLine;
99
import picocli.CommandLine.Command;
@@ -56,13 +56,13 @@ public Integer call() throws Exception {
5656
packages.repo("4PointSolutions", "FluentFormsAPI")
5757
.group("com._4point.aem.docservices")
5858
.artifact("rest-services.server")
59-
.version("0.0.3-SNAPSHOT")
59+
.version("0.0.3")
6060
.copyTo(dest, StandardCopyOption.REPLACE_EXISTING);
6161

6262
packages.repo("4PointSolutions", "FluentFormsAPI")
6363
.group("com._4point.aem")
6464
.artifact("fluentforms.core")
65-
.version("0.0.3-SNAPSHOT")
65+
.version("0.0.3")
6666
.copyTo(dest, StandardCopyOption.REPLACE_EXISTING);
6767

6868
return 0;

jbang_scripts/SmokeTest_Forms.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22
//REPOS mavencentral,github=https://maven.pkg.github.com/4PointSolutions/*
3-
//DEPS com._4point.aem:fluentforms.core:0.0.3-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.3-SNAPSHOT
4-
//JAVA 21+
3+
//DEPS com._4point.aem:fluentforms.core:0.0.5-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.5-SNAPSHOT
4+
//DEPS com._4point.aem.docservices.rest-services:rest-services.jersey-client:0.0.5-SNAPSHOT
5+
//JAVA 25+
56

67
/*
8+
* This script performs a smoke test of the AEM Forms FormsService via FluentForms by rendering a simple PDF form from an XDP
9+
*
710
* This script uses the 4PointSolutions/FluentFormsAPI GitHub package repository. GitHub requires a user to authenticate in order
811
* to access a package repository. In order for this script to work, you need to have your personal credentials configured
912
* in your local settings.xml file (found in you $HOME/.m2 directory).
@@ -28,6 +31,7 @@
2831
import java.nio.file.StandardCopyOption;
2932

3033
import com._4point.aem.docservices.rest_services.client.forms.RestServicesFormsServiceAdapter;
34+
import com._4point.aem.docservices.rest_services.client.jersey.JerseyRestClient;
3135
import com._4point.aem.fluentforms.api.Document;
3236
import com._4point.aem.fluentforms.impl.UsageContext;
3337
import com._4point.aem.fluentforms.impl.forms.FormsServiceImpl;
@@ -41,7 +45,7 @@ public static void main(String... args) {
4145
Path outLocation = Files.createTempFile("AemForms_SmokeTest", ".pdf");
4246

4347
// If AEM is not localhost:4502 or does not use default credentials, change the values below.
44-
var adapter = RestServicesFormsServiceAdapter.builder()
48+
var adapter = RestServicesFormsServiceAdapter.builder(JerseyRestClient.factory())
4549
.machineName("localhost")
4650
.port(4502)
4751
.basicAuthentication("admin", "admin")

jbang_scripts/SmokeTest_Output.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22
//REPOS mavencentral,github=https://maven.pkg.github.com/4PointSolutions/*
3-
//DEPS com._4point.aem:fluentforms.core:0.0.3-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.3-SNAPSHOT
4-
//JAVA 21+
3+
//DEPS com._4point.aem:fluentforms.core:0.0.5-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.5-SNAPSHOT
4+
//DEPS com._4point.aem.docservices.rest-services:rest-services.jersey-client:0.0.5-SNAPSHOT
5+
//JAVA 25+
56

67
/*
8+
* This script demonstrates how to use FluentForms to invoke AEM Forms OutputService to render a PDF form from an XDP
9+
*
710
* This script uses the 4PointSolutions/FluentFormsAPI GitHub package repository. GitHub requires a user to authenticate in order
811
* to access a package repository. In order for this script to work, you need to have your personal credentials configured
912
* in your local settings.xml file (found in you $HOME/.m2 directory).
@@ -27,6 +30,7 @@
2730
import java.nio.file.Path;
2831
import java.nio.file.StandardCopyOption;
2932

33+
import com._4point.aem.docservices.rest_services.client.jersey.JerseyRestClient;
3034
import com._4point.aem.docservices.rest_services.client.output.RestServicesOutputServiceAdapter;
3135
import com._4point.aem.fluentforms.api.Document;
3236
import com._4point.aem.fluentforms.impl.UsageContext;
@@ -41,7 +45,7 @@ public static void main(String... args) {
4145
Path outLocation = Files.createTempFile("AemOutput_SmokeTest", ".pdf");
4246

4347
// If AEM is not localhost:4502 or does not use default credentials, change the values below.
44-
var adapter = RestServicesOutputServiceAdapter.builder()
48+
var adapter = RestServicesOutputServiceAdapter.builder(JerseyRestClient.factory())
4549
.machineName("localhost")
4650
.port(4502)
4751
.basicAuthentication("admin", "admin")

jbang_scripts/invoke_forms.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22
//REPOS mavencentral,github=https://maven.pkg.github.com/4PointSolutions/*
3-
//DEPS info.picocli:picocli:4.6.3
4-
//DEPS com._4point.aem:fluentforms.core:0.0.3-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.3-SNAPSHOT
5-
//JAVA 11+
3+
//DEPS info.picocli:picocli:4.7.7
4+
//DEPS com._4point.aem:fluentforms.core:0.0.5-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.5-SNAPSHOT
5+
//DEPS com._4point.aem.docservices.rest-services:rest-services.jersey-client:0.0.5-SNAPSHOT
6+
//JAVA 25+
67

78
/*
9+
* This script demonstrates how to use FluentForms to invoke AEM Forms FormsService to render an interactive PDF form from
10+
* an XDP that resides on the AEM server. It can optionally use a local XML data file to populate the form with data.
11+
*
12+
* For example, to invoke this script against an AEM instance configured for the project's integration tests:
13+
* jbang invoke_forms.java -f /opt/adobe/ff_it_files/SampleForm.xdp -o result_forms.pdf
14+
*
815
* This script uses the 4PointSolutions/FluentFormsAPI GitHub package repository. GitHub requires a user to authenticate in order
916
* to access a package repository. In order for this script to work, you need to have your personal credentials configured
1017
* in your local settings.xml file (found in you $HOME/.m2 directory).
@@ -28,7 +35,9 @@
2835
import java.util.concurrent.Callable;
2936

3037
import com._4point.aem.docservices.rest_services.client.forms.RestServicesFormsServiceAdapter;
38+
import com._4point.aem.docservices.rest_services.client.jersey.JerseyRestClient;
3139
import com._4point.aem.fluentforms.api.Document;
40+
import com._4point.aem.fluentforms.api.PathOrUrl;
3241
import com._4point.aem.fluentforms.impl.SimpleDocumentFactoryImpl;
3342
import com._4point.aem.fluentforms.impl.UsageContext;
3443
import com._4point.aem.fluentforms.impl.forms.FormsServiceImpl;
@@ -43,7 +52,7 @@
4352
class invoke_aem implements Callable<Integer> {
4453

4554
@Option(names = {"-f", "--form"}, description = "A filepath to the XDP.", required = true)
46-
private Path xdpLocation;
55+
private String xdpLocation;
4756

4857
@Option(names = {"-d", "--data"}, description = "A filepath to the XML data file. (Optional)")
4958
private Path xmlLocation;
@@ -59,9 +68,9 @@ public static void main(String... args) {
5968
@Override
6069
public Integer call() throws Exception {
6170

62-
var adapter = RestServicesFormsServiceAdapter.builder()
71+
var adapter = RestServicesFormsServiceAdapter.builder(JerseyRestClient.factory())
6372
.machineName("localhost")
64-
.port(4502)
73+
.port(54740)
6574
.basicAuthentication("admin", "admin")
6675
.useSsl(false)
6776
.build();
@@ -78,13 +87,10 @@ public Integer call() throws Exception {
7887
// .setXci(xci)
7988
.setTaggedPDF(true);
8089

81-
if (Files.exists(xdpLocation)) {
82-
builder = builder.setContentRoot(xdpLocation.toAbsolutePath().getParent());
83-
}
84-
90+
PathOrUrl xdpPathOrUrl = PathOrUrl.from(xdpLocation);
8591
Document pdfResult = xmlLocation == null ?
86-
builder.executeOn(xdpLocation.getFileName()) :
87-
builder.executeOn(xdpLocation.getFileName(), SimpleDocumentFactoryImpl.getFactory().create(xmlLocation.toFile()));
92+
builder.executeOn(xdpPathOrUrl) :
93+
builder.executeOn(xdpPathOrUrl, SimpleDocumentFactoryImpl.getFactory().create(Files.readAllBytes(xmlLocation)));
8894

8995
System.out.println("Writing output to " + outLocation);
9096
Files.copy(pdfResult.getInputStream(), outLocation, StandardCopyOption.REPLACE_EXISTING);

jbang_scripts/invoke_output.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22
//REPOS mavencentral,github=https://maven.pkg.github.com/4PointSolutions/*
3-
//DEPS info.picocli:picocli:4.6.3
4-
//DEPS com._4point.aem:fluentforms.core:0.0.3-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.3-SNAPSHOT
5-
//JAVA 11+
3+
//DEPS info.picocli:picocli:4.7.7
4+
//DEPS com._4point.aem:fluentforms.core:0.0.5-SNAPSHOT com._4point.aem.docservices:rest-services.client:0.0.5-SNAPSHOT
5+
//DEPS com._4point.aem.docservices.rest-services:rest-services.jersey-client:0.0.5-SNAPSHOT
6+
//JAVA 25+
67

78
/*
9+
* This script demonstrates how to use FluentForms to invoke AEM Forms OutputService to render a non-interactive PDF form from
10+
* an XDP that resides on the AEM server. It can optionally use a local XML data file to populate the form with data.
11+
*
12+
* For example, to invoke this script against an AEM instance configured for the project's integration tests:
13+
* jbang invoke_output.java -f /opt/adobe/ff_it_files/SampleForm.xdp -o result_output.pdf
14+
*
815
* This script uses the 4PointSolutions/FluentFormsAPI GitHub package repository. GitHub requires a user to authenticate in order
916
* to access a package repository. In order for this script to work, you need to have your personal credentials configured
1017
* in your local settings.xml file (found in you $HOME/.m2 directory).
@@ -27,8 +34,10 @@
2734
import java.nio.file.StandardCopyOption;
2835
import java.util.concurrent.Callable;
2936

37+
import com._4point.aem.docservices.rest_services.client.jersey.JerseyRestClient;
3038
import com._4point.aem.docservices.rest_services.client.output.RestServicesOutputServiceAdapter;
3139
import com._4point.aem.fluentforms.api.Document;
40+
import com._4point.aem.fluentforms.api.PathOrUrl;
3241
import com._4point.aem.fluentforms.impl.SimpleDocumentFactoryImpl;
3342
import com._4point.aem.fluentforms.impl.UsageContext;
3443
import com._4point.aem.fluentforms.impl.output.OutputServiceImpl;
@@ -43,7 +52,7 @@
4352
class invoke_aem implements Callable<Integer> {
4453

4554
@Option(names = {"-f", "--form"}, description = "A filepath to the XDP.", required = true)
46-
private Path xdpLocation;
55+
private String xdpLocation;
4756

4857
@Option(names = {"-d", "--data"}, description = "A filepath to the XML data file. (Optional)")
4958
private Path xmlLocation;
@@ -59,9 +68,9 @@ public static void main(String... args) {
5968
@Override
6069
public Integer call() throws Exception {
6170

62-
var adapter = RestServicesOutputServiceAdapter.builder()
63-
.machineName("172.18.110.35")
64-
.port(4502)
71+
var adapter = RestServicesOutputServiceAdapter.builder(JerseyRestClient.factory())
72+
.machineName("localhost")
73+
.port(54740)
6574
.basicAuthentication("admin", "admin")
6675
.useSsl(false)
6776
.build();
@@ -79,13 +88,10 @@ public Integer call() throws Exception {
7988
// .setRetainUnsignedSignatureFields(true)
8089
.setTaggedPDF(true);
8190

82-
if (Files.exists(xdpLocation)) {
83-
builder = builder.setContentRoot(xdpLocation.toAbsolutePath().getParent());
84-
}
85-
91+
PathOrUrl xdpPathOrUrl = PathOrUrl.from(xdpLocation);
8692
Document pdfResult = xmlLocation == null ?
87-
builder.executeOn(xdpLocation.getFileName()) :
88-
builder.executeOn(xdpLocation.getFileName(), SimpleDocumentFactoryImpl.getFactory().create(xmlLocation.toFile()));
93+
builder.executeOn(xdpPathOrUrl) :
94+
builder.executeOn(xdpPathOrUrl, SimpleDocumentFactoryImpl.getFactory().create(Files.readAllBytes(xmlLocation)));
8995

9096
System.out.println("Writing output to " + outLocation);
9197
Files.copy(pdfResult.getInputStream(), outLocation, StandardCopyOption.REPLACE_EXISTING);

0 commit comments

Comments
 (0)