Interface Artifact

  • All Superinterfaces:
    Dumpable
    All Known Subinterfaces:
    ExportArtifact, ImportArtifact
    All Known Implementing Classes:
    org.apache.jackrabbit.vault.fs.impl.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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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 or null if the type is not known or cannot be determined.
      java.lang.String getExtension()
      Returns the (repository) extension of this artifact.
      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 or 0 if not known.
      java.lang.String getPlatformPath()
      Returns the relative path of this artifact in platform format including the extension.
      AccessType getPreferredAccess()
      Returns the preferred access value for this artifact.
      java.lang.String getRelativePath()
      Returns the relative (repository) path of this artifact in respect to it's parent node.
      SerializationType getSerializationType()
      Returns the serialization type of this artifact.
      ArtifactType getType()
      Returns the 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 interface org.apache.jackrabbit.vault.fs.api.Dumpable

        dump
    • Method Detail

      • getPlatformPath

        java.lang.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

        java.lang.String getExtension()
        Returns the (repository) extension of this artifact. eg: ".jsp"
        Returns:
        the (repository) extension of this artifact.
      • getRelativePath

        java.lang.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

        java.lang.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​(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.

        Parameters:
        out - the output stream to spool to
        Throws:
        java.io.IOException - if an I/O error occurs
        RepositoryException - if a repository error occurs
      • getInputStream

        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.
        Returns:
        a input stream to the contents of this artifact.
        Throws:
        java.io.IOException - if an I/O error occurs
        RepositoryException - if a repository error occurs