1 /*
2 * Copyright (C) 2013 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 package org.eclipse.jgit.archive;
11
12 import org.osgi.framework.BundleActivator;
13 import org.osgi.framework.BundleContext;
14
15 /**
16 * This activator registers all format types from the
17 * org.eclipse.jgit.archive package for use via the ArchiveCommand
18 * API.
19 *
20 * This registration happens automatically behind the scenes
21 * when the package is loaded as an OSGi bundle (and the corresponding
22 * deregistration happens when the bundle is unloaded, to avoid
23 * leaks).
24 */
25 public class FormatActivator implements BundleActivator {
26 /**
27 * {@inheritDoc}
28 *
29 * Registers all included archive formats by calling
30 * {@link ArchiveFormats#registerAll()}. This method is called by the OSGi
31 * framework when the bundle is started.
32 */
33 @Override
34 public void start(BundleContext context) {
35 ArchiveFormats.registerAll();
36 }
37
38 /**
39 * {@inheritDoc}
40 *
41 * Cleans up after {@link #start(BundleContext)} by calling
42 * {@link ArchiveFormats#unregisterAll}.
43 */
44 @Override
45 public void stop(BundleContext context) {
46 ArchiveFormats.unregisterAll();
47 }
48 }