URL classUrl = clazz.getClassLoader().getResource(clazz.getName().replace('.', '/') + ".class");
if (classUrl == null || !classUrl.getPath().startsWith(project.getBuild().getOutputDirectory())) {
System.out.println("Ignoring " + classUrl);
continue;
}
Services services = clazz.getAnnotation(Services.class);
if (services != null) {
for (RequireService req : services.requires()) {
String flt = req.filter();
if (flt != null && !flt.isEmpty()) {
flt = "(&(objectClass=" + req.value().getName() + ")" + flt + ")";
} else {
flt = "(objectClass=" + req.value().getName() + ")";
}
if (requirements.length() > 0) {
requirements.append(",");
}
requirements.append("osgi.service;effective:=active;filter:=\"")
.append(flt)
.append("\"");
}
for (ProvideService cap : services.provides()) {
if (capabilities.length() > 0) {
capabilities.append(",");
}
capabilities.append("osgi.service;effective:=active;objectClass=")
.append(cap.value().getName());