Class VaultFileImpl
java.lang.Object
org.apache.jackrabbit.vault.fs.impl.VaultFileImpl
Implements the bridge between the repository based artifacts nodes and their
file system representation as a collection of artifacts.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVaultFileImpl(VaultFileSystem fs, String rootPath, VaultFileNode node) Internal constructor for the root fileprotectedVaultFileImpl(VaultFileSystem fs, String name, VaultFileNode node, Artifact artifact) Internal constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds a node to the map of pending onesprotected voidattach(VaultFileNode node, Artifact a) booleancanRead()Checks if this file can be read from (eg. if it's not a directory)voiddump(DumpContext ctx, boolean isLast) Dumps some human readable information using the given context.Returns the artifacts node of this file ornullif it's transientReturns the underlying artifact for this os file.Returns the child with the given name ornullCollection<? extends VaultFile>Returns a collection of the childrenReturns the content type of this file ornullif the type cannot be determined or if it's a directory.Returns the aggregate that controls this file.Returns the underlying file system.getName()Returns the name of this file.protected VaultFileImplgetOrAddChild(String name) Returns the child of the given name or creates and adds a new one.Returns the parent file ornullif this is the root file.getPath()Returns the os pathCollection<? extends VaultFile>Returns the os file set for this file.protected voidinit(VaultFileNode node, Artifact a) (re)initializes this filevoidbooleanChecks if this file is a directory.booleanChecks if this file is transient. a file is transient if it's only used as hierarchical node for a deeper 'real' file. i.e.longReturns the last modified date or0if not known.longlength()Returns the length of the serialized data if it's known without doing the actual serialization.
-
Field Details
-
log
protected static org.slf4j.Logger logThe default logger
-
-
Constructor Details
-
VaultFileImpl
protected VaultFileImpl(VaultFileSystem fs, String rootPath, VaultFileNode node) throws RepositoryException Internal constructor for the root file- Parameters:
fs- the file systemrootPath- path of the root nodenode- the node- Throws:
RepositoryException- if an error occurs
-
VaultFileImpl
protected VaultFileImpl(VaultFileSystem fs, String name, VaultFileNode node, Artifact artifact) throws RepositoryException Internal constructor- Parameters:
fs- the file systemname- the file entry namenode- the nodeartifact- the underlying artifact. can benull- Throws:
RepositoryException- if an error occurs
-
-
Method Details
-
init
(re)initializes this file- Parameters:
node- the artifacts nodea- the artifact- Throws:
RepositoryException- if an error occurs
-
attach
-
getPath
Description copied from interface:VaultFileReturns the os path -
getRepoRelPath
- Specified by:
getRepoRelPathin interfaceVaultFile- Returns:
- the relative path of this artifact with respect to its parent node (repository format).
-
getAggregatePath
- Specified by:
getAggregatePathin interfaceVaultFile- Returns:
- the repository path of the artifact's root (repository format).
-
getName
Description copied from interface:VaultFileReturns the name of this file. -
getArtifact
Description copied from interface:VaultFileReturns the underlying artifact for this os file. If this file represents the Meta-Directorynullis returned.- Specified by:
getArtifactin interfaceVaultFile- Returns:
- the artifact or
null.
-
isDirectory
public boolean isDirectory()Description copied from interface:VaultFileChecks if this file is a directory.- Specified by:
isDirectoryin interfaceVaultFile- Returns:
trueif this file is a directory.
-
isTransient
public boolean isTransient()Description copied from interface:VaultFileChecks if this file is transient. a file is transient if it's only used as hierarchical node for a deeper 'real' file. i.e.- Specified by:
isTransientin interfaceVaultFile- Returns:
trueif this file is transient
-
getParent
Description copied from interface:VaultFileReturns the parent file ornullif this is the root file.- Specified by:
getParentin interfaceVaultFile- Returns:
- the parent file.
- Throws:
IOException- if an I/O error occurs.RepositoryException- if a repository error occurs.
-
getAggregate
Description copied from interface:VaultFileReturns the artifacts node of this file ornullif it's transient- Specified by:
getAggregatein interfaceVaultFile- Returns:
- the artifacts node
-
getControllingAggregate
Description copied from interface:VaultFileReturns the aggregate that controls this file.- Specified by:
getControllingAggregatein interfaceVaultFile- Returns:
- the artifacts node
-
getChild
Description copied from interface:VaultFileReturns the child with the given name ornull- Specified by:
getChildin interfaceVaultFile- Parameters:
name- the name of the child- Returns:
- the child or
null - Throws:
RepositoryException- if an error occurs
-
getChildren
Description copied from interface:VaultFileReturns a collection of the children- Specified by:
getChildrenin interfaceVaultFile- Returns:
- a collection of the children
- Throws:
RepositoryException- if an error occurs
-
addPendingNode
Adds a node to the map of pending ones- Parameters:
n- the node- Throws:
RepositoryException- if an error occurs
-
getOrAddChild
Returns the child of the given name or creates and adds a new one.- Parameters:
name- the name of the file- Returns:
- the child
- Throws:
RepositoryException- if an error occurs
-
getRelated
Description copied from interface:VaultFileReturns the os file set for this file. The set contains those are the files that are generated from the same jcr file.- Specified by:
getRelatedin interfaceVaultFile- Returns:
- the file set of related files
- Throws:
RepositoryException- if an error occurs.
-
canRead
public boolean canRead()Description copied from interface:VaultFileChecks if this file can be read from (eg. if it's not a directory) -
lastModified
public long lastModified()Description copied from interface:VaultFileReturns the last modified date or0if not known.- Specified by:
lastModifiedin interfaceVaultFile- Returns:
- the last modified date or
0
-
length
public long length()Description copied from interface:VaultFileReturns the length of the serialized data if it's known without doing the actual serialization. -
getContentType
Description copied from interface:VaultFileReturns the content type of this file ornullif the type cannot be determined or if it's a directory.- Specified by:
getContentTypein interfaceVaultFile- Returns:
- the content type or
null.
-
getFileSystem
Description copied from interface:VaultFileReturns the underlying file system.- Specified by:
getFileSystemin interfaceVaultFile- Returns:
- the Vault filesystem
-
invalidate
- Specified by:
invalidatein interfaceVaultFile- Throws:
RepositoryException
-
dump
Dumps some human readable information using the given context.
-