blob: a357eac6730e40b0a69bf15259c697574dbbf7d1 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.ecview.extension.grid.tests;
import org.knowhowlab.osgi.testing.assertions.BundleAssert;
import org.knowhowlab.osgi.testing.assertions.ServiceAssert;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static Activator instance;
public static BundleContext context;
/**
* @return the instance
*/
public static Activator getInstance() {
return instance;
}
@Override
public void start(BundleContext context) throws Exception {
Activator.context = context;
instance = this;
BundleAssert.setDefaultBundleContext(context);
ServiceAssert.setDefaultBundleContext(context);
}
/**
* Returns the bundle with the given id.
*
* @param id
* @return
*/
public static Bundle findBundle(String id) {
for (Bundle bundle : context.getBundles()) {
if (bundle.getSymbolicName().equals(id)) {
return bundle;
}
}
return null;
}
@Override
public void stop(BundleContext context) throws Exception {
Activator.context = null;
instance = null;
}
}