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:
ArtifactSinkFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
abortWrite()
Method for aborting the write operation.OutputStream
beginWrite()
Method for starting the write operation.boolean
canBeginWrite()
Check ifbeginWrite()
can be called on this instance.void
commitWrite()
Method to committing the write operation.org.eclipse.equinox.p2.metadata.IArtifactKey
getArtifactToBeWritten()
Returns the key of the artifact expected by this instance.
-
-
-
Method Detail
-
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 returnfalse
ifcommitWrite()
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:
true
ifbeginWrite()
can be called on this instance.
-
beginWrite
OutputStream beginWrite() throws IllegalStateException, ArtifactSinkException
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, 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
void commitWrite() throws IllegalStateException, ArtifactSinkException
Method to committing the write operation. Will be called after the entire artifact content has been successfully streamed to theOutputStream
returned 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
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.
-
-