Remote repositories are registered using
register(Object, Repository), after which they can be accessed using
the returned URI. As this class provides both the client side (the protocol)
and the server side, the caller is responsible for setting up and passing the
connection context, whatever form that may take.
Unlike the other built-in protocols, which are automatically-registered
singletons, callers are expected to register/unregister specific protocol
instances on demand with
org..
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private static BasePackFetchConnection. | |
| private final HashMap | |
| pack-priv final ReceivePackFactory | |
| private static final String | |
| pack-priv final UploadPackFactory |
| Access | Constructor and Description |
|---|---|
| public | TestProtocol(UploadPackFactory<C>
factory for creating
uploadPackFactory, ReceivePackFactory<C> org. used by all
connections from this protocol instance.factory for creating
receivePackFactory)org. used by all
connections from this protocol instance.Constructor for TestProtocol. |
| Modifier and Type | Method and Description |
|---|---|
| public String | getName()
Implements abstract org. Get text name of the protocol suitable for display to a user. |
| public Set | getOptionalFields()
Overrides org. Get immutable set of URIishFields that may be filled in. |
| public Set | getRequiredFields()
Overrides org. Get immutable set of URIishFields that must be filled in. |
| public Set | getSchemes()
Overrides org. Get immutable set of schemes supported by this protocol. |
| public Transport | open(URIish
address of the Git repository. uri, Repository the local repository that will communicate with the other Git
repository. local, String name of the remote, if the remote as configured in
remoteName)local; otherwise null.Implements abstract org. Open a Transport instance to the other repository. |
| public synchronized URIish | Returns: a URI that can be used to connect to this repository for both fetch and push.connection context. This instance is reused for all connections
made using this protocol; if it is stateful and usable only for
one connection, the same repository should be registered
multiple times. req, Repository remote repository to connect to. remote)Register a repository connection over the internal test protocol. |
| pack-priv static void |
| fetchConfig | back to summary |
|---|---|
| private static BasePackFetchConnection. | |
| handles | back to summary |
|---|---|
| private final HashMap<URIish, TestProtocol<C>. | |
| receivePackFactory | back to summary |
|---|---|
| pack-priv final ReceivePackFactory<C> receivePackFactory | |
| SCHEME | back to summary |
|---|---|
| private static final String SCHEME | |
| uploadPackFactory | back to summary |
|---|---|
| pack-priv final UploadPackFactory<C> uploadPackFactory | |
| TestProtocol | back to summary |
|---|---|
| public TestProtocol(UploadPackFactory<C> uploadPackFactory, ReceivePackFactory<C> receivePackFactory) Constructor for TestProtocol.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements abstract org. Doc from org. Get text name of the protocol suitable for display to a user. | |
| getOptionalFields | back to summary |
|---|---|
| public Set Overrides org. Doc from org. Get immutable set of URIishFields that may be filled in.
| |
| getRequiredFields | back to summary |
|---|---|
| public Set Overrides org. Doc from org. Get immutable set of URIishFields that must be filled in.
| |
| getSchemes | back to summary |
|---|---|
| public Set Overrides org. Doc from org. Get immutable set of schemes supported by this protocol. | |
| open | back to summary |
|---|---|
| public Transport open(URIish uri, Repository local, String remoteName) throws NotSupportedException, TransportException Implements abstract org. Doc from org. Open a Transport instance to the other repository. Implementations should avoid making remote connections until an operation on the returned Transport is invoked, however they may fail fast here if they know a connection is impossible, such as when using the local filesystem and the target path does not exist.
Implementations may access implementation-specific configuration options
within
| |
| register | back to summary |
|---|---|
| public synchronized URIish register(C req, Repository remote) Register a repository connection over the internal test protocol.
| |
| setFetchConfig | back to summary |
|---|---|
| pack-priv static void setFetchConfig(BasePackFetchConnection. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Repository | |
| pack-priv final C |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| remote | back to summary |
|---|---|
| pack-priv final Repository remote | |
| req | back to summary |
|---|---|
| pack-priv final C req | |
| Handle | back to summary |
|---|---|
| pack-priv Handle(C req, Repository remote) | |
| Modifier and Type | Field and Description |
|---|---|
| private final TestProtocol |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements abstract org. Implements java. Closes this resource, relinquishing any underlying resources. |
| public FetchConnection | openFetch()
Implements abstract org. Begins a new connection for fetching from the remote repository. |
| public PushConnection | openPush()
Implements abstract org. Begins a new connection for pushing into the remote repository. |
| handle | back to summary |
|---|---|
| private final TestProtocol<C>. | |
| TransportInternal | back to summary |
|---|---|
| pack-priv TransportInternal(Repository local, URIish uri, TestProtocol<C>. | |
| close | back to summary |
|---|---|
| public void close() Implements abstract org. Implements java. Doc from org. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
Close any resources used by this transport. If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.
| |
| openFetch | back to summary |
|---|---|
| public FetchConnection openFetch() throws NotSupportedException, TransportException Implements abstract org. Doc from org. Begins a new connection for fetching from the remote repository. If the transport has no local repository, the fetch connection can only be used for reading remote refs.
| |
| openPush | back to summary |
|---|---|
| public PushConnection openPush() throws NotSupportedException, TransportException Implements abstract org. Doc from org. Begins a new connection for pushing into the remote repository.
| |