View Javadoc
1   /*
2    * Copyright (C) 2012, Google Inc. 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  
11  package org.eclipse.jgit.internal.storage.dfs;
12  
13  import org.eclipse.jgit.events.RepositoryEvent;
14  
15  /**
16   * Describes the {@link org.eclipse.jgit.internal.storage.dfs.DfsPackFile} just
17   * before its index is loaded. Currently, DfsPackFile directly dispatches the
18   * event on {@link org.eclipse.jgit.lib.Repository#getGlobalListenerList}. Which
19   * means the call to {@link #getRepository} will always return null.
20   */
21  public class BeforeDfsPackIndexLoadedEvent
22  		extends RepositoryEvent<BeforeDfsPackIndexLoadedListener> {
23  	private final DfsPackFile pack;
24  
25  	/**
26  	 * A new event triggered before a PackFile index is loaded.
27  	 *
28  	 * @param pack
29  	 *            the pack
30  	 */
31  	public BeforeDfsPackIndexLoadedEvent(DfsPackFile pack) {
32  		this.pack = pack;
33  	}
34  
35  	/**
36  	 * Get the PackFile containing the index that will be loaded.
37  	 *
38  	 * @return the PackFile containing the index that will be loaded.
39  	 */
40  	public DfsPackFile getPackFile() {
41  		return pack;
42  	}
43  
44  	/** {@inheritDoc} */
45  	@Override
46  	public Class<BeforeDfsPackIndexLoadedListener> getListenerType() {
47  		return BeforeDfsPackIndexLoadedListener.class;
48  	}
49  
50  	/** {@inheritDoc} */
51  	@Override
52  	public void dispatch(BeforeDfsPackIndexLoadedListener listener) {
53  		listener.onBeforeDfsPackIndexLoaded(this);
54  	}
55  }