use of io.fabric8.dosgi.capset.SimpleFilter in project fabric8 by jboss-fuse.
the class Manager method removed.
@SuppressWarnings("unchecked")
public void removed(final Collection listenerInfos) {
for (ListenerInfo listenerInfo : (Collection<ListenerInfo>) listenerInfos) {
// Ignore our own listeners or those that don't have any filter
if (listenerInfo.getBundleContext() == bundleContext || listenerInfo.getFilter() == null) {
continue;
}
SimpleFilter exFilter = listeners.remove(listenerInfo);
// Iterate through known services and dereference them if needed
Set<EndpointDescription> matches = remoteEndpoints.match(exFilter);
for (EndpointDescription endpoint : matches) {
Map<Long, ImportRegistration> registrations = importedServices.get(endpoint);
if (registrations != null) {
ImportRegistration registration = registrations.get(listenerInfo.getBundleContext().getBundle().getBundleId());
if (registration != null) {
registration.removeReference(listenerInfo);
if (!registration.hasReferences()) {
registration.getImportedService().unregister();
registrations.remove(listenerInfo.getBundleContext().getBundle().getBundleId());
}
}
}
}
}
}
use of io.fabric8.dosgi.capset.SimpleFilter in project fabric8 by jboss-fuse.
the class Manager method added.
//
// ListenerHook
//
@SuppressWarnings("unchecked")
public void added(final Collection listenerInfos) {
for (ListenerInfo listenerInfo : (Collection<ListenerInfo>) listenerInfos) {
// Ignore our own listeners or those that don't have any filter
if (listenerInfo.getBundleContext() == bundleContext || listenerInfo.getFilter() == null) {
continue;
}
// Make sure we only import remote services
String filter = "(&" + listenerInfo.getFilter() + "(!(" + ENDPOINT_FRAMEWORK_UUID + "=" + this.uuid + ")))";
SimpleFilter exFilter = SimpleFilter.parse(filter);
listeners.put(listenerInfo, exFilter);
// Iterate through known services and import them if needed
Set<EndpointDescription> matches = remoteEndpoints.match(exFilter);
for (EndpointDescription endpoint : matches) {
doImportService(endpoint, listenerInfo);
}
}
}
use of io.fabric8.dosgi.capset.SimpleFilter in project fabric8 by jboss-fuse.
the class SubsystemResolver method getFeatures.
public Map<Resource, String> getFeatures() {
if (features == null) {
SimpleFilter sf = createFilter(IDENTITY_NAMESPACE, "*", CAPABILITY_TYPE_ATTRIBUTE, TYPE_FEATURE);
features = getResourceMapping(sf);
}
return features;
}
Aggregations