* @throws RepositoryException if there was a problem extracting properties.
*/
private static Property processAclProperty(Document document,
String aclPropName, String aclRolePrefix) throws RepositoryException {
LinkedList<Value> acl = new LinkedList<Value>();
Property scopeProp = document.findProperty(aclPropName);
Value scopeVal;
while ((scopeVal = scopeProp.nextValue()) != null) {
Principal principal = (scopeVal instanceof PrincipalValue)
? ((PrincipalValue) scopeVal).getPrincipal()
: new Principal(scopeVal.toString().trim());
String aclScope = principal.getName();
if (Strings.isNullOrEmpty(aclScope)) {
continue;
}
Property scopeRoleProp = document.findProperty(aclRolePrefix + aclScope);
if (scopeRoleProp != null) {
// Add ACL Entry (scope=role pair) to the list.
Value roleVal;
while ((roleVal = scopeRoleProp.nextValue()) != null) {
String role = roleVal.toString().trim();
if (role.length() > 0) {
acl.add(Value.getPrincipalValue(new Principal(
principal.getPrincipalType(),
principal.getNamespace(), aclScope + '=' + role,