void addGenerics(GenericCapability[] generics) { for (GenericCapability capability : generics) { String type = capability.getGenericDescription().getType(); VersionHashMap<GenericCapability> namespace = resolverGenerics.get(type); if (namespace == null) { namespace = new VersionHashMap<GenericCapability>(this); resolverGenerics.put(type, namespace); } namespace.put(capability.getName(), capability); } } }
protected int insertionIndex(List<V> existing, V value) { int index = existing.size(); if (compare(existing.get(existing.size() - 1), value) > 0) { index = Collections.binarySearch(existing, value, this); if (index < 0) index = -index - 1; } return index; }
public boolean contains(V vs) { return contains(vs, false) != null; }
private void rewireGeneric(GenericConstraint constraint, List<ResolverBundle> visited) { if (constraint.getSelectedSupplier() != null) return; GenericDescription[] suppliers = ((GenericSpecification) constraint.getVersionConstraint()).getSuppliers(); if (suppliers == null) return; VersionHashMap<GenericCapability> namespace = resolverGenerics.get(constraint.getNameSpace()); if (namespace == null) { System.err.println("Could not find matching capability for " + constraint.getVersionConstraint()); //$NON-NLS-1$ // TODO log error!! return; } String constraintName = constraint.getName(); List<GenericCapability> matches = constraintName == null ? namespace.get(constraintName) : namespace.getAllValues(); for (GenericCapability match : matches) { for (GenericDescription supplier : suppliers) if (match.getBaseDescription() == supplier) constraint.addPossibleSupplier(match); } VersionSupplier[] matchingCapabilities = constraint.getPossibleSuppliers(); if (matchingCapabilities != null) for (int i = 0; i < matchingCapabilities.length; i++) rewireBundle(matchingCapabilities[i].getResolverBundle(), visited); }
ResolverExport[] getExports(String name) { List<ResolverExport> results = new ArrayList<>(1); // rare to have more than one // it is faster to ask the VersionHashMap for this package name and then compare the exporter to this List<ResolverExport> resolverExports = resolver.getResolverExports().get(name); for (ResolverExport export : resolverExports) if (export.getExporter() == this) results.add(export); return results.toArray(new ResolverExport[results.size()]); }
public void remove(V[] versionSuppliers) { for (int i = 0; i < versionSuppliers.length; i++) remove(versionSuppliers[i]); }
public void put(V[] versionSuppliers) { for (int i = 0; i < versionSuppliers.length; i++) put(versionSuppliers[i].getName(), versionSuppliers[i]); }
private void setBundleUnresolved(ResolverBundle bundle, boolean removed, boolean keepFragsAttached) { if (bundle.getState() == ResolverBundle.UNRESOLVED && !developmentMode) // in this case there is nothing more to do return; // Note that when in dev mode we only want to force the fragment detach if asked to; // this would be done only when forcing a dependency chain to unresolve from unresolveBundle method if (removed || !keepFragsAttached) { // Force the initialization of the bundle, its exports and its capabilities. This is needed to force proper attachment of fragments. resolverExports.remove(bundle.getExportPackages()); removeGenerics(bundle.getGenericCapabilities()); bundle.detachAllFragments(); bundle.initialize(false); if (!removed) { // add back the available exports/capabilities resolverExports.put(bundle.getExportPackages()); addGenerics(bundle.getGenericCapabilities()); } } // TODO unresolvedBundles should be a set; for now only need to do a contains check in devMode. if (!removed && (!developmentMode || !unresolvedBundles.contains(bundle))) unresolvedBundles.add(bundle); bundle.setState(ResolverBundle.UNRESOLVED); }
private void reorderGenerics() { for (VersionHashMap<GenericCapability> namespace : resolverGenerics.values()) namespace.reorder(); }
private void initialize() { resolverExports = new VersionHashMap<ResolverExport>(this); resolverBundles = new VersionHashMap<ResolverBundle>(this); resolverGenerics = new HashMap<String, VersionHashMap<GenericCapability>>(); unresolvedBundles = new HashSet<ResolverBundle>();
private void printWirings() { ResolverImpl.log("****** Result Wirings ******"); //$NON-NLS-1$ List<ResolverBundle> bundles = resolverBundles.getAllValues(); for (ResolverBundle rb : bundles) { if (rb.getBundleDescription().isResolved()) {
private void rewireGeneric(GenericConstraint constraint, List<ResolverBundle> visited) { if (constraint.getSelectedSupplier() != null) return; GenericDescription[] suppliers = ((GenericSpecification) constraint.getVersionConstraint()).getSuppliers(); if (suppliers == null) return; VersionHashMap<GenericCapability> namespace = resolverGenerics.get(constraint.getNameSpace()); if (namespace == null) { System.err.println("Could not find matching capability for " + constraint.getVersionConstraint()); //$NON-NLS-1$ // TODO log error!! return; } String constraintName = constraint.getName(); List<GenericCapability> matches = constraintName == null ? namespace.get(constraintName) : namespace.getAllValues(); for (GenericCapability match : matches) { for (GenericDescription supplier : suppliers) if (match.getBaseDescription() == supplier) constraint.addPossibleSupplier(match); } VersionSupplier[] matchingCapabilities = constraint.getPossibleSuppliers(); if (matchingCapabilities != null) for (int i = 0; i < matchingCapabilities.length; i++) rewireBundle(matchingCapabilities[i].getResolverBundle(), visited); }
ResolverExport[] getExports(String name) { List<ResolverExport> results = new ArrayList<ResolverExport>(1); // rare to have more than one // it is faster to ask the VersionHashMap for this package name and then compare the exporter to this List<ResolverExport> resolverExports = resolver.getResolverExports().get(name); for (ResolverExport export : resolverExports) if (export.getExporter() == this) results.add(export); return results.toArray(new ResolverExport[results.size()]); }
public void remove(V[] versionSuppliers) { for (int i = 0; i < versionSuppliers.length; i++) remove(versionSuppliers[i]); }
public void put(V[] versionSuppliers) { for (int i = 0; i < versionSuppliers.length; i++) put(versionSuppliers[i].getName(), versionSuppliers[i]); }
private void setBundleUnresolved(ResolverBundle bundle, boolean removed, boolean keepFragsAttached) { if (bundle.getState() == ResolverBundle.UNRESOLVED && !developmentMode) // in this case there is nothing more to do return; // Note that when in dev mode we only want to force the fragment detach if asked to; // this would be done only when forcing a dependency chain to unresolve from unresolveBundle method if (removed || !keepFragsAttached) { // Force the initialization of the bundle, its exports and its capabilities. This is needed to force proper attachment of fragments. resolverExports.remove(bundle.getExportPackages()); removeGenerics(bundle.getGenericCapabilities()); bundle.detachAllFragments(); bundle.initialize(false); if (!removed) { // add back the available exports/capabilities resolverExports.put(bundle.getExportPackages()); addGenerics(bundle.getGenericCapabilities()); } } // TODO unresolvedBundles should be a set; for now only need to do a contains check in devMode. if (!removed && (!developmentMode || !unresolvedBundles.contains(bundle))) unresolvedBundles.add(bundle); bundle.setState(ResolverBundle.UNRESOLVED); }
private void reorderGenerics() { for (VersionHashMap<GenericCapability> namespace : resolverGenerics.values()) namespace.reorder(); }
private void initialize() { resolverExports = new VersionHashMap<ResolverExport>(this); resolverBundles = new VersionHashMap<ResolverBundle>(this); resolverGenerics = new HashMap<String, VersionHashMap<GenericCapability>>(); unresolvedBundles = new HashSet<ResolverBundle>();
private void printWirings() { ResolverImpl.log("****** Result Wirings ******"); //$NON-NLS-1$ List<ResolverBundle> bundles = resolverBundles.getAllValues(); for (ResolverBundle rb : bundles) { if (rb.getBundleDescription().isResolved()) {
private void rewireGeneric(GenericConstraint constraint, List<ResolverBundle> visited) { if (constraint.getSelectedSupplier() != null) return; GenericDescription[] suppliers = ((GenericSpecification) constraint.getVersionConstraint()).getSuppliers(); if (suppliers == null) return; VersionHashMap<GenericCapability> namespace = resolverGenerics.get(constraint.getNameSpace()); if (namespace == null) { System.err.println("Could not find matching capability for " + constraint.getVersionConstraint()); //$NON-NLS-1$ // TODO log error!! return; } String constraintName = constraint.getName(); List<GenericCapability> matches = constraintName == null ? namespace.get(constraintName) : namespace.getAllValues(); for (GenericCapability match : matches) { for (GenericDescription supplier : suppliers) if (match.getBaseDescription() == supplier) constraint.addPossibleSupplier(match); } VersionSupplier[] matchingCapabilities = constraint.getPossibleSuppliers(); if (matchingCapabilities != null) for (int i = 0; i < matchingCapabilities.length; i++) rewireBundle(matchingCapabilities[i].getResolverBundle(), visited); }