Interface IArtifactSink

All Known Subinterfaces:
IRawArtifactSink

public interface IArtifactSink
Interface for receiving the content of an artifact. In order to support streaming from a remote server where integrity can only be checked after transferring the entire content, there are methods to commit, abort, or retry the write operation.
See Also:
  • invalid reference
    ArtifactSinkFactory
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method for aborting the write operation.
    Method for starting the write operation.
    boolean
    Check if beginWrite() can be called on this instance.
    void
    Method to committing the write operation.
    org.eclipse.equinox.p2.metadata.IArtifactKey
    Returns the key of the artifact expected by this instance.
  • Method Details

    • getArtifactToBeWritten

      org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
      Returns the key of the artifact expected by this instance.
    • canBeginWrite

      boolean canBeginWrite()
      Check if beginWrite() can be called on this instance. This method will typically return false if commitWrite() has already been called on this instance, or if beginWrite() has been called before and the instance doesn't support re-starting the write operation.
      Returns:
      true if beginWrite() can be called on this instance.
    • beginWrite

      Method for starting the write operation. If this method has been called before, any content written so far will be discarded.
      Returns:
      the OutputStream to write the artifact content to. The ownership of the stream is not transferred to the caller, i.e. OutputStream.close() must not be called on the returned instance. Instead, call commitWrite() or abortWrite() to free any allocated resources.
      Throws:
      IllegalStateException - if this instance is not in the right state to start a write operation. This exception will be thrown if and only if canBeginWrite() returns false.
      ArtifactSinkException - if an error occurs while starting the write operation.
    • commitWrite

      void commitWrite() throws IllegalStateException, ArtifactSinkException
      Method to committing the write operation. Will be called after the entire artifact content has been successfully streamed to the OutputStream returned by beginWrite().
      Throws:
      IllegalStateException - if there is no running write operation, i.e. when this method has already been called, abortWrite() has been called, or beginWrite() has not been called.
      ArtifactSinkException - if an error occurs while committing the write operation.
    • abortWrite

      void abortWrite() throws ArtifactSinkException
      Method for aborting the write operation. Should be called if an error is detected while streaming the artifact content.
      Throws:
      ArtifactSinkException - if an error occurs while aborting the write operation.