Skip to content

Commit b85db6e

Browse files
authored
Merge pull request #199 from evolvedbinary/7.x.x/feature/support-calabash3
[7.x.x] Support for executing XQuery from XML Calabash 3
2 parents f1aacdd + a1b6475 commit b85db6e

33 files changed

Lines changed: 1058 additions & 313 deletions

elemental-parent/pom.xml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@
382382
<version>3.4.0</version>
383383
</plugin>
384384
<plugin>
385-
<groupId>com.code54.mojo</groupId>
386-
<artifactId>buildversion-plugin</artifactId>
387-
<version>1.0.3</version>
385+
<groupId>com.evolvedbinary.maven.plugins</groupId>
386+
<artifactId>buildversion-maven-plugin</artifactId>
387+
<version>2.0.0</version>
388388
</plugin>
389389
<plugin>
390390
<groupId>org.apache.maven.plugins</groupId>
@@ -640,8 +640,8 @@
640640
</executions>
641641
</plugin>
642642
<plugin>
643-
<groupId>com.code54.mojo</groupId>
644-
<artifactId>buildversion-plugin</artifactId>
643+
<groupId>com.evolvedbinary.maven.plugins</groupId>
644+
<artifactId>buildversion-maven-plugin</artifactId>
645645
<executions>
646646
<execution>
647647
<phase>validate</phase>
@@ -807,19 +807,4 @@
807807
</profile>
808808
</profiles>
809809

810-
<pluginRepositories>
811-
<pluginRepository>
812-
<id>clojars.org</id>
813-
<url>https://clojars.org/repo</url>
814-
</pluginRepository>
815-
</pluginRepositories>
816-
817-
<distributionManagement>
818-
<repository>
819-
<id>central-ossrh-staging</id>
820-
<name>Central Portal - OSSRH Staging API</name>
821-
<url>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</url>
822-
</repository>
823-
</distributionManagement>
824-
825810
</project>

exist-core/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,7 @@
14151415
<include>src/test/java/org/exist/xquery/functions/validate/JingXsdTest.java</include>
14161416
<include>src/main/java/org/exist/xquery/functions/validation/Jaxp.java</include>
14171417
<include>src/test/java/org/exist/xquery/functions/xmldb/DbStore2Test.java</include>
1418+
<include>src/main/java/org/exist/xquery/functions/xmldb/FunXCollection.java</include>
14181419
<include>src/main/java/org/exist/xquery/functions/xmldb/XMLDBGetMimeType.java</include>
14191420
<include>src/main/java/org/exist/xquery/functions/xmldb/XMLDBLoadFromPattern.java</include>
14201421
<include>src/main/java/org/exist/xquery/functions/xmldb/XMLDBModule.java</include>
@@ -2249,6 +2250,7 @@
22492250
<exclude>src/main/java/org/exist/xquery/functions/validation/Jaxp.java</exclude>
22502251
<exclude>src/test/java/org/exist/xquery/functions/xmldb/AbstractXMLDBTest.java</exclude>
22512252
<exclude>src/test/java/org/exist/xquery/functions/xmldb/DbStore2Test.java</exclude>
2253+
<exclude>src/main/java/org/exist/xquery/functions/xmldb/FunXCollection.java</exclude>
22522254
<exclude>src/test/java/org/exist/xquery/functions/xmldb/XMLDBAuthenticateTest.java</exclude>
22532255
<exclude>src/main/java/org/exist/xquery/functions/xmldb/XMLDBGetMimeType.java</exclude>
22542256
<exclude>src/main/java/org/exist/xquery/functions/xmldb/XMLDBLoadFromPattern.java</exclude>

exist-core/src/main/java/org/exist/Namespaces.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public interface Namespaces {
6161
String DTD_NS = XMLConstants.XML_DTD_NS_URI;
6262

6363
String SCHEMA_NS = XMLConstants.W3C_XML_SCHEMA_NS_URI;
64+
String SCHEMA_NS_PREFIX = "xs";
6465
String SCHEMA_DATATYPES_NS = "http://www.w3.org/2001/XMLSchema-datatypes";
6566
String SCHEMA_INSTANCE_NS = XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
6667

exist-core/src/main/java/org/exist/client/CommandlineOptions.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ public class CommandlineOptions {
108108
.description("do not make embedded mode available")
109109
.defaultValue(false)
110110
.build();
111+
private static final Argument<Boolean> noAutoDeployArg = optionArgument("-a", "--no-auto-deploy")
112+
.description("Disable auto-deployment of EXPath Packages")
113+
.defaultValue(false)
114+
.build();
111115

112116

113117
/* gui arguments */
@@ -193,7 +197,7 @@ private static Optional<XmldbURI> optUri(final ParsedArguments parsedArguments,
193197

194198
public static CommandlineOptions parse(final String[] args) throws ArgumentException, URISyntaxException {
195199
final ParsedArguments arguments = CommandLineParser
196-
.withArguments(userArg, passwordArg, useSslArg, embeddedArg, embeddedConfigArg, noEmbeddedModeArg)
200+
.withArguments(userArg, passwordArg, useSslArg, embeddedArg, embeddedConfigArg, noEmbeddedModeArg, noAutoDeployArg)
197201
.andArguments(noGuiArg, guiQueryDialogArg)
198202
.andArguments(mkColArg, rmColArg, setColArg)
199203
.andArguments(parseDocsArg, getDocArg, rmDocArg)
@@ -215,6 +219,7 @@ public static CommandlineOptions parse(final String[] args) throws ArgumentExcep
215219
final boolean embedded = getBool(arguments, embeddedArg);
216220
final Optional<Path> embeddedConfig = getPathOpt(arguments, embeddedConfigArg);
217221
final boolean noEmbeddedMode = getBool(arguments, noEmbeddedModeArg);
222+
final boolean noAutoDeploy = getBool(arguments, noAutoDeployArg);
218223

219224
final boolean startGUI = !getBool(arguments, noGuiArg);
220225
final boolean openQueryGUI = getBool(arguments, guiQueryDialogArg);
@@ -259,6 +264,7 @@ public static CommandlineOptions parse(final String[] args) throws ArgumentExcep
259264
embedded,
260265
embeddedConfig,
261266
noEmbeddedMode,
267+
noAutoDeploy,
262268
startGUI,
263269
openQueryGUI,
264270
mkCol,
@@ -278,7 +284,7 @@ public static CommandlineOptions parse(final String[] args) throws ArgumentExcep
278284
);
279285
}
280286

281-
public CommandlineOptions(boolean quiet, boolean verbose, Optional<Path> outputFile, Map<String, String> options, Optional<String> username, Optional<String> password, boolean useSSL, boolean embedded, Optional<Path> embeddedConfig, boolean noEmbeddedMode, boolean startGUI, boolean openQueryGUI, Optional<XmldbURI> mkCol, Optional<XmldbURI> rmCol, Optional<XmldbURI> setCol, List<Path> parseDocs, Optional<XmldbURI> getDoc, Optional<String> rmDoc, Optional<String> xpath, List<Path> queryFiles, Optional<Integer> howManyResults, Optional<Path> traceQueriesFile, Optional<String> setDoc, Optional<Path> xupdateFile, boolean reindex, boolean reindexRecurse) {
287+
public CommandlineOptions(boolean quiet, boolean verbose, Optional<Path> outputFile, Map<String, String> options, Optional<String> username, Optional<String> password, boolean useSSL, boolean embedded, Optional<Path> embeddedConfig, boolean noEmbeddedMode, boolean noAutoDeploy, boolean startGUI, boolean openQueryGUI, Optional<XmldbURI> mkCol, Optional<XmldbURI> rmCol, Optional<XmldbURI> setCol, List<Path> parseDocs, Optional<XmldbURI> getDoc, Optional<String> rmDoc, Optional<String> xpath, List<Path> queryFiles, Optional<Integer> howManyResults, Optional<Path> traceQueriesFile, Optional<String> setDoc, Optional<Path> xupdateFile, boolean reindex, boolean reindexRecurse) {
282288
this.quiet = quiet;
283289
this.verbose = verbose;
284290
this.outputFile = outputFile;
@@ -289,6 +295,7 @@ public CommandlineOptions(boolean quiet, boolean verbose, Optional<Path> outputF
289295
this.embedded = embedded;
290296
this.embeddedConfig = embeddedConfig;
291297
this.noEmbeddedMode = noEmbeddedMode;
298+
this.noAutoDeploy = noAutoDeploy;
292299
this.startGUI = startGUI;
293300
this.openQueryGUI = openQueryGUI;
294301
this.mkCol = mkCol;
@@ -318,6 +325,7 @@ public CommandlineOptions(boolean quiet, boolean verbose, Optional<Path> outputF
318325
final boolean embedded;
319326
final Optional<Path> embeddedConfig;
320327
final boolean noEmbeddedMode;
328+
final boolean noAutoDeploy;
321329

322330
final boolean startGUI;
323331
final boolean openQueryGUI;

exist-core/src/main/java/org/exist/client/InteractiveClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public class InteractiveClient {
161161
public static final String CREATE_DATABASE = "create-database";
162162
public static final String LOCAL_MODE = "local-mode-opt";
163163
public static final String NO_EMBED_MODE = "NO_EMBED_MODE";
164+
public static final String NO_AUTO_DEPLOY = "no-autodeploy";
164165

165166
// values
166167
protected static final String EDIT_CMD = "emacsclient -t $file";
@@ -169,6 +170,7 @@ public class InteractiveClient {
169170
protected static final String SSL_ENABLE_DEFAULT = "FALSE";
170171
protected static final String LOCAL_MODE_DEFAULT = "FALSE";
171172
protected static final String NO_EMBED_MODE_DEFAULT = "FALSE";
173+
protected static final String NO_AUTO_DEPLOY_DEFAULT = "FALSE";
172174
protected static final String USER_DEFAULT = SecurityManager.DBA_USER;
173175
protected static final String DRIVER_IMPL_CLASS = "org.exist.xmldb.DatabaseImpl";
174176

@@ -188,6 +190,7 @@ public class InteractiveClient {
188190
DEFAULT_PROPERTIES.setProperty(PERMISSIONS, "false");
189191
DEFAULT_PROPERTIES.setProperty(EXPAND_XINCLUDES, "true");
190192
DEFAULT_PROPERTIES.setProperty(SSL_ENABLE, SSL_ENABLE_DEFAULT);
193+
DEFAULT_PROPERTIES.setProperty(NO_AUTO_DEPLOY, NO_AUTO_DEPLOY_DEFAULT);
191194
}
192195
protected static final int[] COL_SIZES = new int[]{10, 10, 10, -1};
193196

@@ -334,6 +337,7 @@ protected void connect() throws Exception {
334337
// Configure database
335338
database.setProperty(CREATE_DATABASE, "true");
336339
database.setProperty(SSL_ENABLE, properties.getProperty(SSL_ENABLE));
340+
database.setProperty(NO_AUTO_DEPLOY, properties.getProperty(NO_AUTO_DEPLOY));
337341

338342
// secure empty configuration
339343
final String configProp = properties.getProperty(InteractiveClient.CONFIGURATION);
@@ -1882,6 +1886,9 @@ protected void setPropertiesFromCommandLine(final CommandlineOptions options, fi
18821886
if (options.noEmbeddedMode) {
18831887
props.setProperty(NO_EMBED_MODE, "TRUE");
18841888
}
1889+
if (options.noAutoDeploy) {
1890+
props.setProperty(NO_AUTO_DEPLOY, "TRUE");
1891+
}
18851892
}
18861893

18871894
/**

exist-core/src/main/java/org/exist/collections/MutableCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ public MutableDocumentSet allDocs(final DBBroker broker, final MutableDocumentSe
481481
if(recursive && subColls != null) {
482482
// process the child collections
483483
for(final XmldbURI subCol : subColls) {
484-
try(final Collection child = broker.openCollection(subCol, NO_LOCK)) { // NOTE: the recursive call below to child.addDocs will take a lock
484+
try(final Collection child = broker.openCollection(subCol, INTENTION_READ)) { // NOTE: the recursive call below to child.addDocs will take a lock
485485
//A collection may have been removed in the meantime, so check first
486486
if(child != null) {
487487
child.allDocs(broker, docs, recursive, lockMap);

0 commit comments

Comments
 (0)