Top Description Constructors Methods
org.eclipse.jgit.transport

pack-priv abstract Class BaseFetchConnection

extends BaseConnection
implements FetchConnection
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.FetchConnection, org.eclipse.jgit.transport.Connection, java.lang.AutoCloseable
Known Direct Subclasses
org.eclipse.jgit.transport.BundleFetchConnection, org.eclipse.jgit.transport.WalkFetchConnection
Imports
java.io.OutputStream, java.util.Collection, .Set, org.eclipse.jgit.errors.TransportException, org.eclipse.jgit.lib.ObjectId, .ProgressMonitor, .Ref

Base helper class for fetch connection implementations. Provides some common typical structures and methods used during fetch connection.

Implementors of fetch over pack-based protocols should consider using BasePackFetchConnection instead.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
protected abstract void
public final void
fetch(final ProgressMonitor
progress monitor to inform the end-user about the amount of work completed, or to indicate cancellation. Implementations should poll the monitor at regular intervals to look for cancellation requests from the user.
monitor
,
final Collection<Ref>
one or more refs advertised by this connection that the caller wants to store locally.
want
,
final Set<ObjectId>
additional objects known to exist in the destination repository, especially if they aren't yet reachable by the ref database. Connections should take this set as an addition to what is reachable through all Refs, not in replace of it.
have
)

Implements org.eclipse.jgit.transport.FetchConnection.fetch.

Fetch objects we don't have but that are reachable from advertised refs.

public final void
fetch(final ProgressMonitor
progress monitor to inform the end-user about the amount of work completed, or to indicate cancellation. Implementations should poll the monitor at regular intervals to look for cancellation requests from the user.
monitor
,
final Collection<Ref>
one or more refs advertised by this connection that the caller wants to store locally.
want
,
final Set<ObjectId>
additional objects known to exist in the destination repository, especially if they aren't yet reachable by the ref database. Connections should take this set as an addition to what is reachable through all Refs, not in replace of it.
have
,
OutputStream
OutputStream to write sideband messages to
out
)

Implements org.eclipse.jgit.transport.FetchConnection.fetch.

Fetch objects we don't have but that are reachable from advertised refs.

Inherited from org.eclipse.jgit.transport.BaseConnection:
availableclosegetMessagesgetMessageWritergetPeerUserAgentgetRefgetRefsgetRefsMapmarkStartedOperationsetMessageWritersetPeerUserAgent

Constructor Detail

BaseFetchConnectionback to summary
pack-priv BaseFetchConnection()

Method Detail

didFetchIncludeTagsback to summary
public boolean didFetchIncludeTags()

Implements org.eclipse.jgit.transport.FetchConnection.didFetchIncludeTags.

Doc from org.eclipse.jgit.transport.FetchConnection.didFetchIncludeTags.

Did the last fetch(ProgressMonitor, Collection, Set) get tags?

Some Git aware transports are able to implicitly grab an annotated tag if org.eclipse.jgit.transport.TagOpt#AUTO_FOLLOW or org.eclipse.jgit.transport.TagOpt#FETCH_TAGS was selected and the object the tag peels to (references) was transferred as part of the last fetch(ProgressMonitor, Collection, Set) call. If it is possible for such tags to have been included in the transfer this method returns true, allowing the caller to attempt tag discovery.

By returning only true/false (and not the actual list of tags obtained) the transport itself does not need to be aware of whether or not tags were included in the transfer. Default implementation of FetchConnection#didFetchIncludeTags() - returning false.

Returns:boolean

true if the last fetch call implicitly included tag objects; false if tags were not implicitly obtained.

Annotations
@Override
doFetchback to summary
protected abstract void doFetch(final ProgressMonitor monitor, final Collection<Ref> want, final Set<ObjectId> have) throws TransportException

Implementation of fetch(ProgressMonitor, Collection, Set) without checking for multiple fetch.

Parameters
monitor:ProgressMonitor

as in fetch(ProgressMonitor, Collection, Set)

want:Collection<Ref>

as in fetch(ProgressMonitor, Collection, Set)

have:Set<ObjectId>

as in fetch(ProgressMonitor, Collection, Set)

Exceptions
TransportException:
as in fetch(ProgressMonitor, Collection, Set), but implementation doesn't have to care about multiple fetch(ProgressMonitor, Collection, Set) calls, as it is checked in this class.
fetchback to summary
public final void fetch(final ProgressMonitor monitor, final Collection<Ref> want, final Set<ObjectId> have) throws TransportException

Implements org.eclipse.jgit.transport.FetchConnection.fetch.

Doc from org.eclipse.jgit.transport.FetchConnection.fetch.

Fetch objects we don't have but that are reachable from advertised refs.

Only one call per connection is allowed. Subsequent calls will result in org.eclipse.jgit.errors.TransportException.

Implementations are free to use network connections as necessary to efficiently (for both client and server) transfer objects from the remote repository into this repository. When possible implementations should avoid replacing/overwriting/duplicating an object already available in the local destination repository. Locally available objects and packs should always be preferred over remotely available objects and packs. org.eclipse.jgit.transport.Transport#isFetchThin() should be honored if applicable.

Parameters
monitor:ProgressMonitor

progress monitor to inform the end-user about the amount of work completed, or to indicate cancellation. Implementations should poll the monitor at regular intervals to look for cancellation requests from the user.

want:Collection<Ref>

one or more refs advertised by this connection that the caller wants to store locally.

have:Set<ObjectId>

additional objects known to exist in the destination repository, especially if they aren't yet reachable by the ref database. Connections should take this set as an addition to what is reachable through all Refs, not in replace of it.

Annotations
@Override
Exceptions
TransportException:
objects could not be copied due to a network failure, protocol error, or error on remote side, or connection was already used for fetch.
fetchback to summary
public final void fetch(final ProgressMonitor monitor, final Collection<Ref> want, final Set<ObjectId> have, OutputStream out) throws TransportException

Implements org.eclipse.jgit.transport.FetchConnection.fetch.

Doc from org.eclipse.jgit.transport.FetchConnection.fetch.

Fetch objects we don't have but that are reachable from advertised refs.

Only one call per connection is allowed. Subsequent calls will result in org.eclipse.jgit.errors.TransportException.

Implementations are free to use network connections as necessary to efficiently (for both client and server) transfer objects from the remote repository into this repository. When possible implementations should avoid replacing/overwriting/duplicating an object already available in the local destination repository. Locally available objects and packs should always be preferred over remotely available objects and packs. org.eclipse.jgit.transport.Transport#isFetchThin() should be honored if applicable.

Parameters
monitor:ProgressMonitor

progress monitor to inform the end-user about the amount of work completed, or to indicate cancellation. Implementations should poll the monitor at regular intervals to look for cancellation requests from the user.

want:Collection<Ref>

one or more refs advertised by this connection that the caller wants to store locally.

have:Set<ObjectId>

additional objects known to exist in the destination repository, especially if they aren't yet reachable by the ref database. Connections should take this set as an addition to what is reachable through all Refs, not in replace of it.

out:OutputStream

OutputStream to write sideband messages to

Annotations
@Override
Exceptions
TransportException:
objects could not be copied due to a network failure, protocol error, or error on remote side, or connection was already used for fetch.