import java.util.Iterator;
import java.util.Map;
-import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@Override
public Content get(ProvidedSession contentSession, String mountPath, String relativePath) {
- String workspace = ContentUtils.getParentPath(mountPath)[1];
+ String jcrWorkspace = ContentUtils.getParentPath(mountPath)[1];
+ String jcrPath = "/" + relativePath;
+ return new JcrContent(contentSession, this, jcrWorkspace, jcrPath);
+ }
+
+ public Session getJcrSession(ProvidedSession contentSession, String jcrWorkspace) {
JcrSessionAdapter sessionAdapter = sessionAdapters.get(contentSession);
if (sessionAdapter == null) {
final JcrSessionAdapter newSessionAdapter = new JcrSessionAdapter(jcrRepository,
sessionAdapter = newSessionAdapter;
}
- Session jcrSession = sessionAdapter.getSession(workspace);
- String jcrPath = "/" + relativePath;
- try {
- Node node = jcrSession.getNode(jcrPath);
- return new JcrContent(contentSession, this, node);
- } catch (RepositoryException e) {
- throw new JcrException("Cannot get JCR content '" + jcrPath + ", mounted from '" + mountPath
- + "' with JCR session " + jcrSession, e);
- }
+ Session jcrSession = sessionAdapter.getSession(jcrWorkspace);
+ return jcrSession;
}
/*