Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 70e03d585f51197a05b4b2e3531d4df8d4a7b581 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*******************************************************************************
 * Copyright (c) 2008 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     ProSyst Software GmbH - initial API and implementation
 *******************************************************************************/

package security.b;

import org.osgi.framework.*;

public class Activator implements BundleActivator {

	private BundleContext bc;

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		System.out.println("Starting bundle Test2!!"); //$NON-NLS-1$
		System.out.println("Security manager: " + System.getSecurityManager()); //$NON-NLS-1$
		this.bc = context;
		doTestAction();
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		System.out.println("Stopping bundle Test2!!"); //$NON-NLS-1$
	}

	private void doTestAction() {
		Bundle[] bundles = bc.getBundles();
		Bundle thisBundle = bc.getBundle();
		for (int i = 0; i < bundles.length; i++) {
			if (thisBundle.getBundleId() != bundles[i].getBundleId()) {
				checkBundle(bundles[i]);
			}
		}
	}

	private void checkBundle(Bundle bundle) {
		bundle.getHeaders();
	}
}

Back to the top