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
Artifacts are used for exporting (output) and importing (input). Output artifacts are generated by the vault fs, input artifacts are used by the respective import layer.

Depending on the type of the artifact and of it's source different access methods for it's content are preferred: If AccessType.NONE is set, no content is available. this is the case for ArtifactType.DIRECTORY artifacts.
If AccessType.SPOOL is set then clients should use the spool(OutputStream) method to retrieve the content. this is mostly the case for output-artifacts that have serialized content.
Tree.If AccessType.STREAM is set then clients should use the getInputStream() method in to retrieve the content. this is mostly the case for input-artifacts or for ArtifactType.BINARY artifacts.

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

    Modifier and Type
    Method
    Description
    long
    Returns the length of the serialized data if it's known without doing the actual serialization.
    Returns the content type of the serialized data or null if the type is not known or cannot be determined.
    Returns the (repository) extension of this artifact. eg: ".jsp"
    Returns an input source to the contents of this artifact.
    Returns the input stream to the contents of this artifact.
    long
    Returns the last modified date or 0 if not known.
    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 preferred access value for this artifact.
    Returns the relative (repository) path of this artifact in respect to it's parent node. eg: "myNodeType"
    Returns the serialization type of this artifact.
    Returns the type of this artifact.
    void
    Writes the content to the given output stream.

    Methods inherited from interface org.apache.jackrabbit.vault.fs.api.Dumpable

    dump
  • Method Details

    • 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 -1 if the length cannot be determined.
    • getContentType

      String getContentType()
      Returns the content type of the serialized data or null if the type is not known or cannot be determined.
      Returns:
      the content type or null.
    • getLastModified

      long getLastModified()
      Returns the last modified date or 0 if 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 occurs
      RepositoryException - 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 occurs
      RepositoryException - if a repository error occurs
    • getInputSource

      Returns an input source to the contents of this artifact. This is also preferred for AccessType.STREAM.
      Returns:
      an input source.
      Throws:
      IOException - if an I/O error occurs.
      RepositoryException - of a repository error occurs.