Class 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  
    • 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)  
      • Methods inherited from class org.apache.sling.spi.resource.provider.ResourceProvider

        adaptTo, authenticate, commit, copy, create, delete, getAttribute, getAttributeNames, getParent, getProviderContext, getQueryLanguageProvider, hasChanges, isLive, logout, move, refresh, revert, start, stop, update
    • Field Detail

      • bundleContext

        protected org.osgi.framework.BundleContext bundleContext
      • localRoot

        protected String localRoot
      • searchPath

        protected String[] searchPath
      • ignoredPathPatterns

        protected List<Pattern> ignoredPathPatterns
      • remoteClient

        protected com.composum.sling.nodes.mount.remote.RemoteClient remoteClient
    • Constructor Detail

      • RemoteProvider

        public RemoteProvider()
    • 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 class org.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 class org.apache.sling.spi.resource.provider.ResourceProvider<Object>
        Returns:
        the children retrieved using the the parent resource itself