String role = b.getName();
Uri roleUri = namespace.getUri(token, namespaceConfig.getRolesPath()+"/"+role);
try {
NodeRevisionDescriptor nrd =
roleUri.getStore().retrieveRevisionDescriptor(roleUri, new NodeRevisionNumber());
NodeProperty membersetProp = nrd.getProperty("group-member-set");
if (membersetProp != null && membersetProp.getValue() != null) {
XMLValue xmlVal = new XMLValue((String)membersetProp.getValue());
List memberNodes = xmlVal.getHrefNodes();
if (memberNodes.contains(subjectNode)) {
result.add(roleUri.toString());
}
}
} catch (RevisionDescriptorNotFoundException e) {
} catch (JDOMException e) {}
}
}
}
Uri groupsUri = null;
ObjectNode groupsNode = null;
if (namespaceConfig.getGroupsPath() != null && namespaceConfig.getGroupsPath().length() != 0) {
groupsUri = namespace.getUri(token, namespaceConfig.getGroupsPath());
try {
groupsNode = groupsUri.getStore().retrieveObject(groupsUri);
} catch (ObjectNotFoundException e) {}
if (groupsNode != null) {
Enumeration rolesEnum = groupsNode.enumerateBindings();
while (rolesEnum.hasMoreElements()) {
ObjectNode.Binding b = (ObjectNode.Binding)rolesEnum.nextElement();
String group = b.getName();
Uri roleUri = namespace.getUri(token, namespaceConfig.getGroupsPath()+"/"+group);
try {
NodeRevisionDescriptor nrd =
roleUri.getStore().retrieveRevisionDescriptor(roleUri, new NodeRevisionNumber());
NodeProperty membersetProp = nrd.getProperty("group-member-set");
if (membersetProp != null && membersetProp.getValue() != null) {
XMLValue xmlVal = new XMLValue((String)membersetProp.getValue());
List memberNodes = xmlVal.getHrefNodes();
if (memberNodes.contains(subjectNode)) {
result.add(roleUri.toString());
}
}