org.eclipse.jgit.transport
Class ReceivePack

java.lang.Object
  extended by org.eclipse.jgit.transport.BaseReceivePack
      extended by org.eclipse.jgit.transport.ReceivePack

public class ReceivePack
extends BaseReceivePack

Implements the server side of a push connection, receiving objects.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jgit.transport.BaseReceivePack
BaseReceivePack.FirstLine, BaseReceivePack.ReceiveConfig
 
Field Summary
 
Fields inherited from class org.eclipse.jgit.transport.BaseReceivePack
msgOut, pckIn, pckOut, rawIn, rawOut
 
Constructor Summary
ReceivePack(Repository into)
          Create a new pack receive for an open repository.
 
Method Summary
protected  void enableCapabilities()
          Enable capabilities based on a previously read capabilities line.
protected  String getLockMessageProcessName()
           
 PostReceiveHook getPostReceiveHook()
           
 PreReceiveHook getPreReceiveHook()
           
 void receive(InputStream input, OutputStream output, OutputStream messages)
          Execute the receive task on the socket.
 void setEchoCommandFailures(boolean echo)
           
 void setPostReceiveHook(PostReceiveHook h)
          Set the hook which is invoked after commands are executed.
 void setPreReceiveHook(PreReceiveHook h)
          Set the hook which is invoked prior to commands being executed.
 
Methods inherited from class org.eclipse.jgit.transport.BaseReceivePack
close, executeCommands, filterCommands, getAdvertisedObjects, getAdvertisedOrDefaultRefs, getAdvertisedRefs, getAdvertiseRefsHook, getAllCommands, getMessageOutputStream, getRefFilter, getRefLogIdent, getRepository, getRevWalk, getTimeout, hasCommands, hasError, init, isAllowCreates, isAllowDeletes, isAllowNonFastForwards, isBiDirectionalPipe, isCapabilityEnabled, isCheckReceivedObjects, isCheckReferencedObjectsAreReachable, isExpectDataAfterPackFooter, isSideBand, needPack, receivePackAndCheckConnectivity, recvCommands, release, sendAdvertisedRefs, sendError, sendMessage, sendStatusReport, setAdvertisedRefs, setAdvertiseRefsHook, setAllowCreates, setAllowDeletes, setAllowNonFastForwards, setBiDirectionalPipe, setCheckReceivedObjects, setCheckReferencedObjectsAreReachable, setExpectDataAfterPackFooter, setMaxObjectSizeLimit, setRefFilter, setRefLogIdent, setTimeout, unlockPack, validateCommands
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceivePack

public ReceivePack(Repository into)
Create a new pack receive for an open repository.

Parameters:
into - the destination repository.
Method Detail

getPreReceiveHook

public PreReceiveHook getPreReceiveHook()
Returns:
the hook invoked before updates occur.

setPreReceiveHook

public void setPreReceiveHook(PreReceiveHook h)
Set the hook which is invoked prior to commands being executed.

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 ReceiveCommand.Result.NOT_ATTEMPTED to block its execution.

The hook may be called with an empty command collection if the current set is completely invalid.

Parameters:
h - the hook instance; may be null to disable the hook.

getPostReceiveHook

public PostReceiveHook getPostReceiveHook()
Returns:
the hook invoked after updates occur.

setPostReceiveHook

public void setPostReceiveHook(PostReceiveHook h)
Set the hook which is invoked after commands are executed.

Only successful commands (type is 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.

Parameters:
h - the hook instance; may be null to disable the hook.

setEchoCommandFailures

public void setEchoCommandFailures(boolean echo)
Parameters:
echo - if true this class will report command failures as warning messages before sending the command results. This is usually not necessary, but may help buggy Git clients that discard the errors when all branches fail.

receive

public void receive(InputStream input,
                    OutputStream output,
                    OutputStream messages)
             throws IOException
Execute the receive task on the socket.

Parameters:
input - raw input to read client commands and pack data from. Caller must ensure the input is buffered, otherwise read performance may suffer.
output - response back to the Git network client. Caller must ensure the output is buffered, otherwise write performance may suffer.
messages - secondary "notice" channel to send additional messages out 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

enableCapabilities

protected void enableCapabilities()
Description copied from class: BaseReceivePack
Enable capabilities based on a previously read capabilities line.

Overrides:
enableCapabilities in class BaseReceivePack

getLockMessageProcessName

protected String getLockMessageProcessName()
Specified by:
getLockMessageProcessName in class BaseReceivePack
Returns:
the process name used for pack lock messages.


Copyright © 2013. All Rights Reserved.