Class AggregateImpl

  • All Implemented Interfaces:
    Aggregate, Dumpable

    public class AggregateImpl
    extends Object
    implements Aggregate
    Collects the items that form an aggregate. The aggregates form a tree on top of the repository one by invoking the respective aggregators. The aggregates are controlled via the AggregateManagerImpl and are loaded dynamically when traversing through the tree.

    The aggregates can then later be used by the aggregators to provide the artifacts of this aggregate.

    • Field Detail

      • log

        protected static final org.slf4j.Logger log
        The default logger
    • Constructor Detail

      • AggregateImpl

        protected AggregateImpl​(AggregateManagerImpl mgr,
                                String path,
                                Aggregator aggregator)
                         throws javax.jcr.RepositoryException
        Creates a new root aggregate
        Parameters:
        mgr - Aggregate manager
        path - the path of the aggregate
        aggregator - aggregator
        Throws:
        javax.jcr.RepositoryException - if a error occurs
      • AggregateImpl

        protected AggregateImpl​(AggregateImpl parent,
                                String path,
                                Aggregator aggregator)
                         throws javax.jcr.RepositoryException
        Creates a new sub aggregate
        Parameters:
        parent - parent aggregate
        path - path of aggregate
        aggregator - aggregator
        Throws:
        javax.jcr.RepositoryException - if a error occurs
    • Method Detail

      • getNode

        public javax.jcr.Node getNode()
                               throws javax.jcr.RepositoryException
        Specified by:
        getNode in interface Aggregate
        Throws:
        javax.jcr.RepositoryException
      • hasNode

        public boolean hasNode()
                        throws javax.jcr.RepositoryException
        Specified by:
        hasNode in interface Aggregate
        Throws:
        javax.jcr.RepositoryException
      • invalidate

        public void invalidate()
      • getRepositoryAddress

        public RepositoryAddress getRepositoryAddress()
                                               throws javax.jcr.RepositoryException
        Description copied from interface: Aggregate
        Returns the (absolute) repository address to the node that this artifact node represents.
        Specified by:
        getRepositoryAddress in interface Aggregate
        Returns:
        the repository address
        Throws:
        javax.jcr.RepositoryException - if an error occurs.
      • allowsChildren

        public boolean allowsChildren()
        Description copied from interface: Aggregate
        Checks if this artifact node possibly allows children, i.e. is a folder.
        Specified by:
        allowsChildren in interface Aggregate
        Returns:
        true if this artifact node allows children; false otherwise.
      • getRelPath

        public String getRelPath()
        Description copied from interface: Aggregate
        Returns the relative path of this aggregate in respect to it's parent aggregate.
        Specified by:
        getRelPath in interface Aggregate
        Returns:
        the relative path
      • getName

        public String getName()
        Description copied from interface: Aggregate
        Returns the name of this aggregate.
        Specified by:
        getName in interface Aggregate
        Returns:
        the name of this aggregate.
      • getLeaves

        public List<? extends Aggregate> getLeaves()
                                            throws javax.jcr.RepositoryException
        Description copied from interface: Aggregate
        Returns the leaves of this aggregate or null.
        Specified by:
        getLeaves in interface Aggregate
        Returns:
        the leaves
        Throws:
        javax.jcr.RepositoryException - if an error occurs
      • getAggregate

        public Aggregate getAggregate​(String relPath)
                               throws javax.jcr.RepositoryException
        Specified by:
        getAggregate in interface Aggregate
        Throws:
        javax.jcr.RepositoryException
      • getArtifacts

        public ArtifactSet getArtifacts()
                                 throws javax.jcr.RepositoryException
        Description copied from interface: Aggregate
        Returns the artifacts of this node.
        Specified by:
        getArtifacts in interface Aggregate
        Returns:
        the artifacts
        Throws:
        javax.jcr.RepositoryException - if this file is not attached to the fs, yet.
      • getBuilder

        public AggregateBuilder getBuilder()
                                    throws javax.jcr.RepositoryException
        Returns an artifact output for this node that allows writing the artifacts.
        Returns:
        an artifact output.
        Throws:
        javax.jcr.RepositoryException - if this file is not attached to the fs, yet.
      • create

        public AggregateBuilder create​(String reposName)
                                throws javax.jcr.RepositoryException
        Creates a new child artifact node with the given name. Please note, that the returned node is not attached to the tree.

        If this artifact node does not allow children a RepositoryException is thrown.

        Parameters:
        reposName - the (repository) name for the new node
        Returns:
        a new child node.
        Throws:
        javax.jcr.RepositoryException - if an error occurs.
      • remove

        public ImportInfo remove​(boolean recursive)
                          throws javax.jcr.RepositoryException
        Removes this artifact node from the tree. If this artifact node has directory and non-directory artifacts only the non-directory artifacts are removed unless recursive is specified.
        Parameters:
        recursive - specifies if directories are removed as well.
        Returns:
        infos about the modifications
        Throws:
        javax.jcr.RepositoryException - if an error occurs.
      • isAttached

        public boolean isAttached()
                           throws javax.jcr.RepositoryException
        Description copied from interface: Aggregate
        Checks if this aggregate has an aggregator and its node exists.
        Specified by:
        isAttached in interface Aggregate
        Returns:
        true if this aggregate is attached
        Throws:
        javax.jcr.RepositoryException - if an error occurs
      • dump

        public void dump​(DumpContext ctx,
                         boolean isLast)
        Dumps some human readable information using the given context.
        Specified by:
        dump in interface Dumpable
        Parameters:
        ctx - the dump context
        isLast - specifies if this is the last element to dump on this level
      • getNamespaceURI

        public String getNamespaceURI​(String prefix)
                               throws javax.jcr.RepositoryException
        Specified by:
        getNamespaceURI in interface Aggregate
        Throws:
        javax.jcr.RepositoryException
      • getBinaries

        public Collection<javax.jcr.Property> getBinaries()
        Description copied from interface: Aggregate
        Returns the collection of binary properties in this aggregate
        Specified by:
        getBinaries in interface Aggregate
        Returns:
        the binaries or null
      • walk

        public void walk​(org.apache.jackrabbit.vault.fs.impl.io.AggregateWalkListener aggregateWalkListener)
                  throws javax.jcr.RepositoryException
        Walks the node tree and invokes the callbacks in the listener according to the configured filters. For each tree there are the following events generated: events := OnWalkBegin { nodeEvent } OnWalkEnd; nodeEvent := OnNodeBegin { propEvent } OnChildBegin { nodeEvent } OnNodeEnd; propEvent := OnProperty;
        Parameters:
        aggregateWalkListener - the listener that receives the events
        Throws:
        javax.jcr.RepositoryException - if an repository error occurs.