Class AggregateManagerImpl
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.impl.AggregateManagerImpl
-
- All Implemented Interfaces:
AggregateManager
,NodeTypesCollector
public class AggregateManagerImpl extends Object implements AggregateManager
The artifact manager exposes an artifact node tree using the configured aggregators and serializers.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNodeTypes(Node node)
Add the primary and mixin node types of that node to the internal set of used node types.void
dumpConfig(PrintWriter out)
Dumps the configuration to the given writer for debugging purposes.Aggregator
getAggregator(Node node, String path)
Returns the aggregator for the given node ornull
if none found.VaultFsConfig
getConfig()
Returns the configstatic VaultFsConfig
getDefaultBinaryReferencesConfig()
Returns the default configstatic VaultFsConfig
getDefaultConfig()
Returns the default configstatic DefaultWorkspaceFilter
getDefaultWorkspaceFilter()
Returns the default workspace filterRepositoryAddress
getMountpoint()
Returns the repository address of the mountpoint of this artifacts node tree.String
getNamespaceURI(String prefix)
Set<String>
getNodeTypes()
Returns the node types used in the aggregates (so far).AggregateImpl
getRoot()
Returns the root aggregate of the treeSession
getSession()
Returns the session of this manager.String
getUserId()
Returns the user id of the session of this manager.String
getWorkspace()
Returns the name of the workspace of this manager.WorkspaceFilter
getWorkspaceFilter()
Returns the workspace filter.boolean
isMounted()
Checks if this tree is still mounted and if the attached session is still live.static AggregateManager
mount(VaultFsConfig config, WorkspaceFilter wspFilter, Repository rep, Credentials credentials, RepositoryAddress mountpoint)
Creates a new artifact manager that is rooted at the given path using the provided repository, credentials and workspace to create the session.static AggregateManager
mount(VaultFsConfig config, WorkspaceFilter wspFilter, RepositoryAddress mountpoint, Session session)
Creates a new artifact manager that is rooted at the given node.void
onAggregateCollected()
void
onAggregateCreated()
void
onAggregatePrepared()
void
startTracking(ProgressTrackerListener pTracker)
Starts tracking aggregate lifecyclesvoid
stopTracking()
Stops tracking of aggregate lifecyclevoid
unmount()
Releases all resources attached to this artifact managerImportInfo
writeAggregate(AggregateImpl node, String reposName, ArtifactSetImpl artifacts)
Writes the artifact set back to the repository.
-
-
-
Method Detail
-
mount
public static AggregateManager mount(VaultFsConfig config, WorkspaceFilter wspFilter, RepositoryAddress mountpoint, Session session) throws RepositoryException
Creates a new artifact manager that is rooted at the given node.- Parameters:
config
- fs configwspFilter
- the workspace filtermountpoint
- the address of the mountpointsession
- the repository session- Returns:
- an artifact manager
- Throws:
RepositoryException
- if an error occurs.
-
mount
public static AggregateManager mount(VaultFsConfig config, WorkspaceFilter wspFilter, Repository rep, Credentials credentials, RepositoryAddress mountpoint) throws RepositoryException
Creates a new artifact manager that is rooted at the given path using the provided repository, credentials and workspace to create the session.- Parameters:
config
- fs configwspFilter
- the workspace filterrep
- the jcr repositorycredentials
- the credentialsmountpoint
- the address of the mountpoint- Returns:
- an artifact manager
- Throws:
RepositoryException
- if an error occurs.
-
getDefaultConfig
public static VaultFsConfig getDefaultConfig()
Returns the default config- Returns:
- the default config
-
getDefaultBinaryReferencesConfig
public static VaultFsConfig getDefaultBinaryReferencesConfig()
Returns the default config- Returns:
- the default config
-
getDefaultWorkspaceFilter
public static DefaultWorkspaceFilter getDefaultWorkspaceFilter()
Returns the default workspace filter- Returns:
- the default workspace filter
-
unmount
public void unmount() throws RepositoryException
Description copied from interface:AggregateManager
Releases all resources attached to this artifact manager- Specified by:
unmount
in interfaceAggregateManager
- Throws:
RepositoryException
- if an error occurs.
-
getRoot
public AggregateImpl getRoot() throws RepositoryException
Description copied from interface:AggregateManager
Returns the root aggregate of the tree- Specified by:
getRoot
in interfaceAggregateManager
- Returns:
- the root aggregate.
- Throws:
RepositoryException
- if an error occurs.
-
getMountpoint
public RepositoryAddress getMountpoint()
Description copied from interface:AggregateManager
Returns the repository address of the mountpoint of this artifacts node tree.- Specified by:
getMountpoint
in interfaceAggregateManager
- Returns:
- the mountpoint
-
getNodeTypes
public Set<String> getNodeTypes()
Description copied from interface:NodeTypesCollector
Returns the node types used in the aggregates (so far).- Specified by:
getNodeTypes
in interfaceNodeTypesCollector
- Returns:
- node types
-
addNodeTypes
public void addNodeTypes(Node node) throws RepositoryException
Add the primary and mixin node types of that node to the internal set of used node types.- Specified by:
addNodeTypes
in interfaceNodeTypesCollector
- Parameters:
node
- the node- Throws:
RepositoryException
- if an error occurs
-
getNamespaceURI
public String getNamespaceURI(String prefix) throws RepositoryException
- Throws:
RepositoryException
-
startTracking
public void startTracking(ProgressTrackerListener pTracker)
Description copied from interface:AggregateManager
Starts tracking aggregate lifecycles- Specified by:
startTracking
in interfaceAggregateManager
- Parameters:
pTracker
- optional listener
-
stopTracking
public void stopTracking()
Description copied from interface:AggregateManager
Stops tracking of aggregate lifecycle- Specified by:
stopTracking
in interfaceAggregateManager
-
onAggregateCreated
public void onAggregateCreated()
-
onAggregateCollected
public void onAggregateCollected()
-
onAggregatePrepared
public void onAggregatePrepared()
-
getAggregator
public Aggregator getAggregator(Node node, String path) throws RepositoryException
Description copied from interface:AggregateManager
Returns the aggregator for the given node ornull
if none found.- Specified by:
getAggregator
in interfaceAggregateManager
- Parameters:
node
- for which the aggregator is to be returnedpath
- the path of the node ornull
- Returns:
- the aggregator or
null
- Throws:
RepositoryException
- if a repository error occurs.
-
getWorkspaceFilter
public WorkspaceFilter getWorkspaceFilter()
Description copied from interface:AggregateManager
Returns the workspace filter.- Specified by:
getWorkspaceFilter
in interfaceAggregateManager
- Returns:
- the workspace filter.
-
writeAggregate
public ImportInfo writeAggregate(AggregateImpl node, String reposName, ArtifactSetImpl artifacts) throws RepositoryException, IOException
Writes the artifact set back to the repository.- Parameters:
node
- the artifact node to writereposName
- the name of the new node ornull
artifacts
- the artifact to write- Returns:
- infos about the modifications
- Throws:
RepositoryException
- if an error occurs.IOException
- if an I/O error occurs.
-
isMounted
public boolean isMounted()
Description copied from interface:AggregateManager
Checks if this tree is still mounted and if the attached session is still live.- Specified by:
isMounted
in interfaceAggregateManager
- Returns:
true
if still mounted
-
getUserId
public String getUserId() throws RepositoryException
Description copied from interface:AggregateManager
Returns the user id of the session of this manager.- Specified by:
getUserId
in interfaceAggregateManager
- Returns:
- the user id.
- Throws:
RepositoryException
- if an error occurs.
-
getWorkspace
public String getWorkspace() throws RepositoryException
Description copied from interface:AggregateManager
Returns the name of the workspace of this manager.- Specified by:
getWorkspace
in interfaceAggregateManager
- Returns:
- the name of the workspace.
- Throws:
RepositoryException
- if an error occurs.
-
getSession
public Session getSession()
Description copied from interface:AggregateManager
Returns the session of this manager.- Specified by:
getSession
in interfaceAggregateManager
- Returns:
- the jcr session
-
dumpConfig
public void dumpConfig(PrintWriter out) throws IOException
Description copied from interface:AggregateManager
Dumps the configuration to the given writer for debugging purposes.- Specified by:
dumpConfig
in interfaceAggregateManager
- Parameters:
out
- the writer- Throws:
IOException
- if an I/O error occurs
-
getConfig
public VaultFsConfig getConfig()
Description copied from interface:AggregateManager
Returns the config- Specified by:
getConfig
in interfaceAggregateManager
- Returns:
- the config
-
-