String query)
throws InvalidSyntaxException {
if (serviceType == null) {
serviceType = "*";
}
Filter filter;
if (query == null) {
filter = new Filter(String.format("(%s=%s)", SERVICE_TYPE,
serviceType));
} else {
filter = new Filter(String.format("(&(%s=%s) %s)", SERVICE_TYPE,
serviceType, query));
}
ArrayList<ServiceReference> references = new ArrayList<ServiceReference>();
for (Map.Entry<UUID, ServiceReferenceImpl> entry : services.entrySet()) {
if (filter.match(entry.getValue())) {
references.add(entry.getValue());
}
}
return references;
}