Interface Artifact
- 
- All Superinterfaces:
 Dumpable
- All Known Subinterfaces:
 ExportArtifact,ImportArtifact
- All Known Implementing Classes:
 AbstractArtifact,DirectoryArtifact,HintArtifact,PropertyValueArtifact,SerializerArtifact
public interface Artifact extends Dumpable
An artifact represents a fragment (or aspect) of a Vault file. This can either be a:- primary (serialized) content
 - additional serialized content
 - binary attachments (eg. binary properties)
 - directory representation
 
Depending on the type of the artifact and of it's source different access methods for it's content are preferred: If
AccessType.NONEis set, no content is available. this is the case forArtifactType.DIRECTORYartifacts.
IfAccessType.SPOOLis set then clients should use thespool(OutputStream)method to retrieve the content. this is mostly the case for output-artifacts that have serialized content.
Tree.IfAccessType.STREAMis set then clients should use thegetInputStream()method in to retrieve the content. this is mostly the case for input-artifacts or forArtifactType.BINARYartifacts.Each artifact contains a (repository) name and a possible extension. The name and the extension must be preserved after a export/import roundtrip.
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetContentLength()Returns the length of the serialized data if it's known without doing the actual serialization.StringgetContentType()Returns the content type of the serialized data ornullif the type is not known or cannot be determined.StringgetExtension()Returns the (repository) extension of this artifact. eg: ".jsp"VaultInputSourcegetInputSource()Returns an input source to the contents of this artifact.InputStreamgetInputStream()Returns the input stream to the contents of this artifact.longgetLastModified()Returns the last modified date or0if not known.StringgetPlatformPath()Returns the relative path of this artifact in platform format including the extension. eg: "_cq_nodeType.cnd" or "en/.content.xml" and eventual intermediate extensions. eg: "image.png.dir/.content.xml"AccessTypegetPreferredAccess()Returns the preferred access value for this artifact.StringgetRelativePath()Returns the relative (repository) path of this artifact in respect to it's parent node. eg: "myNodeType"SerializationTypegetSerializationType()Returns the serialization type of this artifact.ArtifactTypegetType()Returns the type of this artifact.voidspool(OutputStream out)Writes the content to the given output stream. 
 - 
 
- 
- 
Method Detail
- 
getPlatformPath
String getPlatformPath()
Returns the relative path of this artifact in platform format including the extension. eg: "_cq_nodeType.cnd" or "en/.content.xml" and eventual intermediate extensions. eg: "image.png.dir/.content.xml"- Returns:
 - the relative platform path
 
 
- 
getExtension
String getExtension()
Returns the (repository) extension of this artifact. eg: ".jsp"- Returns:
 - the (repository) extension of this artifact.
 
 
- 
getRelativePath
String getRelativePath()
Returns the relative (repository) path of this artifact in respect to it's parent node. eg: "myNodeType"- Returns:
 - the final name
 
 
- 
getType
ArtifactType getType()
Returns the type of this artifact.- Returns:
 - the type of this artifact.
 
 
- 
getSerializationType
SerializationType getSerializationType()
Returns the serialization type of this artifact.- Returns:
 - the serialization type of this artifact.
 
 
- 
getPreferredAccess
AccessType getPreferredAccess()
Returns the preferred access value for this artifact.- Returns:
 - the preferred access value.
 
 
- 
getContentLength
long getContentLength()
Returns the length of the serialized data if it's known without doing the actual serialization.- Returns:
 - the length or 
-1if the length cannot be determined. 
 
- 
getContentType
String getContentType()
Returns the content type of the serialized data ornullif the type is not known or cannot be determined.- Returns:
 - the content type or 
null. 
 
- 
getLastModified
long getLastModified()
Returns the last modified date or0if not known.- Returns:
 - the last modified date or 
0 
 
- 
spool
void spool(OutputStream out) throws IOException, RepositoryException
Writes the content to the given output stream. This is the preferred method to use for output-artifacts.The specified stream remains open after this method returns.
- Parameters:
 out- the output stream to spool to- Throws:
 IOException- if an I/O error occursRepositoryException- if a repository error occurs
 
- 
getInputStream
InputStream getInputStream() throws IOException, RepositoryException
Returns the input stream to the contents of this artifact. This is the preferred method to use for input-artifacts.- Returns:
 - a input stream to the contents of this artifact.
 - Throws:
 IOException- if an I/O error occursRepositoryException- if a repository error occurs
 
- 
getInputSource
VaultInputSource getInputSource() throws IOException, RepositoryException
Returns an input source to the contents of this artifact. This is also preferred forAccessType.STREAM.- Returns:
 - an input source.
 - Throws:
 IOException- if an I/O error occurs.RepositoryException- of a repository error occurs.
 
 - 
 
 -