+ 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) {
+ final JcrSessionAdapter newSessionAdapter = new JcrSessionAdapter(jcrRepository, contentSession,
+ contentSession.getSubject());
+ sessionAdapters.put(contentSession, newSessionAdapter);
+ contentSession.onClose().thenAccept((s) -> newSessionAdapter.close());
+ sessionAdapter = newSessionAdapter;
+ }
+
+ Session jcrSession = sessionAdapter.getSession(jcrWorkspace);
+ return jcrSession;
+ }
+
+ public Session getJcrSession(Content content, String jcrWorkspace) {
+ return getJcrSession(((ProvidedContent) content).getSession(), jcrWorkspace);
+ }
+
+ @Override
+ public String getMountPath() {
+ return mountPath;