You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2022/07/13 10:11:10 UTC
[jackrabbit-filevault] branch master updated: JCRVLT-643 expose XML Schema definition for workspace filter XMLs (#236)
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
The following commit(s) were added to refs/heads/master by this push:
new 383356c1 JCRVLT-643 expose XML Schema definition for workspace filter XMLs (#236)
383356c1 is described below
commit 383356c109e0d2a1b4e3478ec389d80937e6292b
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Jul 13 12:11:06 2022 +0200
JCRVLT-643 expose XML Schema definition for workspace filter XMLs (#236)
allow new modes "merge_properties" and "update_properties"
reference XSD from example filter.xml
---
pom.xml | 25 +++++++++++++++++++---
src/site/markdown/config.md | 2 +-
src/site/markdown/filter.md | 8 ++++---
src/site/markdown/importmode.md | 2 +-
.../spi/impl/AdvancedFilterValidatorFactory.java | 4 ++--
.../{filter.xsd => workspacefilter-1.0.xsd} | 2 ++
.../spi/impl/AdvancedFilterValidatorTest.java | 2 +-
7 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index a774a80c..68d89223 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,11 +134,30 @@
<goals>
<goal>resources</goal>
</goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/site</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-xsds</id>
+ <phase>pre-site</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <resources>
+ <resource>
+ <directory>vault-validation/src/main/resources</directory>
+ <includes>
+ <include>*.xsd</include>
+ </includes>
+ </resource>
+ </resources>
+ <outputDirectory>${project.build.directory}/site/xsd</outputDirectory>
+ </configuration>
</execution>
</executions>
- <configuration>
- <outputDirectory>${project.build.directory}/site</outputDirectory>
- </configuration>
+
</plugin>
</plugins>
diff --git a/src/site/markdown/config.md b/src/site/markdown/config.md
index 3245e4eb..7cfecc0e 100644
--- a/src/site/markdown/config.md
+++ b/src/site/markdown/config.md
@@ -30,7 +30,7 @@ The following system properties or OSGi Framework properties can be used
Property Name | Type | Default Value | Description | Related JIRA Ticket | Supported since
--- | --- | --- | --- | --- | ---
-`vault.useNioArchive` | `Boolean` | `false` | If set to `true `uses an [Archive implementation](https://github.com/apache/jackrabbit-filevault/blob/master/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/ZipNioArchive.java) based on the [Java NIO Zip File System Provider](https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/zipfilesystemprovider.html) instead of the [default implementation](https://github.com/apache/jackrabbit-filevault/blob/master/vault-core/src/main/ [...]
+`vault.useNioArchive` | `Boolean` | `false` | If set to `true ` uses an [Archive implementation](https://github.com/apache/jackrabbit-filevault/blob/master/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/ZipNioArchive.java) based on the [Java NIO Zip File System Provider](https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/zipfilesystemprovider.html) instead of the [default implementation](https://github.com/apache/jackrabbit-filevault/blob/master/vault-core/src/main [...]
`vault.enableStackTraces` | `Boolean` | `false` | If set to `true` persists a stack trace for every opened Archive and logs it in case it was not properly closed. Should only be enabled on non-production environments as this has a negative performance impact. | [JCRVLT-591](https://issues.apache.org/jira/browse/JCRVLT-591) | 3.5.10
diff --git a/src/site/markdown/filter.md b/src/site/markdown/filter.md
index 45adab5a..40120e3b 100644
--- a/src/site/markdown/filter.md
+++ b/src/site/markdown/filter.md
@@ -31,7 +31,7 @@ The `filter.xml` consists of a set of `filter` elements, each with a mandatory `
Example:
- <workspaceFilter version="1.0">
+ <workspaceFilter xmlns="http://jackrabbit.apache.org/filevault/workspacefilter/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jackrabbit.apache.org/filevault/workspacefilter/1.0 https://jackrabbit.apache.org/filevault/xsd/workspacefilter-1.0.xsd" version="1.0">
<filter root="/apps/project1" />
<filter root="/etc/project1">
<exclude pattern=".*\.gif" />
@@ -48,8 +48,10 @@ The filter element can have an optional `mode` attribute which specified the [im
importing content. the following values are possible:
1. `replace` : This is the normal behavior. Existing content is replaced completely by the imported content, i.e. is overridden or deleted accordingly.
-1. `merge` : Existing content is not modified, i.e. only new content is added and none is deleted or modified.
-1. `update` : Existing content is updated, new content is added and none is deleted.
+1. `merge` : Existing content is not modified, i.e. only new content is added and none is deleted or modified. Deprecated, as not handled consistently, use `merge_properties` instead.
+1. `merge_properties`: Existing content is not modified, i.e. only new content is added and none is deleted or modified.
+1. `update` : Existing content is updated, new content is added and none is deleted. Deprecated, as not handled consistently, use `update_properties` instead.
+1. `update_properties`: Existing content is updated, new content is added and none is deleted.
For a more detailed description of the import mode, see [here](importmode.html).
diff --git a/src/site/markdown/importmode.md b/src/site/markdown/importmode.md
index 13f92610..1f12c185 100644
--- a/src/site/markdown/importmode.md
+++ b/src/site/markdown/importmode.md
@@ -49,7 +49,7 @@ If an authorizable with the same name already exists, the active `ImportMode` co
: Replaces the authorizable node completely with the content in the package **in place**. The importer effectively deletes and re-creates the authorizable at the path specified in the package (internally the content is imported using the content handler with `IMPORT_UUID_COLLISION_REPLACE_EXISTING`). Note that any sub-nodes of the authorizable are treated like normal content and obey the normal filter rules. However, if the authorizable existed at a different path as specified in the rep [...]
-**`ImportMode.MERGE`,`ImportMode.UPDATE_PROPERTIES`**
+**`ImportMode.MERGE`,`ImportMode.MERGE_PROPERTIES`**
: Has no effect if the authorizable already existed except for group memberships (see below). Note that any sub-nodes of the authorizable are treated like normal content and obey the normal filter rules. However, if the authorizable existed at a different path as specified in the repository, the importer keeps track of the remapping and calculates the filters accordingly.
### Merging Group Members
diff --git a/vault-validation/src/main/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorFactory.java b/vault-validation/src/main/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorFactory.java
index 39752311..789e02e7 100644
--- a/vault-validation/src/main/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorFactory.java
+++ b/vault-validation/src/main/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorFactory.java
@@ -75,14 +75,14 @@ public final class AdvancedFilterValidatorFactory implements ValidatorFactory {
static @NotNull DocumentBuilderFactory createFilterXsdAwareDocumentBuilder(Locale locale) throws IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
- try (InputStream xsdInput = AdvancedFilterValidatorFactory.class.getResourceAsStream("/filter.xsd")) {
+ try (InputStream xsdInput = AdvancedFilterValidatorFactory.class.getResourceAsStream("/workspacefilter-1.0.xsd")) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// load a WXS schema, represented by a Schema instance
Source schemaFile = new StreamSource(xsdInput);
Schema schema = schemaFactory.newSchema(schemaFile);
factory.setSchema(schema);
if (xsdInput == null) {
- throw new IllegalStateException("Can not load filter.xsd");
+ throw new IllegalStateException("Can not load workspacefilter-1.0.xsd");
}
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
diff --git a/vault-validation/src/main/resources/filter.xsd b/vault-validation/src/main/resources/workspacefilter-1.0.xsd
similarity index 95%
rename from vault-validation/src/main/resources/filter.xsd
rename to vault-validation/src/main/resources/workspacefilter-1.0.xsd
index 12d91ca6..82a68da0 100644
--- a/vault-validation/src/main/resources/filter.xsd
+++ b/vault-validation/src/main/resources/workspacefilter-1.0.xsd
@@ -32,7 +32,9 @@
<xs:restriction base="xs:string">
<xs:enumeration value="replace"/>
<xs:enumeration value="merge"/>
+ <xs:enumeration value="merge_properties"/>
<xs:enumeration value="update"/>
+ <xs:enumeration value="update_properties"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="workspaceFilter">
diff --git a/vault-validation/src/test/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorTest.java b/vault-validation/src/test/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorTest.java
index 7fd37cd1..003c092f 100644
--- a/vault-validation/src/test/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorTest.java
+++ b/vault-validation/src/test/java/org/apache/jackrabbit/vault/validation/spi/impl/AdvancedFilterValidatorTest.java
@@ -396,7 +396,7 @@ public class AdvancedFilterValidatorTest {
Collection<ValidationMessage> messages = validator.validateMetaInfData(input, Paths.get("vault/filter.xml"), Paths.get(""));
ValidationExecutorTest.assertViolation(messages,
new ValidationMessage(ValidationMessageSeverity.WARN,
- "cvc-enumeration-valid: Value 'invalid' is not facet-valid with respect to enumeration '[replace, merge, update]'. It must be a value from the enumeration.", 19, 49, null),
+ "cvc-enumeration-valid: Value 'invalid' is not facet-valid with respect to enumeration '[replace, merge, merge_properties, update, update_properties]'. It must be a value from the enumeration.", 19, 49, null),
new ValidationMessage(ValidationMessageSeverity.WARN,
"cvc-attribute.3: The value 'invalid' of attribute 'mode' on element 'filter' is not valid with respect to its type, 'mode'.", 19, 49, null), // unclear why type is 'null'
new ValidationMessage(ValidationMessageSeverity.WARN,