1 /* 2 * Copyright (C) 2018, Google LLC. and others 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the Eclipse Distribution License v. 1.0 which is available at 6 * https://www.eclipse.org/org/documents/edl-v10.php. 7 * 8 * SPDX-License-Identifier: BSD-3-Clause 9 */ 10 package org.eclipse.jgit.transport; 11 12 /** 13 * Hook to allow callers to be notified on Git protocol v2 requests. 14 * 15 * @see UploadPack#setProtocolV2Hook(ProtocolV2Hook) 16 * @since 5.1 17 */ 18 public interface ProtocolV2Hook { 19 /** 20 * The default hook implementation that does nothing. 21 */ 22 static ProtocolV2HookHook.html#ProtocolV2Hook">ProtocolV2Hook DEFAULT = new ProtocolV2Hook() { 23 // No override. 24 }; 25 26 /** 27 * @param req 28 * the capabilities request 29 * @throws ServiceMayNotContinueException 30 * abort; the message will be sent to the user 31 * @since 5.1 32 */ 33 default void onCapabilities(CapabilitiesV2Request req) 34 throws ServiceMayNotContinueException { 35 // Do nothing by default. 36 } 37 38 /** 39 * @param req 40 * the ls-refs request 41 * @throws ServiceMayNotContinueException 42 * abort; the message will be sent to the user 43 * @since 5.1 44 */ 45 default void onLsRefs(LsRefsV2Request req) 46 throws ServiceMayNotContinueException { 47 // Do nothing by default. 48 } 49 50 /** 51 * @param req the fetch request 52 * @throws ServiceMayNotContinueException abort; the message will be sent to the user 53 */ 54 default void onFetch(FetchV2Request req) 55 throws ServiceMayNotContinueException { 56 // Do nothing by default 57 } 58 }