Class ArtifactRepositoryBaseImpl.AddingArtifactSink
- java.lang.Object
-
- org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositoryBaseImpl.AddingArtifactSink
-
- All Implemented Interfaces:
IArtifactSink
- Direct Known Subclasses:
ArtifactRepositoryBaseImpl.RawAddingArtifactSink
- Enclosing class:
- ArtifactRepositoryBaseImpl<ArtifactDescriptorT extends org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor>
private class ArtifactRepositoryBaseImpl.AddingArtifactSink extends java.lang.Object implements IArtifactSink
-
-
Field Summary
Fields Modifier and Type Field Description private booleancommittedprivate java.io.OutputStreamcurrentOutputStreamprotected ArtifactDescriptorTnewDescriptor
-
Constructor Summary
Constructors Constructor Description AddingArtifactSink(ArtifactDescriptorT newDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortWrite()Method for aborting the write operation.java.io.OutputStreambeginWrite()Method for starting the write operation.booleancanBeginWrite()Check ifIArtifactSink.beginWrite()can be called on this instance.voidcommitWrite()Method to committing the write operation.org.eclipse.equinox.p2.metadata.IArtifactKeygetArtifactToBeWritten()Returns the key of the artifact expected by this instance.
-
-
-
Field Detail
-
newDescriptor
protected final ArtifactDescriptorT extends org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor newDescriptor
-
currentOutputStream
private java.io.OutputStream currentOutputStream
-
committed
private boolean committed
-
-
Constructor Detail
-
AddingArtifactSink
AddingArtifactSink(ArtifactDescriptorT newDescriptor) throws org.eclipse.equinox.p2.core.ProvisionException
- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
-
Method Detail
-
getArtifactToBeWritten
public org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
Description copied from interface:IArtifactSinkReturns the key of the artifact expected by this instance.- Specified by:
getArtifactToBeWrittenin interfaceIArtifactSink
-
canBeginWrite
public boolean canBeginWrite()
Description copied from interface:IArtifactSinkCheck ifIArtifactSink.beginWrite()can be called on this instance. This method will typically returnfalseifIArtifactSink.commitWrite()has already been called on this instance, or ifIArtifactSink.beginWrite()has been called before and the instance doesn't support re-starting the write operation.- Specified by:
canBeginWritein interfaceIArtifactSink- Returns:
trueifIArtifactSink.beginWrite()can be called on this instance.
-
beginWrite
public java.io.OutputStream beginWrite() throws java.lang.IllegalStateException, ArtifactSinkExceptionDescription copied from interface:IArtifactSinkMethod for starting the write operation. If this method has been called before, any content written so far will be discarded.- Specified by:
beginWritein interfaceIArtifactSink- 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, callIArtifactSink.commitWrite()orIArtifactSink.abortWrite()to free any allocated resources. - Throws:
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 ifIArtifactSink.canBeginWrite()returnsfalse.ArtifactSinkException- if an error occurs while starting the write operation.
-
commitWrite
public void commitWrite() throws java.lang.IllegalStateException, ArtifactSinkExceptionDescription copied from interface:IArtifactSinkMethod to committing the write operation. Will be called after the entire artifact content has been successfully streamed to theOutputStreamreturned byIArtifactSink.beginWrite().- Specified by:
commitWritein interfaceIArtifactSink- Throws:
java.lang.IllegalStateException- if there is no running write operation, i.e. when this method has already been called,IArtifactSink.abortWrite()has been called, orIArtifactSink.beginWrite()has not been called.ArtifactSinkException- if an error occurs while committing the write operation.
-
abortWrite
public void abortWrite() throws ArtifactSinkExceptionDescription copied from interface:IArtifactSinkMethod for aborting the write operation. Should be called if an error is detected while streaming the artifact content.- Specified by:
abortWritein interfaceIArtifactSink- Throws:
ArtifactSinkException- if an error occurs while aborting the write operation.
-
-