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.ProvisionException
public org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
IArtifactSink
getArtifactToBeWritten
in interface IArtifactSink
public boolean canBeginWrite()
IArtifactSink
IArtifactSink.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 IArtifactSink
true
if IArtifactSink.beginWrite()
can be called on this instance.public java.io.OutputStream beginWrite() throws java.lang.IllegalStateException, ArtifactSinkException
IArtifactSink
beginWrite
in interface IArtifactSink
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 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
IArtifactSink
OutputStream
returned by IArtifactSink.beginWrite()
.commitWrite
in interface IArtifactSink
java.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
IArtifactSink
abortWrite
in interface IArtifactSink
ArtifactSinkException
- if an error occurs while aborting the write operation.