Browse Source

Fix javadoc in org.eclipse.jgit transport package

Change-Id: Id70e2c27e38bf12f87e66b28fbd0b06908494764
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.10.0.201712302008-r
Matthias Sohn 6 years ago
parent
commit
781e106a26
100 changed files with 1646 additions and 711 deletions
  1. 6
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java
  2. 8
    6
      org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java
  3. 7
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java
  4. 6
    7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
  5. 8
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java
  6. 5
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseFetchConnection.java
  7. 29
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
  8. 14
    10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
  9. 6
    5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
  10. 196
    72
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
  11. 5
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
  12. 4
    8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
  13. 4
    12
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java
  14. 2
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/Connection.java
  15. 23
    8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialItem.java
  16. 19
    9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java
  17. 11
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java
  18. 29
    10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
  19. 23
    5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java
  20. 30
    6
      org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java
  21. 1
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java
  22. 17
    14
      org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchConnection.java
  23. 6
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
  24. 6
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
  25. 17
    8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java
  26. 9
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpTransport.java
  27. 16
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalFetchConnection.java
  28. 16
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java
  29. 12
    9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
  30. 9
    6
      org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java
  31. 8
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java
  32. 6
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java
  33. 5
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/NonceGenerator.java
  34. 7
    7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ObjectCountCallback.java
  35. 9
    7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
  36. 77
    43
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
  37. 6
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PackedObjectInfo.java
  38. 2
    2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
  39. 5
    5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java
  40. 5
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PostReceiveHook.java
  41. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PostReceiveHookChain.java
  42. 5
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PostUploadHook.java
  43. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PostUploadHookChain.java
  44. 9
    7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PreReceiveHook.java
  45. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PreReceiveHookChain.java
  46. 7
    5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PreUploadHook.java
  47. 5
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PreUploadHookChain.java
  48. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
  49. 28
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java
  50. 43
    22
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
  51. 25
    13
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateParser.java
  52. 32
    29
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
  53. 29
    20
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushConnection.java
  54. 2
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushResult.java
  55. 68
    22
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
  56. 22
    7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
  57. 56
    12
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivedPackStatistics.java
  58. 14
    8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
  59. 6
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RefFilter.java
  60. 3
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RefLeaseSpec.java
  61. 12
    9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java
  62. 10
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java
  63. 80
    42
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
  64. 3
    2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteSession.java
  65. 5
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RequestNotYetReadException.java
  66. 21
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ServiceMayNotContinueException.java
  67. 2
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
  68. 3
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java
  69. 4
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java
  70. 28
    15
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SignedPushConfig.java
  71. 4
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java
  72. 7
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java
  73. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java
  74. 20
    10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java
  75. 6
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java
  76. 13
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
  77. 133
    93
      org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
  78. 6
    2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
  79. 11
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java
  80. 3
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java
  81. 3
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java
  82. 2
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
  83. 9
    3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
  84. 12
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java
  85. 36
    14
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportProtocol.java
  86. 7
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java
  87. 33
    5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
  88. 81
    31
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
  89. 3
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackInternalServerErrorException.java
  90. 3
    2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java
  91. 3
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLoggerChain.java
  92. 12
    2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java
  93. 14
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
  94. 5
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
  95. 3
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
  96. 1
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java
  97. 3
    2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkTransport.java
  98. 1
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WantNotValidException.java
  99. 1
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WriteAbortedException.java
  100. 0
    0
      org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java

+ 6
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java View File

@@ -51,12 +51,13 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;

/**
* Implementation of {@link AdvertiseRefsHook} that advertises the same refs for
* Implementation of {@link org.eclipse.jgit.transport.AdvertiseRefsHook} that advertises the same refs for
* upload-pack and receive-pack.
*
* @since 2.0
*/
public abstract class AbstractAdvertiseRefsHook implements AdvertiseRefsHook {
/** {@inheritDoc} */
@Override
public void advertiseRefs(UploadPack uploadPack)
throws ServiceMayNotContinueException {
@@ -64,6 +65,7 @@ public abstract class AbstractAdvertiseRefsHook implements AdvertiseRefsHook {
uploadPack.getRepository(), uploadPack.getRevWalk()));
}

/** {@inheritDoc} */
@Override
public void advertiseRefs(BaseReceivePack receivePack)
throws ServiceMayNotContinueException {
@@ -82,7 +84,7 @@ public abstract class AbstractAdvertiseRefsHook implements AdvertiseRefsHook {
* @param revWalk
* open rev walk on the repository.
* @return set of refs to advertise.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
protected abstract Map<String, Ref> getAdvertisedRefs(
@@ -97,8 +99,8 @@ public abstract class AbstractAdvertiseRefsHook implements AdvertiseRefsHook {
* @param revWalk
* open rev walk on the repository.
* @return set of additional haves; see
* {@link ReceivePack#getAdvertisedObjects()}.
* @throws ServiceMayNotContinueException
* {@link org.eclipse.jgit.transport.ReceivePack#getAdvertisedObjects()}.
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
protected Set<ObjectId> getAdvertisedHaves(

+ 8
- 6
org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java View File

@@ -70,10 +70,11 @@ public interface AdvertiseRefsHook {
/**
* Advertise refs for upload-pack.
*
* @param uploadPack instance on which to call
* {@link UploadPack#setAdvertisedRefs(java.util.Map)}
* @param uploadPack
* instance on which to call
* {@link org.eclipse.jgit.transport.UploadPack#setAdvertisedRefs(java.util.Map)}
* if necessary.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
public void advertiseRefs(UploadPack uploadPack)
@@ -82,10 +83,11 @@ public interface AdvertiseRefsHook {
/**
* Advertise refs for receive-pack.
*
* @param receivePack instance on which to call
* {@link BaseReceivePack#setAdvertisedRefs(java.util.Map,java.util.Set)}
* @param receivePack
* instance on which to call
* {@link org.eclipse.jgit.transport.BaseReceivePack#setAdvertisedRefs(java.util.Map,java.util.Set)}
* if necessary.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
public void advertiseRefs(BaseReceivePack receivePack)

+ 7
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java View File

@@ -46,13 +46,14 @@ package org.eclipse.jgit.transport;
import java.util.List;

/**
* {@link AdvertiseRefsHook} that delegates to a list of other hooks.
* {@link org.eclipse.jgit.transport.AdvertiseRefsHook} that delegates to a list
* of other hooks.
* <p>
* Hooks are run in the order passed to the constructor. A hook may inspect or
* modify the results of the previous hooks in the chain by calling
* {@link UploadPack#getAdvertisedRefs()}, or
* {@link BaseReceivePack#getAdvertisedRefs()} or
* {@link BaseReceivePack#getAdvertisedObjects()}.
* {@link org.eclipse.jgit.transport.UploadPack#getAdvertisedRefs()}, or
* {@link org.eclipse.jgit.transport.BaseReceivePack#getAdvertisedRefs()} or
* {@link org.eclipse.jgit.transport.BaseReceivePack#getAdvertisedObjects()}.
*/
public class AdvertiseRefsHookChain implements AdvertiseRefsHook {
private final AdvertiseRefsHook[] hooks;
@@ -79,6 +80,7 @@ public class AdvertiseRefsHookChain implements AdvertiseRefsHook {
return new AdvertiseRefsHookChain(newHooks, i);
}

/** {@inheritDoc} */
@Override
public void advertiseRefs(BaseReceivePack rp)
throws ServiceMayNotContinueException {
@@ -86,6 +88,7 @@ public class AdvertiseRefsHookChain implements AdvertiseRefsHook {
hooks[i].advertiseRefs(rp);
}

/** {@inheritDoc} */
@Override
public void advertiseRefs(UploadPack rp)
throws ServiceMayNotContinueException {

+ 6
- 7
org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java View File

@@ -231,7 +231,6 @@ public class AmazonS3 {
*
* @param props
* connection properties.
*
*/
public AmazonS3(final Properties props) {
domain = props.getProperty(Keys.DOMAIN, "s3.amazonaws.com"); //$NON-NLS-1$
@@ -281,7 +280,7 @@ public class AmazonS3 {
* @return connection to stream the content of the object. The request
* properties of the connection may not be modified by the caller as
* the request parameters have already been signed.
* @throws IOException
* @throws java.io.IOException
* sending the request was not possible.
*/
public URLConnection get(final String bucket, final String key)
@@ -310,7 +309,7 @@ public class AmazonS3 {
* @param u
* connection previously created by {@link #get(String, String)}}.
* @return stream to read plain text from.
* @throws IOException
* @throws java.io.IOException
* decryption could not be configured.
*/
public InputStream decrypt(final URLConnection u) throws IOException {
@@ -333,7 +332,7 @@ public class AmazonS3 {
* @return list of keys starting with <code>prefix</code>, after removing
* <code>prefix</code> (or <code>prefix + "/"</code>)from all
* of them.
* @throws IOException
* @throws java.io.IOException
* sending the request was not possible, or the response XML
* document could not be parsed properly.
*/
@@ -357,7 +356,7 @@ public class AmazonS3 {
* name of the bucket storing the object.
* @param key
* key of the object within its bucket.
* @throws IOException
* @throws java.io.IOException
* deletion failed due to communications error.
*/
public void delete(final String bucket, final String key)
@@ -394,7 +393,7 @@ public class AmazonS3 {
* @param data
* new data content for the object. Must not be null. Zero length
* array will create a zero length object.
* @throws IOException
* @throws java.io.IOException
* creation/updating failed due to communications error.
*/
public void put(final String bucket, final String key, final byte[] data)
@@ -463,7 +462,7 @@ public class AmazonS3 {
* @param monitorTask
* (optional) task name to display during the close method.
* @return a stream which accepts the new data, and transmits once closed.
* @throws IOException
* @throws java.io.IOException
* if encryption was enabled it could not be configured.
*/
public OutputStream beginPut(final String bucket, final String key,

+ 8
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java View File

@@ -71,31 +71,34 @@ public abstract class BaseConnection implements Connection {

private Writer messageWriter;

/** {@inheritDoc} */
@Override
public Map<String, Ref> getRefsMap() {
return advertisedRefs;
}

/** {@inheritDoc} */
@Override
public final Collection<Ref> getRefs() {
return advertisedRefs.values();
}

/** {@inheritDoc} */
@Override
public final Ref getRef(final String name) {
return advertisedRefs.get(name);
}

/** {@inheritDoc} */
@Override
public String getMessages() {
return messageWriter != null ? messageWriter.toString() : ""; //$NON-NLS-1$
}

/**
* User agent advertised by the remote server.
* {@inheritDoc}
*
* @return agent (version of Git) running on the remote server. Null if the
* server does not advertise this version.
* User agent advertised by the remote server.
* @since 4.0
*/
@Override
@@ -114,6 +117,7 @@ public abstract class BaseConnection implements Connection {
peerUserAgent = agent;
}

/** {@inheritDoc} */
@Override
public abstract void close();

@@ -136,7 +140,7 @@ public abstract class BaseConnection implements Connection {
* Helper method for ensuring one-operation per connection. Check whether
* operation was already marked as started, and mark it as started.
*
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* if operation was already marked as started.
*/
protected void markStartedOperation() throws TransportException {

+ 5
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseFetchConnection.java View File

@@ -64,6 +64,7 @@ import org.eclipse.jgit.lib.Ref;
*/
abstract class BaseFetchConnection extends BaseConnection implements
FetchConnection {
/** {@inheritDoc} */
@Override
public final void fetch(final ProgressMonitor monitor,
final Collection<Ref> want, final Set<ObjectId> have)
@@ -71,6 +72,7 @@ abstract class BaseFetchConnection extends BaseConnection implements
fetch(monitor, want, have, null);
}

/** {@inheritDoc} */
@Override
public final void fetch(final ProgressMonitor monitor,
final Collection<Ref> want, final Set<ObjectId> have,
@@ -80,6 +82,8 @@ abstract class BaseFetchConnection extends BaseConnection implements
}

/**
* {@inheritDoc}
*
* Default implementation of {@link FetchConnection#didFetchIncludeTags()} -
* returning false.
*/
@@ -98,7 +102,7 @@ abstract class BaseFetchConnection extends BaseConnection implements
* as in {@link #fetch(ProgressMonitor, Collection, Set)}
* @param have
* as in {@link #fetch(ProgressMonitor, Collection, Set)}
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* as in {@link #fetch(ProgressMonitor, Collection, Set)}, but
* implementation doesn't have to care about multiple
* {@link #fetch(ProgressMonitor, Collection, Set)} calls, as it

+ 29
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java View File

@@ -170,9 +170,9 @@ abstract class BasePackConnection extends BaseConnection {
* <p>
* If any errors occur, this connection is automatically closed by invoking
* {@link #close()} and the exception is wrapped (if necessary) and thrown
* as a {@link TransportException}.
* as a {@link org.eclipse.jgit.errors.TransportException}.
*
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the reference list could not be scanned.
*/
protected void readAdvertisedRefs() throws TransportException {
@@ -267,10 +267,26 @@ abstract class BasePackConnection extends BaseConnection {
return new NoRemoteRepositoryException(uri, JGitText.get().notFound);
}

/**
* Whether this option is supported
*
* @param option
* option string
* @return whether this option is supported
*/
protected boolean isCapableOf(final String option) {
return remoteCapablities.contains(option);
}

/**
* Request capability
*
* @param b
* buffer
* @param option
* option we want
* @return {@code true} if the requested option is supported
*/
protected boolean wantCapability(final StringBuilder b, final String option) {
if (!isCapableOf(option))
return false;
@@ -279,6 +295,12 @@ abstract class BasePackConnection extends BaseConnection {
return true;
}

/**
* Add user agent capability
*
* @param b
* a {@link java.lang.StringBuilder} object.
*/
protected void addUserAgentCapability(StringBuilder b) {
String a = UserAgent.get();
if (a != null && UserAgent.hasAgent(remoteCapablities)) {
@@ -286,6 +308,7 @@ abstract class BasePackConnection extends BaseConnection {
}
}

/** {@inheritDoc} */
@Override
public String getPeerUserAgent() {
return UserAgent.getAgent(remoteCapablities, super.getPeerUserAgent());
@@ -295,6 +318,7 @@ abstract class BasePackConnection extends BaseConnection {
return new PackProtocolException(uri, MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, name));
}

/** {@inheritDoc} */
@Override
public void close() {
if (out != null) {
@@ -334,7 +358,9 @@ abstract class BasePackConnection extends BaseConnection {
}
}

/** Tell the peer we are disconnecting, if it cares to know. */
/**
* Tell the peer we are disconnecting, if it cares to know.
*/
protected void endOut() {
if (outNeedsEnd && out != null) {
try {

+ 14
- 10
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java View File

@@ -94,10 +94,10 @@ import org.eclipse.jgit.util.TemporaryBuffer;
* easily wrapped up into a local process pipe, anonymous TCP socket, or a
* command executed through an SSH tunnel.
* <p>
* If {@link BasePackConnection#statelessRPC} is {@code true}, this connection
* can be tunneled over a request-response style RPC system like HTTP. The RPC
* call boundary is determined by this class switching from writing to the
* OutputStream to reading from the InputStream.
* If {@link org.eclipse.jgit.transport.BasePackConnection#statelessRPC} is
* {@code true}, this connection can be tunneled over a request-response style
* RPC system like HTTP. The RPC call boundary is determined by this class
* switching from writing to the OutputStream to reading from the InputStream.
* <p>
* Concrete implementations should just call
* {@link #init(java.io.InputStream, java.io.OutputStream)} and
@@ -285,6 +285,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
}
}

/** {@inheritDoc} */
@Override
public final void fetch(final ProgressMonitor monitor,
final Collection<Ref> want, final Set<ObjectId> have)
@@ -292,9 +293,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
fetch(monitor, want, have, null);
}

/**
* @since 3.0
*/
/** {@inheritDoc} */
@Override
public final void fetch(final ProgressMonitor monitor,
final Collection<Ref> want, final Set<ObjectId> have,
@@ -303,21 +302,25 @@ public abstract class BasePackFetchConnection extends BasePackConnection
doFetch(monitor, want, have, outputStream);
}

/** {@inheritDoc} */
@Override
public boolean didFetchIncludeTags() {
return false;
}

/** {@inheritDoc} */
@Override
public boolean didFetchTestConnectivity() {
return false;
}

/** {@inheritDoc} */
@Override
public void setPackLockMessage(final String message) {
lockMessage = message;
}

/** {@inheritDoc} */
@Override
public Collection<PackLock> getPackLocks() {
if (packLock != null)
@@ -330,7 +333,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
*
* @param monitor
* progress monitor to receive status updates. If the monitor is
* the {@link NullProgressMonitor#INSTANCE}, then the no-progress
* the {@link org.eclipse.jgit.lib.NullProgressMonitor#INSTANCE}, then the no-progress
* option enabled.
* @param want
* the advertised remote references the caller wants to fetch.
@@ -340,7 +343,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
* destination repository's references.
* @param outputStream
* ouputStream to write sideband messages to
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* if any exception occurs.
* @since 3.0
*/
@@ -380,6 +383,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
}
}

/** {@inheritDoc} */
@Override
public void close() {
if (walk != null)
@@ -776,7 +780,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection

/**
* Notification event delivered just before the pack is received from the
* network. This event can be used by RPC such as {@link TransportHttp} to
* network. This event can be used by RPC such as {@link org.eclipse.jgit.transport.TransportHttp} to
* disable its request magic and ensure the pack stream is read correctly.
*
* @since 2.0

+ 6
- 5
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java View File

@@ -81,7 +81,8 @@ import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
* easily wrapped up into a local process pipe, anonymous TCP socket, or a
* command executed through an SSH tunnel.
* <p>
* This implementation honors {@link Transport#isPushThin()} option.
* This implementation honors
* {@link org.eclipse.jgit.transport.Transport#isPushThin()} option.
* <p>
* Concrete implementations should just call
* {@link #init(java.io.InputStream, java.io.OutputStream)} and
@@ -152,6 +153,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
pushOptions = transport.getPushOptions();
}

/** {@inheritDoc} */
@Override
public void push(final ProgressMonitor monitor,
final Map<String, RemoteRefUpdate> refUpdates)
@@ -159,9 +161,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
push(monitor, refUpdates, null);
}

/**
* @since 3.0
*/
/** {@inheritDoc} */
@Override
public void push(final ProgressMonitor monitor,
final Map<String, RemoteRefUpdate> refUpdates, OutputStream outputStream)
@@ -170,6 +170,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
doPush(monitor, refUpdates, outputStream);
}

/** {@inheritDoc} */
@Override
protected TransportException noRepository() {
// Sadly we cannot tell the "invalid URI" case from "push not allowed".
@@ -202,7 +203,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
* update commands to be applied to the remote repository.
* @param outputStream
* output stream to write sideband messages to
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* if any exception occurs.
* @since 3.0
*/

+ 196
- 72
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java View File

@@ -405,15 +405,27 @@ public abstract class BaseReceivePack {
}
}

/** @return the process name used for pack lock messages. */
/**
* Get the process name used for pack lock messages.
*
* @return the process name used for pack lock messages.
*/
protected abstract String getLockMessageProcessName();

/** @return the repository this receive completes into. */
/**
* Get the repository this receive completes into.
*
* @return the repository this receive completes into.
*/
public final Repository getRepository() {
return db;
}

/** @return the RevWalk instance used by this connection. */
/**
* Get the RevWalk instance used by this connection.
*
* @return the RevWalk instance used by this connection.
*/
public final RevWalk getRevWalk() {
return walk;
}
@@ -431,14 +443,15 @@ public abstract class BaseReceivePack {
/**
* Set the refs advertised by this ReceivePack.
* <p>
* Intended to be called from a {@link PreReceiveHook}.
* Intended to be called from a
* {@link org.eclipse.jgit.transport.PreReceiveHook}.
*
* @param allRefs
* explicit set of references to claim as advertised by this
* ReceivePack instance. This overrides any references that
* may exist in the source repository. The map is passed
* to the configured {@link #getRefFilter()}. If null, assumes
* all refs were advertised.
* ReceivePack instance. This overrides any references that may
* exist in the source repository. The map is passed to the
* configured {@link #getRefFilter()}. If null, assumes all refs
* were advertised.
* @param additionalHaves
* explicit set of additional haves to claim as advertised. If
* null, assumes the default set of additional haves from the
@@ -475,6 +488,9 @@ public abstract class BaseReceivePack {
}

/**
* Whether this instance will validate all referenced, but not supplied by
* the client, objects are reachable from another reference.
*
* @return true if this instance will validate all referenced, but not
* supplied by the client, objects are reachable from another
* reference.
@@ -493,8 +509,9 @@ public abstract class BaseReceivePack {
* This feature is useful when the application doesn't trust the client to
* not provide a forged SHA-1 reference to an object, in an attempt to
* access parts of the DAG that they aren't allowed to see and which have
* been hidden from them via the configured {@link AdvertiseRefsHook} or
* {@link RefFilter}.
* been hidden from them via the configured
* {@link org.eclipse.jgit.transport.AdvertiseRefsHook} or
* {@link org.eclipse.jgit.transport.RefFilter}.
* <p>
* Enabling this feature may imply at least some, if not all, of the same
* functionality performed by {@link #setCheckReceivedObjects(boolean)}.
@@ -508,6 +525,9 @@ public abstract class BaseReceivePack {
}

/**
* Whether this class expects a bi-directional pipe opened between the
* client and itself.
*
* @return true if this class expects a bi-directional pipe opened between
* the client and itself. The default is true.
*/
@@ -516,6 +536,10 @@ public abstract class BaseReceivePack {
}

/**
* Whether this class will assume the socket is a fully bidirectional pipe
* between the two peers and takes advantage of that by first transmitting
* the known refs, then waiting to read commands.
*
* @param twoWay
* if true, this class will assume the socket is a fully
* bidirectional pipe between the two peers and takes advantage
@@ -528,32 +552,44 @@ public abstract class BaseReceivePack {
biDirectionalPipe = twoWay;
}

/** @return true if there is data expected after the pack footer. */
/**
* Whether there is data expected after the pack footer.
*
* @return {@code true} if there is data expected after the pack footer.
*/
public boolean isExpectDataAfterPackFooter() {
return expectDataAfterPackFooter;
}

/**
* Whether there is additional data in InputStream after pack.
*
* @param e
* true if there is additional data in InputStream after pack.
* {@code true} if there is additional data in InputStream after
* pack.
*/
public void setExpectDataAfterPackFooter(boolean e) {
expectDataAfterPackFooter = e;
}

/**
* @return true if this instance will verify received objects are formatted
* correctly. Validating objects requires more CPU time on this side
* of the connection.
* Whether this instance will verify received objects are formatted
* correctly.
*
* @return {@code true} if this instance will verify received objects are
* formatted correctly. Validating objects requires more CPU time on
* this side of the connection.
*/
public boolean isCheckReceivedObjects() {
return objectChecker != null;
}

/**
* Whether to enable checking received objects
*
* @param check
* true to enable checking received objects; false to assume all
* received objects are valid.
* {@code true} to enable checking received objects; false to
* assume all received objects are valid.
* @see #setObjectChecker(ObjectChecker)
*/
public void setCheckReceivedObjects(final boolean check) {
@@ -564,42 +600,59 @@ public abstract class BaseReceivePack {
}

/**
* @param impl if non-null the object checking instance to verify each
* received object with; null to disable object checking.
* Set the object checking instance to verify each received object with
*
* @param impl
* if non-null the object checking instance to verify each
* received object with; null to disable object checking.
* @since 3.4
*/
public void setObjectChecker(ObjectChecker impl) {
objectChecker = impl;
}

/** @return true if the client can request refs to be created. */
/**
* Whether the client can request refs to be created.
*
* @return {@code true} if the client can request refs to be created.
*/
public boolean isAllowCreates() {
return allowCreates;
}

/**
* Whether to permit create ref commands to be processed.
*
* @param canCreate
* true to permit create ref commands to be processed.
* {@code true} to permit create ref commands to be processed.
*/
public void setAllowCreates(final boolean canCreate) {
allowCreates = canCreate;
}

/** @return true if the client can request refs to be deleted. */
/**
* Whether the client can request refs to be deleted.
*
* @return {@code true} if the client can request refs to be deleted.
*/
public boolean isAllowDeletes() {
return allowAnyDeletes;
}

/**
* Whether to permit delete ref commands to be processed.
*
* @param canDelete
* true to permit delete ref commands to be processed.
* {@code true} to permit delete ref commands to be processed.
*/
public void setAllowDeletes(final boolean canDelete) {
allowAnyDeletes = canDelete;
}

/**
* @return true if the client can delete from {@code refs/heads/}.
* Whether the client can delete from {@code refs/heads/}.
*
* @return {@code true} if the client can delete from {@code refs/heads/}.
* @since 3.6
*/
public boolean isAllowBranchDeletes() {
@@ -607,8 +660,11 @@ public abstract class BaseReceivePack {
}

/**
* Configure whether to permit deletion of branches from the
* {@code refs/heads/} namespace.
*
* @param canDelete
* true to permit deletion of branches from the
* {@code true} to permit deletion of branches from the
* {@code refs/heads/} namespace.
* @since 3.6
*/
@@ -617,25 +673,34 @@ public abstract class BaseReceivePack {
}

/**
* @return true if the client can request non-fast-forward updates of a ref,
* possibly making objects unreachable.
* Whether the client can request non-fast-forward updates of a ref,
* possibly making objects unreachable.
*
* @return {@code true} if the client can request non-fast-forward updates
* of a ref, possibly making objects unreachable.
*/
public boolean isAllowNonFastForwards() {
return allowNonFastForwards;
}

/**
* Configure whether to permit the client to ask for non-fast-forward
* updates of an existing ref.
*
* @param canRewind
* true to permit the client to ask for non-fast-forward updates
* of an existing ref.
* {@code true} to permit the client to ask for non-fast-forward
* updates of an existing ref.
*/
public void setAllowNonFastForwards(final boolean canRewind) {
allowNonFastForwards = canRewind;
}

/**
* @return true if the client's commands should be performed as a single
* atomic transaction.
* Whether the client's commands should be performed as a single atomic
* transaction.
*
* @return {@code true} if the client's commands should be performed as a
* single atomic transaction.
* @since 4.4
*/
public boolean isAtomic() {
@@ -643,16 +708,23 @@ public abstract class BaseReceivePack {
}

/**
* Configure whether to perform the client's commands as a single atomic
* transaction.
*
* @param atomic
* true to perform the client's commands as a single atomic
* transaction.
* {@code true} to perform the client's commands as a single
* atomic transaction.
* @since 4.4
*/
public void setAtomic(boolean atomic) {
this.atomic = atomic;
}

/** @return identity of the user making the changes in the reflog. */
/**
* Get identity of the user making the changes in the reflog.
*
* @return identity of the user making the changes in the reflog.
*/
public PersonIdent getRefLogIdent() {
return refLogIdent;
}
@@ -673,12 +745,20 @@ public abstract class BaseReceivePack {
refLogIdent = pi;
}

/** @return the hook used while advertising the refs to the client */
/**
* Get the hook used while advertising the refs to the client
*
* @return the hook used while advertising the refs to the client
*/
public AdvertiseRefsHook getAdvertiseRefsHook() {
return advertiseRefsHook;
}

/** @return the filter used while advertising the refs to the client */
/**
* Get the filter used while advertising the refs to the client
*
* @return the filter used while advertising the refs to the client
*/
public RefFilter getRefFilter() {
return refFilter;
}
@@ -686,12 +766,14 @@ public abstract class BaseReceivePack {
/**
* Set the hook used while advertising the refs to the client.
* <p>
* If the {@link AdvertiseRefsHook} chooses to call
* {@link #setAdvertisedRefs(Map,Set)}, only refs set by this hook
* <em>and</em> selected by the {@link RefFilter} will be shown to the client.
* Clients may still attempt to create or update a reference not advertised by
* the configured {@link AdvertiseRefsHook}. These attempts should be rejected
* by a matching {@link PreReceiveHook}.
* If the {@link org.eclipse.jgit.transport.AdvertiseRefsHook} chooses to
* call {@link #setAdvertisedRefs(Map,Set)}, only refs set by this hook
* <em>and</em> selected by the {@link org.eclipse.jgit.transport.RefFilter}
* will be shown to the client. Clients may still attempt to create or
* update a reference not advertised by the configured
* {@link org.eclipse.jgit.transport.AdvertiseRefsHook}. These attempts
* should be rejected by a matching
* {@link org.eclipse.jgit.transport.PreReceiveHook}.
*
* @param advertiseRefsHook
* the hook; may be null to show all refs.
@@ -706,9 +788,9 @@ public abstract class BaseReceivePack {
/**
* Set the filter used while advertising the refs to the client.
* <p>
* Only refs allowed by this filter will be shown to the client.
* The filter is run against the refs specified by the
* {@link AdvertiseRefsHook} (if applicable).
* Only refs allowed by this filter will be shown to the client. The filter
* is run against the refs specified by the
* {@link org.eclipse.jgit.transport.AdvertiseRefsHook} (if applicable).
*
* @param refFilter
* the filter; may be null to show all refs.
@@ -717,7 +799,11 @@ public abstract class BaseReceivePack {
this.refFilter = refFilter != null ? refFilter : RefFilter.DEFAULT;
}

/** @return timeout (in seconds) before aborting an IO operation. */
/**
* Get timeout (in seconds) before aborting an IO operation.
*
* @return timeout (in seconds) before aborting an IO operation.
*/
public int getTimeout() {
return timeout;
}
@@ -786,7 +872,6 @@ public abstract class BaseReceivePack {
*
* @param limit
* the pack size limit, in bytes
*
* @since 3.3
*/
public void setMaxPackSizeLimit(final long limit) {
@@ -801,7 +886,7 @@ public abstract class BaseReceivePack {
*
* @return true if the client has advertised a side-band capability, false
* otherwise.
* @throws RequestNotYetReadException
* @throws org.eclipse.jgit.transport.RequestNotYetReadException
* if the client's request has not yet been read from the wire, so
* we do not know if they expect side-band. Note that the client
* may have already written the request, it just has not been
@@ -813,6 +898,8 @@ public abstract class BaseReceivePack {
}

/**
* Whether clients may request avoiding noisy progress messages.
*
* @return true if clients may request avoiding noisy progress messages.
* @since 4.0
*/
@@ -835,6 +922,8 @@ public abstract class BaseReceivePack {
}

/**
* Whether the server supports receiving push options.
*
* @return true if the server supports receiving push options.
* @since 4.5
*/
@@ -857,7 +946,7 @@ public abstract class BaseReceivePack {
* True if the client wants less verbose output.
*
* @return true if the client has requested the server to be less verbose.
* @throws RequestNotYetReadException
* @throws org.eclipse.jgit.transport.RequestNotYetReadException
* if the client's request has not yet been read from the wire,
* so we do not know if they expect side-band. Note that the
* client may have already written the request, it just has not
@@ -908,7 +997,11 @@ public abstract class BaseReceivePack {
return UserAgent.getAgent(enabledCapabilities, userAgent);
}

/** @return all of the command received by the current request. */
/**
* Get all of the command received by the current request.
*
* @return all of the command received by the current request.
*/
public List<ReceiveCommand> getAllCommands() {
return Collections.unmodifiableList(commands);
}
@@ -926,11 +1019,13 @@ public abstract class BaseReceivePack {
* message will be discarded, with no other indication to the caller or to
* the client.
* <p>
* {@link PreReceiveHook}s should always try to use
* {@link ReceiveCommand#setResult(Result, String)} with a result status of
* {@link Result#REJECTED_OTHER_REASON} to indicate any reasons for
* rejecting an update. Messages attached to a command are much more likely
* to be returned to the client.
* {@link org.eclipse.jgit.transport.PreReceiveHook}s should always try to
* use
* {@link org.eclipse.jgit.transport.ReceiveCommand#setResult(Result, String)}
* with a result status of
* {@link org.eclipse.jgit.transport.ReceiveCommand.Result#REJECTED_OTHER_REASON}
* to indicate any reasons for rejecting an update. Messages attached to a
* command are much more likely to be returned to the client.
*
* @param what
* string describing the problem identified by the hook. The
@@ -973,7 +1068,11 @@ public abstract class BaseReceivePack {
msgOutWrapper.write(Constants.encode(what + "\n")); //$NON-NLS-1$
}

/** @return an underlying stream for sending messages to the client. */
/**
* Get an underlying stream for sending messages to the client.
*
* @return an underlying stream for sending messages to the client.
*/
public OutputStream getMessageOutputStream() {
return msgOutWrapper;
}
@@ -984,7 +1083,7 @@ public abstract class BaseReceivePack {
* This can only be called if the pack is already received.
*
* @return the size of the received pack including index size
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* if called before the pack has been received
* @since 3.3
*/
@@ -1006,12 +1105,20 @@ public abstract class BaseReceivePack {
return clientShallowCommits;
}

/** @return true if any commands to be executed have been read. */
/**
* Whether any commands to be executed have been read.
*
* @return {@code true} if any commands to be executed have been read.
*/
protected boolean hasCommands() {
return !commands.isEmpty();
}

/** @return true if an error occurred that should be advertised. */
/**
* Whether an error occurred that should be advertised.
*
* @return true if an error occurred that should be advertised.
*/
protected boolean hasError() {
return advertiseError != null;
}
@@ -1059,7 +1166,11 @@ public abstract class BaseReceivePack {
commands = new ArrayList<>();
}

/** @return advertised refs, or the default if not explicitly advertised. */
/**
* Get advertised refs, or the default if not explicitly advertised.
*
* @return advertised refs, or the default if not explicitly advertised.
*/
protected Map<String, Ref> getAdvertisedOrDefaultRefs() {
if (refs == null)
setAdvertisedRefs(null, null);
@@ -1069,7 +1180,7 @@ public abstract class BaseReceivePack {
/**
* Receive a pack from the stream and check connectivity if necessary.
*
* @throws IOException
* @throws java.io.IOException
* an error occurred during unpacking or connectivity checking.
*/
protected void receivePackAndCheckConnectivity() throws IOException {
@@ -1082,7 +1193,7 @@ public abstract class BaseReceivePack {
/**
* Unlock the pack written by this object.
*
* @throws IOException
* @throws java.io.IOException
* the pack could not be unlocked.
*/
protected void unlockPack() throws IOException {
@@ -1097,9 +1208,9 @@ public abstract class BaseReceivePack {
*
* @param adv
* the advertisement formatter.
* @throws IOException
* @throws java.io.IOException
* the formatter failed to write an advertisement.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* the hook denied advertisement.
*/
public void sendAdvertisedRefs(final RefAdvertiser adv)
@@ -1160,7 +1271,7 @@ public abstract class BaseReceivePack {
/**
* Receive a list of commands from the input.
*
* @throws IOException
* @throws java.io.IOException
*/
protected void recvCommands() throws IOException {
PacketLineIn pck = maxCommandBytes > 0
@@ -1289,7 +1400,9 @@ public abstract class BaseReceivePack {
// Do nothing by default.
}

/** Enable capabilities based on a previously read capabilities line. */
/**
* Enable capabilities based on a previously read capabilities line.
*/
protected void enableCapabilities() {
sideBand = isCapabilityEnabled(CAPABILITY_SIDE_BAND_64K);
quiet = allowQuiet && isCapabilityEnabled(CAPABILITY_QUIET);
@@ -1321,7 +1434,11 @@ public abstract class BaseReceivePack {
throw new RequestNotYetReadException();
}

/** @return true if a pack is expected based on the list of commands. */
/**
* Whether a pack is expected based on the list of commands.
*
* @return {@code true} if a pack is expected based on the list of commands.
*/
protected boolean needPack() {
for (final ReceiveCommand cmd : commands) {
if (cmd.getType() != ReceiveCommand.Type.DELETE)
@@ -1475,7 +1592,9 @@ public abstract class BaseReceivePack {
}
}

/** Validate the command list. */
/**
* Validate the command list.
*/
protected void validateCommands() {
for (final ReceiveCommand cmd : commands) {
final Ref ref = cmd.getRef();
@@ -1612,6 +1731,8 @@ public abstract class BaseReceivePack {
}

/**
* Whether any commands have been rejected so far.
*
* @return if any commands have been rejected so far.
* @since 3.6
*/
@@ -1625,6 +1746,7 @@ public abstract class BaseReceivePack {

/**
* Set the result to fail for any command that was not processed yet.
*
* @since 3.6
*/
protected void failPendingCommands() {
@@ -1643,7 +1765,9 @@ public abstract class BaseReceivePack {
return ReceiveCommand.filter(commands, want);
}

/** Execute commands to update references. */
/**
* Execute commands to update references.
*/
protected void executeCommands() {
List<ReceiveCommand> toApply = filterCommands(Result.NOT_ATTEMPTED);
if (toApply.isEmpty())
@@ -1683,7 +1807,7 @@ public abstract class BaseReceivePack {
* an error that occurred during unpacking, or {@code null}
* @param out
* the reporter for sending the status strings.
* @throws IOException
* @throws java.io.IOException
* an error occurred writing the status report.
*/
protected void sendStatusReport(final boolean forClient,
@@ -1770,7 +1894,7 @@ public abstract class BaseReceivePack {
/**
* Close and flush (if necessary) the underlying streams.
*
* @throws IOException
* @throws java.io.IOException
*/
protected void close() throws IOException {
if (sideBand) {
@@ -1802,7 +1926,7 @@ public abstract class BaseReceivePack {
/**
* Release any resources used by this object.
*
* @throws IOException
* @throws java.io.IOException
* the pack could not be unlocked.
*/
protected void release() throws IOException {

+ 5
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java View File

@@ -180,11 +180,13 @@ class BundleFetchConnection extends BaseFetchConnection {
return line.toString();
}

/** {@inheritDoc} */
@Override
public boolean didFetchTestConnectivity() {
return false;
}

/** {@inheritDoc} */
@Override
protected void doFetch(final ProgressMonitor monitor,
final Collection<Ref> want, final Set<ObjectId> have)
@@ -208,11 +210,13 @@ class BundleFetchConnection extends BaseFetchConnection {
}
}

/** {@inheritDoc} */
@Override
public void setPackLockMessage(final String message) {
lockMessage = message;
}

/** {@inheritDoc} */
@Override
public Collection<PackLock> getPackLocks() {
if (packLock != null)
@@ -290,6 +294,7 @@ class BundleFetchConnection extends BaseFetchConnection {
}
}

/** {@inheritDoc} */
@Override
public void close() {
if (bin != null) {

+ 4
- 8
org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java View File

@@ -70,7 +70,7 @@ import org.eclipse.jgit.storage.pack.PackConfig;
* <p>
* Bundles generated by this class can be later read in from a file URI using
* the bundle transport, or from an application controlled buffer by the more
* generic {@link TransportBundleStream}.
* generic {@link org.eclipse.jgit.transport.TransportBundleStream}.
* <p>
* Applications creating bundles need to call one or more <code>include</code>
* calls to reflect which objects should be available as refs in the bundle for
@@ -208,13 +208,10 @@ public class BundleWriter {
* the stream the bundle is written to. The stream should be
* buffered by the caller. The caller is responsible for closing
* the stream.
* @throws IOException
* @throws java.io.IOException
* an error occurred reading a local object's data to include in
* the bundle, or writing compressed object data to the output
* stream.
* @throws WriteAbortedException
* the write operation is aborted by
* {@link ObjectCountCallback}.
*/
public void writeBundle(ProgressMonitor monitor, OutputStream os)
throws IOException {
@@ -270,17 +267,16 @@ public class BundleWriter {
}

/**
* Set the {@link ObjectCountCallback}.
* Set the {@link org.eclipse.jgit.transport.ObjectCountCallback}.
* <p>
* It should be set before calling
* {@link #writeBundle(ProgressMonitor, OutputStream)}.
* <p>
* This callback will be passed on to
* {@link PackWriter#setObjectCountCallback}.
* {@link org.eclipse.jgit.internal.storage.pack.PackWriter#setObjectCountCallback}.
*
* @param callback
* the callback to set
*
* @return this object for chaining.
* @since 4.1
*/

+ 4
- 12
org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java View File

@@ -72,11 +72,7 @@ public class ChainingCredentialsProvider extends CredentialsProvider {
Arrays.asList(providers));
}

/**
* @return {@code true} if any of the credential providers in the list is
* interactive, otherwise {@code false}
* @see org.eclipse.jgit.transport.CredentialsProvider#isInteractive()
*/
/** {@inheritDoc} */
@Override
public boolean isInteractive() {
for (CredentialsProvider p : credentialProviders)
@@ -85,11 +81,7 @@ public class ChainingCredentialsProvider extends CredentialsProvider {
return false;
}

/**
* @return {@code true} if any of the credential providers in the list
* supports the requested items, otherwise {@code false}
* @see org.eclipse.jgit.transport.CredentialsProvider#supports(org.eclipse.jgit.transport.CredentialItem[])
*/
/** {@inheritDoc} */
@Override
public boolean supports(CredentialItem... items) {
for (CredentialsProvider p : credentialProviders)
@@ -99,11 +91,11 @@ public class ChainingCredentialsProvider extends CredentialsProvider {
}

/**
* {@inheritDoc}
* <p>
* Populates the credential items with the credentials provided by the first
* credential provider in the list which populates them with non-null values
*
* @return {@code true} if any of the credential providers in the list
* supports the requested items, otherwise {@code false}
* @see org.eclipse.jgit.transport.CredentialsProvider#supports(org.eclipse.jgit.transport.CredentialItem[])
*/
@Override

+ 2
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/Connection.java View File

@@ -98,6 +98,8 @@ public interface Connection extends AutoCloseable {
public Ref getRef(final String name);

/**
* {@inheritDoc}
* <p>
* Close any resources used by this connection.
* <p>
* If the remote repository is contacted by a network socket this method

+ 23
- 8
org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialItem.java View File

@@ -48,14 +48,19 @@ import java.util.Arrays;
import org.eclipse.jgit.internal.JGitText;

/**
* A credential requested from a {@link CredentialsProvider}.
* A credential requested from a
* {@link org.eclipse.jgit.transport.CredentialsProvider}.
*
* Most users should work with the specialized subclasses:
* <ul>
* <li>{@link Username} for usernames</li>
* <li>{@link Password} for passwords</li>
* <li>{@link StringType} for other general string information</li>
* <li>{@link CharArrayType} for other general secret information</li>
* <li>{@link org.eclipse.jgit.transport.CredentialItem.Username} for
* usernames</li>
* <li>{@link org.eclipse.jgit.transport.CredentialItem.Password} for
* passwords</li>
* <li>{@link org.eclipse.jgit.transport.CredentialItem.StringType} for other
* general string information</li>
* <li>{@link org.eclipse.jgit.transport.CredentialItem.CharArrayType} for other
* general secret information</li>
* </ul>
*
* This class is not thread-safe. Applications should construct their own
@@ -83,17 +88,27 @@ public abstract class CredentialItem {
this.valueSecure = maskValue;
}

/** @return prompt to display to the user. */
/**
* Get prompt to display to the user.
*
* @return prompt to display to the user.
*/
public String getPromptText() {
return promptText;
}

/** @return true if the value should be masked when entered. */
/**
* Whether the value should be masked when entered.
*
* @return true if the value should be masked when entered.
*/
public boolean isValueSecure() {
return valueSecure;
}

/** Clear the stored value, destroying it as much as possible. */
/**
* Clear the stored value, destroying it as much as possible.
*/
public abstract void clear();

/**

+ 19
- 9
org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java View File

@@ -52,9 +52,10 @@ import org.eclipse.jgit.errors.UnsupportedCredentialItem;
* Provide credentials for use in connecting to Git repositories.
*
* Implementors are strongly encouraged to support at least the minimal
* {@link CredentialItem.Username} and {@link CredentialItem.Password} items.
* More sophisticated implementors may implement additional types, such as
* {@link CredentialItem.StringType}.
* {@link org.eclipse.jgit.transport.CredentialItem.Username} and
* {@link org.eclipse.jgit.transport.CredentialItem.Password} items. More
* sophisticated implementors may implement additional types, such as
* {@link org.eclipse.jgit.transport.CredentialItem.StringType}.
*
* CredentialItems are usually presented in bulk, allowing implementors to
* combine them into a single UI widget and streamline the authentication
@@ -65,7 +66,11 @@ import org.eclipse.jgit.errors.UnsupportedCredentialItem;
public abstract class CredentialsProvider {
private static volatile CredentialsProvider defaultProvider;

/** @return the default credentials provider, or null. */
/**
* Get the default credentials provider, or null.
*
* @return the default credentials provider, or null.
*/
public static CredentialsProvider getDefault() {
return defaultProvider;
}
@@ -81,6 +86,8 @@ public abstract class CredentialsProvider {
}

/**
* Whether any of the passed items is null
*
* @param items
* credential items to check
* @return {@code true} if any of the passed items is null, {@code false}
@@ -106,12 +113,14 @@ public abstract class CredentialsProvider {
public abstract boolean isInteractive();

/**
* Check if the provider can supply the necessary {@link CredentialItem}s.
* Check if the provider can supply the necessary
* {@link org.eclipse.jgit.transport.CredentialItem}s.
*
* @param items
* the items the application requires to complete authentication.
* @return {@code true} if this {@link CredentialsProvider} supports all of
* the items supplied.
* @return {@code true} if this
* {@link org.eclipse.jgit.transport.CredentialsProvider} supports
* all of the items supplied.
*/
public abstract boolean supports(CredentialItem... items);

@@ -125,7 +134,7 @@ public abstract class CredentialsProvider {
* @return {@code true} if the request was successful and values were
* supplied; {@code false} if the user canceled the request and did
* not supply all requested values.
* @throws UnsupportedCredentialItem
* @throws org.eclipse.jgit.errors.UnsupportedCredentialItem
* if one of the items supplied is not supported.
*/
public abstract boolean get(URIish uri, CredentialItem... items)
@@ -141,7 +150,7 @@ public abstract class CredentialsProvider {
* @return {@code true} if the request was successful and values were
* supplied; {@code false} if the user canceled the request and did
* not supply all requested values.
* @throws UnsupportedCredentialItem
* @throws org.eclipse.jgit.errors.UnsupportedCredentialItem
* if one of the items supplied is not supported.
*/
public boolean get(URIish uri, List<CredentialItem> items)
@@ -153,6 +162,7 @@ public abstract class CredentialsProvider {
* Reset the credentials provider for the given URI
*
* @param uri
* a {@link org.eclipse.jgit.transport.URIish} object.
*/
public void reset(URIish uri) {
// default does nothing

+ 11
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java View File

@@ -51,7 +51,10 @@ import com.jcraft.jsch.Session;
import com.jcraft.jsch.UIKeyboardInteractive;
import com.jcraft.jsch.UserInfo;

/** A JSch {@link UserInfo} adapter for a {@link CredentialsProvider}. */
/**
* A JSch {@link com.jcraft.jsch.UserInfo} adapter for a
* {@link org.eclipse.jgit.transport.CredentialsProvider}.
*/
public class CredentialsProviderUserInfo implements UserInfo,
UIKeyboardInteractive {
private final URIish uri;
@@ -85,16 +88,19 @@ public class CredentialsProviderUserInfo implements UserInfo,
return uri;
}

/** {@inheritDoc} */
@Override
public String getPassword() {
return password;
}

/** {@inheritDoc} */
@Override
public String getPassphrase() {
return passphrase;
}

/** {@inheritDoc} */
@Override
public boolean promptPassphrase(String msg) {
CredentialItem.StringType v = newPrompt(msg);
@@ -107,6 +113,7 @@ public class CredentialsProviderUserInfo implements UserInfo,
}
}

/** {@inheritDoc} */
@Override
public boolean promptPassword(String msg) {
CredentialItem.Password p = new CredentialItem.Password(msg);
@@ -123,17 +130,20 @@ public class CredentialsProviderUserInfo implements UserInfo,
return new CredentialItem.StringType(msg, true);
}

/** {@inheritDoc} */
@Override
public boolean promptYesNo(String msg) {
CredentialItem.YesNoType v = new CredentialItem.YesNoType(msg);
return provider.get(uri, v) && v.getValue();
}

/** {@inheritDoc} */
@Override
public void showMessage(String msg) {
provider.get(uri, new CredentialItem.InformationalMessage(msg));
}

/** {@inheritDoc} */
@Override
public String[] promptKeyboardInteractive(String destination, String name,
String instruction, String[] prompt, boolean[] echo) {

+ 29
- 10
org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java View File

@@ -65,7 +65,9 @@ import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.transport.resolver.UploadPackFactory;

/** Basic daemon for the anonymous <code>git://</code> transport protocol. */
/**
* Basic daemon for the anonymous <code>git://</code> transport protocol.
*/
public class Daemon {
/** 9418: IANA assigned port number for Git. */
public static final int DEFAULT_PORT = 9418;
@@ -90,7 +92,9 @@ public class Daemon {

volatile ReceivePackFactory<DaemonClient> receivePackFactory;

/** Configure a daemon to listen on any available network port. */
/**
* Configure a daemon to listen on any available network port.
*/
public Daemon() {
this(null);
}
@@ -175,7 +179,11 @@ public class Daemon {
} };
}

/** @return the address connections are received on. */
/**
* Get the address connections are received on.
*
* @return the address connections are received on.
*/
public synchronized InetSocketAddress getAddress() {
return myAddress;
}
@@ -199,7 +207,11 @@ public class Daemon {
return null;
}

/** @return timeout (in seconds) before aborting an IO operation. */
/**
* Get timeout (in seconds) before aborting an IO operation.
*
* @return timeout (in seconds) before aborting an IO operation.
*/
public int getTimeout() {
return timeout;
}
@@ -216,7 +228,11 @@ public class Daemon {
timeout = seconds;
}

/** @return configuration controlling packing, may be null. */
/**
* Get configuration controlling packing, may be null.
*
* @return configuration controlling packing, may be null.
*/
public PackConfig getPackConfig() {
return packConfig;
}
@@ -333,9 +349,9 @@ public class Daemon {
/**
* Start this daemon on a background thread.
*
* @throws IOException
* @throws java.io.IOException
* the server socket could not be opened.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* the daemon is already running.
*/
public synchronized void start() throws IOException {
@@ -359,7 +375,11 @@ public class Daemon {
acceptThread = null;
}

/** @return true if this daemon is receiving connections. */
/**
* Whether this daemon is receiving connections.
*
* @return {@code true} if this daemon is receiving connections.
*/
public synchronized boolean isRunning() {
return acceptThread != null && acceptThread.isRunning();
}
@@ -376,9 +396,8 @@ public class Daemon {
/**
* Stops this daemon and waits until it's acceptor thread has finished.
*
* @throws InterruptedException
* @throws java.lang.InterruptedException
* if waiting for the acceptor thread is interrupted
*
* @since 4.9
*/
public void stopAndWait() throws InterruptedException {

+ 23
- 5
org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java View File

@@ -54,7 +54,9 @@ import java.net.Socket;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;

/** Active network client of {@link Daemon}. */
/**
* Active network client of {@link org.eclipse.jgit.transport.Daemon}.
*/
public class DaemonClient {
private final Daemon daemon;

@@ -72,22 +74,38 @@ public class DaemonClient {
peer = ia;
}

/** @return the daemon which spawned this client. */
/**
* Get the daemon which spawned this client.
*
* @return the daemon which spawned this client.
*/
public Daemon getDaemon() {
return daemon;
}

/** @return Internet address of the remote client. */
/**
* Get Internet address of the remote client.
*
* @return Internet address of the remote client.
*/
public InetAddress getRemoteAddress() {
return peer;
}

/** @return input stream to read from the connected client. */
/**
* Get input stream to read from the connected client.
*
* @return input stream to read from the connected client.
*/
public InputStream getInputStream() {
return rawIn;
}

/** @return output stream to send data to the connected client. */
/**
* Get output stream to send data to the connected client.
*
* @return output stream to send data to the connected client.
*/
public OutputStream getOutputStream() {
return rawOut;
}

+ 30
- 6
org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java View File

@@ -52,7 +52,10 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;

/** A service exposed by {@link Daemon} over anonymous <code>git://</code>. */
/**
* A service exposed by {@link org.eclipse.jgit.transport.Daemon} over anonymous
* <code>git://</code>.
*/
public abstract class DaemonService {
private final String command;

@@ -77,34 +80,55 @@ public abstract class DaemonService {
}
}

/** @return is this service enabled for invocation? */
/**
* Whether this service is enabled for invocation.
*
* @return whether this service is enabled for invocation.
*/
public boolean isEnabled() {
return enabled;
}

/**
* Set if it is allowed to use this service
*
* @param on
* true to allow this service to be used; false to deny it.
* {@code true} to allow this service to be used; {@code false}
* to deny it.
*/
public void setEnabled(final boolean on) {
enabled = on;
}

/** @return can this service be configured in the repository config file? */
/**
* Whether this service can be configured in the repository config file
*
* @return whether this service can be configured in the repository config
* file
*/
public boolean isOverridable() {
return overridable;
}

/**
* Whether to permit repositories to override this service's enabled state
* with the <code>daemon.servicename</code> config setting.
*
* @param on
* true to permit repositories to override this service's enabled
* state with the <code>daemon.servicename</code> config setting.
* {@code true} to permit repositories to override this service's
* enabled state with the <code>daemon.servicename</code> config
* setting.
*/
public void setOverridable(final boolean on) {
overridable = on;
}

/** @return name of the command requested by clients. */
/**
* Get name of the command requested by clients.
*
* @return name of the command requested by clients.
*/
public String getCommandName() {
return command;
}

+ 1
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java View File

@@ -59,6 +59,7 @@ import com.jcraft.jsch.Session;
* connection will immediately fail.
*/
class DefaultSshSessionFactory extends JschConfigSessionFactory {
/** {@inheritDoc} */
@Override
protected void configure(final OpenSshConfig.Host hc, final Session session) {
// No additional configuration required.

+ 17
- 14
org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchConnection.java View File

@@ -64,9 +64,9 @@ import org.eclipse.jgit.lib.Ref;
* one-way object transfer service to copy objects from the remote repository
* into this local repository.
* <p>
* Instances of a FetchConnection must be created by a {@link Transport} that
* implements a specific object transfer protocol that both sides of the
* connection understand.
* Instances of a FetchConnection must be created by a
* {@link org.eclipse.jgit.transport.Transport} that implements a specific
* object transfer protocol that both sides of the connection understand.
* <p>
* FetchConnection instances are not thread safe and may be accessed by only one
* thread at a time.
@@ -78,7 +78,7 @@ public interface FetchConnection extends Connection {
* Fetch objects we don't have but that are reachable from advertised refs.
* <p>
* Only one call per connection is allowed. Subsequent calls will result in
* {@link TransportException}.
* {@link org.eclipse.jgit.errors.TransportException}.
* </p>
* <p>
* Implementations are free to use network connections as necessary to
@@ -87,7 +87,8 @@ public interface FetchConnection extends Connection {
* 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.
* {@link Transport#isFetchThin()} should be honored if applicable.
* {@link org.eclipse.jgit.transport.Transport#isFetchThin()} should be
* honored if applicable.
* </p>
*
* @param monitor
@@ -103,7 +104,7 @@ public interface FetchConnection extends Connection {
* 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.
* @throws TransportException
* @throws org.eclipse.jgit.errors.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.
@@ -116,7 +117,7 @@ public interface FetchConnection extends Connection {
* Fetch objects we don't have but that are reachable from advertised refs.
* <p>
* Only one call per connection is allowed. Subsequent calls will result in
* {@link TransportException}.
* {@link org.eclipse.jgit.errors.TransportException}.
* </p>
* <p>
* Implementations are free to use network connections as necessary to
@@ -125,7 +126,8 @@ public interface FetchConnection extends Connection {
* 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.
* {@link Transport#isFetchThin()} should be honored if applicable.
* {@link org.eclipse.jgit.transport.Transport#isFetchThin()} should be
* honored if applicable.
* </p>
*
* @param monitor
@@ -143,7 +145,7 @@ public interface FetchConnection extends Connection {
* what is reachable through all Refs, not in replace of it.
* @param out
* OutputStream to write sideband messages to
* @throws TransportException
* @throws org.eclipse.jgit.errors.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.
@@ -157,11 +159,12 @@ public interface FetchConnection extends Connection {
* Did the last {@link #fetch(ProgressMonitor, Collection, Set)} get tags?
* <p>
* Some Git aware transports are able to implicitly grab an annotated tag if
* {@link TagOpt#AUTO_FOLLOW} or {@link TagOpt#FETCH_TAGS} was selected and
* the object the tag peels to (references) was transferred as part of the
* last {@link #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.
* {@link org.eclipse.jgit.transport.TagOpt#AUTO_FOLLOW} or
* {@link org.eclipse.jgit.transport.TagOpt#FETCH_TAGS} was selected and the
* object the tag peels to (references) was transferred as part of the last
* {@link #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.
* <p>
* 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

+ 6
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java View File

@@ -66,8 +66,11 @@ public class HMACSHA1NonceGenerator implements NonceGenerator {
private Mac mac;

/**
* Constructor for HMACSHA1NonceGenerator.
*
* @param seed
* @throws IllegalStateException
* seed the generator
* @throws java.lang.IllegalStateException
*/
public HMACSHA1NonceGenerator(String seed) throws IllegalStateException {
try {
@@ -82,6 +85,7 @@ public class HMACSHA1NonceGenerator implements NonceGenerator {
}
}

/** {@inheritDoc} */
@Override
public synchronized String createNonce(Repository repo, long timestamp)
throws IllegalStateException {
@@ -102,6 +106,7 @@ public class HMACSHA1NonceGenerator implements NonceGenerator {
return Long.toString(timestamp) + "-" + toHex(rawHmac); //$NON-NLS-1$
}

/** {@inheritDoc} */
@Override
public NonceStatus verify(String received, String sent,
Repository db, boolean allowSlop, int slop) {

+ 6
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java View File

@@ -204,6 +204,12 @@ abstract class HttpAuthMethod {

protected final Type type;

/**
* Constructor for HttpAuthMethod.
*
* @param type
* authentication method type
*/
protected HttpAuthMethod(Type type) {
this.type = type;
}

+ 17
- 8
org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java View File

@@ -61,10 +61,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* A representation of the "http.*" config values in a git {@link Config}. git
* provides for setting values for specific URLs through "http.<url>.*
* subsections. git always considers only the initial original URL for such
* settings, not any redirected URL.
* A representation of the "http.*" config values in a git
* {@link org.eclipse.jgit.lib.Config}. git provides for setting values for
* specific URLs through "http.<url>.* subsections. git always considers only
* the initial original URL for such settings, not any redirected URL.
*
* @since 4.9
*/
@@ -154,6 +154,8 @@ public class HttpConfig {
private int maxRedirects;

/**
* Get the "http.postBuffer" setting
*
* @return the value of the "http.postBuffer" setting
*/
public int getPostBuffer() {
@@ -161,6 +163,8 @@ public class HttpConfig {
}

/**
* Get the "http.sslVerify" setting
*
* @return the value of the "http.sslVerify" setting
*/
public boolean isSslVerify() {
@@ -168,6 +172,8 @@ public class HttpConfig {
}

/**
* Get the "http.followRedirects" setting
*
* @return the value of the "http.followRedirects" setting
*/
public HttpRedirectMode getFollowRedirects() {
@@ -175,6 +181,8 @@ public class HttpConfig {
}

/**
* Get the "http.maxRedirects" setting
*
* @return the value of the "http.maxRedirects" setting
*/
public int getMaxRedirects() {
@@ -182,10 +190,11 @@ public class HttpConfig {
}

/**
* Creates a new {@link HttpConfig} tailored to the given {@link URIish}.
* Creates a new {@link org.eclipse.jgit.transport.HttpConfig} tailored to
* the given {@link org.eclipse.jgit.transport.URIish}.
*
* @param config
* to read the {@link HttpConfig} from
* to read the {@link org.eclipse.jgit.transport.HttpConfig} from
* @param uri
* to get the configuration values for
*/
@@ -194,8 +203,8 @@ public class HttpConfig {
}

/**
* Creates a {@link HttpConfig} that reads values solely from the user
* config.
* Creates a {@link org.eclipse.jgit.transport.HttpConfig} that reads values
* solely from the user config.
*
* @param uri
* to get the configuration values for

+ 9
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpTransport.java View File

@@ -62,7 +62,11 @@ public abstract class HttpTransport extends Transport {
protected static HttpConnectionFactory connectionFactory = new JDKHttpConnectionFactory();

/**
* @return the {@link HttpConnectionFactory} used to create new connections
* Get the {@link org.eclipse.jgit.transport.http.HttpConnectionFactory}
* used to create new connections
*
* @return the {@link org.eclipse.jgit.transport.http.HttpConnectionFactory}
* used to create new connections
* @since 3.3
*/
public static HttpConnectionFactory getConnectionFactory() {
@@ -70,10 +74,11 @@ public abstract class HttpTransport extends Transport {
}

/**
* Set the {@link HttpConnectionFactory} to be used to create new
* connections
* Set the {@link org.eclipse.jgit.transport.http.HttpConnectionFactory} to
* be used to create new connections
*
* @param cf
* connection factory
* @since 3.3
*/
public static void setConnectionFactory(HttpConnectionFactory cf) {
@@ -98,7 +103,7 @@ public abstract class HttpTransport extends Transport {
/**
* Create a minimal HTTP transport instance not tied to a single repository.
*
* @param uri
* @param uri a {@link org.eclipse.jgit.transport.URIish} object.
*/
protected HttpTransport(URIish uri) {
super(uri);

+ 16
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalFetchConnection.java View File

@@ -57,6 +57,21 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory;
class InternalFetchConnection<C> extends BasePackFetchConnection {
private Thread worker;

/**
* Constructor for InternalFetchConnection.
*
* @param transport
* a {@link org.eclipse.jgit.transport.PackTransport}
* @param uploadPackFactory
* a
* {@link org.eclipse.jgit.transport.resolver.UploadPackFactory}
* @param req
* request
* @param remote
* the remote {@link org.eclipse.jgit.lib.Repository}
* @throws org.eclipse.jgit.errors.TransportException
* if any.
*/
public InternalFetchConnection(PackTransport transport,
final UploadPackFactory<C> uploadPackFactory,
final C req, final Repository remote) throws TransportException {
@@ -125,6 +140,7 @@ class InternalFetchConnection<C> extends BasePackFetchConnection {
readAdvertisedRefs();
}

/** {@inheritDoc} */
@Override
public void close() {
super.close();

+ 16
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/InternalPushConnection.java View File

@@ -57,6 +57,21 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
class InternalPushConnection<C> extends BasePackPushConnection {
private Thread worker;

/**
* Constructor for InternalPushConnection.
*
* @param transport
* a {@link org.eclipse.jgit.transport.PackTransport}
* @param receivePackFactory
* a
* {@link org.eclipse.jgit.transport.resolver.ReceivePackFactory}
* @param req
* a request
* @param remote
* the {@link org.eclipse.jgit.lib.Repository}
* @throws org.eclipse.jgit.errors.TransportException
* if any.
*/
public InternalPushConnection(PackTransport transport,
final ReceivePackFactory<C> receivePackFactory,
final C req, final Repository remote) throws TransportException {
@@ -115,6 +130,7 @@ class InternalPushConnection<C> extends BasePackPushConnection {
readAdvertisedRefs();
}

/** {@inheritDoc} */
@Override
public void close() {
super.close();

+ 12
- 9
org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java View File

@@ -70,7 +70,6 @@ import org.slf4j.LoggerFactory;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.UserInfo;

/**
* The base session factory that loads known hosts and private keys from
@@ -81,8 +80,8 @@ import com.jcraft.jsch.UserInfo;
* used by C Git.
* <p>
* The factory does not provide UI behavior. Override the method
* {@link #configure(org.eclipse.jgit.transport.OpenSshConfig.Host, Session)}
* to supply appropriate {@link UserInfo} to the session.
* {@link #configure(org.eclipse.jgit.transport.OpenSshConfig.Host, Session)} to
* supply appropriate {@link com.jcraft.jsch.UserInfo} to the session.
*/
public abstract class JschConfigSessionFactory extends SshSessionFactory {

@@ -95,6 +94,7 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {

private OpenSshConfig config;

/** {@inheritDoc} */
@Override
public synchronized RemoteSession getSession(URIish uri,
CredentialsProvider credentialsProvider, FS fs, int tms)
@@ -248,7 +248,7 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {
* the file system abstraction which will be necessary to
* perform certain file system operations.
* @return new session instance, but otherwise unconfigured.
* @throws JSchException
* @throws com.jcraft.jsch.JSchException
* the session could not be created.
*/
protected Session createSession(final OpenSshConfig.Host hc,
@@ -272,7 +272,8 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {

/**
* Provide additional configuration for the session based on the host
* information. This method could be used to supply {@link UserInfo}.
* information. This method could be used to supply
* {@link com.jcraft.jsch.UserInfo}.
*
* @param hc
* host configuration
@@ -290,7 +291,7 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {
* the file system abstraction which will be necessary to
* perform certain file system operations.
* @return the JSch instance to use.
* @throws JSchException
* @throws com.jcraft.jsch.JSchException
* the user configuration could not be created.
*/
protected JSch getJSch(final OpenSshConfig.Host hc, FS fs) throws JSchException {
@@ -323,11 +324,13 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {
}

/**
* Create default instance of jsch
*
* @param fs
* the file system abstraction which will be necessary to
* perform certain file system operations.
* the file system abstraction which will be necessary to perform
* certain file system operations.
* @return the new default JSch implementation.
* @throws JSchException
* @throws com.jcraft.jsch.JSchException
* known host keys cannot be loaded.
*/
protected JSch createDefaultJSch(FS fs) throws JSchException {

+ 9
- 6
org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java View File

@@ -66,8 +66,8 @@ import com.jcraft.jsch.Session;
* Run remote commands using Jsch.
* <p>
* This class is the default session implementation using Jsch. Note that
* {@link JschConfigSessionFactory} is used to create the actual session passed
* to the constructor.
* {@link org.eclipse.jgit.transport.JschConfigSessionFactory} is used to create
* the actual session passed to the constructor.
*/
public class JschSession implements RemoteSession {
final Session sock;
@@ -87,11 +87,13 @@ public class JschSession implements RemoteSession {
this.uri = uri;
}

/** {@inheritDoc} */
@Override
public Process exec(String command, int timeout) throws IOException {
return new JschProcess(command, timeout);
}

/** {@inheritDoc} */
@Override
public void disconnect() {
if (sock.isConnected())
@@ -99,12 +101,13 @@ public class JschSession implements RemoteSession {
}

/**
* A kludge to allow {@link TransportSftp} to get an Sftp channel from Jsch.
* Ideally, this method would be generic, which would require implementing
* generic Sftp channel operations in the RemoteSession class.
* A kludge to allow {@link org.eclipse.jgit.transport.TransportSftp} to get
* an Sftp channel from Jsch. Ideally, this method would be generic, which
* would require implementing generic Sftp channel operations in the
* RemoteSession class.
*
* @return a channel suitable for Sftp operations.
* @throws JSchException
* @throws com.jcraft.jsch.JSchException
* on problems getting the channel.
*/
public Channel getSftpChannel() throws JSchException {

+ 8
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java View File

@@ -143,7 +143,9 @@ public class NetRC {
COMMAND, MACHINE, LOGIN, PASSWORD, DEFAULT, ACCOUNT, MACDEF
}

/** */
/**
* <p>Constructor for NetRC.</p>
*/
public NetRC() {
netrc = getDefaultFile();
if (netrc != null)
@@ -151,6 +153,8 @@ public class NetRC {
}

/**
* <p>Constructor for NetRC.</p>
*
* @param netrc
* the .netrc file
*/
@@ -176,6 +180,7 @@ public class NetRC {
* Get entry by host name
*
* @param host
* the host name
* @return entry associated with host name or null
*/
public NetRCEntry getEntry(String host) {
@@ -194,6 +199,8 @@ public class NetRC {
}

/**
* Get all entries collected from .netrc file
*
* @return all entries collected from .netrc file
*/
public Collection<NetRCEntry> getEntries() {

+ 6
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java View File

@@ -54,7 +54,9 @@ public class NetRCCredentialsProvider extends CredentialsProvider {

NetRC netrc = new NetRC();

/** */
/**
* <p>Constructor for NetRCCredentialsProvider.</p>
*/
public NetRCCredentialsProvider() {
}

@@ -65,6 +67,7 @@ public class NetRCCredentialsProvider extends CredentialsProvider {
CredentialsProvider.setDefault(new NetRCCredentialsProvider());
}

/** {@inheritDoc} */
@Override
public boolean supports(CredentialItem... items) {
for (CredentialItem i : items) {
@@ -78,6 +81,7 @@ public class NetRCCredentialsProvider extends CredentialsProvider {
return true;
}

/** {@inheritDoc} */
@Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
@@ -108,6 +112,7 @@ public class NetRCCredentialsProvider extends CredentialsProvider {
return !isAnyNull(items);
}

/** {@inheritDoc} */
@Override
public boolean isInteractive() {
return false;

+ 5
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/NonceGenerator.java View File

@@ -55,6 +55,8 @@ import org.eclipse.jgit.transport.PushCertificate.NonceStatus;
public interface NonceGenerator {

/**
* Create nonce to be signed by the pusher
*
* @param db
* The repository which should be used to obtain a unique String
* such that the pusher cannot forge nonces by pushing to another
@@ -62,12 +64,14 @@ public interface NonceGenerator {
* @param timestamp
* The current time in seconds.
* @return The nonce to be signed by the pusher
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
*/
public String createNonce(Repository db, long timestamp)
throws IllegalStateException;

/**
* Verify trustworthiness of the received nonce.
*
* @param received
* The nonce which was received from the server
* @param sent
@@ -76,7 +80,6 @@ public interface NonceGenerator {
* The repository which should be used to obtain a unique String
* such that the pusher cannot forge nonces by pushing to another
* repository at the same time as well and reusing the nonce.
*
* @param allowSlop
* If the receiving backend is is able to generate slop. This is
* the case for serving via http protocol using more than one
@@ -85,7 +88,6 @@ public interface NonceGenerator {
* @param slop
* If `allowSlop` is true, this specifies the number of seconds
* which we allow as slop.
*
* @return a NonceStatus indicating the trustworthiness of the received
* nonce.
*/

+ 7
- 7
org.eclipse.jgit/src/org/eclipse/jgit/transport/ObjectCountCallback.java View File

@@ -45,7 +45,6 @@ package org.eclipse.jgit.transport;

import java.io.OutputStream;

import org.eclipse.jgit.internal.storage.pack.PackWriter;
import org.eclipse.jgit.lib.ProgressMonitor;

/**
@@ -55,19 +54,20 @@ import org.eclipse.jgit.lib.ProgressMonitor;
*/
public interface ObjectCountCallback {
/**
* Invoked when the {@link PackWriter} has counted the objects to be
* written to pack.
* Invoked when the
* {@link org.eclipse.jgit.internal.storage.pack.PackWriter} has counted the
* objects to be written to pack.
* <p>
* An {@code ObjectCountCallback} can use this information to decide
* whether the
* {@link PackWriter#writePack(ProgressMonitor, ProgressMonitor, OutputStream)}
* An {@code ObjectCountCallback} can use this information to decide whether
* the
* {@link org.eclipse.jgit.internal.storage.pack.PackWriter#writePack(ProgressMonitor, ProgressMonitor, OutputStream)}
* operation should be aborted.
* <p>
* This callback will be called exactly once.
*
* @param objectCount
* the count of the objects.
* @throws WriteAbortedException
* @throws org.eclipse.jgit.transport.WriteAbortedException
* to indicate that the write operation should be aborted.
*/
void setObjectCount(long objectCount) throws WriteAbortedException;

+ 9
- 7
org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java View File

@@ -85,9 +85,11 @@ import com.jcraft.jsch.ConfigRepository;
* </ul>
* <p>
* Therefore implement our own parser to read an OpenSSH configuration file. It
* makes the critical options available to {@link SshSessionFactory} via
* {@link Host} objects returned by {@link #lookup(String)}, and implements a
* fully conforming {@link ConfigRepository} providing
* makes the critical options available to
* {@link org.eclipse.jgit.transport.SshSessionFactory} via
* {@link org.eclipse.jgit.transport.OpenSshConfig.Host} objects returned by
* {@link #lookup(String)}, and implements a fully conforming
* {@link com.jcraft.jsch.ConfigRepository} providing
* {@link com.jcraft.jsch.ConfigRepository.Config}s via
* {@link #getConfig(String)}.
* </p>
@@ -104,7 +106,7 @@ import com.jcraft.jsch.ConfigRepository;
* ConfigRepository OTOH treats all option values as plain strings, so any
* validation must happen in Jsch outside of the parser. Thus this parser does
* not validate option values, except for a few options when constructing a
* {@link Host} object.
* {@link org.eclipse.jgit.transport.OpenSshConfig.Host} object.
* </p>
* <p>
* This config does %-substitutions for the following tokens:
@@ -961,12 +963,11 @@ public class OpenSshConfig implements ConfigRepository {
}

/**
* {@inheritDoc}
* <p>
* Retrieves the full {@link com.jcraft.jsch.ConfigRepository.Config Config}
* for the given host name. Should be called only by Jsch and tests.
*
* @param hostName
* to get the config for
* @return the configuration for the host
* @since 4.9
*/
@Override
@@ -975,6 +976,7 @@ public class OpenSshConfig implements ConfigRepository {
return new JschBugFixingConfig(host.getConfig());
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("nls")
public String toString() {

+ 77
- 43
org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java View File

@@ -76,7 +76,6 @@ import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdOwnerMap;
import org.eclipse.jgit.lib.ObjectIdSubclassMap;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.ObjectStream;
@@ -88,14 +87,16 @@ import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.sha1.SHA1;

/**
* Parses a pack stream and imports it for an {@link ObjectInserter}.
* Parses a pack stream and imports it for an
* {@link org.eclipse.jgit.lib.ObjectInserter}.
* <p>
* Applications can acquire an instance of a parser from ObjectInserter's
* {@link ObjectInserter#newPackParser(InputStream)} method.
* {@link org.eclipse.jgit.lib.ObjectInserter#newPackParser(InputStream)}
* method.
* <p>
* Implementations of {@link ObjectInserter} should subclass this type and
* provide their own logic for the various {@code on*()} event methods declared
* to be abstract.
* Implementations of {@link org.eclipse.jgit.lib.ObjectInserter} should
* subclass this type and provide their own logic for the various {@code on*()}
* event methods declared to be abstract.
*/
public abstract class PackParser {
/** Size of the internal stream buffer. */
@@ -213,7 +214,11 @@ public abstract class PackParser {
checkObjectCollisions = true;
}

/** @return true if a thin pack (missing base objects) is permitted. */
/**
* Whether a thin pack (missing base objects) is permitted.
*
* @return {@code true} if a thin pack (missing base objects) is permitted.
*/
public boolean isAllowThin() {
return allowThin;
}
@@ -232,6 +237,8 @@ public abstract class PackParser {
}

/**
* Whether received objects are verified to prevent collisions.
*
* @return if true received objects are verified to prevent collisions.
* @since 4.1
*/
@@ -300,7 +307,11 @@ public abstract class PackParser {
this.needBaseObjectIds = b;
}

/** @return true if the EOF should be read from the input after the footer. */
/**
* Whether the EOF should be read from the input after the footer.
*
* @return true if the EOF should be read from the input after the footer.
*/
public boolean isCheckEofAfterPackFooter() {
return checkEofAfterPackFooter;
}
@@ -315,12 +326,18 @@ public abstract class PackParser {
checkEofAfterPackFooter = b;
}

/** @return true if there is data expected after the pack footer. */
/**
* Whether there is data expected after the pack footer.
*
* @return true if there is data expected after the pack footer.
*/
public boolean isExpectDataAfterPackFooter() {
return expectDataAfterPackFooter;
}

/**
* Set if there is additional data in InputStream after pack.
*
* @param e
* true if there is additional data in InputStream after pack.
* This requires the InputStream to support the mark and reset
@@ -330,14 +347,22 @@ public abstract class PackParser {
expectDataAfterPackFooter = e;
}

/** @return the new objects that were sent by the user */
/**
* Get the new objects that were sent by the user
*
* @return the new objects that were sent by the user
*/
public ObjectIdSubclassMap<ObjectId> getNewObjectIds() {
if (newObjectIds != null)
return newObjectIds;
return new ObjectIdSubclassMap<>();
}

/** @return set of objects the incoming pack assumed for delta purposes */
/**
* Get set of objects the incoming pack assumed for delta purposes
*
* @return set of objects the incoming pack assumed for delta purposes
*/
public ObjectIdSubclassMap<ObjectId> getBaseObjectIds() {
if (baseObjectIds != null)
return baseObjectIds;
@@ -378,7 +403,11 @@ public abstract class PackParser {
setObjectChecker(on ? new ObjectChecker() : null);
}

/** @return the message to record with the pack lock. */
/**
* Get the message to record with the pack lock.
*
* @return the message to record with the pack lock.
*/
public String getLockMessage() {
return lockMessage;
}
@@ -420,7 +449,7 @@ public abstract class PackParser {
return entryCount;
}

/***
/**
* Get the information about the requested object.
* <p>
* The object information is only available after
@@ -477,7 +506,7 @@ public abstract class PackParser {
* <p>
* This should only be called after pack parsing is finished.
*
* @return {@link ReceivedPackStatistics}
* @return {@link org.eclipse.jgit.transport.ReceivedPackStatistics}
* @since 4.6
*/
public ReceivedPackStatistics getReceivedPackStatistics() {
@@ -489,10 +518,10 @@ public abstract class PackParser {
*
* @param progress
* callback to provide progress feedback during parsing. If null,
* {@link NullProgressMonitor} will be used.
* {@link org.eclipse.jgit.lib.NullProgressMonitor} will be used.
* @return the pack lock, if one was requested by setting
* {@link #setLockMessage(String)}.
* @throws IOException
* @throws java.io.IOException
* the stream is malformed, or contains corrupt objects.
* @since 3.0
*/
@@ -505,13 +534,13 @@ public abstract class PackParser {
*
* @param receiving
* receives progress feedback during the initial receiving
* objects phase. If null, {@link NullProgressMonitor} will be
* used.
* objects phase. If null,
* {@link org.eclipse.jgit.lib.NullProgressMonitor} will be used.
* @param resolving
* receives progress feedback during the resolving objects phase.
* @return the pack lock, if one was requested by setting
* {@link #setLockMessage(String)}.
* @throws IOException
* @throws java.io.IOException
* the stream is malformed, or contains corrupt objects.
* @since 3.0
*/
@@ -737,7 +766,7 @@ public abstract class PackParser {
* @param info
* the info object to populate.
* @return {@code info}, after populating.
* @throws IOException
* @throws java.io.IOException
* the size cannot be read.
*/
protected ObjectTypeAndSize readObjectHeader(ObjectTypeAndSize info)
@@ -1097,9 +1126,8 @@ public abstract class PackParser {
* the type of the object.
* @param data
* raw content of the object.
* @throws CorruptObjectException
* @throws org.eclipse.jgit.errors.CorruptObjectException
* @since 4.9
*
*/
protected void verifySafeObject(final AnyObjectId id, final int type,
final byte[] data) throws CorruptObjectException {
@@ -1265,7 +1293,11 @@ public abstract class PackParser {
bOffset = 0;
}

/** @return a temporary byte array for use by the caller. */
/**
* Get a temporary byte array for use by the caller.
*
* @return a temporary byte array for use by the caller.
*/
protected byte[] buffer() {
return tempBuffer;
}
@@ -1302,7 +1334,7 @@ public abstract class PackParser {
* If external implementation wants to overwrite the expectedObjectCount,
* they should call this method during {@link #onPackHeader(long)}.
*
* @param expectedObjectCount
* @param expectedObjectCount a long.
* @since 4.9
*/
protected void setExpectedObjectCount(long expectedObjectCount) {
@@ -1327,7 +1359,7 @@ public abstract class PackParser {
* first offset within the buffer that is valid.
* @param len
* number of bytes in the buffer that are valid.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be archived.
*/
protected abstract void onStoreStream(byte[] raw, int pos, int len)
@@ -1347,7 +1379,7 @@ public abstract class PackParser {
* first offset within buffer that is valid.
* @param len
* number of bytes in buffer that are valid.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be archived.
*/
protected abstract void onObjectHeader(Source src, byte[] raw, int pos,
@@ -1370,7 +1402,7 @@ public abstract class PackParser {
* first offset within buffer that is valid.
* @param len
* number of bytes in buffer that are valid.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be archived.
*/
protected abstract void onObjectData(Source src, byte[] raw, int pos,
@@ -1385,7 +1417,7 @@ public abstract class PackParser {
* the type of the object.
* @param data
* inflated data for the object.
* @throws IOException
* @throws java.io.IOException
* the object cannot be archived.
*/
protected abstract void onInflatedObjectData(PackedObjectInfo obj,
@@ -1396,7 +1428,7 @@ public abstract class PackParser {
*
* @param objCnt
* number of objects expected in the stream.
* @throws IOException
* @throws java.io.IOException
* the implementation refuses to work with this many objects.
*/
protected abstract void onPackHeader(long objCnt) throws IOException;
@@ -1407,7 +1439,7 @@ public abstract class PackParser {
* @param hash
* the trailing 20 bytes of the pack, this is a SHA-1 checksum of
* all of the pack data.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be archived.
*/
protected abstract void onPackFooter(byte[] hash) throws IOException;
@@ -1430,7 +1462,7 @@ public abstract class PackParser {
* @return true if the {@code info} should be included in the object list
* returned by {@link #getSortedObjectList(Comparator)}, false if it
* should not be included.
* @throws IOException
* @throws java.io.IOException
* the base could not be included into the pack.
*/
protected abstract boolean onAppendBase(int typeCode, byte[] data,
@@ -1443,7 +1475,7 @@ public abstract class PackParser {
* external from the pack. The event is called after all of those deltas
* have been resolved.
*
* @throws IOException
* @throws java.io.IOException
* the pack cannot be archived.
*/
protected abstract void onEndThinPack() throws IOException;
@@ -1460,7 +1492,7 @@ public abstract class PackParser {
* @param info
* object to populate with type and size.
* @return the {@code info} object.
* @throws IOException
* @throws java.io.IOException
* the database cannot reposition to this location.
*/
protected abstract ObjectTypeAndSize seekDatabase(PackedObjectInfo obj,
@@ -1478,7 +1510,7 @@ public abstract class PackParser {
* @param info
* object to populate with type and size.
* @return the {@code info} object.
* @throws IOException
* @throws java.io.IOException
* the database cannot reposition to this location.
*/
protected abstract ObjectTypeAndSize seekDatabase(UnresolvedDelta delta,
@@ -1495,7 +1527,7 @@ public abstract class PackParser {
* ideal target number of bytes to read. Actual read length may
* be shorter.
* @return number of bytes stored.
* @throws IOException
* @throws java.io.IOException
* the database cannot be accessed.
*/
protected abstract int readDatabase(byte[] dst, int pos, int cnt)
@@ -1525,13 +1557,15 @@ public abstract class PackParser {
* @param streamPosition
* position of this object in the incoming stream.
* @param type
* type of the object; one of {@link Constants#OBJ_COMMIT},
* {@link Constants#OBJ_TREE}, {@link Constants#OBJ_BLOB}, or
* {@link Constants#OBJ_TAG}.
* type of the object; one of
* {@link org.eclipse.jgit.lib.Constants#OBJ_COMMIT},
* {@link org.eclipse.jgit.lib.Constants#OBJ_TREE},
* {@link org.eclipse.jgit.lib.Constants#OBJ_BLOB}, or
* {@link org.eclipse.jgit.lib.Constants#OBJ_TAG}.
* @param inflatedSize
* size of the object when fully inflated. The size stored within
* the pack may be larger or smaller, and is not yet known.
* @throws IOException
* @throws java.io.IOException
* the object cannot be recorded.
*/
protected abstract void onBeginWholeObject(long streamPosition, int type,
@@ -1542,7 +1576,7 @@ public abstract class PackParser {
*
*@param info
* object information.
* @throws IOException
* @throws java.io.IOException
* the object cannot be recorded.
*/
protected abstract void onEndWholeObject(PackedObjectInfo info)
@@ -1561,7 +1595,7 @@ public abstract class PackParser {
* @param inflatedSize
* size of the delta when fully inflated. The size stored within
* the pack may be larger or smaller, and is not yet known.
* @throws IOException
* @throws java.io.IOException
* the object cannot be recorded.
*/
protected abstract void onBeginOfsDelta(long deltaStreamPosition,
@@ -1579,7 +1613,7 @@ public abstract class PackParser {
* @param inflatedSize
* size of the delta when fully inflated. The size stored within
* the pack may be larger or smaller, and is not yet known.
* @throws IOException
* @throws java.io.IOException
* the object cannot be recorded.
*/
protected abstract void onBeginRefDelta(long deltaStreamPosition,
@@ -1590,7 +1624,7 @@ public abstract class PackParser {
*
*@return object information that must be populated with at least the
* offset.
* @throws IOException
* @throws java.io.IOException
* the object cannot be recorded.
*/
protected UnresolvedDelta onEndDelta() throws IOException {

+ 6
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/PackedObjectInfo.java View File

@@ -80,6 +80,8 @@ public class PackedObjectInfo extends ObjectIdOwnerMap.Entry {
}

/**
* Get offset in pack when object has been already written
*
* @return offset in pack when object has been already written, or 0 if it
* has not been written yet
*/
@@ -98,6 +100,8 @@ public class PackedObjectInfo extends ObjectIdOwnerMap.Entry {
}

/**
* Get the 32 bit CRC checksum for the packed data.
*
* @return the 32 bit CRC checksum for the packed data.
*/
public int getCRC() {
@@ -117,6 +121,8 @@ public class PackedObjectInfo extends ObjectIdOwnerMap.Entry {
}

/**
* Get the object type.
*
* @return the object type. The default type is OBJ_BAD, which is considered
* as unknown or invalid type.
* @since 4.9

+ 2
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java View File

@@ -148,7 +148,7 @@ public class PacketLineIn {
*
* @return the string. {@link #END} if the string was the magic flush
* packet.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be read.
*/
public String readString() throws IOException {
@@ -186,7 +186,7 @@ public class PacketLineIn {
*
* @return the string. {@link #END} if the string was the magic flush
* packet.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be read.
*/
public String readStringRaw() throws IOException {

+ 5
- 5
org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java View File

@@ -100,7 +100,7 @@ public class PacketLineOut {
*
* @param s
* string to write.
* @throws IOException
* @throws java.io.IOException
* the packet could not be written, the stream is corrupted as
* the packet may have been only partially written.
*/
@@ -114,7 +114,7 @@ public class PacketLineOut {
* @param packet
* the packet to write; the length of the packet is equal to the
* size of the byte array.
* @throws IOException
* @throws java.io.IOException
* the packet could not be written, the stream is corrupted as
* the packet may have been only partially written.
*/
@@ -131,7 +131,7 @@ public class PacketLineOut {
* first index within {@code buf}.
* @param len
* number of bytes to write.
* @throws IOException
* @throws java.io.IOException
* the packet could not be written, the stream is corrupted as
* the packet may have been only partially written.
* @since 4.5
@@ -155,7 +155,7 @@ public class PacketLineOut {
* Implicitly performs a flush on the underlying OutputStream to ensure the
* peer will receive all data written thus far.
*
* @throws IOException
* @throws java.io.IOException
* the end marker could not be written, the stream is corrupted
* as the end marker may have been only partially written.
*/
@@ -173,7 +173,7 @@ public class PacketLineOut {
* Performs a flush on the underlying OutputStream to ensure the peer will
* receive all data written thus far.
*
* @throws IOException
* @throws java.io.IOException
* the underlying stream failed to flush.
*/
public void flush() throws IOException {

+ 5
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/PostReceiveHook.java View File

@@ -46,11 +46,13 @@ package org.eclipse.jgit.transport;
import java.util.Collection;

/**
* Hook invoked by {@link ReceivePack} after all updates are executed.
* Hook invoked by {@link org.eclipse.jgit.transport.ReceivePack} after all
* updates are executed.
* <p>
* The hook is called after all commands have been processed. Only commands with
* a status of {@link ReceiveCommand.Result#OK} are passed into the hook. To get
* all commands within the hook, see {@link ReceivePack#getAllCommands()}.
* a status of {@link org.eclipse.jgit.transport.ReceiveCommand.Result#OK} are
* passed into the hook. To get all commands within the hook, see
* {@link org.eclipse.jgit.transport.ReceivePack#getAllCommands()}.
* <p>
* Any post-receive hook implementation should not update the status of a
* command, as the command has already completed or failed, and the status has

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/PostReceiveHookChain.java View File

@@ -47,7 +47,8 @@ import java.util.Collection;
import java.util.List;

/**
* {@link PostReceiveHook} that delegates to a list of other hooks.
* {@link org.eclipse.jgit.transport.PostReceiveHook} that delegates to a list
* of other hooks.
* <p>
* Hooks are run in the order passed to the constructor.
*/
@@ -77,6 +78,7 @@ public class PostReceiveHookChain implements PostReceiveHook {
return new PostReceiveHookChain(newHooks, i);
}

/** {@inheritDoc} */
@Override
public void onPostReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {

+ 5
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/PostUploadHook.java View File

@@ -42,11 +42,11 @@

package org.eclipse.jgit.transport;

import org.eclipse.jgit.internal.storage.pack.PackWriter;
import org.eclipse.jgit.storage.pack.PackStatistics;

/**
* Hook invoked by {@link UploadPack} after the pack has been uploaded.
* Hook invoked by {@link org.eclipse.jgit.transport.UploadPack} after the pack
* has been uploaded.
* <p>
* Implementors of the interface are responsible for associating the current
* thread to a particular connection, if they need to also include connection
@@ -68,8 +68,9 @@ public interface PostUploadHook {
* Notifies the hook that a pack has been sent.
*
* @param stats
* the statistics gathered by {@link PackWriter} for the uploaded
* pack
* the statistics gathered by
* {@link org.eclipse.jgit.internal.storage.pack.PackWriter} for
* the uploaded pack
*/
public void onPostUpload(PackStatistics stats);
}

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/PostUploadHookChain.java View File

@@ -47,7 +47,8 @@ import java.util.List;
import org.eclipse.jgit.storage.pack.PackStatistics;

/**
* {@link PostUploadHook} that delegates to a list of other hooks.
* {@link org.eclipse.jgit.transport.PostUploadHook} that delegates to a list of
* other hooks.
* <p>
* Hooks are run in the order passed to the constructor.
*
@@ -78,6 +79,7 @@ public class PostUploadHookChain implements PostUploadHook {
return new PostUploadHookChain(newHooks, i);
}

/** {@inheritDoc} */
@Override
public void onPostUpload(PackStatistics stats) {
for (int i = 0; i < count; i++)

+ 9
- 7
org.eclipse.jgit/src/org/eclipse/jgit/transport/PreReceiveHook.java View File

@@ -46,7 +46,8 @@ package org.eclipse.jgit.transport;
import java.util.Collection;

/**
* Hook invoked by {@link ReceivePack} before any updates are executed.
* Hook invoked by {@link org.eclipse.jgit.transport.ReceivePack} before any
* updates are executed.
* <p>
* The hook is called with any commands that are deemed valid after parsing them
* from the client and applying the standard receive configuration options to
@@ -57,23 +58,24 @@ import java.util.Collection;
* </ul>
* This means the hook will not receive a non-fast-forward update command if
* denyNonFastForwards is set to true in the configuration file. To get all
* commands within the hook, see {@link ReceivePack#getAllCommands()}.
* commands within the hook, see
* {@link org.eclipse.jgit.transport.ReceivePack#getAllCommands()}.
* <p>
* As the hook is invoked prior to the commands being executed, the hook may
* choose to block any command by setting its result status with
* {@link ReceiveCommand#setResult(ReceiveCommand.Result)}.
* {@link org.eclipse.jgit.transport.ReceiveCommand#setResult(ReceiveCommand.Result)}.
* <p>
* The hook may also choose to perform the command itself (or merely pretend
* that it has performed the command), by setting the result status to
* {@link ReceiveCommand.Result#OK}.
* {@link org.eclipse.jgit.transport.ReceiveCommand.Result#OK}.
* <p>
* Hooks should run quickly, as they block the caller thread and the client
* process from completing.
* <p>
* Hooks may send optional messages back to the client via methods on
* {@link ReceivePack}. Implementors should be aware that not all network
* transports support this output, so some (or all) messages may simply be
* discarded. These messages should be advisory only.
* {@link org.eclipse.jgit.transport.ReceivePack}. Implementors should be aware
* that not all network transports support this output, so some (or all)
* messages may simply be discarded. These messages should be advisory only.
*/
public interface PreReceiveHook {
/** A simple no-op hook. */

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/PreReceiveHookChain.java View File

@@ -47,7 +47,8 @@ import java.util.Collection;
import java.util.List;

/**
* {@link PreReceiveHook} that delegates to a list of other hooks.
* {@link org.eclipse.jgit.transport.PreReceiveHook} that delegates to a list of
* other hooks.
* <p>
* Hooks are run in the order passed to the constructor.
*/
@@ -76,6 +77,7 @@ public class PreReceiveHookChain implements PreReceiveHook {
return new PreReceiveHookChain(newHooks, i);
}

/** {@inheritDoc} */
@Override
public void onPreReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {

+ 7
- 5
org.eclipse.jgit/src/org/eclipse/jgit/transport/PreUploadHook.java View File

@@ -48,9 +48,11 @@ import java.util.Collection;
import org.eclipse.jgit.lib.ObjectId;

/**
* Hook invoked by {@link UploadPack} before during critical phases.
* Hook invoked by {@link org.eclipse.jgit.transport.UploadPack} before during
* critical phases.
* <p>
* If any hook function throws {@link ServiceMayNotContinueException} then
* If any hook function throws
* {@link org.eclipse.jgit.transport.ServiceMayNotContinueException} then
* processing stops immediately and the exception is thrown up the call stack.
* Most phases of UploadPack will try to report the exception's message text to
* the end-user over the client's protocol connection.
@@ -91,7 +93,7 @@ public interface PreUploadHook {
* the list of wanted objects.
* @param cntOffered
* number of objects the client has offered.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
public void onBeginNegotiateRound(UploadPack up,
@@ -115,7 +117,7 @@ public interface PreUploadHook {
* @param ready
* true if a pack is ready to be sent (the commit graph was
* successfully cut).
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
public void onEndNegotiateRound(UploadPack up,
@@ -136,7 +138,7 @@ public interface PreUploadHook {
* the list of common objects. Empty on an initial clone request.
* These may be RevObject or RevCommit if the processed parsed
* them. Implementors should not rely on the values being parsed.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
*/
public void onSendPack(UploadPack up, Collection<? extends ObjectId> wants,

+ 5
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/PreUploadHookChain.java View File

@@ -49,7 +49,8 @@ import java.util.List;
import org.eclipse.jgit.lib.ObjectId;

/**
* {@link PreUploadHook} that delegates to a list of other hooks.
* {@link org.eclipse.jgit.transport.PreUploadHook} that delegates to a list of
* other hooks.
* <p>
* Hooks are run in the order passed to the constructor. If running a method on
* one hook throws an exception, execution of remaining hook methods is aborted.
@@ -79,6 +80,7 @@ public class PreUploadHookChain implements PreUploadHook {
return new PreUploadHookChain(newHooks, i);
}

/** {@inheritDoc} */
@Override
public void onBeginNegotiateRound(UploadPack up,
Collection<? extends ObjectId> wants, int cntOffered)
@@ -87,6 +89,7 @@ public class PreUploadHookChain implements PreUploadHook {
hooks[i].onBeginNegotiateRound(up, wants, cntOffered);
}

/** {@inheritDoc} */
@Override
public void onEndNegotiateRound(UploadPack up,
Collection<? extends ObjectId> wants, int cntCommon,
@@ -96,6 +99,7 @@ public class PreUploadHookChain implements PreUploadHook {
hooks[i].onEndNegotiateRound(up, wants, cntCommon, cntNotFound, ready);
}

/** {@inheritDoc} */
@Override
public void onSendPack(UploadPack up,
Collection<? extends ObjectId> wants,

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java View File

@@ -104,7 +104,9 @@ public class ProgressSpinner {
}
}

/** Update the spinner if it is showing. */
/**
* Update the spinner if it is showing.
*/
public void update() {
long now = System.currentTimeMillis();
if (now >= nextUpdateMillis) {

+ 28
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java View File

@@ -132,6 +132,8 @@ public class PushCertificate {
}

/**
* Get the certificate version string.
*
* @return the certificate version string.
* @since 4.1
*/
@@ -140,6 +142,8 @@ public class PushCertificate {
}

/**
* Get the raw line that signed the cert, as a string.
*
* @return the raw line that signed the cert, as a string.
* @since 4.0
*/
@@ -148,6 +152,8 @@ public class PushCertificate {
}

/**
* Get identity of the pusher who signed the cert.
*
* @return identity of the pusher who signed the cert.
* @since 4.1
*/
@@ -156,6 +162,8 @@ public class PushCertificate {
}

/**
* Get URL of the repository the push was originally sent to.
*
* @return URL of the repository the push was originally sent to.
* @since 4.0
*/
@@ -164,6 +172,8 @@ public class PushCertificate {
}

/**
* Get the raw nonce value that was presented by the pusher.
*
* @return the raw nonce value that was presented by the pusher.
* @since 4.1
*/
@@ -172,6 +182,8 @@ public class PushCertificate {
}

/**
* Get verification status of the nonce embedded in the certificate.
*
* @return verification status of the nonce embedded in the certificate.
* @since 4.0
*/
@@ -180,6 +192,9 @@ public class PushCertificate {
}

/**
* Get the list of commands as one string to be feed into the signature
* verifier.
*
* @return the list of commands as one string to be feed into the signature
* verifier.
* @since 4.1
@@ -189,9 +204,11 @@ public class PushCertificate {
}

/**
* Get the raw signature
*
* @return the raw signature, consisting of the lines received between the
* lines {@code "----BEGIN GPG SIGNATURE-----\n"} and
* {@code "----END GPG SIGNATURE-----\n}", inclusive.
* lines {@code "----BEGIN GPG SIGNATURE-----\n"} and
* {@code "----END GPG SIGNATURE-----\n}", inclusive.
* @since 4.0
*/
public String getSignature() {
@@ -199,6 +216,8 @@ public class PushCertificate {
}

/**
* Get text payload of the certificate for the signature verifier.
*
* @return text payload of the certificate for the signature verifier.
* @since 4.1
*/
@@ -207,8 +226,11 @@ public class PushCertificate {
}

/**
* Get original text payload plus signature
*
* @return original text payload plus signature; the final output will be
* valid as input to {@link PushCertificateParser#fromString(String)}.
* valid as input to
* {@link org.eclipse.jgit.transport.PushCertificateParser#fromString(String)}.
* @since 4.1
*/
public String toTextWithSignature() {
@@ -233,11 +255,13 @@ public class PushCertificate {
return sb;
}

/** {@inheritDoc} */
@Override
public int hashCode() {
return signature.hashCode();
}

/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
if (!(o instanceof PushCertificate)) {
@@ -268,6 +292,7 @@ public class PushCertificate {
return true;
}

/** {@inheritDoc} */
@Override
public String toString() {
return getClass().getSimpleName() + '['

+ 43
- 22
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java View File

@@ -58,18 +58,19 @@ import org.eclipse.jgit.util.RawParseUtils;
/**
* Identity in a push certificate.
* <p>
* This is similar to a {@link PersonIdent} in that it contains a name,
* timestamp, and timezone offset, but differs in the following ways:
* This is similar to a {@link org.eclipse.jgit.lib.PersonIdent} in that it
* contains a name, timestamp, and timezone offset, but differs in the following
* ways:
* <ul>
* <li>It is always parsed from a UTF-8 string, rather than a raw commit
* buffer.</li>
* buffer.</li>
* <li>It is not guaranteed to contain a name and email portion, since any UTF-8
* string is a valid OpenPGP User ID (RFC4880 5.1.1). The raw User ID is
* always available as {@link #getUserId()}, but {@link #getEmailAddress()}
* may return null.</li>
* <li>The raw text from which the identity was parsed is available with {@link
* #getRaw()}. This is necessary for losslessly reconstructing the signed push
* certificate payload.</li>
* string is a valid OpenPGP User ID (RFC4880 5.1.1). The raw User ID is always
* available as {@link #getUserId()}, but {@link #getEmailAddress()} may return
* null.</li>
* <li>The raw text from which the identity was parsed is available with
* {@link #getRaw()}. This is necessary for losslessly reconstructing the signed
* push certificate payload.</li>
* <li>
* </ul>
*
@@ -79,18 +80,18 @@ public class PushCertificateIdent {
/**
* Parse an identity from a string.
* <p>
* Spaces are trimmed when parsing the timestamp and timezone offset, with one
* exception. The timestamp must be preceded by a single space, and the rest
* of the string prior to that space (including any additional whitespace) is
* treated as the OpenPGP User ID.
* Spaces are trimmed when parsing the timestamp and timezone offset, with
* one exception. The timestamp must be preceded by a single space, and the
* rest of the string prior to that space (including any additional
* whitespace) is treated as the OpenPGP User ID.
* <p>
* If either the timestamp or timezone offsets are missing, mimics {@link
* RawParseUtils#parsePersonIdent(String)} behavior and sets them both to
* zero.
* If either the timestamp or timezone offsets are missing, mimics
* {@link RawParseUtils#parsePersonIdent(String)} behavior and sets them
* both to zero.
*
* @param str
* string to parse.
* @return identity, never null.
* @return a {@link org.eclipse.jgit.transport.PushCertificateIdent} object.
*/
public static PushCertificateIdent parse(String str) {
MutableInteger p = new MutableInteger();
@@ -181,15 +182,21 @@ public class PushCertificateIdent {
return raw;
}

/** @return the OpenPGP User ID, which may be any string. */
/**
* Get the OpenPGP User ID, which may be any string.
*
* @return the OpenPGP User ID, which may be any string.
*/
public String getUserId() {
return userId;
}

/**
* Get the name portion of the User ID.
*
* @return the name portion of the User ID. If no email address would be
* parsed by {@link #getEmailAddress()}, returns the full User ID with
* spaces trimmed.
* parsed by {@link #getEmailAddress()}, returns the full User ID
* with spaces trimmed.
*/
public String getName() {
int nameEnd = userId.indexOf('<');
@@ -208,6 +215,8 @@ public class PushCertificateIdent {
}

/**
* Get the email portion of the User ID
*
* @return the email portion of the User ID, if one was successfully parsed
* from {@link #getUserId()}, or null.
*/
@@ -223,19 +232,28 @@ public class PushCertificateIdent {
return userId.substring(emailBegin + 1, emailEnd);
}

/** @return the timestamp of the identity. */
/**
* Get the timestamp of the identity.
*
* @return the timestamp of the identity.
*/
public Date getWhen() {
return new Date(when);
}

/**
* @return this person's declared time zone; null if the timezone is unknown.
* Get this person's declared time zone
*
* @return this person's declared time zone; null if the timezone is
* unknown.
*/
public TimeZone getTimeZone() {
return PersonIdent.getTimeZone(tzOffset);
}

/**
* Get this person's declared time zone as minutes east of UTC.
*
* @return this person's declared time zone as minutes east of UTC. If the
* timezone is to the west of UTC it is negative.
*/
@@ -243,17 +261,20 @@ public class PushCertificateIdent {
return tzOffset;
}

/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
return (o instanceof PushCertificateIdent)
&& raw.equals(((PushCertificateIdent) o).raw);
}

/** {@inheritDoc} */
@Override
public int hashCode() {
return raw.hashCode();
}

/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

+ 25
- 13
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateParser.java View File

@@ -133,11 +133,12 @@ public class PushCertificateParser {
/**
* Parse a push certificate from a reader.
* <p>
* Differences from the {@link PacketLineIn} receiver methods:
* Differences from the {@link org.eclipse.jgit.transport.PacketLineIn}
* receiver methods:
* <ul>
* <li>Does not use pkt-line framing.</li>
* <li>Reads an entire cert in one call rather than depending on a loop in
* the caller.</li>
* the caller.</li>
* <li>Does not assume a {@code "push-cert-end"} line.</li>
* </ul>
*
@@ -145,9 +146,9 @@ public class PushCertificateParser {
* input reader; consumed only up until the end of the next
* signature in the input.
* @return the parsed certificate, or null if the reader was at EOF.
* @throws PackProtocolException
* @throws org.eclipse.jgit.errors.PackProtocolException
* if the certificate is malformed.
* @throws IOException
* @throws java.io.IOException
* if there was an error reading from the input.
* @since 4.1
*/
@@ -163,9 +164,9 @@ public class PushCertificateParser {
* @param str
* input string.
* @return the parsed certificate.
* @throws PackProtocolException
* @throws org.eclipse.jgit.errors.PackProtocolException
* if the certificate is malformed.
* @throws IOException
* @throws java.io.IOException
* if there was an error reading from the input.
* @since 4.1
*/
@@ -207,6 +208,8 @@ public class PushCertificateParser {
private final List<ReceiveCommand> commands = new ArrayList<>();

/**
* <p>Constructor for PushCertificateParser.</p>
*
* @param into
* destination repository for the push.
* @param cfg
@@ -240,9 +243,9 @@ public class PushCertificateParser {
* input reader; consumed only up until the end of the next
* signature in the input.
* @return the parsed certificate, or null if the reader was at EOF.
* @throws PackProtocolException
* @throws org.eclipse.jgit.errors.PackProtocolException
* if the certificate is malformed.
* @throws IOException
* @throws java.io.IOException
* if there was an error reading from the input.
* @since 4.1
*/
@@ -267,8 +270,11 @@ public class PushCertificateParser {
}

/**
* @return the parsed certificate, or null if push certificates are disabled.
* @throws IOException
* Build the parsed certificate
*
* @return the parsed certificate, or null if push certificates are
* disabled.
* @throws java.io.IOException
* if the push certificate has missing or invalid fields.
* @since 4.1
*/
@@ -285,6 +291,9 @@ public class PushCertificateParser {
}

/**
* Whether the repository is configured to use signed pushes in this
* context.
*
* @return if the repository is configured to use signed pushes in this
* context.
* @since 4.0
@@ -294,6 +303,9 @@ public class PushCertificateParser {
}

/**
* Get the whole string for the nonce to be included into the capability
* advertisement
*
* @return the whole string for the nonce to be included into the capability
* advertisement, or null if push certificates are disabled.
* @since 4.0
@@ -348,7 +360,7 @@ public class PushCertificateParser {
* {@code NonceGenerator} will allow for some time skew caused by
* clients disconnected and reconnecting in the stateless smart
* HTTP protocol.
* @throws IOException
* @throws java.io.IOException
* if the certificate from the client is badly malformed or the
* client disconnects before sending the entire certificate.
* @since 4.0
@@ -410,7 +422,7 @@ public class PushCertificateParser {
*
* @param pckIn
* where we read the signature from.
* @throws IOException
* @throws java.io.IOException
* if the signature is invalid.
* @since 4.0
*/
@@ -455,7 +467,7 @@ public class PushCertificateParser {
* @param line
* the line read from the wire that produced this
* command, with optional trailing newline already trimmed.
* @throws PackProtocolException
* @throws org.eclipse.jgit.errors.PackProtocolException
* if the raw line cannot be parsed to a command.
* @since 4.0
*/

+ 32
- 29
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java View File

@@ -135,10 +135,12 @@ public class PushCertificateStore implements AutoCloseable {
}

/**
* {@inheritDoc}
* <p>
* Close resources opened by this store.
* <p>
* If {@link #get(String)} was called, closes the cached object reader created
* by that method. Does not close the underlying repository.
* If {@link #get(String)} was called, closes the cached object reader
* created by that method. Does not close the underlying repository.
*/
@Override
public void close() {
@@ -160,7 +162,7 @@ public class PushCertificateStore implements AutoCloseable {
* the ref name to get the certificate for.
* @return last certificate affecting the ref, or null if no cert was recorded
* for the last update to this ref.
* @throws IOException
* @throws java.io.IOException
* if a problem occurred reading the repository.
*/
public PushCertificate get(String refName) throws IOException {
@@ -298,20 +300,20 @@ public class PushCertificateStore implements AutoCloseable {
/**
* Put a certificate to be saved to the store.
* <p>
* Writes the contents of this certificate for each ref mentioned. It is up to
* the caller to ensure this certificate accurately represents the state of
* the ref.
* Writes the contents of this certificate for each ref mentioned. It is up
* to the caller to ensure this certificate accurately represents the state
* of the ref.
* <p>
* Pending certificates added to this method are not returned by {@link
* #get(String)} and {@link #getAll(String)} until after calling {@link
* #save()}.
* Pending certificates added to this method are not returned by
* {@link #get(String)} and {@link #getAll(String)} until after calling
* {@link #save()}.
*
* @param cert
* certificate to store.
* @param ident
* identity for the commit that stores this certificate. Pending
* certificates are sorted by identity timestamp during {@link
* #save()}.
* certificates are sorted by identity timestamp during
* {@link #save()}.
*/
public void put(PushCertificate cert, PersonIdent ident) {
put(cert, ident, null);
@@ -325,16 +327,16 @@ public class PushCertificateStore implements AutoCloseable {
* list that exactly matches the old/new values mentioned in the push
* certificate.
* <p>
* Pending certificates added to this method are not returned by {@link
* #get(String)} and {@link #getAll(String)} until after calling {@link
* #save()}.
* Pending certificates added to this method are not returned by
* {@link #get(String)} and {@link #getAll(String)} until after calling
* {@link #save()}.
*
* @param cert
* certificate to store.
* @param ident
* identity for the commit that stores this certificate. Pending
* certificates are sorted by identity timestamp during {@link
* #save()}.
* certificates are sorted by identity timestamp during
* {@link #save()}.
* @param matching
* only store certs for the refs listed in this list whose values
* match the commands in the cert.
@@ -347,15 +349,15 @@ public class PushCertificateStore implements AutoCloseable {
/**
* Save pending certificates to the store.
* <p>
* One commit is created per certificate added with {@link
* #put(PushCertificate, PersonIdent)}, in order of identity timestamps, and
* a single ref update is performed.
* One commit is created per certificate added with
* {@link #put(PushCertificate, PersonIdent)}, in order of identity
* timestamps, and a single ref update is performed.
* <p>
* The pending list is cleared if and only the ref update fails, which allows
* for easy retries in case of lock failure.
* The pending list is cleared if and only the ref update fails, which
* allows for easy retries in case of lock failure.
*
* @return the result of attempting to update the ref.
* @throws IOException
* @throws java.io.IOException
* if there was an error reading from or writing to the
* repository.
*/
@@ -384,18 +386,19 @@ public class PushCertificateStore implements AutoCloseable {
/**
* Save pending certificates to the store in an existing batch ref update.
* <p>
* One commit is created per certificate added with {@link
* #put(PushCertificate, PersonIdent)}, in order of identity timestamps, all
* commits are flushed, and a single command is added to the batch.
* One commit is created per certificate added with
* {@link #put(PushCertificate, PersonIdent)}, in order of identity
* timestamps, all commits are flushed, and a single command is added to the
* batch.
* <p>
* The cached ref value and pending list are <em>not</em> cleared. If the ref
* update succeeds, the caller is responsible for calling {@link #close()}
* and/or {@link #clear()}.
* The cached ref value and pending list are <em>not</em> cleared. If the
* ref update succeeds, the caller is responsible for calling
* {@link #close()} and/or {@link #clear()}.
*
* @param batch
* update to save to.
* @return whether a command was added to the batch.
* @throws IOException
* @throws java.io.IOException
* if there was an error reading from or writing to the
* repository.
*/

+ 29
- 20
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushConnection.java View File

@@ -49,7 +49,6 @@ import java.util.Map;

import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.transport.RemoteRefUpdate.Status;

/**
* Lists known refs from the remote and sends objects to the remote.
@@ -60,9 +59,9 @@ import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
* into the remote repository, as well as a way to modify the refs stored by the
* remote repository.
* <p>
* Instances of a PushConnection must be created by a {@link Transport} that
* implements a specific object transfer protocol that both sides of the
* connection understand.
* Instances of a PushConnection must be created by a
* {@link org.eclipse.jgit.transport.Transport} that implements a specific
* object transfer protocol that both sides of the connection understand.
* <p>
* PushConnection instances are not thread safe and may be accessed by only one
* thread at a time.
@@ -79,13 +78,14 @@ public interface PushConnection extends Connection {
* <p>
* <p>
* Only one call per connection is allowed. Subsequent calls will result in
* {@link TransportException}.
* {@link org.eclipse.jgit.errors.TransportException}.
* </p>
* <p>
* Implementation may use local repository to send a minimum set of objects
* needed by remote repository in efficient way.
* {@link Transport#isPushThin()} should be honored if applicable.
* refUpdates should be filled with information about status of each update.
* {@link org.eclipse.jgit.transport.Transport#isPushThin()} should be
* honored if applicable. refUpdates should be filled with information about
* status of each update.
* </p>
*
* @param monitor
@@ -97,12 +97,16 @@ public interface PushConnection extends Connection {
* map of remote refnames to remote refs update
* specifications/statuses. Can't be empty. This indicate what
* refs caller want to update on remote side. Only refs updates
* with {@link Status#NOT_ATTEMPTED} should passed.
* Implementation must ensure that and appropriate status with
* optional message should be set during call. No refUpdate with
* {@link Status#AWAITING_REPORT} or {@link Status#NOT_ATTEMPTED}
* with
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* should passed. Implementation must ensure that and appropriate
* status with optional message should be set during call. No
* refUpdate with
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#AWAITING_REPORT}
* or
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* can be leaved by implementation after return from this call.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* objects could not be copied due to a network failure,
* critical protocol error, or error on remote side, or
* connection was already used for push - new connection must be
@@ -121,13 +125,14 @@ public interface PushConnection extends Connection {
* <p>
* <p>
* Only one call per connection is allowed. Subsequent calls will result in
* {@link TransportException}.
* {@link org.eclipse.jgit.errors.TransportException}.
* </p>
* <p>
* Implementation may use local repository to send a minimum set of objects
* needed by remote repository in efficient way.
* {@link Transport#isPushThin()} should be honored if applicable.
* refUpdates should be filled with information about status of each update.
* {@link org.eclipse.jgit.transport.Transport#isPushThin()} should be
* honored if applicable. refUpdates should be filled with information about
* status of each update.
* </p>
*
* @param monitor
@@ -139,14 +144,18 @@ public interface PushConnection extends Connection {
* map of remote refnames to remote refs update
* specifications/statuses. Can't be empty. This indicate what
* refs caller want to update on remote side. Only refs updates
* with {@link Status#NOT_ATTEMPTED} should passed.
* Implementation must ensure that and appropriate status with
* optional message should be set during call. No refUpdate with
* {@link Status#AWAITING_REPORT} or {@link Status#NOT_ATTEMPTED}
* with
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* should passed. Implementation must ensure that and appropriate
* status with optional message should be set during call. No
* refUpdate with
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#AWAITING_REPORT}
* or
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* can be leaved by implementation after return from this call.
* @param out
* output stream to write sideband messages to
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* objects could not be copied due to a network failure,
* critical protocol error, or error on remote side, or
* connection was already used for push - new connection must be

+ 2
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushResult.java View File

@@ -51,7 +51,8 @@ import java.util.Map;

/**
* Result of push operation to the remote repository. Holding information of
* {@link OperationResult} and remote refs updates status.
* {@link org.eclipse.jgit.transport.OperationResult} and remote refs updates
* status.
*
* @see Transport#push(org.eclipse.jgit.lib.ProgressMonitor, Collection)
*/

+ 68
- 22
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java View File

@@ -64,10 +64,11 @@ import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevWalk;

/**
* A command being processed by {@link BaseReceivePack}.
* A command being processed by
* {@link org.eclipse.jgit.transport.BaseReceivePack}.
* <p>
* This command instance roughly translates to the server side representation of
* the {@link RemoteRefUpdate} created by the client.
* the {@link org.eclipse.jgit.transport.RemoteRefUpdate} created by the client.
*/
public class ReceiveCommand {
/** Type of operation requested. */
@@ -176,8 +177,10 @@ public class ReceiveCommand {
/**
* Set unprocessed commands as failed due to transaction aborted.
* <p>
* If a command is still {@link Result#NOT_ATTEMPTED} it will be set to
* {@link Result#REJECTED_OTHER_REASON}.
* If a command is still
* {@link org.eclipse.jgit.transport.ReceiveCommand.Result#NOT_ATTEMPTED} it
* will be set to
* {@link org.eclipse.jgit.transport.ReceiveCommand.Result#REJECTED_OTHER_REASON}.
*
* @param commands
* commands to mark as failed.
@@ -286,14 +289,17 @@ public class ReceiveCommand {
private Boolean forceRefLog;

/**
* Create a new command for {@link BaseReceivePack}.
* Create a new command for
* {@link org.eclipse.jgit.transport.BaseReceivePack}.
*
* @param oldId
* the expected old object id; must not be null. Use
* {@link ObjectId#zeroId()} to indicate a ref creation.
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to indicate a
* ref creation.
* @param newId
* the new object id; must not be null. Use
* {@link ObjectId#zeroId()} to indicate a ref deletion.
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to indicate a
* ref deletion.
* @param name
* name of the ref being affected.
*/
@@ -327,20 +333,26 @@ public class ReceiveCommand {
}

/**
* Create a new command for {@link BaseReceivePack}.
* Create a new command for
* {@link org.eclipse.jgit.transport.BaseReceivePack}.
*
* @param oldId
* the old object id; must not be null. Use
* {@link ObjectId#zeroId()} to indicate a ref creation.
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to indicate a
* ref creation.
* @param newId
* the new object id; must not be null. Use
* {@link ObjectId#zeroId()} to indicate a ref deletion.
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to indicate a
* ref deletion.
* @param name
* name of the ref being affected.
* @param type
* type of the command. Must be {@link Type#CREATE} if {@code
* oldId} is zero, or {@link Type#DELETE} if {@code newId} is
* zero.
* type of the command. Must be
* {@link org.eclipse.jgit.transport.ReceiveCommand.Type#CREATE}
* if {@code
* oldId} is zero, or
* {@link org.eclipse.jgit.transport.ReceiveCommand.Type#DELETE}
* if {@code newId} is zero.
* @since 2.0
*/
public ReceiveCommand(final ObjectId oldId, final ObjectId newId,
@@ -500,12 +512,18 @@ public class ReceiveCommand {
typeIsCorrect = true;
}

/** @return the old value the client thinks the ref has. */
/**
* Get the old value the client thinks the ref has.
*
* @return the old value the client thinks the ref has.
*/
public ObjectId getOldId() {
return oldId;
}

/**
* Get expected old target for a symbolic reference.
*
* @return expected old target for a symbolic reference.
* @since 4.10
*/
@@ -514,12 +532,18 @@ public class ReceiveCommand {
return oldSymref;
}

/** @return the requested new value for this ref. */
/**
* Get the requested new value for this ref.
*
* @return the requested new value for this ref.
*/
public ObjectId getNewId() {
return newId;
}

/**
* Get requested new target for a symbolic reference.
*
* @return requested new target for a symbolic reference.
* @since 4.10
*/
@@ -528,27 +552,47 @@ public class ReceiveCommand {
return newSymref;
}

/** @return the name of the ref being updated. */
/**
* Get the name of the ref being updated.
*
* @return the name of the ref being updated.
*/
public String getRefName() {
return name;
}

/** @return the type of this command; see {@link Type}. */
/**
* Get the type of this command; see {@link Type}.
*
* @return the type of this command; see {@link Type}.
*/
public Type getType() {
return type;
}

/** @return the ref, if this was advertised by the connection. */
/**
* Get the ref, if this was advertised by the connection.
*
* @return the ref, if this was advertised by the connection.
*/
public Ref getRef() {
return ref;
}

/** @return the current status code of this command. */
/**
* Get the current status code of this command.
*
* @return the current status code of this command.
*/
public Result getResult() {
return status;
}

/** @return the message associated with a failure status. */
/**
* Get the message associated with a failure status.
*
* @return the message associated with a failure status.
*/
public String getMessage() {
return message;
}
@@ -692,12 +736,13 @@ public class ReceiveCommand {
* If the command's current type is UPDATE, a merge test will be performed
* using the supplied RevWalk to determine if {@link #getOldId()} is fully
* merged into {@link #getNewId()}. If some commits are not merged the
* update type is changed to {@link Type#UPDATE_NONFASTFORWARD}.
* update type is changed to
* {@link org.eclipse.jgit.transport.ReceiveCommand.Type#UPDATE_NONFASTFORWARD}.
*
* @param walk
* an instance to perform the merge test with. The caller must
* allocate and release this object.
* @throws IOException
* @throws java.io.IOException
* either oldId or newId is not accessible in the repository
* used by the RevWalk. This usually indicates data corruption,
* and the command cannot be processed.
@@ -837,6 +882,7 @@ public class ReceiveCommand {
JGitText.get().lockError, err.getMessage()));
}

/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

+ 22
- 7
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java View File

@@ -130,7 +130,11 @@ public class ReceivePack extends BaseReceivePack {
pushOptions = options;
}

/** @return the hook invoked before updates occur. */
/**
* Get the hook invoked before updates occur.
*
* @return the hook invoked before updates occur.
*/
public PreReceiveHook getPreReceiveHook() {
return preReceive;
}
@@ -141,7 +145,8 @@ public class ReceivePack extends BaseReceivePack {
* Only valid commands (those which have no obvious errors according to the
* received input and this instance's configuration) are passed into the
* hook. The hook may mark a command with a result of any value other than
* {@link Result#NOT_ATTEMPTED} to block its execution.
* {@link org.eclipse.jgit.transport.ReceiveCommand.Result#NOT_ATTEMPTED} to
* block its execution.
* <p>
* The hook may be called with an empty command collection if the current
* set is completely invalid.
@@ -153,7 +158,11 @@ public class ReceivePack extends BaseReceivePack {
preReceive = h != null ? h : PreReceiveHook.NULL;
}

/** @return the hook invoked after updates occur. */
/**
* Get the hook invoked after updates occur.
*
* @return the hook invoked after updates occur.
*/
public PostReceiveHook getPostReceiveHook() {
return postReceive;
}
@@ -161,9 +170,10 @@ public class ReceivePack extends BaseReceivePack {
/**
* Set the hook which is invoked after commands are executed.
* <p>
* Only successful commands (type is {@link Result#OK}) are passed into the
* hook. The hook may be called with an empty command collection if the
* current set all resulted in an error.
* Only successful commands (type is
* {@link org.eclipse.jgit.transport.ReceiveCommand.Result#OK}) are passed
* into the hook. The hook may be called with an empty command collection if
* the current set all resulted in an error.
*
* @param h
* the hook instance; may be null to disable the hook.
@@ -173,6 +183,9 @@ public class ReceivePack extends BaseReceivePack {
}

/**
* Set whether this class will report command failures as warning messages
* before sending the command results.
*
* @param echo
* if true this class will report command failures as warning
* messages before sending the command results. This is usually
@@ -199,7 +212,7 @@ public class ReceivePack extends BaseReceivePack {
* through. When run over SSH this should be tied back to the
* standard error channel of the command execution. For most
* other network connections this should be null.
* @throws IOException
* @throws java.io.IOException
*/
public void receive(final InputStream input, final OutputStream output,
final OutputStream messages) throws IOException {
@@ -215,6 +228,7 @@ public class ReceivePack extends BaseReceivePack {
}
}

/** {@inheritDoc} */
@Override
protected void enableCapabilities() {
reportStatus = isCapabilityEnabled(CAPABILITY_REPORT_STATUS);
@@ -325,6 +339,7 @@ public class ReceivePack extends BaseReceivePack {
repo.autoGC(NullProgressMonitor.INSTANCE);
}

/** {@inheritDoc} */
@Override
protected String getLockMessageProcessName() {
return "jgit receive-pack"; //$NON-NLS-1$

+ 56
- 12
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivedPackStatistics.java View File

@@ -46,7 +46,7 @@ package org.eclipse.jgit.transport;
import org.eclipse.jgit.lib.Constants;

/**
* Statistics about {@link PackParser}.
* Statistics about {@link org.eclipse.jgit.transport.PackParser}.
*
* @since 4.6
*/
@@ -65,57 +65,101 @@ public class ReceivedPackStatistics {
private long numDeltaBlob;
private long numDeltaTag;

/** @return number of bytes read from the input stream */
/**
* Get number of bytes read from the input stream
*
* @return number of bytes read from the input stream
*/
public long getNumBytesRead() {
return numBytesRead;
}

/** @return number of whole commit objects in the pack */
/**
* Get number of whole commit objects in the pack
*
* @return number of whole commit objects in the pack
*/
public long getNumWholeCommit() {
return numWholeCommit;
}

/** @return number of whole tree objects in the pack */
/**
* Get number of whole tree objects in the pack
*
* @return number of whole tree objects in the pack
*/
public long getNumWholeTree() {
return numWholeTree;
}

/** @return number of whole blob objects in the pack */
/**
* Get number of whole blob objects in the pack
*
* @return number of whole blob objects in the pack
*/
public long getNumWholeBlob() {
return numWholeBlob;
}

/** @return number of whole tag objects in the pack */
/**
* Get number of whole tag objects in the pack
*
* @return number of whole tag objects in the pack
*/
public long getNumWholeTag() {
return numWholeTag;
}

/** @return number of offset delta objects in the pack */
/**
* Get number of offset delta objects in the pack
*
* @return number of offset delta objects in the pack
*/
public long getNumOfsDelta() {
return numOfsDelta;
}

/** @return number of ref delta objects in the pack */
/**
* Get number of ref delta objects in the pack
*
* @return number of ref delta objects in the pack
*/
public long getNumRefDelta() {
return numRefDelta;
}

/** @return number of delta commit objects in the pack */
/**
* Get number of delta commit objects in the pack
*
* @return number of delta commit objects in the pack
*/
public long getNumDeltaCommit() {
return numDeltaCommit;
}

/** @return number of delta tree objects in the pack */
/**
* Get number of delta tree objects in the pack
*
* @return number of delta tree objects in the pack
*/
public long getNumDeltaTree() {
return numDeltaTree;
}

/** @return number of delta blob objects in the pack */
/**
* Get number of delta blob objects in the pack
*
* @return number of delta blob objects in the pack
*/
public long getNumDeltaBlob() {
return numDeltaBlob;
}

/** @return number of delta tag objects in the pack */
/**
* Get number of delta tag objects in the pack
*
* @return number of delta tag objects in the pack
*/
public long getNumDeltaTag() {
return numDeltaTag;
}

+ 14
- 8
org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java View File

@@ -67,7 +67,10 @@ import org.eclipse.jgit.lib.RefComparator;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.RefMap;

/** Support for the start of {@link UploadPack} and {@link ReceivePack}. */
/**
* Support for the start of {@link org.eclipse.jgit.transport.UploadPack} and
* {@link org.eclipse.jgit.transport.ReceivePack}.
*/
public abstract class RefAdvertiser {
/** Advertiser which frames lines in a {@link PacketLineOut} format. */
public static class PacketLineOutRefAdvertiser extends RefAdvertiser {
@@ -247,7 +250,6 @@ public abstract class RefAdvertiser {
* The symbolic ref, e.g. "HEAD"
* @param to
* The real ref it points to, e.g. "refs/heads/master"
*
* @since 3.6
*/
public void addSymref(String from, String to) {
@@ -262,7 +264,7 @@ public abstract class RefAdvertiser {
* sorted before display if necessary, and therefore may appear
* in any order.
* @return set of ObjectIds that were advertised to the client.
* @throws IOException
* @throws java.io.IOException
* the underlying output stream failed to write out an
* advertisement record.
*/
@@ -305,7 +307,7 @@ public abstract class RefAdvertiser {
*
* @param id
* identity of the object that is assumed to exist.
* @throws IOException
* @throws java.io.IOException
* the underlying output stream failed to write out an
* advertisement record.
*/
@@ -313,7 +315,11 @@ public abstract class RefAdvertiser {
advertiseAnyOnce(id, ".have"); //$NON-NLS-1$
}

/** @return true if no advertisements have been sent yet. */
/**
* Whether no advertisements have been sent yet.
*
* @return true if no advertisements have been sent yet.
*/
public boolean isEmpty() {
return first;
}
@@ -341,7 +347,7 @@ public abstract class RefAdvertiser {
* @param refName
* name of the reference to advertise the object as, can be any
* string not including the NUL byte.
* @throws IOException
* @throws java.io.IOException
* the underlying output stream failed to write out an
* advertisement record.
*/
@@ -372,7 +378,7 @@ public abstract class RefAdvertiser {
* @param line
* the advertisement line to be written. The line always ends
* with LF. Never null or the empty string.
* @throws IOException
* @throws java.io.IOException
* the underlying output stream failed to write out an
* advertisement record.
*/
@@ -381,7 +387,7 @@ public abstract class RefAdvertiser {
/**
* Mark the end of the advertisements.
*
* @throws IOException
* @throws java.io.IOException
* the underlying output stream failed to write out an
* advertisement record.
*/

+ 6
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/RefFilter.java View File

@@ -50,14 +50,17 @@ import org.eclipse.jgit.lib.Ref;
/**
* Filters the list of refs that are advertised to the client.
* <p>
* The filter is called by {@link ReceivePack} and {@link UploadPack} to ensure
* that the refs are filtered before they are advertised to the client.
* The filter is called by {@link org.eclipse.jgit.transport.ReceivePack} and
* {@link org.eclipse.jgit.transport.UploadPack} to ensure that the refs are
* filtered before they are advertised to the client.
* <p>
* This can be used by applications to control visibility of certain refs based
* on a custom set of rules.
*/
public interface RefFilter {
/** The default filter, allows all refs to be shown. */
/**
* The default filter, allows all refs to be shown.
*/
public static final RefFilter DEFAULT = new RefFilter() {
@Override
public Map<String, Ref> filter (final Map<String, Ref> refs) {

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/RefLeaseSpec.java View File

@@ -47,6 +47,7 @@ import java.io.Serializable;

/**
* Describes the expected value for a ref being pushed.
*
* @since 4.7
*/
public class RefLeaseSpec implements Serializable {
@@ -59,6 +60,7 @@ public class RefLeaseSpec implements Serializable {
private final String expected;

/**
* <p>Constructor for RefLeaseSpec.</p>
*
* @param ref
* ref being pushed
@@ -89,6 +91,7 @@ public class RefLeaseSpec implements Serializable {
return expected;
}

/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder r = new StringBuilder();

+ 12
- 9
org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java View File

@@ -153,7 +153,7 @@ public class RefSpec implements Serializable {
* @param mode
* whether to allow a wildcard on one side without a wildcard on
* the other.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* the specification is invalid.
* @since 4.5
*/
@@ -219,7 +219,7 @@ public class RefSpec implements Serializable {
*
* @param spec
* string describing the specification.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* the specification is invalid.
*/
public RefSpec(final String spec) {
@@ -288,7 +288,7 @@ public class RefSpec implements Serializable {
* @param source
* new value for source in the returned instance.
* @return a new RefSpec with source as specified.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* There is already a destination configured, and the wildcard
* status of the existing destination disagrees with the
* wildcard status of the new source.
@@ -327,7 +327,7 @@ public class RefSpec implements Serializable {
* @param destination
* new value for destination in the returned instance.
* @return a new RefSpec with destination as specified.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* There is already a source configured, and the wildcard status
* of the existing source disagrees with the wildcard status of
* the new destination.
@@ -350,7 +350,7 @@ public class RefSpec implements Serializable {
* @param destination
* new value for destination in the returned instance.
* @return a new RefSpec with destination as specified.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* The wildcard status of the new source disagrees with the
* wildcard status of the new destination.
*/
@@ -421,7 +421,7 @@ public class RefSpec implements Serializable {
* @return a new specification expanded from provided ref name. Result
* specification is wildcard if and only if provided ref name is
* wildcard.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* when the RefSpec was constructed with wildcard mode that
* doesn't require matching wildcards.
*/
@@ -453,7 +453,7 @@ public class RefSpec implements Serializable {
* @return a new specification expanded from provided ref name. Result
* specification is wildcard if and only if provided ref name is
* wildcard.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* when the RefSpec was constructed with wildcard mode that
* doesn't require matching wildcards.
*/
@@ -473,7 +473,7 @@ public class RefSpec implements Serializable {
* @return a new specification expanded from provided ref name. Result
* specification is wildcard if and only if provided ref name is
* wildcard.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* when the RefSpec was constructed with wildcard mode that
* doesn't require matching wildcards.
*/
@@ -504,7 +504,7 @@ public class RefSpec implements Serializable {
* @return a new specification expanded from provided ref name. Result
* specification is wildcard if and only if provided ref name is
* wildcard.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* when the RefSpec was constructed with wildcard mode that
* doesn't require matching wildcards.
*/
@@ -556,6 +556,7 @@ public class RefSpec implements Serializable {
return true;
}

/** {@inheritDoc} */
@Override
public int hashCode() {
int hc = 0;
@@ -566,6 +567,7 @@ public class RefSpec implements Serializable {
return hc;
}

/** {@inheritDoc} */
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof RefSpec))
@@ -590,6 +592,7 @@ public class RefSpec implements Serializable {
return a.equals(b);
}

/** {@inheritDoc} */
@Override
public String toString() {
final StringBuilder r = new StringBuilder();

+ 10
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java View File

@@ -109,7 +109,7 @@ public class RemoteConfig implements Serializable {
* @return all remotes configurations existing in provided repository
* configuration. Returned configurations are ordered
* lexicographically by names.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
* one of the URIs within the remote's configuration is invalid.
*/
public static List<RemoteConfig> getAllRemoteConfigs(final Config rc)
@@ -157,7 +157,7 @@ public class RemoteConfig implements Serializable {
* The configuration must already be loaded into memory.
* @param remoteName
* subsection key indicating the name of this remote.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
* one of the URIs within the remote's configuration is invalid.
*/
public RemoteConfig(final Config rc, final String remoteName)
@@ -525,6 +525,9 @@ public class RemoteConfig implements Serializable {
}

/**
* Whether pushing to the remote automatically deletes remote refs which
* don't exist on the source side.
*
* @return true if pushing to the remote automatically deletes remote refs
* which don't exist on the source side.
*/
@@ -542,7 +545,11 @@ public class RemoteConfig implements Serializable {
mirror = m;
}

/** @return timeout (in seconds) before aborting an IO operation. */
/**
* Get timeout (in seconds) before aborting an IO operation.
*
* @return timeout (in seconds) before aborting an IO operation.
*/
public int getTimeout() {
return timeout;
}

+ 80
- 42
org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java View File

@@ -55,17 +55,18 @@ import org.eclipse.jgit.revwalk.RevWalk;

/**
* Represent request and status of a remote ref update. Specification is
* provided by client, while status is handled by {@link PushProcess} class,
* being read-only for client.
* provided by client, while status is handled by
* {@link org.eclipse.jgit.transport.PushProcess} class, being read-only for
* client.
* <p>
* Client can create instances of this class directly, basing on user
* specification and advertised refs ({@link Connection} or through
* {@link Transport} helper methods. Apply this specification on remote
* repository using
* {@link Transport#push(org.eclipse.jgit.lib.ProgressMonitor, java.util.Collection)}
* specification and advertised refs
* ({@link org.eclipse.jgit.transport.Connection} or through
* {@link org.eclipse.jgit.transport.Transport} helper methods. Apply this
* specification on remote repository using
* {@link org.eclipse.jgit.transport.Transport#push(org.eclipse.jgit.lib.ProgressMonitor, java.util.Collection)}
* method.
* </p>
*
*/
public class RemoteRefUpdate {
/**
@@ -149,16 +150,19 @@ public class RemoteRefUpdate {

/**
* Construct remote ref update request by providing an update specification.
* Object is created with default {@link Status#NOT_ATTEMPTED} status and no
* message.
* Object is created with default
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* status and no message.
*
* @param localDb
* local repository to push from.
* @param srcRef
* source revision - any string resolvable by
* {@link Repository#resolve(String)}. This resolves to the new
* object that the caller want remote ref to be after update. Use
* null or {@link ObjectId#zeroId()} string for delete request.
* {@link org.eclipse.jgit.lib.Repository#resolve(String)}. This
* resolves to the new object that the caller want remote ref to
* be after update. Use null or
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} string for
* delete request.
* @param remoteName
* full name of a remote ref to update, e.g. "refs/heads/master"
* (no wildcard, no short name).
@@ -176,13 +180,14 @@ public class RemoteRefUpdate {
* advertised by remote side before update; update will take
* place ONLY if remote side advertise exactly this expected id;
* null if caller doesn't care what object id remote side
* advertise. Use {@link ObjectId#zeroId()} when expecting no
* remote ref with this name.
* @throws IOException
* advertise. Use {@link org.eclipse.jgit.lib.ObjectId#zeroId()}
* when expecting no remote ref with this name.
* @throws java.io.IOException
* when I/O error occurred during creating
* {@link TrackingRefUpdate} for local tracking branch or srcRef
* can't be resolved to any object.
* @throws IllegalArgumentException
* {@link org.eclipse.jgit.transport.TrackingRefUpdate} for
* local tracking branch or srcRef can't be resolved to any
* object.
* @throws java.lang.IllegalArgumentException
* if some required parameter was null
*/
public RemoteRefUpdate(final Repository localDb, final String srcRef,
@@ -196,8 +201,9 @@ public class RemoteRefUpdate {

/**
* Construct remote ref update request by providing an update specification.
* Object is created with default {@link Status#NOT_ATTEMPTED} status and no
* message.
* Object is created with default
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* status and no message.
*
* @param localDb
* local repository to push from.
@@ -220,13 +226,14 @@ public class RemoteRefUpdate {
* advertised by remote side before update; update will take
* place ONLY if remote side advertise exactly this expected id;
* null if caller doesn't care what object id remote side
* advertise. Use {@link ObjectId#zeroId()} when expecting no
* remote ref with this name.
* @throws IOException
* advertise. Use {@link org.eclipse.jgit.lib.ObjectId#zeroId()}
* when expecting no remote ref with this name.
* @throws java.io.IOException
* when I/O error occurred during creating
* {@link TrackingRefUpdate} for local tracking branch or srcRef
* can't be resolved to any object.
* @throws IllegalArgumentException
* {@link org.eclipse.jgit.transport.TrackingRefUpdate} for
* local tracking branch or srcRef can't be resolved to any
* object.
* @throws java.lang.IllegalArgumentException
* if some required parameter was null
*/
public RemoteRefUpdate(final Repository localDb, final Ref srcRef,
@@ -240,8 +247,9 @@ public class RemoteRefUpdate {

/**
* Construct remote ref update request by providing an update specification.
* Object is created with default {@link Status#NOT_ATTEMPTED} status and no
* message.
* Object is created with default
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#NOT_ATTEMPTED}
* status and no message.
*
* @param localDb
* local repository to push from.
@@ -250,7 +258,8 @@ public class RemoteRefUpdate {
* be used instead.
* @param srcId
* The new object that the caller wants remote ref to be after
* update. Use null or {@link ObjectId#zeroId()} for delete
* update. Use null or
* {@link org.eclipse.jgit.lib.ObjectId#zeroId()} for delete
* request.
* @param remoteName
* full name of a remote ref to update, e.g. "refs/heads/master"
@@ -269,13 +278,14 @@ public class RemoteRefUpdate {
* advertised by remote side before update; update will take
* place ONLY if remote side advertise exactly this expected id;
* null if caller doesn't care what object id remote side
* advertise. Use {@link ObjectId#zeroId()} when expecting no
* remote ref with this name.
* @throws IOException
* advertise. Use {@link org.eclipse.jgit.lib.ObjectId#zeroId()}
* when expecting no remote ref with this name.
* @throws java.io.IOException
* when I/O error occurred during creating
* {@link TrackingRefUpdate} for local tracking branch or srcRef
* can't be resolved to any object.
* @throws IllegalArgumentException
* {@link org.eclipse.jgit.transport.TrackingRefUpdate} for
* local tracking branch or srcRef can't be resolved to any
* object.
* @throws java.lang.IllegalArgumentException
* if some required parameter was null
*/
public RemoteRefUpdate(final Repository localDb, final String srcRef,
@@ -333,10 +343,11 @@ public class RemoteRefUpdate {
* configuration base.
* @param newExpectedOldObjectId
* new expected object id value.
* @throws IOException
* @throws java.io.IOException
* when I/O error occurred during creating
* {@link TrackingRefUpdate} for local tracking branch or srcRef
* of base object no longer can be resolved to any object.
* {@link org.eclipse.jgit.transport.TrackingRefUpdate} for
* local tracking branch or srcRef of base object no longer can
* be resolved to any object.
*/
public RemoteRefUpdate(final RemoteRefUpdate base,
final ObjectId newExpectedOldObjectId) throws IOException {
@@ -346,6 +357,8 @@ public class RemoteRefUpdate {
}

/**
* Get expected old object id
*
* @return expectedOldObjectId required to be advertised by remote side, as
* set in constructor; may be null.
*/
@@ -354,6 +367,9 @@ public class RemoteRefUpdate {
}

/**
* Whether some object is required to be advertised by remote side, as set
* in constructor
*
* @return true if some object is required to be advertised by remote side,
* as set in constructor; false otherwise.
*/
@@ -362,6 +378,8 @@ public class RemoteRefUpdate {
}

/**
* Get new object id
*
* @return newObjectId for remote ref, as set in constructor.
*/
public ObjectId getNewObjectId() {
@@ -369,6 +387,8 @@ public class RemoteRefUpdate {
}

/**
* Whether this update is a deleting update
*
* @return true if this update is deleting update; false otherwise.
*/
public boolean isDelete() {
@@ -376,6 +396,8 @@ public class RemoteRefUpdate {
}

/**
* Get name of remote ref to update
*
* @return name of remote ref to update, as set in constructor.
*/
public String getRemoteName() {
@@ -383,6 +405,8 @@ public class RemoteRefUpdate {
}

/**
* Get tracking branch update if localName was set in constructor.
*
* @return local tracking branch update if localName was set in constructor.
*/
public TrackingRefUpdate getTrackingRefUpdate() {
@@ -390,9 +414,12 @@ public class RemoteRefUpdate {
}

/**
* Get source revision as specified by user (in constructor)
*
* @return source revision as specified by user (in constructor), could be
* any string parseable by {@link Repository#resolve(String)}; can
* be null if specified that way in constructor - this stands for
* any string parseable by
* {@link org.eclipse.jgit.lib.Repository#resolve(String)}; can be
* null if specified that way in constructor - this stands for
* delete request.
*/
public String getSrcRef() {
@@ -400,6 +427,8 @@ public class RemoteRefUpdate {
}

/**
* Whether user specified a local tracking branch for remote update
*
* @return true if user specified a local tracking branch for remote update;
* false otherwise.
*/
@@ -408,6 +437,8 @@ public class RemoteRefUpdate {
}

/**
* Whether this update is forced regardless of old remote ref object
*
* @return true if this update is forced regardless of old remote ref
* object; false otherwise.
*/
@@ -416,6 +447,8 @@ public class RemoteRefUpdate {
}

/**
* Get status of remote ref update operation.
*
* @return status of remote ref update operation.
*/
public Status getStatus() {
@@ -424,7 +457,8 @@ public class RemoteRefUpdate {

/**
* Check whether update was fast-forward. Note that this result is
* meaningful only after successful update (when status is {@link Status#OK}).
* meaningful only after successful update (when status is
* {@link org.eclipse.jgit.transport.RemoteRefUpdate.Status#OK}).
*
* @return true if update was fast-forward; false otherwise.
*/
@@ -433,6 +467,9 @@ public class RemoteRefUpdate {
}

/**
* Get message describing reasons of status when needed/possible; may be
* null.
*
* @return message describing reasons of status when needed/possible; may be
* null.
*/
@@ -461,7 +498,7 @@ public class RemoteRefUpdate {
*
* @param walk
* walker used for checking update properties.
* @throws IOException
* @throws java.io.IOException
* when I/O error occurred during update
*/
protected void updateTrackingRef(final RevWalk walk) throws IOException {
@@ -471,6 +508,7 @@ public class RemoteRefUpdate {
trackingRefUpdate.setResult(localUpdate.update(walk));
}

/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

+ 3
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteSession.java View File

@@ -65,17 +65,18 @@ public interface RemoteSession {
* Generate a new remote process to execute the given command. This function
* should also start execution and may need to create the streams prior to
* execution.
*
* @param commandName
* command to execute
* @param timeout
* timeout value, in seconds, for command execution
* @return a new remote process
* @throws IOException
* @throws java.io.IOException
* may be thrown in several cases. For example, on problems
* opening input or output streams or on problems connecting or
* communicating with the remote host. For the latter two cases,
* a TransportException may be thrown (a subclass of
* IOException).
* java.io.IOException).
*/
public Process exec(String commandName, int timeout) throws IOException;


+ 5
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/RequestNotYetReadException.java View File

@@ -51,12 +51,16 @@ package org.eclipse.jgit.transport;
public class RequestNotYetReadException extends IllegalStateException {
private static final long serialVersionUID = 1L;

/** Initialize with no message. */
/**
* Initialize with no message.
*/
public RequestNotYetReadException() {
// Do not set a message.
}

/**
* <p>Constructor for RequestNotYetReadException.</p>
*
* @param msg
* a message explaining the state. This message should not
* be shown to an end-user.

+ 21
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/ServiceMayNotContinueException.java View File

@@ -59,13 +59,17 @@ public class ServiceMayNotContinueException extends IOException {
private final int statusCode;
private boolean output;

/** Initialize with no message. */
/**
* Initialize with no message.
*/
public ServiceMayNotContinueException() {
// Do not set a message.
statusCode = FORBIDDEN;
}

/**
* <p>Constructor for ServiceMayNotContinueException.</p>
*
* @param msg
* a message explaining why it cannot continue. This message may
* be shown to an end-user.
@@ -76,6 +80,8 @@ public class ServiceMayNotContinueException extends IOException {
}

/**
* <p>Constructor for ServiceMayNotContinueException.</p>
*
* @param msg
* a message explaining why it cannot continue. This message may
* be shown to an end-user.
@@ -89,6 +95,8 @@ public class ServiceMayNotContinueException extends IOException {
}

/**
* <p>Constructor for ServiceMayNotContinueException.</p>
*
* @param msg
* a message explaining why it cannot continue. This message may
* be shown to an end-user.
@@ -102,6 +110,8 @@ public class ServiceMayNotContinueException extends IOException {
}

/**
* <p>Constructor for ServiceMayNotContinueException.</p>
*
* @param msg
* a message explaining why it cannot continue. This message may
* be shown to an end-user.
@@ -128,17 +138,25 @@ public class ServiceMayNotContinueException extends IOException {
this(JGitText.get().internalServerError, cause);
}

/** @return true if the message was already output to the client. */
/**
* Whether the message was already output to the client.
*
* @return {@code true} if the message was already output to the client.
*/
public boolean isOutput() {
return output;
}

/** Mark this message has being sent to the client. */
/**
* Mark this message has being sent to the client.
*/
public void setOutput() {
output = true;
}

/**
* Get status code
*
* @return true if the message was already output to the client.
* @since 4.5
*/

+ 2
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java View File

@@ -120,6 +120,7 @@ class SideBandInputStream extends InputStream {
out = outputStream;
}

/** {@inheritDoc} */
@Override
public int read() throws IOException {
needDataPacket();
@@ -129,6 +130,7 @@ class SideBandInputStream extends InputStream {
return rawIn.read();
}

/** {@inheritDoc} */
@Override
public int read(final byte[] b, int off, int len) throws IOException {
int r = 0;

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java View File

@@ -127,12 +127,14 @@ public class SideBandOutputStream extends OutputStream {
writeBuffer();
}

/** {@inheritDoc} */
@Override
public void flush() throws IOException {
flushBuffer();
out.flush();
}

/** {@inheritDoc} */
@Override
public void write(final byte[] b, int off, int len) throws IOException {
while (0 < len) {
@@ -159,6 +161,7 @@ public class SideBandOutputStream extends OutputStream {
}
}

/** {@inheritDoc} */
@Override
public void write(final int b) throws IOException {
if (cnt == buffer.length)

+ 4
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java View File

@@ -60,6 +60,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor {
write = true;
}

/** {@inheritDoc} */
@Override
protected void onUpdate(String taskName, int workCurr) {
StringBuilder s = new StringBuilder();
@@ -68,6 +69,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor {
send(s);
}

/** {@inheritDoc} */
@Override
protected void onEndTask(String taskName, int workCurr) {
StringBuilder s = new StringBuilder();
@@ -82,6 +84,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor {
s.append(workCurr);
}

/** {@inheritDoc} */
@Override
protected void onUpdate(String taskName, int cmp, int totalWork, int pcnt) {
StringBuilder s = new StringBuilder();
@@ -90,6 +93,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor {
send(s);
}

/** {@inheritDoc} */
@Override
protected void onEndTask(String taskName, int cmp, int totalWork, int pcnt) {
StringBuilder s = new StringBuilder();

+ 28
- 15
org.eclipse.jgit/src/org/eclipse/jgit/transport/SignedPushConfig.java View File

@@ -60,7 +60,9 @@ public class SignedPushConfig {
private int certNonceSlopLimit;
private NonceGenerator nonceGenerator;

/** Create a new config with default values disabling push verification. */
/**
* Create a new config with default values disabling push verification.
*/
public SignedPushConfig() {
}

@@ -73,9 +75,10 @@ public class SignedPushConfig {
* Set the seed used by the nonce verifier.
* <p>
* Setting this to a non-null value enables push certificate verification
* using the default {@link HMACSHA1NonceGenerator} implementation, if a
* different implementation was not set using {@link
* #setNonceGenerator(NonceGenerator)}.
* using the default
* {@link org.eclipse.jgit.transport.HMACSHA1NonceGenerator} implementation,
* if a different implementation was not set using
* {@link #setNonceGenerator(NonceGenerator)}.
*
* @param seed
* new seed value.
@@ -84,7 +87,11 @@ public class SignedPushConfig {
certNonceSeed = seed;
}

/** @return the configured seed. */
/**
* Get the configured seed.
*
* @return the configured seed.
*/
public String getCertNonceSeed() {
return certNonceSeed;
}
@@ -101,18 +108,23 @@ public class SignedPushConfig {
certNonceSlopLimit = limit;
}

/** @return the configured nonce slop limit. */
/**
* Get the configured nonce slop limit.
*
* @return the configured nonce slop limit.
*/
public int getCertNonceSlopLimit() {
return certNonceSlopLimit;
}

/**
* Set the {@link NonceGenerator} used for signed pushes.
* Set the {@link org.eclipse.jgit.transport.NonceGenerator} used for signed
* pushes.
* <p>
* Setting this to a non-null value enables push certificate verification. If
* this method is called, this implementation will be used instead of the
* default {@link HMACSHA1NonceGenerator} even if {@link
* #setCertNonceSeed(String)} was called.
* Setting this to a non-null value enables push certificate verification.
* If this method is called, this implementation will be used instead of the
* default {@link org.eclipse.jgit.transport.HMACSHA1NonceGenerator} even if
* {@link #setCertNonceSeed(String)} was called.
*
* @param generator
* new nonce generator.
@@ -122,12 +134,13 @@ public class SignedPushConfig {
}

/**
* Get the {@link NonceGenerator} used for signed pushes.
* Get the {@link org.eclipse.jgit.transport.NonceGenerator} used for signed
* pushes.
* <p>
* If {@link #setNonceGenerator(NonceGenerator)} was used to set a non-null
* implementation, that will be returned. If no custom implementation was set
* but {@link #setCertNonceSeed(String)} was called, returns a newly-created
* {@link HMACSHA1NonceGenerator}.
* implementation, that will be returned. If no custom implementation was
* set but {@link #setCertNonceSeed(String)} was called, returns a
* newly-created {@link org.eclipse.jgit.transport.HMACSHA1NonceGenerator}.
*
* @return the configured nonce generator.
*/

+ 4
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java View File

@@ -54,9 +54,9 @@ import org.eclipse.jgit.util.FS;
* communicating with the end-user as well as reading their personal SSH
* configuration settings, such as known hosts and private keys.
* <p>
* A {@link RemoteSession} must be returned to the factory that created it.
* Callers are encouraged to retain the SshSessionFactory for the duration of
* the period they are using the Session.
* A {@link org.eclipse.jgit.transport.RemoteSession} must be returned to the
* factory that created it. Callers are encouraged to retain the
* SshSessionFactory for the duration of the period they are using the Session.
*/
public abstract class SshSessionFactory {
private static SshSessionFactory INSTANCE = new DefaultSshSessionFactory();
@@ -106,7 +106,7 @@ public abstract class SshSessionFactory {
* @param tms
* Timeout value, in milliseconds.
* @return a session that can contact the remote host.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the session could not be created.
*/
public abstract RemoteSession getSession(URIish uri,

+ 7
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java View File

@@ -99,7 +99,7 @@ public abstract class SshTransport extends TcpTransport {
*
* @param factory
* a factory to set, must not be null
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* if session has been already created.
*/
public void setSshSessionFactory(SshSessionFactory factory) {
@@ -112,7 +112,10 @@ public abstract class SshTransport extends TcpTransport {
}

/**
* @return the SSH session factory that will be used for creating SSH sessions
* Get the SSH session factory
*
* @return the SSH session factory that will be used for creating SSH
* sessions
*/
public SshSessionFactory getSshSessionFactory() {
return sch;
@@ -122,7 +125,7 @@ public abstract class SshTransport extends TcpTransport {
* Get the default SSH session
*
* @return a remote session
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* in case of error with opening SSH session
*/
protected RemoteSession getSession() throws TransportException {
@@ -138,6 +141,7 @@ public abstract class SshTransport extends TcpTransport {
return sock;
}

/** {@inheritDoc} */
@Override
public void close() {
if (sock != null) {

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java View File

@@ -48,7 +48,9 @@ import java.text.MessageFormat;

import org.eclipse.jgit.internal.JGitText;

/** Specification of annotated tag behavior during fetch. */
/**
* Specification of annotated tag behavior during fetch.
*/
public enum TagOpt {
/**
* Automatically follow tags if we fetch the thing they point at.

+ 20
- 10
org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java View File

@@ -60,15 +60,16 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory;
/**
* Protocol for transport between manually-specified repositories in tests.
* <p>
* Remote repositories are registered using {@link #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.
* Remote repositories are registered using
* {@link #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.
* <p>
* Unlike the other built-in protocols, which are automatically-registered
* singletons, callers are expected to register/unregister specific protocol
* instances on demand with {@link Transport#register(TransportProtocol)}.
* instances on demand with
* {@link org.eclipse.jgit.transport.Transport#register(TransportProtocol)}.
*
* @param <C>
* the connection type
@@ -92,12 +93,16 @@ public class TestProtocol<C> extends TransportProtocol {
private final HashMap<URIish, Handle> handles;

/**
* Constructor for TestProtocol.
*
* @param uploadPackFactory
* factory for creating {@link UploadPack} used by all connections
* from this protocol instance.
* factory for creating
* {@link org.eclipse.jgit.transport.UploadPack} used by all
* connections from this protocol instance.
* @param receivePackFactory
* factory for creating {@link ReceivePack} used by all connections
* from this protocol instance.
* factory for creating
* {@link org.eclipse.jgit.transport.ReceivePack} used by all
* connections from this protocol instance.
*/
public TestProtocol(UploadPackFactory<C> uploadPackFactory,
ReceivePackFactory<C> receivePackFactory) {
@@ -106,16 +111,19 @@ public class TestProtocol<C> extends TransportProtocol {
this.handles = new HashMap<>();
}

/** {@inheritDoc} */
@Override
public String getName() {
return JGitText.get().transportProtoTest;
}

/** {@inheritDoc} */
@Override
public Set<String> getSchemes() {
return Collections.singleton(SCHEME);
}

/** {@inheritDoc} */
@Override
public Transport open(URIish uri, Repository local, String remoteName)
throws NotSupportedException, TransportException {
@@ -127,11 +135,13 @@ public class TestProtocol<C> extends TransportProtocol {
return new TransportInternal(local, uri, h);
}

/** {@inheritDoc} */
@Override
public Set<URIishField> getRequiredFields() {
return EnumSet.of(URIishField.HOST, URIishField.PATH);
}

/** {@inheritDoc} */
@Override
public Set<URIishField> getOptionalFields() {
return Collections.emptySet();

+ 6
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java View File

@@ -49,7 +49,9 @@ import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefUpdate;

/** Update of a locally stored tracking branch. */
/**
* Update of a locally stored tracking branch.
*/
public class TrackingRefUpdate {
private final String remoteName;
final String localName;
@@ -132,6 +134,8 @@ public class TrackingRefUpdate {
}

/**
* Get this update wrapped by a ReceiveCommand.
*
* @return this update wrapped by a ReceiveCommand.
* @since 3.4
*/
@@ -201,6 +205,7 @@ public class TrackingRefUpdate {
}
}

/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

+ 13
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java View File

@@ -157,6 +157,8 @@ public class TransferConfig {
}

/**
* Create checker to verify fetched objects
*
* @return checker to verify fetched objects, or null if checking is not
* enabled in the repository configuration.
* @since 3.6
@@ -167,6 +169,8 @@ public class TransferConfig {
}

/**
* Create checker to verify objects pushed into this repository
*
* @return checker to verify objects pushed into this repository, or null if
* checking is not enabled in the repository configuration.
* @since 4.2
@@ -196,6 +200,8 @@ public class TransferConfig {
}

/**
* Whether to allow clients to request non-advertised tip SHA-1s
*
* @return allow clients to request non-advertised tip SHA-1s?
* @since 3.1
*/
@@ -204,6 +210,8 @@ public class TransferConfig {
}

/**
* Whether to allow clients to request non-tip SHA-1s
*
* @return allow clients to request non-tip SHA-1s?
* @since 4.1
*/
@@ -212,7 +220,11 @@ public class TransferConfig {
}

/**
* @return {@link RefFilter} respecting configured hidden refs.
* Get {@link org.eclipse.jgit.transport.RefFilter} respecting configured
* hidden refs.
*
* @return {@link org.eclipse.jgit.transport.RefFilter} respecting
* configured hidden refs.
* @since 3.1
*/
public RefFilter getRefFilter() {

+ 133
- 93
org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java View File

@@ -78,7 +78,6 @@ import org.eclipse.jgit.hooks.Hooks;
import org.eclipse.jgit.hooks.PrePushHook;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectChecker;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ProgressMonitor;
@@ -215,7 +214,8 @@ public abstract class Transport implements AutoCloseable {
* Protocol definitions are held by WeakReference, allowing them to be
* garbage collected when the calling application drops all strongly held
* references to the TransportProtocol. Therefore applications should use a
* singleton pattern as described in {@link TransportProtocol}'s class
* singleton pattern as described in
* {@link org.eclipse.jgit.transport.TransportProtocol}'s class
* documentation to ensure their protocol does not get disabled by garbage
* collection earlier than expected.
* <p>
@@ -270,7 +270,8 @@ public abstract class Transport implements AutoCloseable {
/**
* Open a new transport instance to connect two repositories.
* <p>
* This method assumes {@link Operation#FETCH}.
* This method assumes
* {@link org.eclipse.jgit.transport.Transport.Operation#FETCH}.
*
* @param local
* existing local repository.
@@ -279,12 +280,12 @@ public abstract class Transport implements AutoCloseable {
* configuration name.
* @return the new transport instance. Never null. In case of multiple URIs
* in remote configuration, only the first is chosen.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
* the location is not a remote defined in the configuration
* file and is not a well-formed URL.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static Transport open(final Repository local, final String remote)
@@ -306,12 +307,12 @@ public abstract class Transport implements AutoCloseable {
* based on the type of connection desired.
* @return the new transport instance. Never null. In case of multiple URIs
* in remote configuration, only the first is chosen.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
* the location is not a remote defined in the configuration
* file and is not a well-formed URL.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static Transport open(final Repository local, final String remote,
@@ -330,7 +331,8 @@ public abstract class Transport implements AutoCloseable {
/**
* Open new transport instances to connect two repositories.
* <p>
* This method assumes {@link Operation#FETCH}.
* This method assumes
* {@link org.eclipse.jgit.transport.Transport.Operation#FETCH}.
*
* @param local
* existing local repository.
@@ -339,12 +341,12 @@ public abstract class Transport implements AutoCloseable {
* configuration name.
* @return the list of new transport instances for every URI in remote
* configuration.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
* the location is not a remote defined in the configuration
* file and is not a well-formed URL.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static List<Transport> openAll(final Repository local,
@@ -366,12 +368,12 @@ public abstract class Transport implements AutoCloseable {
* based on the type of connection desired.
* @return the list of new transport instances for every URI in remote
* configuration.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
* the location is not a remote defined in the configuration
* file and is not a well-formed URL.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static List<Transport> openAll(final Repository local,
@@ -390,7 +392,8 @@ public abstract class Transport implements AutoCloseable {
/**
* Open a new transport instance to connect two repositories.
* <p>
* This method assumes {@link Operation#FETCH}.
* This method assumes
* {@link org.eclipse.jgit.transport.Transport.Operation#FETCH}.
*
* @param local
* existing local repository.
@@ -399,11 +402,11 @@ public abstract class Transport implements AutoCloseable {
* repository.
* @return the new transport instance. Never null. In case of multiple URIs
* in remote configuration, only the first is chosen.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* if provided remote configuration doesn't have any URI
* associated.
*/
@@ -425,11 +428,11 @@ public abstract class Transport implements AutoCloseable {
* based on the type of connection desired.
* @return the new transport instance. Never null. In case of multiple URIs
* in remote configuration, only the first is chosen.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* if provided remote configuration doesn't have any URI
* associated.
*/
@@ -448,7 +451,8 @@ public abstract class Transport implements AutoCloseable {
/**
* Open new transport instances to connect two repositories.
* <p>
* This method assumes {@link Operation#FETCH}.
* This method assumes
* {@link org.eclipse.jgit.transport.Transport.Operation#FETCH}.
*
* @param local
* existing local repository.
@@ -457,9 +461,9 @@ public abstract class Transport implements AutoCloseable {
* repository.
* @return the list of new transport instances for every URI in remote
* configuration.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static List<Transport> openAll(final Repository local,
@@ -481,9 +485,9 @@ public abstract class Transport implements AutoCloseable {
* based on the type of connection desired.
* @return the list of new transport instances for every URI in remote
* configuration.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static List<Transport> openAll(final Repository local,
@@ -527,9 +531,9 @@ public abstract class Transport implements AutoCloseable {
* @param uri
* location of the remote repository.
* @return the new transport instance. Never null.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static Transport open(final Repository local, final URIish uri)
@@ -548,9 +552,9 @@ public abstract class Transport implements AutoCloseable {
* name of the remote, if the remote as configured in
* {@code local}; otherwise null.
* @return the new transport instance. Never null.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the protocol specified is not supported.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public static Transport open(Repository local, URIish uri, String remoteName)
@@ -580,10 +584,10 @@ public abstract class Transport implements AutoCloseable {
* Note that the resulting transport instance can not be used for fetching
* or pushing, but only for reading remote refs.
*
* @param uri
* @param uri a {@link org.eclipse.jgit.transport.URIish} object.
* @return new Transport instance
* @throws NotSupportedException
* @throws TransportException
* @throws org.eclipse.jgit.errors.NotSupportedException
* @throws org.eclipse.jgit.errors.TransportException
*/
public static Transport open(URIish uri) throws NotSupportedException, TransportException {
for (WeakReference<TransportProtocol> ref : protocols) {
@@ -601,12 +605,13 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Convert push remote refs update specification from {@link RefSpec} form
* to {@link RemoteRefUpdate}. Conversion expands wildcards by matching
* source part to local refs. expectedOldObjectId in RemoteRefUpdate is
* set when specified in leases. Tracking branch is configured if RefSpec
* destination matches source of any fetch ref spec for this transport
* remote configuration.
* Convert push remote refs update specification from
* {@link org.eclipse.jgit.transport.RefSpec} form to
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands
* wildcards by matching source part to local refs. expectedOldObjectId in
* RemoteRefUpdate is set when specified in leases. Tracking branch is
* configured if RefSpec destination matches source of any fetch ref spec
* for this transport remote configuration.
*
* @param db
* local database.
@@ -617,8 +622,9 @@ public abstract class Transport implements AutoCloseable {
* @param fetchSpecs
* fetch specifications used for finding localtracking refs. May
* be null or empty collection.
* @return collection of set up {@link RemoteRefUpdate}.
* @throws IOException
* @return collection of set up
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}.
* @throws java.io.IOException
* when problem occurred during conversion or specification set
* up: most probably, missing objects or refs.
* @since 4.7
@@ -668,12 +674,13 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Convert push remote refs update specification from {@link RefSpec} form
* to {@link RemoteRefUpdate}. Conversion expands wildcards by matching
* source part to local refs. expectedOldObjectId in RemoteRefUpdate is
* always set as null. Tracking branch is configured if RefSpec destination
* matches source of any fetch ref spec for this transport remote
* configuration.
* Convert push remote refs update specification from
* {@link org.eclipse.jgit.transport.RefSpec} form to
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands
* wildcards by matching source part to local refs. expectedOldObjectId in
* RemoteRefUpdate is always set as null. Tracking branch is configured if
* RefSpec destination matches source of any fetch ref spec for this
* transport remote configuration.
*
* @param db
* local database.
@@ -682,8 +689,9 @@ public abstract class Transport implements AutoCloseable {
* @param fetchSpecs
* fetch specifications used for finding localtracking refs. May
* be null or empty collection.
* @return collection of set up {@link RemoteRefUpdate}.
* @throws IOException
* @return collection of set up
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}.
* @throws java.io.IOException
* when problem occurred during conversion or specification set
* up: most probably, missing objects or refs.
*/
@@ -838,6 +846,7 @@ public abstract class Transport implements AutoCloseable {
* Create a minimal transport instance not tied to a single repository.
*
* @param uri
* a {@link org.eclipse.jgit.transport.URIish} object.
*/
protected Transport(final URIish uri) {
this.uri = uri;
@@ -923,6 +932,8 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Whether fetch will verify if received objects are formatted correctly.
*
* @return true if fetch will verify received objects are formatted
* correctly. Validating objects requires more CPU time on the
* client side of the connection.
@@ -932,6 +943,8 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Configure if checking received objects is enabled
*
* @param check
* true to enable checking received objects; false to assume all
* received objects are valid.
@@ -945,6 +958,8 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Get configured object checker for received objects
*
* @return configured object checker for received objects, or null.
* @since 3.6
*/
@@ -953,6 +968,8 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Set the object checker to verify each received object with
*
* @param impl
* if non-null the object checking instance to verify each
* received object with; null to disable object checking.
@@ -963,7 +980,8 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Default setting is: {@link RemoteConfig#DEFAULT_RECEIVE_PACK}
* Default setting is:
* {@link org.eclipse.jgit.transport.RemoteConfig#DEFAULT_RECEIVE_PACK}
*
* @return remote executable providing receive-pack service for pack
* transports.
@@ -975,7 +993,8 @@ public abstract class Transport implements AutoCloseable {

/**
* Set remote executable providing receive-pack service for pack transports.
* Default setting is: {@link RemoteConfig#DEFAULT_RECEIVE_PACK}
* Default setting is:
* {@link org.eclipse.jgit.transport.RemoteConfig#DEFAULT_RECEIVE_PACK}
*
* @param optionReceivePack
* remote executable, if null or empty default one is set;
@@ -1036,6 +1055,9 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Whether destination refs should be removed if they no longer exist at the
* source repository.
*
* @return true if destination refs should be removed if they no longer
* exist at the source repository.
*/
@@ -1075,6 +1097,9 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Whether push operation should just check for possible result and not
* really update remote refs
*
* @return true if push operation should just check for possible result and
* not really update remote refs, false otherwise - when push should
* act normally.
@@ -1095,7 +1120,11 @@ public abstract class Transport implements AutoCloseable {
this.dryRun = dryRun;
}

/** @return timeout (in seconds) before aborting an IO operation. */
/**
* Get timeout (in seconds) before aborting an IO operation.
*
* @return timeout (in seconds) before aborting an IO operation.
*/
public int getTimeout() {
return timeout;
}
@@ -1159,6 +1188,8 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Get the option strings associated with the push operation
*
* @return the option strings associated with the push operation
* @since 4.5
*/
@@ -1182,22 +1213,24 @@ public abstract class Transport implements AutoCloseable {
* <p>
* This is a utility function providing standard fetch behavior. Local
* tracking refs associated with the remote repository are automatically
* updated if this transport was created from a {@link RemoteConfig} with
* fetch RefSpecs defined.
* updated if this transport was created from a
* {@link org.eclipse.jgit.transport.RemoteConfig} with fetch RefSpecs
* defined.
*
* @param monitor
* progress monitor to inform the user about our processing
* activity. Must not be null. Use {@link NullProgressMonitor} if
* progress updates are not interesting or necessary.
* activity. Must not be null. Use
* {@link org.eclipse.jgit.lib.NullProgressMonitor} if progress
* updates are not interesting or necessary.
* @param toFetch
* specification of refs to fetch locally. May be null or the
* empty collection to use the specifications from the
* RemoteConfig. Source for each RefSpec can't be null.
* @return information describing the tracking refs updated.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* this transport implementation does not support fetching
* objects.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the remote connection could not be established or object
* copying (if necessary) failed or update specification was
* incorrect.
@@ -1252,17 +1285,18 @@ public abstract class Transport implements AutoCloseable {
* For setting up remote ref update specification from ref spec, see helper
* method {@link #findRemoteRefUpdatesFor(Collection)}, predefined refspecs
* ({@link #REFSPEC_TAGS}, {@link #REFSPEC_PUSH_ALL}) or consider using
* directly {@link RemoteRefUpdate} for more possibilities.
* directly {@link org.eclipse.jgit.transport.RemoteRefUpdate} for more
* possibilities.
* <p>
* When {@link #isDryRun()} is true, result of this operation is just
* estimation of real operation result, no real action is performed.
*
* @see RemoteRefUpdate
*
* @param monitor
* progress monitor to inform the user about our processing
* activity. Must not be null. Use {@link NullProgressMonitor} if
* progress updates are not interesting or necessary.
* activity. Must not be null. Use
* {@link org.eclipse.jgit.lib.NullProgressMonitor} if progress
* updates are not interesting or necessary.
* @param toPush
* specification of refs to push. May be null or the empty
* collection to use the specifications from the RemoteConfig
@@ -1273,10 +1307,10 @@ public abstract class Transport implements AutoCloseable {
* output stream to write messages to
* @return information about results of remote refs updates, tracking refs
* updates and refs advertised by remote repository.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* this transport implementation does not support pushing
* objects.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the remote connection could not be established or object
* copying (if necessary) failed at I/O or protocol level or
* update specification was incorrect.
@@ -1322,30 +1356,30 @@ public abstract class Transport implements AutoCloseable {
* For setting up remote ref update specification from ref spec, see helper
* method {@link #findRemoteRefUpdatesFor(Collection)}, predefined refspecs
* ({@link #REFSPEC_TAGS}, {@link #REFSPEC_PUSH_ALL}) or consider using
* directly {@link RemoteRefUpdate} for more possibilities.
* directly {@link org.eclipse.jgit.transport.RemoteRefUpdate} for more
* possibilities.
* <p>
* When {@link #isDryRun()} is true, result of this operation is just
* estimation of real operation result, no real action is performed.
*
* @see RemoteRefUpdate
*
* @param monitor
* progress monitor to inform the user about our processing
* activity. Must not be null. Use {@link NullProgressMonitor} if
* progress updates are not interesting or necessary.
* activity. Must not be null. Use
* {@link org.eclipse.jgit.lib.NullProgressMonitor} if progress
* updates are not interesting or necessary.
* @param toPush
* specification of refs to push. May be null or the empty
* collection to use the specifications from the RemoteConfig
* converted by {@link #findRemoteRefUpdatesFor(Collection)}. No
* more than 1 RemoteRefUpdate with the same remoteName is
* allowed. These objects are modified during this call.
*
* @return information about results of remote refs updates, tracking refs
* updates and refs advertised by remote repository.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* this transport implementation does not support pushing
* objects.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the remote connection could not be established or object
* copying (if necessary) failed at I/O or protocol level or
* update specification was incorrect.
@@ -1357,20 +1391,22 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Convert push remote refs update specification from {@link RefSpec} form
* to {@link RemoteRefUpdate}. Conversion expands wildcards by matching
* source part to local refs. expectedOldObjectId in RemoteRefUpdate is
* always set as null. Tracking branch is configured if RefSpec destination
* matches source of any fetch ref spec for this transport remote
* configuration.
* Convert push remote refs update specification from
* {@link org.eclipse.jgit.transport.RefSpec} form to
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands
* wildcards by matching source part to local refs. expectedOldObjectId in
* RemoteRefUpdate is always set as null. Tracking branch is configured if
* RefSpec destination matches source of any fetch ref spec for this
* transport remote configuration.
* <p>
* Conversion is performed for context of this transport (database, fetch
* specifications).
*
* @param specs
* collection of RefSpec to convert.
* @return collection of set up {@link RemoteRefUpdate}.
* @throws IOException
* @return collection of set up
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}.
* @throws java.io.IOException
* when problem occurred during conversion or specification set
* up: most probably, missing objects or refs.
*/
@@ -1381,12 +1417,13 @@ public abstract class Transport implements AutoCloseable {
}

/**
* Convert push remote refs update specification from {@link RefSpec} form
* to {@link RemoteRefUpdate}. Conversion expands wildcards by matching
* source part to local refs. expectedOldObjectId in RemoteRefUpdate is
* set according to leases. Tracking branch is configured if RefSpec destination
* matches source of any fetch ref spec for this transport remote
* configuration.
* Convert push remote refs update specification from
* {@link org.eclipse.jgit.transport.RefSpec} form to
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands
* wildcards by matching source part to local refs. expectedOldObjectId in
* RemoteRefUpdate is set according to leases. Tracking branch is configured
* if RefSpec destination matches source of any fetch ref spec for this
* transport remote configuration.
* <p>
* Conversion is performed for context of this transport (database, fetch
* specifications).
@@ -1395,8 +1432,9 @@ public abstract class Transport implements AutoCloseable {
* collection of RefSpec to convert.
* @param leases
* map from ref to lease (containing expected old object id)
* @return collection of set up {@link RemoteRefUpdate}.
* @throws IOException
* @return collection of set up
* {@link org.eclipse.jgit.transport.RemoteRefUpdate}.
* @throws java.io.IOException
* when problem occurred during conversion or specification set
* up: most probably, missing objects or refs.
* @since 4.7
@@ -1415,9 +1453,9 @@ public abstract class Transport implements AutoCloseable {
* be used for reading remote refs.
*
* @return a fresh connection to fetch from the remote repository.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the implementation does not support fetching.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the remote connection could not be established.
*/
public abstract FetchConnection openFetch() throws NotSupportedException,
@@ -1427,15 +1465,17 @@ public abstract class Transport implements AutoCloseable {
* Begins a new connection for pushing into the remote repository.
*
* @return a fresh connection to push into the remote repository.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* the implementation does not support pushing.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the remote connection could not be established
*/
public abstract PushConnection openPush() throws NotSupportedException,
TransportException;

/**
* {@inheritDoc}
* <p>
* Close any resources used by this transport.
* <p>
* If the remote repository is contacted by a network socket this method

+ 6
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java View File

@@ -86,8 +86,9 @@ import org.eclipse.jgit.lib.SymbolicRef;
* extended HTTP/1.1 semantics. This make it possible to read or write Git data
* from a remote repository that is stored on S3.
* <p>
* Unlike the HTTP variant (see {@link TransportHttp}) we rely upon being able
* to list objects in a bucket, as the S3 API supports this function. By listing
* Unlike the HTTP variant (see
* {@link org.eclipse.jgit.transport.TransportHttp}) we rely upon being able to
* list objects in a bucket, as the S3 API supports this function. By listing
* the bucket contents we can avoid relying on <code>objects/info/packs</code>
* or <code>info/refs</code> in the remote repository.
* <p>
@@ -201,6 +202,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
}
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
final DatabaseS3 c = new DatabaseS3(bucket, keyPrefix + "/objects"); //$NON-NLS-1$
@@ -209,6 +211,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
return r;
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws TransportException {
final DatabaseS3 c = new DatabaseS3(bucket, keyPrefix + "/objects"); //$NON-NLS-1$
@@ -217,6 +220,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
return r;
}

/** {@inheritDoc} */
@Override
public void close() {
// No explicit connections are maintained.

+ 11
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java View File

@@ -125,11 +125,20 @@ class TransportBundleFile extends Transport implements TransportBundle {
bundle = bundlePath;
}

/**
* Constructor for TransportBundleFile.
*
* @param uri
* a {@link org.eclipse.jgit.transport.URIish} object.
* @param bundlePath
* transport bundle path
*/
public TransportBundleFile(URIish uri, File bundlePath) {
super(uri);
bundle = bundlePath;
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws NotSupportedException,
TransportException {
@@ -142,12 +151,14 @@ class TransportBundleFile extends Transport implements TransportBundle {
return new BundleFetchConnection(this, src);
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws NotSupportedException {
throw new NotSupportedException(
JGitText.get().pushIsNotSupportedForBundleTransport);
}

/** {@inheritDoc} */
@Override
public void close() {
// Resources must be established per-connection.

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java View File

@@ -90,6 +90,7 @@ public class TransportBundleStream extends Transport implements TransportBundle
src = in;
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
if (src == null)
@@ -101,12 +102,14 @@ public class TransportBundleStream extends Transport implements TransportBundle
}
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws NotSupportedException {
throw new NotSupportedException(
JGitText.get().pushIsNotSupportedForBundleTransport);
}

/** {@inheritDoc} */
@Override
public void close() {
if (src != null) {

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java View File

@@ -121,16 +121,19 @@ class TransportGitAnon extends TcpTransport implements PackTransport {
super(uri);
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
return new TcpFetchConnection();
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws TransportException {
return new TcpPushConnection();
}

/** {@inheritDoc} */
@Override
public void close() {
// Resources must be established per-connection.

+ 2
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java View File

@@ -164,11 +164,13 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
}
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
return new SshFetchConnection();
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws TransportException {
return new SshPushConnection();

+ 9
- 3
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java View File

@@ -291,8 +291,11 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
}

/**
* Set uri a {@link org.eclipse.jgit.transport.URIish} object.
*
* @param uri
* @throws NotSupportedException
* a {@link org.eclipse.jgit.transport.URIish} object.
* @throws org.eclipse.jgit.errors.NotSupportedException
* @since 4.9
*/
protected void setURI(final URIish uri) throws NotSupportedException {
@@ -333,6 +336,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
useSmartHttp = on;
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException,
NotSupportedException {
@@ -427,6 +431,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
return new BufferedReader(new InputStreamReader(in, Constants.CHARSET));
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws NotSupportedException,
TransportException {
@@ -465,6 +470,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
return p;
}

/** {@inheritDoc} */
@Override
public void close() {
// No explicit connections are maintained.
@@ -803,7 +809,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
* @param method HTTP request method
* @param u url of the HTTP connection
* @return the HTTP connection
* @throws IOException
* @throws java.io.IOException
* @since 3.3
* @deprecated use {@link #httpOpen(String, URL, AcceptEncoding)} instead.
*/
@@ -819,7 +825,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
* @param u url of the HTTP connection
* @param acceptEncoding accept-encoding header option
* @return the HTTP connection
* @throws IOException
* @throws java.io.IOException
* @since 4.6
*/
protected HttpConnection httpOpen(String method, URL u,

+ 12
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java View File

@@ -178,6 +178,7 @@ class TransportLocal extends Transport implements PackTransport {
}
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
final String up = getOptionUploadPack();
@@ -194,6 +195,7 @@ class TransportLocal extends Transport implements PackTransport {
return new InternalFetchConnection<>(this, upf, null, openRepo());
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws TransportException {
final String rp = getOptionReceivePack();
@@ -210,11 +212,21 @@ class TransportLocal extends Transport implements PackTransport {
return new InternalPushConnection<>(this, rpf, null, openRepo());
}

/** {@inheritDoc} */
@Override
public void close() {
// Resources must be established per-connection.
}

/**
* Spawn process
*
* @param cmd
* command
* @return a {@link java.lang.Process} object.
* @throws org.eclipse.jgit.errors.TransportException
* if any.
*/
protected Process spawn(final String cmd)
throws TransportException {
try {

+ 36
- 14
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportProtocol.java View File

@@ -72,11 +72,12 @@ import org.eclipse.jgit.lib.Repository;
*
* <p>
* Applications may register additional protocols for use by JGit by calling
* {@link Transport#register(TransportProtocol)}. Because that API holds onto
* the protocol object by a WeakReference, applications must ensure their own
* ClassLoader retains the TransportProtocol for the life of the application.
* Using a static singleton pattern as above will ensure the protocol is valid
* so long as the ClassLoader that defines it remains valid.
* {@link org.eclipse.jgit.transport.Transport#register(TransportProtocol)}.
* Because that API holds onto the protocol object by a WeakReference,
* applications must ensure their own ClassLoader retains the TransportProtocol
* for the life of the application. Using a static singleton pattern as above
* will ensure the protocol is valid so long as the ClassLoader that defines it
* remains valid.
* <p>
* Applications may automatically register additional protocols by filling in
* the names of their TransportProtocol defining classes using the services file
@@ -102,25 +103,45 @@ public abstract class TransportProtocol {
PATH,
}

/** @return text name of the protocol suitable for display to a user. */
/**
* Get text name of the protocol suitable for display to a user.
*
* @return text name of the protocol suitable for display to a user.
*/
public abstract String getName();

/** @return immutable set of schemes supported by this protocol. */
/**
* Get immutable set of schemes supported by this protocol.
*
* @return immutable set of schemes supported by this protocol.
*/
public Set<String> getSchemes() {
return Collections.emptySet();
}

/** @return immutable set of URIishFields that must be filled in. */
/**
* Get immutable set of URIishFields that must be filled in.
*
* @return immutable set of URIishFields that must be filled in.
*/
public Set<URIishField> getRequiredFields() {
return Collections.unmodifiableSet(EnumSet.of(URIishField.PATH));
}

/** @return immutable set of URIishFields that may be filled in. */
/**
* Get immutable set of URIishFields that may be filled in.
*
* @return immutable set of URIishFields that may be filled in.
*/
public Set<URIishField> getOptionalFields() {
return Collections.emptySet();
}

/** @return if a port is supported, the default port, else -1. */
/**
* Get the default port if the protocol supports a port, else -1.
*
* @return the default port if the protocol supports a port, else -1.
*/
public int getDefaultPort() {
return -1;
}
@@ -246,9 +267,9 @@ public abstract class TransportProtocol {
* name of the remote, if the remote as configured in
* {@code local}; otherwise null.
* @return the transport.
* @throws NotSupportedException
* @throws org.eclipse.jgit.errors.NotSupportedException
* this protocol does not support the URI.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* the transport cannot open this URI.
*/
public abstract Transport open(URIish uri, Repository local,
@@ -260,9 +281,10 @@ public abstract class TransportProtocol {
* configuration instead of reading from configuration files.
*
* @param uri
* a {@link org.eclipse.jgit.transport.URIish} object.
* @return new Transport
* @throws NotSupportedException
* @throws TransportException
* @throws org.eclipse.jgit.errors.NotSupportedException
* @throws org.eclipse.jgit.errors.TransportException
*/
public Transport open(URIish uri)
throws NotSupportedException, TransportException {

+ 7
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java View File

@@ -86,11 +86,12 @@ import com.jcraft.jsch.SftpException;
* repository that is available over SSH, but whose remote host does not have
* Git installed.
* <p>
* Unlike the HTTP variant (see {@link TransportHttp}) we rely upon being able
* to list files in directories, as the SFTP protocol supports this function. By
* Unlike the HTTP variant (see
* {@link org.eclipse.jgit.transport.TransportHttp}) we rely upon being able to
* list files in directories, as the SFTP protocol supports this function. By
* listing files through SFTP we can avoid needing to have current
* <code>objects/info/packs</code> or <code>info/refs</code> files on the
* remote repository and access the data directly, much as Git itself would.
* <code>objects/info/packs</code> or <code>info/refs</code> files on the remote
* repository and access the data directly, much as Git itself would.
* <p>
* Concurrent pushing over this transport is not supported. Multiple concurrent
* push operations may cause confusion in the repository state.
@@ -137,6 +138,7 @@ public class TransportSftp extends SshTransport implements WalkTransport {
super(local, uri);
}

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
final SftpObjectDB c = new SftpObjectDB(uri.getPath());
@@ -145,6 +147,7 @@ public class TransportSftp extends SshTransport implements WalkTransport {
return r;
}

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws TransportException {
final SftpObjectDB c = new SftpObjectDB(uri.getPath());

+ 33
- 5
org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java View File

@@ -200,10 +200,12 @@ public class URIish implements Serializable {
private String host;

/**
* Parse and construct an {@link URIish} from a string
* Parse and construct an {@link org.eclipse.jgit.transport.URIish} from a
* string
*
* @param s
* @throws URISyntaxException
* a {@link java.lang.String} object.
* @throws java.net.URISyntaxException
*/
public URIish(String s) throws URISyntaxException {
if (StringUtils.isEmptyOrNull(s)) {
@@ -395,7 +397,9 @@ public class URIish implements Serializable {
host = u.getHost();
}

/** Create an empty, non-configured URI. */
/**
* Create an empty, non-configured URI.
*/
public URIish() {
// Configure nothing.
}
@@ -411,6 +415,8 @@ public class URIish implements Serializable {
}

/**
* Whether this URI references a repository on another system.
*
* @return true if this URI references a repository on another system.
*/
public boolean isRemote() {
@@ -418,6 +424,8 @@ public class URIish implements Serializable {
}

/**
* Get host name part.
*
* @return host name part or null
*/
public String getHost() {
@@ -438,6 +446,8 @@ public class URIish implements Serializable {
}

/**
* Get protocol name
*
* @return protocol name or null for local references
*/
public String getScheme() {
@@ -458,6 +468,8 @@ public class URIish implements Serializable {
}

/**
* Get path name component
*
* @return path name component
*/
public String getPath() {
@@ -465,6 +477,8 @@ public class URIish implements Serializable {
}

/**
* Get path name component
*
* @return path name component
*/
public String getRawPath() {
@@ -491,7 +505,7 @@ public class URIish implements Serializable {
* @param n
* the new value for path.
* @return a new URI with the updated value.
* @throws URISyntaxException
* @throws java.net.URISyntaxException
*/
public URIish setRawPath(final String n) throws URISyntaxException {
final URIish r = new URIish(this);
@@ -501,6 +515,8 @@ public class URIish implements Serializable {
}

/**
* Get user name requested for transfer
*
* @return user name requested for transfer or null
*/
public String getUser() {
@@ -521,6 +537,8 @@ public class URIish implements Serializable {
}

/**
* Get password requested for transfer
*
* @return password requested for transfer or null
*/
public String getPass() {
@@ -541,6 +559,8 @@ public class URIish implements Serializable {
}

/**
* Get port number requested for transfer or -1 if not explicit
*
* @return port number requested for transfer or -1 if not explicit
*/
public int getPort() {
@@ -560,6 +580,7 @@ public class URIish implements Serializable {
return r;
}

/** {@inheritDoc} */
@Override
public int hashCode() {
int hc = 0;
@@ -578,6 +599,7 @@ public class URIish implements Serializable {
return hc;
}

/** {@inheritDoc} */
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof URIish))
@@ -617,6 +639,7 @@ public class URIish implements Serializable {
return format(true, false);
}

/** {@inheritDoc} */
@Override
public String toString() {
return format(false, false);
@@ -666,6 +689,8 @@ public class URIish implements Serializable {
}

/**
* <Get the URI as an ASCII string.
*
* @return the URI as an ASCII string. Password is not included.
*/
public String toASCIIString() {
@@ -673,6 +698,9 @@ public class URIish implements Serializable {
}

/**
* Convert the URI including password, formatted with only ASCII characters
* such that it will be valid for use over the network.
*
* @return the URI including password, formatted with only ASCII characters
* such that it will be valid for use over the network.
*/
@@ -713,7 +741,7 @@ public class URIish implements Serializable {
*
* @return the "humanish" part of the path. May be an empty string. Never
* {@code null}.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* if it's impossible to determine a humanish part, or path is
* {@code null} or empty
* @see #getPath

+ 81
- 31
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java View File

@@ -346,12 +346,20 @@ public class UploadPack {
setTransferConfig(null);
}

/** @return the repository this upload is reading from. */
/**
* Get the repository this upload is reading from.
*
* @return the repository this upload is reading from.
*/
public final Repository getRepository() {
return db;
}

/** @return the RevWalk instance used by this connection. */
/**
* Get the RevWalk instance used by this connection.
*
* @return the RevWalk instance used by this connection.
*/
public final RevWalk getRevWalk() {
return walk;
}
@@ -369,14 +377,15 @@ public class UploadPack {
/**
* Set the refs advertised by this UploadPack.
* <p>
* Intended to be called from a {@link PreUploadHook}.
* Intended to be called from a
* {@link org.eclipse.jgit.transport.PreUploadHook}.
*
* @param allRefs
* explicit set of references to claim as advertised by this
* UploadPack instance. This overrides any references that
* may exist in the source repository. The map is passed
* to the configured {@link #getRefFilter()}. If null, assumes
* all refs were advertised.
* UploadPack instance. This overrides any references that may
* exist in the source repository. The map is passed to the
* configured {@link #getRefFilter()}. If null, assumes all refs
* were advertised.
*/
public void setAdvertisedRefs(Map<String, Ref> allRefs) {
if (allRefs != null)
@@ -389,7 +398,11 @@ public class UploadPack {
refs = refFilter.filter(refs);
}

/** @return timeout (in seconds) before aborting an IO operation. */
/**
* Get timeout (in seconds) before aborting an IO operation.
*
* @return timeout (in seconds) before aborting an IO operation.
*/
public int getTimeout() {
return timeout;
}
@@ -407,6 +420,9 @@ public class UploadPack {
}

/**
* Whether this class expects a bi-directional pipe opened between the
* client and itself.
*
* @return true if this class expects a bi-directional pipe opened between
* the client and itself. The default is true.
*/
@@ -415,6 +431,9 @@ public class UploadPack {
}

/**
* Set whether this class will assume the socket is a fully bidirectional
* pipe between the two peers
*
* @param twoWay
* if true, this class will assume the socket is a fully
* bidirectional pipe between the two peers and takes advantage
@@ -428,8 +447,10 @@ public class UploadPack {
}

/**
* @return policy used by the service to validate client requests, or null for
* a custom request validator.
* Get policy used by the service to validate client requests
*
* @return policy used by the service to validate client requests, or null
* for a custom request validator.
*/
public RequestPolicy getRequestPolicy() {
if (requestValidator instanceof AdvertisedRequestValidator)
@@ -446,15 +467,21 @@ public class UploadPack {
}

/**
* Set the policy used to enforce validation of a client's want list.
*
* @param policy
* the policy used to enforce validation of a client's want list.
* By default the policy is {@link RequestPolicy#ADVERTISED},
* By default the policy is
* {@link org.eclipse.jgit.transport.UploadPack.RequestPolicy#ADVERTISED},
* which is the Git default requiring clients to only ask for an
* object that a reference directly points to. This may be relaxed
* to {@link RequestPolicy#REACHABLE_COMMIT} or
* {@link RequestPolicy#REACHABLE_COMMIT_TIP} when callers have
* {@link #setBiDirectionalPipe(boolean)} set to false.
* Overrides any policy specified in a {@link TransferConfig}.
* object that a reference directly points to. This may be
* relaxed to
* {@link org.eclipse.jgit.transport.UploadPack.RequestPolicy#REACHABLE_COMMIT}
* or
* {@link org.eclipse.jgit.transport.UploadPack.RequestPolicy#REACHABLE_COMMIT_TIP}
* when callers have {@link #setBiDirectionalPipe(boolean)} set
* to false. Overrides any policy specified in a
* {@link org.eclipse.jgit.transport.TransferConfig}.
*/
public void setRequestPolicy(RequestPolicy policy) {
switch (policy) {
@@ -478,6 +505,8 @@ public class UploadPack {
}

/**
* Set custom validator for client want list.
*
* @param validator
* custom validator for client want list.
* @since 3.1
@@ -487,12 +516,20 @@ public class UploadPack {
: new AdvertisedRequestValidator();
}

/** @return the hook used while advertising the refs to the client */
/**
* Get the hook used while advertising the refs to the client.
*
* @return the hook used while advertising the refs to the client.
*/
public AdvertiseRefsHook getAdvertiseRefsHook() {
return advertiseRefsHook;
}

/** @return the filter used while advertising the refs to the client */
/**
* Get the filter used while advertising the refs to the client.
*
* @return the filter used while advertising the refs to the client.
*/
public RefFilter getRefFilter() {
return refFilter;
}
@@ -500,9 +537,10 @@ public class UploadPack {
/**
* Set the hook used while advertising the refs to the client.
* <p>
* If the {@link AdvertiseRefsHook} chooses to call
* {@link #setAdvertisedRefs(Map)}, only refs set by this hook <em>and</em>
* selected by the {@link RefFilter} will be shown to the client.
* If the {@link org.eclipse.jgit.transport.AdvertiseRefsHook} chooses to
* call {@link #setAdvertisedRefs(Map)}, only refs set by this hook
* <em>and</em> selected by the {@link org.eclipse.jgit.transport.RefFilter}
* will be shown to the client.
*
* @param advertiseRefsHook
* the hook; may be null to show all refs.
@@ -517,10 +555,11 @@ public class UploadPack {
/**
* Set the filter used while advertising the refs to the client.
* <p>
* Only refs allowed by this filter will be sent to the client.
* The filter is run against the refs specified by the
* {@link AdvertiseRefsHook} (if applicable). If null or not set, uses the
* filter implied by the {@link TransferConfig}.
* Only refs allowed by this filter will be sent to the client. The filter
* is run against the refs specified by the
* {@link org.eclipse.jgit.transport.AdvertiseRefsHook} (if applicable). If
* null or not set, uses the filter implied by the
* {@link org.eclipse.jgit.transport.TransferConfig}.
*
* @param refFilter
* the filter; may be null to show all refs.
@@ -529,7 +568,11 @@ public class UploadPack {
this.refFilter = refFilter != null ? refFilter : RefFilter.DEFAULT;
}

/** @return the configured pre upload hook. */
/**
* Get the configured pre upload hook.
*
* @return the configured pre upload hook.
*/
public PreUploadHook getPreUploadHook() {
return preUploadHook;
}
@@ -545,6 +588,8 @@ public class UploadPack {
}

/**
* Get the configured post upload hook.
*
* @return the configured post upload hook.
* @since 4.1
*/
@@ -575,6 +620,8 @@ public class UploadPack {
}

/**
* Set configuration controlling transfer options.
*
* @param tc
* configuration controlling transfer options. If null the source
* repository's settings will be used.
@@ -592,8 +639,9 @@ public class UploadPack {
}

/**
* @return the configured logger.
* Get the configured logger.
*
* @return the configured logger.
* @deprecated Use {@link #getPreUploadHook()}.
*/
@Deprecated
@@ -618,7 +666,7 @@ public class UploadPack {
*
* @return true if the client has advertised a side-band capability, false
* otherwise.
* @throws RequestNotYetReadException
* @throws org.eclipse.jgit.transport.RequestNotYetReadException
* if the client's request has not yet been read from the wire, so
* we do not know if they expect side-band. Note that the client
* may have already written the request, it just has not been
@@ -646,7 +694,7 @@ public class UploadPack {
* through. When run over SSH this should be tied back to the
* standard error channel of the command execution. For most
* other network connections this should be null.
* @throws IOException
* @throws java.io.IOException
*/
public void upload(final InputStream input, OutputStream output,
final OutputStream messages) throws IOException {
@@ -889,9 +937,9 @@ public class UploadPack {
*
* @param adv
* the advertisement formatter.
* @throws IOException
* @throws java.io.IOException
* the formatter failed to write an advertisement.
* @throws ServiceMayNotContinueException
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* the hook denied advertisement.
*/
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException,
@@ -957,6 +1005,8 @@ public class UploadPack {
}

/**
* Get an underlying stream for sending messages to the client
*
* @return an underlying stream for sending messages to the client, or null.
* @since 3.1
*/

+ 3
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackInternalServerErrorException.java View File

@@ -45,7 +45,9 @@ package org.eclipse.jgit.transport;

import java.io.IOException;

/** UploadPack has already reported an error to the client.*/
/**
* UploadPack has already reported an error to the client.
*/
public class UploadPackInternalServerErrorException extends IOException {
private static final long serialVersionUID = 1L;


+ 3
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java View File

@@ -46,14 +46,15 @@ package org.eclipse.jgit.transport;
import org.eclipse.jgit.internal.storage.pack.PackWriter;

/**
* Logs activity that occurred within {@link UploadPack}.
* Logs activity that occurred within
* {@link org.eclipse.jgit.transport.UploadPack}.
* <p>
* Implementors of the interface are responsible for associating the current
* thread to a particular connection, if they need to also include connection
* information. One method is to use a {@link java.lang.ThreadLocal} to remember
* the connection information before invoking UploadPack.
*
* @deprecated use {@link PostUploadHook} instead
* @deprecated use {@link org.eclipse.jgit.transport.PostUploadHook} instead
*/
@Deprecated
public interface UploadPackLogger { // TODO remove in JGit 5.0

+ 3
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLoggerChain.java View File

@@ -52,7 +52,8 @@ import org.eclipse.jgit.internal.storage.pack.PackWriter;
* <p>
* loggers are run in the order passed to the constructor.
*
* @deprecated Use {@link PostUploadHookChain} instead.
* @deprecated Use {@link org.eclipse.jgit.transport.PostUploadHookChain}
* instead.
*/
@Deprecated
public class UploadPackLoggerChain implements UploadPackLogger {
@@ -81,9 +82,7 @@ public class UploadPackLoggerChain implements UploadPackLogger {
return new UploadPackLoggerChain(newLoggers, i);
}

/**
* @since 3.0
*/
/** {@inheritDoc} */
@Override
public void onPackStatistics(PackWriter.Statistics stats) {
for (int i = 0; i < count; i++)

+ 12
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java View File

@@ -48,7 +48,8 @@ import java.util.Arrays;
import org.eclipse.jgit.errors.UnsupportedCredentialItem;

/**
* Simple {@link CredentialsProvider} that always uses the same information.
* Simple {@link org.eclipse.jgit.transport.CredentialsProvider} that always
* uses the same information.
*/
public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
private String username;
@@ -59,7 +60,9 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
* Initialize the provider with a single username and password.
*
* @param username
* user name
* @param password
* password
*/
public UsernamePasswordCredentialsProvider(String username, String password) {
this(username, password.toCharArray());
@@ -69,18 +72,22 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
* Initialize the provider with a single username and password.
*
* @param username
* user name
* @param password
* password
*/
public UsernamePasswordCredentialsProvider(String username, char[] password) {
this.username = username;
this.password = password;
}

/** {@inheritDoc} */
@Override
public boolean isInteractive() {
return false;
}

/** {@inheritDoc} */
@Override
public boolean supports(CredentialItem... items) {
for (CredentialItem i : items) {
@@ -96,6 +103,7 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
return true;
}

/** {@inheritDoc} */
@Override
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
@@ -121,7 +129,9 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
return true;
}

/** Destroy the saved username and password.. */
/**
* Destroy the saved username and password..
*/
public void clear() {
username = null;


+ 14
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java View File

@@ -95,6 +95,20 @@ abstract class WalkEncryption {
// consider permitting mixed ciphers to facilitate algorithm migration
// i.e. user keeps the password, but changes the algorithm
// then existing remote entries will still be readable
/**
* Validate
*
* @param u
* a {@link java.net.HttpURLConnection} object.
* @param prefix
* a {@link java.lang.String} object.
* @param version
* a {@link java.lang.String} object.
* @param name
* a {@link java.lang.String} object.
* @throws java.io.IOException
* if any.
*/
protected void validateImpl(final HttpURLConnection u, final String prefix,
final String version, final String name) throws IOException {
String v;

+ 5
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java View File

@@ -223,11 +223,13 @@ class WalkFetchConnection extends BaseFetchConnection {
workQueue = new LinkedList<>();
}

/** {@inheritDoc} */
@Override
public boolean didFetchTestConnectivity() {
return true;
}

/** {@inheritDoc} */
@Override
protected void doFetch(final ProgressMonitor monitor,
final Collection<Ref> want, final Set<ObjectId> have)
@@ -249,16 +251,19 @@ class WalkFetchConnection extends BaseFetchConnection {
}
}

/** {@inheritDoc} */
@Override
public Collection<PackLock> getPackLocks() {
return packLocks;
}

/** {@inheritDoc} */
@Override
public void setPackLockMessage(final String message) {
lockMessage = message;
}

/** {@inheritDoc} */
@Override
public void close() {
inserter.close();

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java View File

@@ -134,6 +134,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
dest = w;
}

/** {@inheritDoc} */
@Override
public void push(final ProgressMonitor monitor,
final Map<String, RemoteRefUpdate> refUpdates)
@@ -141,6 +142,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
push(monitor, refUpdates, null);
}

/** {@inheritDoc} */
@Override
public void push(final ProgressMonitor monitor,
final Map<String, RemoteRefUpdate> refUpdates, OutputStream out)
@@ -212,6 +214,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
}
}

/** {@inheritDoc} */
@Override
public void close() {
dest.close();

+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java View File

@@ -417,7 +417,7 @@ abstract class WalkRemoteObjectDatabase {
* @param avail
* return collection of references. Any existing entries will be
* replaced if they are found in the packed-refs file.
* @throws TransportException
* @throws org.eclipse.jgit.errors.TransportException
* an error occurred reading from the packed refs file.
*/
protected void readPackedRefs(final Map<String, Ref> avail)

+ 3
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkTransport.java View File

@@ -53,8 +53,9 @@ package org.eclipse.jgit.transport;
* from the loose objects directory, or entire packs if the source side does not
* have the object as a loose object.
* <p>
* WalkTransports are not as efficient as {@link PackTransport} instances, but
* can be useful in situations where a pack transport is not acceptable.
* WalkTransports are not as efficient as
* {@link org.eclipse.jgit.transport.PackTransport} instances, but can be useful
* in situations where a pack transport is not acceptable.
*
* @see WalkFetchConnection
*/

+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/WantNotValidException.java View File

@@ -54,7 +54,7 @@ import org.eclipse.jgit.lib.AnyObjectId;
* <p>
* Typically visible only inside of the server implementation; clients are
* usually looking at the text message from the server in a generic
* {@link PackProtocolException}.
* {@link org.eclipse.jgit.errors.PackProtocolException}.
*
* @since 4.3
*/

+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/WriteAbortedException.java View File

@@ -49,7 +49,7 @@ import java.io.IOException;
* An exception to be thrown when the write operation is aborted.
* <p>
* That can be thrown inside
* {@link ObjectCountCallback#setObjectCount(long)}.
* {@link org.eclipse.jgit.transport.ObjectCountCallback#setObjectCount(long)}.
*
* @since 4.1
*/

+ 0
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save