Index: src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/AccessControlHandling.java =================================================================== --- src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/AccessControlHandling.java (nonexistent) +++ src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/AccessControlHandling.java (working copy) @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.filevault.maven.packaging.impl; + +/** + * AccessControlHandling defines the behavior when importing + * access control nodes. + */ +public enum AccessControlHandling { + + /** + * Ignores the packaged access control and leaves the target unchanged. + */ + IGNORE, + + /** + * Applies the access control provided with the package to the target. this + * also removes existing access control. + */ + OVERWRITE, + + /** + * Merge access control provided with the package with the one in the + * content by replacing the access control entries of corresponding + * principals (i.e. package first). It never alters access control entries + * of principals not present in the package. + *

+ * Example:
+ * + * Content ACL: + *

+     *     everyone, deny, jcr:all
+     *     bob, allow, jcr:read
+     *     bob, allow, jcr:write
+     * 
+ * + * Package ACL: + *
+     *     bob, deny, jcr:all
+     *     alice, allow, jcr:read
+     * 
+ * + * Result ACL: + *
+     *     everyone, deny, jcr:all
+     *     bob, deny, jcr:all
+     *     alice, allow, jcr:read
+     * 
+ */ + MERGE, + + /** + * Merge access control in the content with the one provided with the + * package by adding the access control entries of principals not present in the + * content (i.e. content first). It never alters access control entries already + * existing in the content. + * + *

+ * Example:
+ * + * Content ACL: + *

+     *     everyone, deny, jcr:all
+     *     bob, allow, jcr:read
+     *     bob, allow, jcr:write
+     * 
+ * + * Package ACL: + *
+     *     bob, deny, jcr:all
+     *     alice, allow, jcr:read
+     * 
+ * + * Result ACL: + *
+     *     everyone, deny, jcr:all
+     *     bob, allow, jcr:read
+     *     bob, allow, jcr:write
+     *     alice, allow, jcr:read
+     * 
+ */ + MERGE_PRESERVE, + + /** + * Clears all access control on the target system. + */ + CLEAR, + +} Property changes on: src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/AccessControlHandling.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VaultMojo.java =================================================================== --- src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VaultMojo.java (revision 1816417) +++ src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VaultMojo.java (working copy) @@ -40,6 +40,7 @@ import javax.annotation.Nonnull; import org.apache.commons.io.IOUtils; +import org.apache.jackrabbit.filevault.maven.packaging.impl.AccessControlHandling; import org.apache.jackrabbit.filevault.maven.packaging.impl.DefaultWorkspaceFilter; import org.apache.jackrabbit.filevault.maven.packaging.impl.PackageType; import org.apache.jackrabbit.filevault.maven.packaging.impl.PathFilterSet; @@ -248,6 +249,43 @@ private boolean allowIndexDefinitions; /** + * Defines the AC handling. This will become the + * {@code acHandling} property of the properties.xml file.
+ * Possible values: + * + */ + @Parameter( + property = "vault.acHandling", + required = false) + private AccessControlHandling acHandling; + + /** + * Sets the AC handling. + * @param type the string representation of the ac handling + * @throws MojoFailureException if an error occurrs + */ + public void setAcHandling(String type) throws MojoFailureException { + try { + acHandling = AccessControlHandling.valueOf(type.toUpperCase()); + } catch (IllegalArgumentException e) { + throw new MojoFailureException("Invalid acHandling specified: " + type +".\n" + + "Must be empty or one of '" + StringUtils.join(AccessControlHandling.values(), "','") + "'."); + } + + } + + /** * Controls if errors during dependency validation should fail the build. */ @Parameter( @@ -383,6 +421,7 @@ * allowIndexDefinitionsUse allowIndexDefinitions parameter to set * packagePathAutomatically generated from the group and package name * packageTypeSet via the package type parameter + * acHandlingUse acHandling parameter to set * */ @Parameter @@ -836,6 +875,9 @@ props.put("requiresRoot", String.valueOf(requiresRoot)); props.put("allowIndexDefinitions", String.valueOf(allowIndexDefinitions)); props.put("packageType", packageType.name().toLowerCase()); + if (acHandling != null) { + props.put("acHandling", acHandling.name().toLowerCase()); + } return props; }