|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jgit.transport.BaseConnection
public abstract class BaseConnection
Base helper class for implementing operations connections.
BasePackConnection
,
BaseFetchConnection
Constructor Summary | |
---|---|
BaseConnection()
|
Method Summary | |
---|---|
protected void |
available(Map<String,Ref> all)
Denote the list of refs available on the remote repository. |
abstract void |
close()
Close any resources used by this connection. |
String |
getMessages()
Get the additional messages, if any, returned by the remote process. |
protected Writer |
getMessageWriter()
Get the writer that buffers messages from the remote side. |
Ref |
getRef(String name)
Get a single advertised ref by name. |
Collection<Ref> |
getRefs()
Get the complete list of refs advertised as available for fetching or pushing. |
Map<String,Ref> |
getRefsMap()
Get the complete map of refs advertised as available for fetching or pushing. |
protected void |
markStartedOperation()
Helper method for ensuring one-operation per connection. |
protected void |
setMessageWriter(Writer writer)
Set the writer that buffers messages from the remote side. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BaseConnection()
Method Detail |
---|
public Map<String,Ref> getRefsMap()
Connection
getRefsMap
in interface Connection
public final Collection<Ref> getRefs()
Connection
The returned refs may appear in any order. If the caller needs these to be sorted, they should be copied into a new array or List and then sorted by the caller as necessary.
getRefs
in interface Connection
public final Ref getRef(String name)
Connection
The name supplied should be valid ref name. To get a peeled value for a
ref (aka refs/tags/v1.0^{}
) use the base name (without
the ^{}
suffix) and look at the peeled object id.
getRef
in interface Connection
name
- name of the ref to obtain.
public String getMessages()
Connection
These messages are most likely informational or error messages, sent by the remote peer, to help the end-user correct any problems that may have prevented the operation from completing successfully. Application UIs should try to show these in an appropriate context.
The message buffer is available after Connection.close()
has been called.
Prior to closing the connection, the message buffer may be empty.
getMessages
in interface Connection
public abstract void close()
Connection
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.
If additional messages were produced by the remote peer, these should
still be retained in the connection instance for Connection.getMessages()
.
close
in interface Connection
protected void available(Map<String,Ref> all)
Implementors should invoke this method once they have obtained the refs that are available from the remote repository.
all
- the complete list of refs the remote has to offer. This map
will be wrapped in an unmodifiable way to protect it, but it
does not get copied.protected void markStartedOperation() throws TransportException
TransportException
- if operation was already marked as started.protected Writer getMessageWriter()
protected void setMessageWriter(Writer writer)
writer
- the writer that messages will be delivered to. The writer's
toString()
method should be overridden to return the
complete contents.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |