private class ArtifactRepositoryBaseImpl.AddingArtifactSink extends java.lang.Object implements IArtifactSink
| Modifier and Type | Field and Description |
|---|---|
private boolean |
committed |
private java.io.OutputStream |
currentOutputStream |
protected ArtifactDescriptorT |
newDescriptor |
| Constructor and Description |
|---|
AddingArtifactSink(ArtifactDescriptorT newDescriptor) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortWrite()
Method for aborting the write operation.
|
java.io.OutputStream |
beginWrite()
Method for starting the write operation.
|
boolean |
canBeginWrite()
Check if
IArtifactSink.beginWrite() 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.
|
protected final ArtifactDescriptorT extends org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor newDescriptor
private java.io.OutputStream currentOutputStream
private boolean committed
AddingArtifactSink(ArtifactDescriptorT newDescriptor) throws org.eclipse.equinox.p2.core.ProvisionException
org.eclipse.equinox.p2.core.ProvisionExceptionpublic org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
IArtifactSinkgetArtifactToBeWritten in interface IArtifactSinkpublic boolean canBeginWrite()
IArtifactSinkIArtifactSink.beginWrite() can be called on this instance. This method will typically
return false if IArtifactSink.commitWrite() has already been called on this instance,
or if IArtifactSink.beginWrite() has been called before and the instance doesn't support
re-starting the write operation.canBeginWrite in interface IArtifactSinktrue if IArtifactSink.beginWrite() can be called on this instance.public java.io.OutputStream beginWrite()
throws java.lang.IllegalStateException,
ArtifactSinkException
IArtifactSinkbeginWrite in interface IArtifactSinkOutputStream 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 IArtifactSink.commitWrite() or
IArtifactSink.abortWrite() to free any allocated resources.java.lang.IllegalStateException - if this instance is not in the right state to start a write operation. This
exception will be thrown if and only if IArtifactSink.canBeginWrite() returns
false.ArtifactSinkException - if an error occurs while starting the write operation.public void commitWrite()
throws java.lang.IllegalStateException,
ArtifactSinkException
IArtifactSinkOutputStream returned by IArtifactSink.beginWrite().commitWrite in interface IArtifactSinkjava.lang.IllegalStateException - if there is no running write operation, i.e. when this method has already been
called, IArtifactSink.abortWrite() has been called, or IArtifactSink.beginWrite() has not
been called.ArtifactSinkException - if an error occurs while committing the write operation.public void abortWrite()
throws ArtifactSinkException
IArtifactSinkabortWrite in interface IArtifactSinkArtifactSinkException - if an error occurs while aborting the write operation.