/** * Execute a single filter of a query. * * @param filter * @return */ private Set<ArtifactDescriptor> findMatchingArtifacts(Attribute filter) { Set<Attribute> attributes = this.index.findMatchingAttributes(filter.getKey(), filter.getValue()); Set<Attribute> propertyFilteredAttributes = new HashSet<Attribute>(); for (Attribute attribute : attributes) { if (this.propertiesContains(filter.getProperties(), attribute.getProperties())) { propertyFilteredAttributes.add(attribute); } } Set<ArtifactDescriptor> matches = new HashSet<ArtifactDescriptor>(); for (Attribute attribute : propertyFilteredAttributes) { matches.add(this.index.getArtifactDescriptor(attribute)); } return matches; }
public ArtifactDescriptorLibraryDefinition(ArtifactDescriptor artifactDescriptor) { Set<Attribute> descriptionSet = artifactDescriptor.getAttribute(LibraryBridge.LIBRARY_DESCRIPTION); if (!descriptionSet.isEmpty()) { this.description = descriptionSet.iterator().next().getValue(); } else { this.description = null; } Set<Attribute> nameSet = artifactDescriptor.getAttribute(LibraryBridge.LIBRARY_NAME); if (!nameSet.isEmpty()) { this.name = nameSet.iterator().next().getValue(); } else { this.name = null; } this.location = artifactDescriptor.getUri(); Set<Attribute> versionSet = artifactDescriptor.getAttribute(LibraryBridge.LIBRARY_VERSION); this.version = new Version(versionSet.iterator().next().getValue()); Set<Attribute> symbolicNameSet = artifactDescriptor.getAttribute(LibraryBridge.LIBRARY_SYMBOLICNAME); Attribute symbolicNameAttribute = symbolicNameSet.iterator().next(); this.symbolicName = symbolicNameAttribute.getValue(); String importBundleHeader = artifactDescriptor .getAttribute(LibraryBridge.RAW_HEADER_PREFIX + LibraryBridge.IMPORT_BUNDLE) .iterator() .next() .getValue(); this.importedBundles = LibraryBridge.parseImportBundle(importBundleHeader); }