Class RemoteProvider
- java.lang.Object
-
- org.apache.sling.spi.resource.provider.ResourceProvider<Object>
-
- com.composum.sling.nodes.mount.remote.RemoteProvider
-
public class RemoteProvider extends org.apache.sling.spi.resource.provider.ResourceProvider<Object>
A remote resource provider enables the mounting of a remote Sling system via HTTP based on the JSON data rendered by default Sling GET servlet. The CRUD operations to manipulate the remote resources are using the default Sling POST servlet.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RemoteProvider.Config
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.framework.BundleContext
bundleContext
protected RemoteClientSetup
clientSetup
protected List<Pattern>
ignoredPathPatterns
protected String
localRoot
protected com.composum.sling.nodes.mount.remote.RemoteClient
remoteClient
protected RemoteReader
remoteReader
protected RemoteWriter
remoteWriter
protected String[]
searchPath
-
Fields inherited from class org.apache.sling.spi.resource.provider.ResourceProvider
AUTH_ADMIN, AUTH_CLONE, AUTH_SERVICE_BUNDLE, AUTHENTICATE_LAZY, AUTHENTICATE_NO, AUTHENTICATE_REQUIRED, PROPERTY_ADAPTABLE, PROPERTY_ATTRIBUTABLE, PROPERTY_AUTHENTICATE, PROPERTY_MODIFIABLE, PROPERTY_NAME, PROPERTY_REFRESHABLE, PROPERTY_ROOT, PROPERTY_USE_RESOURCE_ACCESS_SECURITY, RESOURCE_TYPE_SYNTHETIC
-
-
Constructor Summary
Constructors Constructor Description RemoteProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(org.osgi.framework.BundleContext bundleContext, RemoteProvider.Config config)
protected void
deactivate()
@NotNull String
getProviderRoot()
@Nullable org.apache.sling.api.resource.Resource
getResource(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Object> ctx, @NotNull String path, @NotNull org.apache.sling.spi.resource.provider.ResourceContext resourceContext, @Nullable org.apache.sling.api.resource.Resource parent)
protected boolean
ignoreIt(@NotNull String path)
boolean
isLocal(@NotNull String path)
@Nullable Iterator<org.apache.sling.api.resource.Resource>
listChildren(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Object> ctx, @NotNull org.apache.sling.api.resource.Resource parent)
protected String
localPath(@NotNull String path)
protected String
remotePath(@NotNull String path)
-
-
-
Field Detail
-
clientSetup
protected RemoteClientSetup clientSetup
-
bundleContext
protected org.osgi.framework.BundleContext bundleContext
-
localRoot
protected String localRoot
-
searchPath
protected String[] searchPath
-
remoteClient
protected com.composum.sling.nodes.mount.remote.RemoteClient remoteClient
-
remoteReader
protected RemoteReader remoteReader
-
remoteWriter
protected RemoteWriter remoteWriter
-
-
Method Detail
-
activate
protected void activate(org.osgi.framework.BundleContext bundleContext, RemoteProvider.Config config)
-
deactivate
protected void deactivate()
-
isLocal
public boolean isLocal(@NotNull @NotNull String path)
- Returns:
- 'true' if the path is part of the local repository tree (starts with the provider root)
-
localPath
protected String localPath(@NotNull @NotNull String path)
- Returns:
- the repository path of the local resource
-
remotePath
protected String remotePath(@NotNull @NotNull String path)
- Returns:
- the given (local) path transformed to the remote system
-
ignoreIt
protected boolean ignoreIt(@NotNull @NotNull String path)
- Returns:
- 'true' if the given repository path should be ignored in the remote tree
-
getProviderRoot
@NotNull public @NotNull String getProviderRoot()
- Returns:
- the mount point of this provider in the repository tree
-
getResource
@Nullable public @Nullable org.apache.sling.api.resource.Resource getResource(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Object> ctx, @NotNull @NotNull String path, @NotNull @NotNull org.apache.sling.spi.resource.provider.ResourceContext resourceContext, @Nullable @Nullable org.apache.sling.api.resource.Resource parent)
- Specified by:
getResource
in classorg.apache.sling.spi.resource.provider.ResourceProvider<Object>
- Returns:
- the remote resource if the path in in the scope of this provider, otherwise 'null'
-
listChildren
@Nullable public @Nullable Iterator<org.apache.sling.api.resource.Resource> listChildren(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Object> ctx, @NotNull @NotNull org.apache.sling.api.resource.Resource parent)
- Specified by:
listChildren
in classorg.apache.sling.spi.resource.provider.ResourceProvider<Object>
- Returns:
- the children retrieved using the the parent resource itself
-
-