Package org.apache.jackrabbit.vault.fs
Class DirectoryArtifact
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.impl.AbstractArtifact
-
- org.apache.jackrabbit.vault.fs.DirectoryArtifact
-
- All Implemented Interfaces:
Artifact
,Dumpable
,ExportArtifact
,ImportArtifact
public class DirectoryArtifact extends org.apache.jackrabbit.vault.fs.impl.AbstractArtifact implements ExportArtifact, ImportArtifact
Implements a generic directory artifact.
-
-
Constructor Summary
Constructors Constructor Description DirectoryArtifact(java.lang.String name)
Constructs a new directory type artifact with the given repository name.DirectoryArtifact(java.lang.String name, java.lang.String extension)
Constructs a new directory type artifact with the given repository name and extension
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getContentLength()
Returns the length of the serialized data if it's known without doing the actual serialization.VaultInputSource
getInputSource()
Returns an input source to the contents of this artifact.java.io.InputStream
getInputStream()
Returns the input stream to the contents of this artifact.long
getLastModified()
Returns the last modified date or0
if not known.AccessType
getPreferredAccess()
Returns the preferred access value for this artifact.SerializationType
getSerializationType()
Returns the serialization type of this artifact.void
spool(java.io.OutputStream out)
Writes the content to the given output stream and closes it afterwards.-
Methods inherited from class org.apache.jackrabbit.vault.fs.impl.AbstractArtifact
dump, equals, getContentType, getExtension, getPlatformPath, getRelativePath, getType, hashCode, toString
-
Methods inherited from interface org.apache.jackrabbit.vault.fs.api.Artifact
getContentType, getExtension, getPlatformPath, getRelativePath, getType
-
-
-
-
Constructor Detail
-
DirectoryArtifact
public DirectoryArtifact(java.lang.String name)
Constructs a new directory type artifact with the given repository name.- Parameters:
name
- the repository name for this artifact.
-
DirectoryArtifact
public DirectoryArtifact(java.lang.String name, java.lang.String extension)
Constructs a new directory type artifact with the given repository name and extension- Parameters:
name
- the repository name for this artifact.extension
- the extension for this artifact
-
-
Method Detail
-
getSerializationType
public SerializationType getSerializationType()
Returns the serialization type of this artifact.- Specified by:
getSerializationType
in interfaceArtifact
- Returns:
- the serialization type of this artifact.
-
getPreferredAccess
public AccessType getPreferredAccess()
Returns the preferred access value for this artifact.- Specified by:
getPreferredAccess
in interfaceArtifact
- Returns:
- always
AccessType.NONE
-
spool
public void spool(java.io.OutputStream out) throws java.io.IOException, RepositoryException
Writes the content to the given output stream and closes it afterwards. This is the preferred method to use for output-artifacts.The specified stream remains open after this method returns.
- Specified by:
spool
in interfaceArtifact
- Overrides:
spool
in classorg.apache.jackrabbit.vault.fs.impl.AbstractArtifact
- Parameters:
out
- the output stream to spool to- Throws:
java.io.IOException
- if an I/O error occursRepositoryException
- if a repository error occurs
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException, RepositoryException
Returns the input stream to the contents of this artifact. This is the preferred method to use for input-artifacts.- Specified by:
getInputStream
in interfaceArtifact
- Returns:
- a input stream to the contents of this artifact.
- Throws:
java.io.IOException
- if an I/O error occursRepositoryException
- if a repository error occurs
-
getInputSource
public VaultInputSource getInputSource() throws java.io.IOException, RepositoryException
Returns an input source to the contents of this artifact. This is also preferred forAccessType.STREAM
.- Specified by:
getInputSource
in interfaceArtifact
- Returns:
- an input source.
- Throws:
java.io.IOException
- if an I/O error occurs.RepositoryException
- of a repository error occurs.
-
getContentLength
public long getContentLength()
Returns the length of the serialized data if it's known without doing the actual serialization.- Specified by:
getContentLength
in interfaceArtifact
- Returns:
- the length or
-1
if the length cannot be determined.
-
getLastModified
public long getLastModified()
Returns the last modified date or0
if not known.- Specified by:
getLastModified
in interfaceArtifact
- Returns:
- the last modified date or
0
-
-