use of org.apache.felix.scr.impl.manager.ComponentActivator in project felix by apache.
the class ComponentRegistry method getComponentHolders.
public final List<ComponentHolder<?>> getComponentHolders(Bundle... bundles) {
List<ComponentHolder<?>> all = getComponentHolders();
List<ComponentHolder<?>> holders = new ArrayList<ComponentHolder<?>>();
for (ComponentHolder<?> holder : all) {
ComponentActivator activator = holder.getActivator();
if (activator != null) {
try {
Bundle holderBundle = activator.getBundleContext().getBundle();
for (Bundle b : bundles) {
if (b == holderBundle) {
holders.add(holder);
}
}
} catch (IllegalStateException ise) {
// ignore inactive bundles
}
}
}
return holders;
}
use of org.apache.felix.scr.impl.manager.ComponentActivator in project felix by apache.
the class ActivateMethodTest method newContainer.
private ComponentContainer newContainer() {
final ComponentMetadata metadata = newMetadata();
ComponentContainer container = new ComponentContainer() {
@Override
public ComponentActivator getActivator() {
final ComponentActivator ca = Mockito.mock(ComponentActivator.class);
Mockito.when(ca.getBundleContext()).thenReturn(Mockito.mock(BundleContext.class));
return ca;
}
@Override
public ComponentMetadata getComponentMetadata() {
return metadata;
}
@Override
public void disposed(SingleComponentManager component) {
}
public boolean isEnabled() {
return false;
}
@Override
public ComponentLogger getLogger() {
return new MockComponentLogger();
}
};
return container;
}
Aggregations