- 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:
-
Method Summary
Modifier and TypeMethodDescriptionvoidMethod for aborting the write operation.Method for starting the write operation.booleanCheck ifbeginWrite()can be called on this instance.voidMethod to committing the write operation.org.eclipse.equinox.p2.metadata.IArtifactKeyReturns 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 ifbeginWrite()can be called on this instance. This method will typically returnfalseifcommitWrite()has already been called on this instance, or ifbeginWrite()has been called before and the instance doesn't support re-starting the write operation.- Returns:
trueifbeginWrite()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
OutputStreamto 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, callcommitWrite()orabortWrite()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 ifcanBeginWrite()returnsfalse.ArtifactSinkException- if an error occurs while starting the write operation.
-
commitWrite
Method to committing the write operation. Will be called after the entire artifact content has been successfully streamed to theOutputStreamreturned bybeginWrite().- Throws:
IllegalStateException- if there is no running write operation, i.e. when this method has already been called,abortWrite()has been called, orbeginWrite()has not been called.ArtifactSinkException- if an error occurs while committing the write operation.
-
abortWrite
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.
-