use of aQute.bnd.osgi.resource.CapReqBuilder in project bndtools by bndtools.
the class PackageSearchPanel method validate.
private void validate() {
try {
String filter = null;
if (packageName == null || packageName.trim().isEmpty()) {
setError(null);
setRequirement(null);
return;
}
VersionRange versionRange = null;
if (versionRangeStr != null && versionRangeStr.trim().length() > 0) {
try {
versionRange = new VersionRange(versionRangeStr);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid version range: " + e.getMessage());
}
}
filter = formatPackageRequirement(packageName, versionRange);
if (filter != null)
setRequirement(new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter).buildSyntheticRequirement());
setError(null);
} catch (Exception e) {
setError(e.getMessage());
setRequirement(null);
}
}
use of aQute.bnd.osgi.resource.CapReqBuilder in project bndtools by bndtools.
the class ServiceSearchPanel method validate.
public void validate() {
if (serviceClass == null || serviceClass.trim().isEmpty()) {
setError(null);
setRequirement(null);
} else {
String filter = String.format("(%s=%s)", ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE, serviceClass);
Requirement requirement = new CapReqBuilder(ServiceNamespace.SERVICE_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter).buildSyntheticRequirement();
setError(null);
setRequirement(requirement);
}
}
Aggregations