Class VaultFileImpl
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.impl.VaultFileImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
The default logger
-
Constructor Summary
Constructors Modifier Constructor Description protected
VaultFileImpl(VaultFileSystem fs, String rootPath, VaultFileNode node)
Internal constructor for the root fileprotected
VaultFileImpl(VaultFileSystem fs, String name, VaultFileNode node, Artifact artifact)
Internal constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPendingNode(VaultFileNode n)
Adds a node to the map of pending onesprotected void
attach(VaultFileNode node, Artifact a)
boolean
canRead()
Checks if this file can be read from (eg.void
dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.Aggregate
getAggregate()
Returns the artifacts node of this file ornull
if it's transientString
getAggregatePath()
Artifact
getArtifact()
Returns the underlying artifact for this os file.VaultFileImpl
getChild(String name)
Returns the child with the given name ornull
Collection<? extends VaultFile>
getChildren()
Returns a collection of the childrenString
getContentType()
Returns the content type of this file ornull
if the type cannot be determined or if it's a directory.Aggregate
getControllingAggregate()
Returns the aggregate that controls this file.VaultFileSystem
getFileSystem()
Returns the underlying file system.String
getName()
Returns the name of this file.protected VaultFileImpl
getOrAddChild(String name)
Returns the child of the given name or creates and adds a new one.VaultFileImpl
getParent()
Returns the parent file ornull
if this is the root file.String
getPath()
Returns the os pathCollection<? extends VaultFile>
getRelated()
Returns the os file set for this file.String
getRepoRelPath()
protected void
init(VaultFileNode node, Artifact a)
(re)initializes this filevoid
invalidate()
boolean
isDirectory()
Checks if this file is a directory.boolean
isTransient()
Checks if this file is transient.long
lastModified()
Returns the last modified date or0
if not known.long
length()
Returns the length of the serialized data if it's known without doing the actual serialization.
-
-
-
Constructor Detail
-
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 Detail
-
init
protected void init(VaultFileNode node, Artifact a) throws RepositoryException
(re)initializes this file- Parameters:
node
- the artifacts nodea
- the artifact- Throws:
RepositoryException
- if an error occurs
-
attach
protected void attach(VaultFileNode node, Artifact a)
-
getRepoRelPath
public String getRepoRelPath()
- Specified by:
getRepoRelPath
in interfaceVaultFile
- Returns:
- the relative path of this artifact with respect to its parent node (repository format).
-
getAggregatePath
public String getAggregatePath()
- Specified by:
getAggregatePath
in interfaceVaultFile
- Returns:
- the repository path of the artifact's root (repository format).
-
getName
public String getName()
Description copied from interface:VaultFile
Returns the name of this file.
-
getArtifact
public Artifact getArtifact()
Description copied from interface:VaultFile
Returns the underlying artifact for this os file. If this file represents the Meta-Directorynull
is returned.- Specified by:
getArtifact
in interfaceVaultFile
- Returns:
- the artifact or
null
.
-
isDirectory
public boolean isDirectory()
Description copied from interface:VaultFile
Checks if this file is a directory.- Specified by:
isDirectory
in interfaceVaultFile
- Returns:
true
if this file is a directory.
-
isTransient
public boolean isTransient()
Description copied from interface:VaultFile
Checks 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:
isTransient
in interfaceVaultFile
- Returns:
true
if this file is transient
-
getParent
public VaultFileImpl getParent() throws IOException, RepositoryException
Description copied from interface:VaultFile
Returns the parent file ornull
if this is the root file.- Specified by:
getParent
in interfaceVaultFile
- Returns:
- the parent file.
- Throws:
IOException
- if an I/O error occurs.RepositoryException
- if a repository error occurs.
-
getAggregate
public Aggregate getAggregate()
Description copied from interface:VaultFile
Returns the artifacts node of this file ornull
if it's transient- Specified by:
getAggregate
in interfaceVaultFile
- Returns:
- the artifacts node
-
getControllingAggregate
public Aggregate getControllingAggregate()
Description copied from interface:VaultFile
Returns the aggregate that controls this file.- Specified by:
getControllingAggregate
in interfaceVaultFile
- Returns:
- the artifacts node
-
getChild
public VaultFileImpl getChild(String name) throws RepositoryException
Description copied from interface:VaultFile
Returns the child with the given name ornull
- Specified by:
getChild
in interfaceVaultFile
- Parameters:
name
- the name of the child- Returns:
- the child or
null
- Throws:
RepositoryException
- if an error occurs
-
getChildren
public Collection<? extends VaultFile> getChildren() throws RepositoryException
Description copied from interface:VaultFile
Returns a collection of the children- Specified by:
getChildren
in interfaceVaultFile
- Returns:
- a collection of the children
- Throws:
RepositoryException
- if an error occurs
-
addPendingNode
protected void addPendingNode(VaultFileNode n) throws RepositoryException
Adds a node to the map of pending ones- Parameters:
n
- the node- Throws:
RepositoryException
- if an error occurs
-
getOrAddChild
protected VaultFileImpl getOrAddChild(String name) throws RepositoryException
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
public Collection<? extends VaultFile> getRelated() throws RepositoryException
Description copied from interface:VaultFile
Returns the os file set for this file. The set contains those are the files that are generated from the same jcr file.- Specified by:
getRelated
in interfaceVaultFile
- Returns:
- the file set of related files
- Throws:
RepositoryException
- if an error occurs.
-
canRead
public boolean canRead()
Description copied from interface:VaultFile
Checks if this file can be read from (eg. if it's not a directory)
-
lastModified
public long lastModified()
Description copied from interface:VaultFile
Returns the last modified date or0
if not known.- Specified by:
lastModified
in interfaceVaultFile
- Returns:
- the last modified date or
0
-
length
public long length()
Description copied from interface:VaultFile
Returns the length of the serialized data if it's known without doing the actual serialization.
-
getContentType
public String getContentType()
Description copied from interface:VaultFile
Returns the content type of this file ornull
if the type cannot be determined or if it's a directory.- Specified by:
getContentType
in interfaceVaultFile
- Returns:
- the content type or
null
.
-
getFileSystem
public VaultFileSystem getFileSystem()
Description copied from interface:VaultFile
Returns the underlying file system.- Specified by:
getFileSystem
in interfaceVaultFile
- Returns:
- the Vault filesystem
-
invalidate
public void invalidate() throws RepositoryException
- Specified by:
invalidate
in interfaceVaultFile
- Throws:
RepositoryException
-
dump
public void dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.
-
-