Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
adding some trace+debug logging to HttpGraphSubjects
  • Loading branch information
cbeer committed May 16, 2013
1 parent 32c9622 commit 7b80be2
Showing 1 changed file with 11 additions and 3 deletions.
Expand Up @@ -48,26 +48,34 @@ public HttpGraphSubjects(Class relativeTo, UriInfo uris) {
public Resource getGraphSubject(Node node) throws RepositoryException {
URI result = nodesBuilder
.buildFromMap(getPathMap(node));
LOGGER.debug("Translated node {} into RDF subject {}", node, result);
return ResourceFactory.createResource(result.toString());
}

@Override
public Node getNodeFromGraphSubject(Session session, Resource subject)
throws RepositoryException {
if (!isFedoraGraphSubject(subject)) {
LOGGER.debug("RDF resource {} was not a URI resource with our expected basePath {}, aborting.", subject, basePath);
return null;
}

final String absPath = subject.getURI().substring(pathIx);

final Node node;
if (absPath.endsWith(FCR_CONTENT)) {
return session.getNode(absPath.replace(FedoraJcrTypes.FCR_CONTENT, JcrConstants.JCR_CONTENT));
node = session.getNode(absPath.replace(FedoraJcrTypes.FCR_CONTENT, JcrConstants.JCR_CONTENT));
LOGGER.trace("RDF resource {} is a fcr:content node, retrieving the corresponding JCR content node {}", subject, node);
} else if (session.nodeExists(absPath)) {
return session.getNode(absPath);
node = session.getNode(absPath);
LOGGER.trace("RDF resource {} maps to JCR node {}", subject, node);
} else {
return null;
node = null;
LOGGER.debug("RDF resource {} looks like a Fedora node, but when we checked was not in the repository", subject);
}

return node;

}

@Override
Expand Down

0 comments on commit 7b80be2

Please sign in to comment.