X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.api.acr%2Fsrc%2Forg%2Fargeo%2Fapi%2Facr%2Fspi%2FProvidedContent.java;h=e2807c0efd19e746c7a9ab41a2971e36c1fe55e9;hb=84914c5224fe7d441cc10f30b8418bf4ac4b0a0f;hp=d483e7fcc7f9e91047e0739258f11cf4064621df;hpb=e3db2eba9a7f8380a6f76d7b0e6cd4825e91893e;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.api.acr/src/org/argeo/api/acr/spi/ProvidedContent.java b/org.argeo.api.acr/src/org/argeo/api/acr/spi/ProvidedContent.java index d483e7fcc..e2807c0ef 100644 --- a/org.argeo.api.acr/src/org/argeo/api/acr/spi/ProvidedContent.java +++ b/org.argeo.api.acr/src/org/argeo/api/acr/spi/ProvidedContent.java @@ -2,12 +2,34 @@ package org.argeo.api.acr.spi; import org.argeo.api.acr.Content; +/** A {@link Content} implementation. */ public interface ProvidedContent extends Content { + final static String ROOT_PATH = "/"; + ProvidedSession getSession(); ContentProvider getProvider(); + int getDepth(); + + /** + * An opaque ID which is guaranteed to uniquely identify this content within the + * session return by {@link #getSession()}. Typically used for UI. + */ + String getSessionLocalId(); + default ProvidedContent getMountPoint(String relativePath) { throw new UnsupportedOperationException("This content doe not support mount"); } + + default ProvidedContent getContent(String path) { + Content fileNode; + if (path.startsWith(ROOT_PATH)) {// absolute + fileNode = getSession().get(path); + } else {// relative + String absolutePath = getPath() + '/' + path; + fileNode = getSession().get(absolutePath); + } + return (ProvidedContent) fileNode; + } }