Class BasePipe

    • Constructor Detail

      • BasePipe

        public BasePipe​(@NotNull
                        @NotNull Plumber plumber,
                        @NotNull
                        @NotNull org.apache.sling.api.resource.Resource resource,
                        @Nullable
                        @Nullable PipeBindings upperBindings)
        Pipe Constructor
        Parameters:
        plumber - plumber
        resource - configuration resource
        upperBindings - already set bindings, can be null
    • Method Detail

      • getParent

        public SuperPipe getParent()
        Specified by:
        getParent in interface Pipe
        Returns:
        pipe's parent (can be null)
      • setParent

        public void setParent​(SuperPipe parent)
        Description copied from interface: Pipe
        sets the parent pipe this pipe is referred by
        Specified by:
        setParent in interface Pipe
        Parameters:
        parent - referrer that refers to this instance
      • getResource

        public org.apache.sling.api.resource.Resource getResource()
        Description copied from interface: Pipe
        get the pipe configuration resource
        Specified by:
        getResource in interface Pipe
        Returns:
        Pipe configruation root resource
      • isDryRun

        public boolean isDryRun()
        Description copied from interface: Pipe
        returns true if that pipe is set not to write content
        Specified by:
        isDryRun in interface Pipe
        Returns:
        true if dry run, false otherwise
      • modifiesContent

        public boolean modifiesContent()
        Description copied from interface: Pipe
        returns true if that pipe modifies content during its execution
        Specified by:
        modifiesContent in interface Pipe
        Returns:
        true for write / false for read
      • getName

        public String getName()
        Description copied from interface: Pipe
        Return the name of that pipe
        Specified by:
        getName in interface Pipe
        Returns:
        name of the pipe
      • getRawExpression

        public String getRawExpression()
        Returns:
        configured expression (not computed)
      • getExpr

        public String getExpr()
        Get pipe's expression, instanciated or not
        Returns:
        configured expression
      • getRawPath

        protected String getRawPath()
        Returns:
        configured input path (not computed)
      • getPath

        public String getPath()
        Get pipe's path, instanciated or not
        Returns:
        configured path (can be empty)
      • getComputedPath

        protected String getComputedPath()
        Returns:
        computed path: getPath, with relative path taken in account
      • isRootPath

        protected boolean isRootPath​(String path)
        Parameters:
        path - path to be checked
        Returns:
        true if path is root (aka not relative)
      • getPreviousPipe

        protected Pipe getPreviousPipe()
        Retrieves previous pipe if contained by a parent, or referrer's
        Returns:
        pipe before this one or the referrer's can be null in case there is no parent
      • getPreviousResource

        protected org.apache.sling.api.resource.Resource getPreviousResource()
        Returns:
        previous pipe's output if in a container, null otherwise
      • getInput

        @Nullable
        public @Nullable org.apache.sling.api.resource.Resource getInput()
        Description copied from interface: Pipe
        Get pipe current's resource *before* next execution, meaning either the configured resource, either previous' pipe output resource
        Specified by:
        getInput in interface Pipe
        Returns:
        input, configured or previous pipe
      • getOutputBinding

        public Object getOutputBinding()
        Description copied from interface: Pipe
        returns the binding output used in container pipe's expression
        Specified by:
        getOutputBinding in interface Pipe
        Returns:
        object, either value map or something else, that will be used in nashorn for computing expressions
      • getBindings

        public PipeBindings getBindings()
        Description copied from interface: Pipe
        returns the pipe's bindings
        Specified by:
        getBindings in interface Pipe
        Returns:
        PipeBindings instance containing all bindings of that pipe
      • getOutput

        public Iterator<org.apache.sling.api.resource.Resource> getOutput()
        default execution, just returns current resource
        Specified by:
        getOutput in interface Pipe
        Returns:
        output of this pipe, which is here the input resource
      • before

        public void before()
        Description copied from interface: Pipe
        to be executed before output is retrieved
        Specified by:
        before in interface Pipe
      • after

        public void after()
        Description copied from interface: Pipe
        to be executed before output is retrieved
        Specified by:
        after in interface Pipe
      • computeOutput

        protected Iterator<org.apache.sling.api.resource.Resource> computeOutput()
        Returns:
        outputs of the pipe, as an iterator of resources
      • getConfiguration

        public org.apache.sling.api.resource.Resource getConfiguration()
        Get configuration node
        Returns:
        configuration node if any
      • getDistributionAgent

        public String getDistributionAgent()
        Description copied from interface: Pipe
        Get Distribution agent
        Specified by:
        getDistributionAgent in interface Pipe
        Returns:
        configured distribution agent