Package org.apache.jackrabbit.vault.fs
Class PropertyValueArtifact
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.impl.AbstractArtifact
-
- org.apache.jackrabbit.vault.fs.PropertyValueArtifact
-
- All Implemented Interfaces:
Artifact
,Dumpable
,ExportArtifact
public class PropertyValueArtifact extends org.apache.jackrabbit.vault.fs.impl.AbstractArtifact implements ExportArtifact
Implements a artifact that is based on a property value.
-
-
Constructor Summary
Constructors Constructor Description PropertyValueArtifact(Artifact parent, java.lang.String relPath, java.lang.String ext, ArtifactType type, Property prop, int index, long lastModified)
PropertyValueArtifact(Artifact parent, java.lang.String relPath, java.lang.String ext, ArtifactType type, Property prop, long lastModified)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<PropertyValueArtifact>
create(Artifact parent, java.lang.String relPath, java.lang.String ext, ArtifactType type, Property prop, long lastModified)
Creates a collection ofPropertyValueArtifact
from the given property.void
detach()
Detaches the value from the underlying property value.long
getContentLength()
Returns the length of the serialized data if it's known without doing the actual serialization.java.lang.String
getContentType()
Returns the content type of the serialized data ornull
if the type is not known or cannot be determined.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.Property
getProperty()
Returns the underlying propertySerializationType
getSerializationType()
Returns the serialization type of this artifact.-
Methods inherited from class org.apache.jackrabbit.vault.fs.impl.AbstractArtifact
dump, equals, getExtension, getPlatformPath, getRelativePath, getType, hashCode, spool, toString
-
Methods inherited from interface org.apache.jackrabbit.vault.fs.api.Artifact
getExtension, getPlatformPath, getRelativePath, getType, spool
-
-
-
-
Constructor Detail
-
PropertyValueArtifact
public PropertyValueArtifact(Artifact parent, java.lang.String relPath, java.lang.String ext, ArtifactType type, Property prop, long lastModified) throws RepositoryException
- Throws:
RepositoryException
-
PropertyValueArtifact
public PropertyValueArtifact(Artifact parent, java.lang.String relPath, java.lang.String ext, ArtifactType type, Property prop, int index, long lastModified) throws RepositoryException
- Throws:
RepositoryException
-
-
Method Detail
-
create
public static java.util.Collection<PropertyValueArtifact> create(Artifact parent, java.lang.String relPath, java.lang.String ext, ArtifactType type, Property prop, long lastModified) throws RepositoryException
Creates a collection ofPropertyValueArtifact
from the given property. If the property is multivalued there will be an artifact created for each value with the value index appended to it's name.- Parameters:
parent
- parent artifactrelPath
- the base name for the artifact(s).ext
- the extensiontype
- the type for the artifact(s).prop
- the property for the artifact(s).lastModified
- the last modified date.- Returns:
- a collection of Artifacts.
- Throws:
RepositoryException
- if an error occurs
-
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.STREAM
-
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
-
detach
public void detach() throws java.io.IOException, RepositoryException
Detaches the value from the underlying property value.- 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:
- a input source which systemId is the path of the underlying property
- 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.
-
getProperty
public Property getProperty()
Returns the underlying property- Returns:
- the underlying property
-
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
-
getContentType
public java.lang.String getContentType()
Returns the content type of the serialized data ornull
if the type is not known or cannot be determined.- Specified by:
getContentType
in interfaceArtifact
- Overrides:
getContentType
in classorg.apache.jackrabbit.vault.fs.impl.AbstractArtifact
- Returns:
- the content type or
null
.
-
-