X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=inline;f=jcr%2Forg.argeo.cms.jcr%2Fsrc%2Forg%2Fargeo%2Fcms%2Fjcr%2Facr%2FJcrContentProvider.java;h=235e27d1a922139558d8e8c42da322199340dda5;hb=da9d144b6b241e1526a3bd255dff905a7969a5bc;hp=198a2a3ed4480054cc87e738d770c818489d2774;hpb=fdf44255df56ae179b904e4ab326bf595674800e;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 198a2a3ed..235e27d1a 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 @@ -12,6 +12,7 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.xml.namespace.NamespaceContext; +import org.argeo.api.acr.Content; import org.argeo.api.acr.spi.ContentProvider; import org.argeo.api.acr.spi.ProvidedContent; import org.argeo.api.acr.spi.ProvidedSession; @@ -47,12 +48,19 @@ public class JcrContentProvider implements ContentProvider, NamespaceContext { } @Override - public ProvidedContent get(ProvidedSession contentSession, String mountPath, String relativePath) { + public ProvidedContent get(ProvidedSession contentSession, String relativePath) { String jcrWorkspace = ContentUtils.getParentPath(mountPath)[1]; String jcrPath = "/" + relativePath; return new JcrContent(contentSession, this, jcrWorkspace, jcrPath); } + @Override + public boolean exists(ProvidedSession contentSession, String relativePath) { + String jcrWorkspace = ContentUtils.getParentPath(mountPath)[1]; + String jcrPath = "/" + relativePath; + return new JcrContent(contentSession, this, jcrWorkspace, jcrPath).exists(); + } + public Session getJcrSession(ProvidedSession contentSession, String jcrWorkspace) { JcrSessionAdapter sessionAdapter = sessionAdapters.get(contentSession); if (sessionAdapter == null) { @@ -67,6 +75,10 @@ public class JcrContentProvider implements ContentProvider, NamespaceContext { return jcrSession; } + public Session getJcrSession(Content content, String jcrWorkspace) { + return getJcrSession(((ProvidedContent) content).getSession(), jcrWorkspace); + } + @Override public String getMountPath() { return mountPath;