X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=jcr%2Forg.argeo.cms.jcr%2Fsrc%2Forg%2Fargeo%2Fcms%2Fjcr%2Facr%2FJcrContentProvider.java;fp=jcr%2Forg.argeo.cms.jcr%2Fsrc%2Forg%2Fargeo%2Fcms%2Fjcr%2Facr%2FJcrContentProvider.java;h=a7005ce23c826b464c7716a5277a6edf1e2e2e95;hb=284e5f62177da9640a16435107925d68f0611dcb;hp=fc4a61bf9e61a72c316f5b5f5f8bf50a291932fb;hpb=e4b81e704db1906a46b718f68d8376289f6e310f;p=lgpl%2Fargeo-commons.git diff --git a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentProvider.java b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentProvider.java index fc4a61bf9..a7005ce23 100644 --- a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentProvider.java +++ b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContentProvider.java @@ -6,7 +6,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import javax.jcr.Node; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; @@ -41,7 +40,12 @@ public class JcrContentProvider implements ContentProvider, NamespaceContext { @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, @@ -51,15 +55,8 @@ public class JcrContentProvider implements ContentProvider, NamespaceContext { 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; } /*