Skip to content

Commit eb7cd86

Browse files
committed
Update for latest eXist-db (5.2.0) and XMLCalabash (1.1.30-99)
1 parent 72e3ea2 commit eb7cd86

File tree

28 files changed

+1155
-119
lines changed

28 files changed

+1155
-119
lines changed

pom.xml

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<licenses>
2727
<license>
28-
<name>&gt;GNU Lesser General Public License, version 3</name>
28+
<name>GNU Lesser General Public License, version 3</name>
2929
<url>https://opensource.org/licenses/LGPL-3</url>
3030
<distribution>repo</distribution>
3131
</license>
@@ -40,7 +40,11 @@
4040

4141
<properties>
4242
<xproc.xmlcalabash.module.namespace>http://exist-db.org/xquery/xproc/xmlcalabash</xproc.xmlcalabash.module.namespace>
43-
<xmlcalabash.version>1.1.15-96</xmlcalabash.version>
43+
<existdb.version>5.2.0</existdb.version>
44+
<xmlcalabash.version>1.1.30-99</xmlcalabash.version>
45+
<saxon.version>9.9.1-6</saxon.version> <!-- NOTE this must be compatible with the version used by both eXist-db and XML Calabash -->
46+
<xmlresolver.version>1.0.4</xmlresolver.version> <!-- NOTE this must be compatible with the version used by XML Calabash -->
47+
<xmlapis.version>1.4.01</xmlapis.version> <!-- NOTE this must be compatible with the version used by eXist-db -->
4448

4549
<java.version>1.8</java.version>
4650
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -59,7 +63,7 @@
5963
<dependency>
6064
<groupId>org.exist-db</groupId>
6165
<artifactId>exist-core</artifactId>
62-
<version>3.0</version>
66+
<version>${existdb.version}</version>
6367
<scope>provided</scope>
6468
</dependency>
6569
<dependency>
@@ -68,20 +72,51 @@
6872
<version>${xmlcalabash.version}</version>
6973
</dependency>
7074
<dependency>
71-
<groupId>com.google.code.findbugs</groupId>
72-
<artifactId>jsr305</artifactId>
73-
<version>3.0.2</version>
75+
<groupId>org.xmlresolver</groupId>
76+
<artifactId>xmlresolver</artifactId>
77+
<version>${xmlresolver.version}</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>net.sf.saxon</groupId>
81+
<artifactId>Saxon-HE</artifactId>
82+
<version>9.9.1-6</version>
83+
</dependency>
84+
<dependency>
85+
<groupId>com.evolvedbinary.j8fu</groupId>
86+
<artifactId>j8fu</artifactId>
87+
<version>1.23.0</version>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.apache.logging.log4j</groupId>
91+
<artifactId>log4j-api</artifactId>
92+
<version>2.13.1</version>
93+
</dependency>
94+
<dependency>
95+
<groupId>xml-apis</groupId>
96+
<artifactId>xml-apis</artifactId>
97+
<version>${xmlapis.version}</version>
7498
</dependency>
7599
<dependency>
76100
<groupId>junit</groupId>
77101
<artifactId>junit</artifactId>
78102
<version>4.13</version>
79103
<scope>test</scope>
80104
</dependency>
81-
82105
</dependencies>
83106

84107
<build>
108+
109+
<testResources>
110+
<testResource>
111+
<directory>src/test/resources</directory>
112+
<filtering>false</filtering>
113+
</testResource>
114+
<testResource>
115+
<directory>src/test/resources-filtered</directory>
116+
<filtering>true</filtering>
117+
</testResource>
118+
</testResources>
119+
85120
<plugins>
86121
<plugin>
87122
<groupId>com.mycila</groupId>
@@ -118,6 +153,19 @@
118153
</excludes>
119154
</configuration>
120155
</plugin>
156+
<plugin>
157+
<groupId>org.apache.maven.plugins</groupId>
158+
<artifactId>maven-dependency-plugin</artifactId>
159+
<version>3.1.2</version>
160+
<executions>
161+
<execution>
162+
<id>analyze</id>
163+
<goals>
164+
<goal>analyze-only</goal>
165+
</goals>
166+
</execution>
167+
</executions>
168+
</plugin>
121169
<plugin>
122170
<groupId>org.apache.maven.plugins</groupId>
123171
<artifactId>maven-compiler-plugin</artifactId>
@@ -149,6 +197,14 @@
149197
</execution>
150198
</executions>
151199
</plugin>
200+
<plugin>
201+
<groupId>org.apache.maven.plugins</groupId>
202+
<artifactId>maven-surefire-plugin</artifactId>
203+
<version>3.0.0-M4</version>
204+
<configuration>
205+
<argLine>-Dlog4j.configurationFile=${project.build.testOutputDirectory}/log4j2.xml</argLine>
206+
</configuration>
207+
</plugin>
152208
<plugin>
153209
<groupId>org.apache.maven.plugins</groupId>
154210
<artifactId>maven-jar-plugin</artifactId>
@@ -262,18 +318,24 @@
262318
<shadedClassifierName>exist</shadedClassifierName>
263319
<artifactSet>
264320
<excludes>
265-
<exclude>com.thaiopensource:jing</exclude>
321+
<exclude>com.ibm.icu:icu4j</exclude>
322+
<exclude>xml-apis:xml-apis</exclude>
323+
<exclude>xerces:xercesImpl</exclude>
324+
<exclude>org.relaxng:jing</exclude>
325+
<exclude>org.ccil.cowan.tagsoup:tagsoup</exclude>
326+
<exclude>com.google.code.findbugs:jsr305</exclude>
327+
<exclude>isorelax:isorelax</exclude>
328+
<exclude>javax.servlet:javax.servlet-api</exclude>
266329
<exclude>commons-codec:commons-codec</exclude>
267330
<exclude>commons-io:commons-io</exclude>
268331
<exclude>commons-logging:commons-logging</exclude>
269332
<exclude>org.apache.logging.log4j:*</exclude>
270333
<exclude>org.apache.ant:*</exclude>
271334
<exclude>net.sf.saxon:Saxon-HE</exclude>
272-
<exclude>javax.servlet:javax.servlet-api</exclude>
273335
<exclude>org.apache.httpcomponents:*</exclude>
274336
<exclude>commons-fileupload:commons-fileupload</exclude>
275337
<exclude>org.slf4j:*</exclude>
276-
<exclude>isorelax:isorelax</exclude>
338+
<exclude>com.evolvedbinary.j8fu:j8fu</exclude>
277339
</excludes>
278340
</artifactSet>
279341
<transformers>
@@ -290,6 +352,9 @@
290352
<resource>META-INF/README.md</resource>
291353
<file>README.md</file>
292354
</transformer>
355+
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
356+
<resource>log4j2.xml</resource>
357+
</transformer>
293358
</transformers>
294359
</configuration>
295360
</execution>

src/main/java/org/exist/xquery/xproc/xmlcalabash/EXistURIResolver.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.File;
2323
import java.io.FileInputStream;
2424
import java.io.IOException;
25+
import java.io.InputStream;
2526
import java.lang.reflect.Array;
2627
import java.net.MalformedURLException;
2728
import java.net.URI;
@@ -333,8 +334,8 @@ private Source databaseSource(final String path) throws TransformerException {
333334

334335
final Source source;
335336
if (doc instanceof BinaryDocument) {
336-
final Path p = broker.getBinaryFile((BinaryDocument) doc);
337-
source = new StreamSource(p.toFile());
337+
final InputStream is = broker.getBinaryResource((BinaryDocument) doc);
338+
source = new StreamSource(is);
338339
source.setSystemId(path);
339340
return source;
340341
} else {

src/main/java/org/exist/xquery/xproc/xmlcalabash/ProcessFunction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class ProcessFunction extends BasicFunction {
6262
private final static FunctionParameterSequenceType OPTIONS =
6363
new FunctionParameterSequenceType("options", Type.NODE, Cardinality.ZERO_OR_MORE, "Options");
6464

65-
private final static FunctionReturnSequenceType RETURN = new FunctionReturnSequenceType(Type.ITEM, Cardinality.ZERO_OR_ONE, "return type");
65+
private final static FunctionReturnSequenceType RETURN = new FunctionReturnSequenceType(Type.MAP, Cardinality.ZERO_OR_ONE, "return type");
6666

6767
static final FunctionSignature FNS_PROCESS_1 = new FunctionSignature(
6868
NAME,
@@ -135,11 +135,11 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
135135
final URI baseUri = getStaticBaseURI();
136136

137137
// execute the XProc
138-
Map<String, org.apache.commons.io.output.ByteArrayOutputStream> outputs =
138+
Map<String, ByteArrayOutputStream> outputs =
139139
XProcRunner.run(baseUri, context.getBroker(), userArgs, primary.orElse(null));
140140

141141
final MapType map = new MapType(context);
142-
for (Map.Entry<String, org.apache.commons.io.output.ByteArrayOutputStream> output : outputs.entrySet()) {
142+
for (Map.Entry<String, ByteArrayOutputStream> output : outputs.entrySet()) {
143143

144144
System.out.println("");
145145
// BinaryValue binaryValue = BinaryValueFromInputStream.getInstance(

src/main/java/org/exist/xquery/xproc/xmlcalabash/XProcRunner.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static com.xmlcalabash.util.Output.Kind.OUTPUT_STREAM;
2222
import static java.lang.String.format;
2323

24+
import java.io.ByteArrayOutputStream;
2425
import java.io.IOException;
2526
import java.io.InputStream;
2627
import java.io.OutputStream;
@@ -31,15 +32,11 @@
3132
import java.util.Map;
3233
import java.util.Set;
3334

35+
import net.sf.saxon.Configuration;
36+
import net.sf.saxon.s9api.*;
3437
import org.apache.logging.log4j.LogManager;
3538
import org.apache.logging.log4j.Logger;
3639

37-
import net.sf.saxon.s9api.QName;
38-
import net.sf.saxon.s9api.SaxonApiException;
39-
import net.sf.saxon.s9api.Serializer;
40-
import net.sf.saxon.s9api.XdmNode;
41-
42-
import org.apache.commons.io.output.ByteArrayOutputStream;
4340
import org.exist.storage.DBBroker;
4441
import org.exist.util.io.Resource;
4542
import org.xml.sax.InputSource;
@@ -113,7 +110,9 @@ protected static Map<String, ByteArrayOutputStream> run(
113110
if (debug) {
114111
System.err.println("Implicit pipeline:");
115112

116-
final Serializer serializer = new Serializer();
113+
final Configuration configuration = Configuration.newConfiguration();
114+
final Processor processor = new Processor(configuration);
115+
final Serializer serializer = processor.newSerializer();
117116

118117
serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
119118
serializer.setOutputProperty(Serializer.Property.METHOD, "xml");

0 commit comments

Comments
 (0)