void addCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$ //$NON-NLS-2$ } all.add(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { addIndex(index, capability); } else { for (Object indexKey : indexCollection) { addIndex(indexKey, capability); } } }
/** * Returns a mutable snapshot of capabilities that are candidates for * satisfying the specified requirement. * @param requirement the requirement * @return the candidates for the requirement */ public List<ModuleCapability> findCapabilities(Requirement requirement) { NamespaceSet namespaceSet = namespaceSets.get(requirement.getNamespace()); if (namespaceSet == null) { return Collections.emptyList(); } return namespaceSet.findCapabilities(requirement); } }
void removeCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$//$NON-NLS-2$ } all.remove(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { removeIndex(index, capability); } else { for (Object indexKey : indexCollection) { removeIndex(indexKey, capability); } } }
result = match(null, all, synthetic); } else { String indexKey = f.getPrimaryKeyValue(name); if (indexKey == null) { result = match(f, all, synthetic); } else { Set<ModuleCapability> indexed = indexes.get(indexKey); result = new ArrayList<ModuleCapability>(0); } else { result = match(f, indexed, synthetic); List<ModuleCapability> nonStringResult = match(f, nonStringIndexes, synthetic); for (ModuleCapability capability : nonStringResult) { if (!result.contains(capability)) {
result = match(null, all, synthetic); } else { String indexKey = f.getPrimaryKeyValue(name); if (indexKey == null) { result = match(f, all, synthetic); } else { Set<ModuleCapability> indexed = indexes.get(indexKey); result = new ArrayList<ModuleCapability>(0); } else { result = match(f, indexed, synthetic); List<ModuleCapability> nonStringResult = match(f, nonStringIndexes, synthetic); for (ModuleCapability capability : nonStringResult) { if (!result.contains(capability)) {
result = match(null, all, synthetic); } else { String indexKey = f.getPrimaryKeyValue(name); if (indexKey == null) { result = match(f, all, synthetic); } else { Set<ModuleCapability> indexed = indexes.get(indexKey); result = new ArrayList<>(0); } else { result = match(f, indexed, synthetic); List<ModuleCapability> nonStringResult = match(f, nonStringIndexes, synthetic); for (ModuleCapability capability : nonStringResult) { if (!result.contains(capability)) {
result = match(null, all, synthetic); } else { String indexKey = f.getPrimaryKeyValue(name); if (indexKey == null) { result = match(f, all, synthetic); } else { Set<ModuleCapability> indexed = indexes.get(indexKey); result = new ArrayList<>(0); } else { result = match(f, indexed, synthetic); List<ModuleCapability> nonStringResult = match(f, nonStringIndexes, synthetic); for (ModuleCapability capability : nonStringResult) { if (!result.contains(capability)) {
result = match(null, all, synthetic); } else { String indexKey = f.getPrimaryKeyValue(name); if (indexKey == null) { result = match(f, all, synthetic); } else { Set<ModuleCapability> indexed = indexes.get(indexKey); result = new ArrayList<ModuleCapability>(0); } else { result = match(f, indexed, synthetic); List<ModuleCapability> nonStringResult = match(f, nonStringIndexes, synthetic); for (ModuleCapability capability : nonStringResult) { if (!result.contains(capability)) {
result = match(null, all, synthetic); } else { String indexKey = f.getPrimaryKeyValue(name); if (indexKey == null) { result = match(f, all, synthetic); } else { Set<ModuleCapability> indexed = indexes.get(indexKey); result = new ArrayList<ModuleCapability>(0); } else { result = match(f, indexed, synthetic); List<ModuleCapability> nonStringResult = match(f, nonStringIndexes, synthetic); for (ModuleCapability capability : nonStringResult) { if (!result.contains(capability)) {
NamespaceSet namespaceSet = namespaceSets.get(capability.getNamespace()); if (namespaceSet == null) { namespaceSet = new NamespaceSet(capability.getNamespace()); namespaceSets.put(capability.getNamespace(), namespaceSet); namespaceSet.addCapability(capability);
NamespaceSet namespaceSet = namespaceSets.get(capability.getNamespace()); if (namespaceSet == null) { namespaceSet = new NamespaceSet(capability.getNamespace()); namespaceSets.put(capability.getNamespace(), namespaceSet); namespaceSet.addCapability(capability);
NamespaceSet namespaceSet = namespaceSets.get(capability.getNamespace()); if (namespaceSet == null) { namespaceSet = new NamespaceSet(capability.getNamespace()); namespaceSets.put(capability.getNamespace(), namespaceSet); namespaceSet.addCapability(capability);
NamespaceSet namespaceSet = namespaceSets.get(capability.getNamespace()); if (namespaceSet == null) { namespaceSet = new NamespaceSet(capability.getNamespace()); namespaceSets.put(capability.getNamespace(), namespaceSet); namespaceSet.addCapability(capability);
NamespaceSet namespaceSet = namespaceSets.get(capability.getNamespace()); if (namespaceSet == null) { namespaceSet = new NamespaceSet(capability.getNamespace()); namespaceSets.put(capability.getNamespace(), namespaceSet); namespaceSet.addCapability(capability);
NamespaceSet namespaceSet = namespaceSets.get(capability.getNamespace()); if (namespaceSet == null) { namespaceSet = new NamespaceSet(capability.getNamespace()); namespaceSets.put(capability.getNamespace(), namespaceSet); namespaceSet.addCapability(capability);
void addCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$ //$NON-NLS-2$ } all.add(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { addIndex(index, capability); } else { for (Object indexKey : indexCollection) { addIndex(indexKey, capability); } } }
void removeCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$//$NON-NLS-2$ } all.remove(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { removeIndex(index, capability); } else { for (Object indexKey : indexCollection) { removeIndex(indexKey, capability); } } }
void addCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$ //$NON-NLS-2$ } all.add(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { addIndex(index, capability); } else { for (Object indexKey : indexCollection) { addIndex(indexKey, capability); } } }
void removeCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$//$NON-NLS-2$ } all.remove(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { removeIndex(index, capability); } else { for (Object indexKey : indexCollection) { removeIndex(indexKey, capability); } } }
void addCapability(ModuleCapability capability) { if (!name.equals(capability.getNamespace())) { throw new IllegalArgumentException("Invalid namespace: " + capability.getNamespace() + ": expecting: " + name); //$NON-NLS-1$ //$NON-NLS-2$ } all.add(capability); // by convention we index by the namespace attribute Object index = capability.getAttributes().get(name); if (index == null) { return; } Collection<?> indexCollection = null; if (index instanceof Collection) { indexCollection = (Collection<?>) index; } else if (index.getClass().isArray()) { indexCollection = Arrays.asList((Object[]) index); } if (indexCollection == null) { addIndex(index, capability); } else { for (Object indexKey : indexCollection) { addIndex(indexKey, capability); } } }