Class AggregateImpl
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.impl.AggregateImpl
-
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 theAggregateManagerImpl
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 Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
The default logger
-
Constructor Summary
Constructors Modifier Constructor Description protected
AggregateImpl(AggregateImpl parent, String path, Aggregator aggregator)
Creates a new sub aggregateprotected
AggregateImpl(AggregateManagerImpl mgr, String path, Aggregator aggregator)
Creates a new root aggregate
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowsChildren()
Checks if this artifact node possibly allows children, i.e.AggregateBuilder
create(String reposName)
Creates a new child artifact node with the given name.void
dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.Aggregate
getAggregate(String relPath)
ArtifactSet
getArtifacts()
Returns the artifacts of this node.Collection<Property>
getBinaries()
Returns the collection of binary properties in this aggregateAggregateBuilder
getBuilder()
Returns an artifact output for this node that allows writing the artifacts.List<? extends Aggregate>
getLeaves()
Returns the leaves of this aggregate ornull
.AggregateManagerImpl
getManager()
Returns the artifact manager this node belongs to.String
getName()
Returns the name of this aggregate.String[]
getNamespacePrefixes()
String
getNamespaceURI(String prefix)
Node
getNode()
Aggregate
getParent()
String
getPath()
String
getRelPath()
Returns the relative path of this aggregate in respect to it's parent aggregate.RepositoryAddress
getRepositoryAddress()
Returns the (absolute) repository address to the node that this artifact node represents.boolean
hasNode()
void
invalidate()
boolean
isAttached()
Checks if this aggregate has an aggregator and its node exists.ImportInfo
remove(boolean recursive)
Removes this artifact node from the tree.void
walk(org.apache.jackrabbit.vault.fs.impl.io.AggregateWalkListener aggregateWalkListener)
Walks the node tree and invokes the callbacks in the listener according to the configured filters.
-
-
-
Constructor Detail
-
AggregateImpl
protected AggregateImpl(AggregateManagerImpl mgr, String path, Aggregator aggregator) throws RepositoryException
Creates a new root aggregate- Parameters:
mgr
- Aggregate managerpath
- the path of the aggregateaggregator
- aggregator- Throws:
RepositoryException
- if a error occurs
-
AggregateImpl
protected AggregateImpl(AggregateImpl parent, String path, Aggregator aggregator) throws RepositoryException
Creates a new sub aggregate- Parameters:
parent
- parent aggregatepath
- path of aggregateaggregator
- aggregator- Throws:
RepositoryException
- if a error occurs
-
-
Method Detail
-
getNode
public Node getNode() throws RepositoryException
- Specified by:
getNode
in interfaceAggregate
- Throws:
RepositoryException
-
hasNode
public boolean hasNode() throws RepositoryException
- Specified by:
hasNode
in interfaceAggregate
- Throws:
RepositoryException
-
invalidate
public void invalidate()
-
getRepositoryAddress
public RepositoryAddress getRepositoryAddress() throws RepositoryException
Description copied from interface:Aggregate
Returns the (absolute) repository address to the node that this artifact node represents.- Specified by:
getRepositoryAddress
in interfaceAggregate
- Returns:
- the repository address
- Throws:
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 interfaceAggregate
- 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 interfaceAggregate
- Returns:
- the relative path
-
getName
public String getName()
Description copied from interface:Aggregate
Returns the name of this aggregate.
-
getLeaves
public List<? extends Aggregate> getLeaves() throws RepositoryException
Description copied from interface:Aggregate
Returns the leaves of this aggregate ornull
.- Specified by:
getLeaves
in interfaceAggregate
- Returns:
- the leaves
- Throws:
RepositoryException
- if an error occurs
-
getAggregate
public Aggregate getAggregate(String relPath) throws RepositoryException
- Specified by:
getAggregate
in interfaceAggregate
- Throws:
RepositoryException
-
getArtifacts
public ArtifactSet getArtifacts() throws RepositoryException
Description copied from interface:Aggregate
Returns the artifacts of this node.- Specified by:
getArtifacts
in interfaceAggregate
- Returns:
- the artifacts
- Throws:
RepositoryException
- if this file is not attached to the fs, yet.
-
getBuilder
public AggregateBuilder getBuilder() throws RepositoryException
Returns an artifact output for this node that allows writing the artifacts.- Returns:
- an artifact output.
- Throws:
RepositoryException
- if this file is not attached to the fs, yet.
-
create
public AggregateBuilder create(String reposName) throws 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:
RepositoryException
- if an error occurs.
-
remove
public ImportInfo remove(boolean recursive) throws 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 unlessrecursive
is specified.- Parameters:
recursive
- specifies if directories are removed as well.- Returns:
- infos about the modifications
- Throws:
RepositoryException
- if an error occurs.
-
getManager
public AggregateManagerImpl getManager()
Description copied from interface:Aggregate
Returns the artifact manager this node belongs to.- Specified by:
getManager
in interfaceAggregate
- Returns:
- the Vault filesystem.
-
isAttached
public boolean isAttached() throws RepositoryException
Description copied from interface:Aggregate
Checks if this aggregate has an aggregator and its node exists.- Specified by:
isAttached
in interfaceAggregate
- Returns:
true
if this aggregate is attached- Throws:
RepositoryException
- if an error occurs
-
dump
public void dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.
-
getNamespacePrefixes
public String[] getNamespacePrefixes()
- Specified by:
getNamespacePrefixes
in interfaceAggregate
-
getNamespaceURI
public String getNamespaceURI(String prefix) throws RepositoryException
- Specified by:
getNamespaceURI
in interfaceAggregate
- Throws:
RepositoryException
-
getBinaries
public Collection<Property> getBinaries()
Description copied from interface:Aggregate
Returns the collection of binary properties in this aggregate- Specified by:
getBinaries
in interfaceAggregate
- Returns:
- the binaries or
null
-
walk
public void walk(org.apache.jackrabbit.vault.fs.impl.io.AggregateWalkListener aggregateWalkListener) throws 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:
RepositoryException
- if an repository error occurs.
-
-