org.eclipse.jgit.transport

## Class AbstractAdvertiseRefsHook

- java.lang.Object
- - org.eclipse.jgit.transport.AbstractAdvertiseRefsHook

All Implemented Interfaces:
  AdvertiseRefsHook

    public abstract class AbstractAdvertiseRefsHook
    extends Object
    implements AdvertiseRefsHook

Implementation of `AdvertiseRefsHook` that advertises the same refs for upload-pack and receive-pack.

Since:
  2.0

### Field Summary

### Fields inherited from interface org.eclipse.jgit.transport.AdvertiseRefsHook

`DEFAULT`

### Constructor Summary

Constructors
Constructor and Description
`AbstractAdvertiseRefsHook()`

### Method Summary

Methods
`void` `advertiseRefs(BaseReceivePack receivePack)` Advertise refs for receive-pack.
`void` `advertiseRefs(UploadPack uploadPack)` Advertise refs for upload-pack.
`protected Set<ObjectId>` `getAdvertisedHaves(Repository repository, RevWalk revWalk)` Get the additional haves to advertise.
`protected abstract Map<String,Ref>` `getAdvertisedRefs(Repository repository, RevWalk revWalk)` Get the refs to advertise.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractAdvertiseRefsHook

    public AbstractAdvertiseRefsHook()

### Method Detail

#### advertiseRefs

    public void advertiseRefs(UploadPack uploadPack)
                       throws ServiceMayNotContinueException

Description copied from interface: `AdvertiseRefsHook`
Advertise refs for upload-pack.

Specified by:
  `advertiseRefs` in interface `AdvertiseRefsHook`
Parameters:
  `uploadPack` - instance on which to call `UploadPack.setAdvertisedRefs(java.util.Map)` if necessary.
Throws:
  `ServiceMayNotContinueException` - abort; the message will be sent to the user.

#### advertiseRefs

    public void advertiseRefs(BaseReceivePack receivePack)
                       throws ServiceMayNotContinueException

Description copied from interface: `AdvertiseRefsHook`
Advertise refs for receive-pack.

Specified by:
  `advertiseRefs` in interface `AdvertiseRefsHook`
Parameters:
  `receivePack` - instance on which to call `BaseReceivePack.setAdvertisedRefs(java.util.Map,java.util.Set)` if necessary.
Throws:
  `ServiceMayNotContinueException` - abort; the message will be sent to the user.

#### getAdvertisedRefs

    protected abstract Map<String,Ref> getAdvertisedRefs(Repository repository,
                                    RevWalk revWalk)
                                                  throws ServiceMayNotContinueException

Get the refs to advertise.

Parameters:
  `repository` - repository instance.
  `revWalk` - open rev walk on the repository.
Returns:
  set of refs to advertise.
Throws:
  `ServiceMayNotContinueException` - abort; the message will be sent to the user.

#### getAdvertisedHaves

    protected Set<ObjectId> getAdvertisedHaves(Repository repository,
                                   RevWalk revWalk)
                                        throws ServiceMayNotContinueException

Get the additional haves to advertise.

Parameters:
  `repository` - repository instance.
  `revWalk` - open rev walk on the repository.
Returns:
  set of additional haves; see `BaseReceivePack.getAdvertisedObjects()`.
Throws:
  `ServiceMayNotContinueException` - abort; the message will be sent to the user.