Interface PipeBuilder


  • @ProviderType
    public interface PipeBuilder
    Builder and Runner of a pipe, based on a fluent API, for script and java usage.
    • Method Detail

      • pipe

        PipeBuilder pipe​(String type)
        attach a new pipe to the current context
        Parameters:
        type - resource type (should be registered by the plumber)
        Returns:
        updated instance of PipeBuilder
      • mv

        PipeBuilder mv​(String expr)
        attach a move pipe to the current context
        Parameters:
        expr - target of the resource to move
        Returns:
        updated instance of PipeBuilder
      • auth

        PipeBuilder auth​(Object... conf)
                  throws IllegalAccessException
        attach an authorizable pipe to the current context
        Parameters:
        conf - configuration key value pairs for authorizable (see pipe's doc)
        Returns:
        updated instance of PipeBuilder
        Throws:
        IllegalAccessException - in case it's called with bad configuration
      • xpath

        PipeBuilder xpath​(String expr)
        attach a xpath pipe to the current context
        Parameters:
        expr - xpath expression
        Returns:
        updated instance of PipeBuilder
      • children

        PipeBuilder children​(String expr)
        attach a sling query children pipe to the current context
        Parameters:
        expr - sling query expression
        Returns:
        updated instance of PipeBuilder
      • siblings

        PipeBuilder siblings​(String expr)
        attach a sling query siblings pipe to the current context
        Parameters:
        expr - sling query expression
        Returns:
        updated instance of PipeBuilder
      • rm

        PipeBuilder rm()
        attach a rm pipe to the current context
        Returns:
        updated instance of PipeBuilder
      • csv

        PipeBuilder csv​(String expr)
        attach a csv pipe to the current context
        Parameters:
        expr - csv expr or URL or path in the resource tree
        Returns:
        updated instance of PipeBuilder
      • json

        PipeBuilder json​(String expr)
        attach a json pipe to the current context
        Parameters:
        expr - json expr or URL or path in the resource tree
        Returns:
        updated instance of PipeBuilder
      • egrep

        PipeBuilder egrep​(String expr)
        attach a Regexp pipe to the current context
        Parameters:
        expr - text expr or URL or path in the resource tree
        Returns:
        updated instance of PipeBuilder
      • mkdir

        PipeBuilder mkdir​(String expr)
        Attach a path pipe to the current context
        Parameters:
        expr - path to create
        Returns:
        updated instance of PipeBuilder
      • echo

        PipeBuilder echo​(String path)
        attach a base pipe to the current context
        Parameters:
        path - pipe path
        Returns:
        updated instance of PipeBuilder
      • traverse

        PipeBuilder traverse()
        attach a traverse pipe to the current context
        Returns:
        updated instance of PipeBuilder
      • parent

        PipeBuilder parent()
        attach a sling query parent pipe to the current context
        Returns:
        updated instance of PipeBuilder
      • parents

        PipeBuilder parents​(String expr)
        attach a sling query parents pipe to the current context
        Parameters:
        expr - expression
        Returns:
        updated instance of PipeBuilder
      • closest

        PipeBuilder closest​(String expr)
        attach a sling query closest pipe to the current context
        Parameters:
        expr - expression
        Returns:
        updated instance of PipeBuilder
      • $

        PipeBuilder $​(String expr)
        attach a sling query find pipe to the current context
        Parameters:
        expr - expression
        Returns:
        updated instance of PipeBuilder
      • ref

        PipeBuilder ref​(String expr)
        attach a reference pipe to the current context
        Parameters:
        expr - reference
        Returns:
        updated instance of PipeBuilder
      • shallowRef

        PipeBuilder shallowRef​(String expr)
        attach a shallow reference pipe to the current context
        Parameters:
        expr - reference
        Returns:
        updated instance of PipeBuilder
      • pkg

        PipeBuilder pkg​(String expr)
        attach a package pipe, in filter collection mode as default
        Parameters:
        expr - path of the pipe
        Returns:
        updated instance of PipeBuilder
      • not

        PipeBuilder not​(String expr)
        attach a not pipe to the current context
        Parameters:
        expr - reference
        Returns:
        updated instance of PipeBuilder
      • mp

        PipeBuilder mp()
        attach a MULTI value property pipe to the current context
        Returns:
        updated instance of PipeBuilder
      • allow

        PipeBuilder allow​(String expr)
                   throws IllegalAccessException
        attach an ACL pipe to the current context and sets allow acls on the resource
        Parameters:
        expr - prinicipalName/AuthorizableId of the user to give allow privileges to
        Returns:
        updated instance of PipeBuilder
        Throws:
        IllegalAccessException - in case it's called with bad configuration
      • deny

        PipeBuilder deny​(String expr)
                  throws IllegalAccessException
        attach an ACL pipe to the current context and sets deny acls on the resource
        Parameters:
        expr - prinicipalName/AuthorizableId of the user/group to give deny privileges to
        Returns:
        updated instance of PipeBuilder
        Throws:
        IllegalAccessException - in case it's called with bad configuration
      • withStrings

        PipeBuilder withStrings​(String... params)
        parameterized current pipe in the context
        Parameters:
        params - key value pair of parameters
        Returns:
        updated instance of PipeBuilder
      • name

        PipeBuilder name​(String name)
                  throws IllegalAccessException
        sets a pipe name, important in case you want to reuse it in another expression
        Parameters:
        name - to overwrite default binding name (otherwise it will be "one", "two", ...)
        Returns:
        updated instance of PipeBuilder
        Throws:
        IllegalAccessException - in case it's called before a pipe is configured
      • conf

        PipeBuilder conf​(Object... properties)
                  throws IllegalAccessException
        Building up a set of configurations for the current pipe
        Parameters:
        properties - configuration key value pairs (must be an even number of arguments)
        Returns:
        updated instance of PipeBuilder
        Throws:
        IllegalAccessException - in case it's called in a bad time
      • outputs

        PipeBuilder outputs​(String... keys)
        add outputs passed key
        Parameters:
        keys - properties of the outputs resource to output
        Returns:
        current instance of PipeBuilder
      • build

        Pipe build()
            throws org.apache.sling.api.resource.PersistenceException
        builds a configured pipe. The configuration will be placed in a balanced tree under /var/pipes
        Returns:
        Created (not executed) Pipe instance.
        Throws:
        org.apache.sling.api.resource.PersistenceException - error occuring when saving the pipe configuration
      • build

        Pipe build​(String path)
            throws org.apache.sling.api.resource.PersistenceException
        builds a configured pipe. The configuration will be placed under path
        Parameters:
        path - path under which the generated configuration should be stored
        Returns:
        Created (not executed) Pipe instance
        Throws:
        org.apache.sling.api.resource.PersistenceException - error occuring when saving the pipe configuration
      • run

        ExecutionResult run()
        builds and run configured pipe
        Returns:
        set of resource path, output of the pipe execution
      • run

        ExecutionResult run​(Map<String,​Object> bindings)
        allow execution of a pipe, with more parameter
        Parameters:
        bindings - additional bindings
        Returns:
        set of resource path, output of the pipe execution
      • runWith

        ExecutionResult runWith​(Object... bindings)
        allow execution of a pipe, with more parameter
        Parameters:
        bindings - additional bindings, should be key/value format
        Returns:
        set of resource path, output of the pipe execution
      • runAsync

        org.apache.sling.event.jobs.Job runAsync​(Map<String,​Object> bindings)
                                          throws org.apache.sling.api.resource.PersistenceException
        run a pipe asynchronously
        Parameters:
        bindings - additional bindings for the execution (can be null)
        Returns:
        registered job for the pipe execution
        Throws:
        org.apache.sling.api.resource.PersistenceException - in case something goes wrong in the job creation
      • runParallel

        ExecutionResult runParallel​(int numThreads,
                                    Map<String,​Object> bindings)
        run referenced pipes in parallel
        Parameters:
        numThreads - number of threads to use for running the contained pipes
        bindings - additional bindings for the execution (can be null)
        Returns:
        set of resource path, merged output of pipes execution (order is arbitrary)