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=98f2c711418690e62e35c931e35d1dc92fd07926;hp=d9f378329f59a3d8932910cf2328df97f4d27796;hpb=fdf44255df56ae179b904e4ab326bf595674800e;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 d9f378329..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 @@ -4,6 +4,8 @@ import org.argeo.api.acr.Content; /** A {@link Content} implementation. */ public interface ProvidedContent extends Content { + final static String ROOT_PATH = "/"; + ProvidedSession getSession(); ContentProvider getProvider(); @@ -19,4 +21,15 @@ public interface ProvidedContent extends Content { 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; + } }