org.eclipse.osgi.service.resolver.State.addResolverError()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(21.7k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.eclipse.osgi.service.resolver.State.addResolverError()方法的一些代码示例,展示了State.addResolverError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。State.addResolverError()方法的具体详情如下:
包路径:org.eclipse.osgi.service.resolver.State
类名称:State
方法名:addResolverError

State.addResolverError介绍

[英]Adds a new ResolverError for the specified bundle.

This method is intended to be used by resolvers in the process of resolving.
[中]为指定的捆绑添加新的ResolverError
此方法旨在供解析器在解析过程中使用。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi.compatibility.state

if (importPackageConflict(resolvedExport, newImports[i])) {
  result = true;
  resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newImports[i].toString(), newImports[i]);
if ((resolvedRequire == null && isResolved()) || (resolvedRequire != null && !newRequires[i].isSatisfiedBy(resolvedRequire.getBundleDescription()))) {
  result = true;
  resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newRequires[i].toString(), newRequires[i]);
  if (!StateImpl.OSGI_EE_NAMESPACE.equals(genericSpecification.getType())) {
    result = true;
    resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, genericSpecification.toString(), genericSpecification);

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

if (importPackageConflict(resolvedExport, newImports[i])) {
  result = true;
  resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newImports[i].toString(), newImports[i]);
if ((resolvedRequire == null && isResolved()) || (resolvedRequire != null && !newRequires[i].isSatisfiedBy(resolvedRequire.getBundleDescription()))) {
  result = true;
  resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newRequires[i].toString(), newRequires[i]);
  if (!StateImpl.OSGI_EE_NAMESPACE.equals(genericSpecification.getType())) {
    result = true;
    resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, genericSpecification.toString(), genericSpecification);

代码示例来源:origin: org.eclipse/org.eclipse.osgi

if (importPackageConflict(resolvedExport, newImports[i])) {
  result = true;
  resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newImports[i].toString(), newImports[i]);
if ((resolvedRequire == null && isResolved()) || (resolvedRequire != null && !newRequires[i].isSatisfiedBy(resolvedRequire.getBundleDescription()))) {
  result = true;
  resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newRequires[i].toString(), newRequires[i]);
  if (!StateImpl.OSGI_EE_NAMESPACE.equals(genericSpecification.getType())) {
    result = true;
    resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, genericSpecification.toString(), genericSpecification);

代码示例来源:origin: org.eclipse/org.eclipse.osgi

private void checkUsesConstraints(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  List<ResolverConstraint> conflictingConstraints = findBestCombination(bundles, platformProperties);
  if (conflictingConstraints == null)
    return;
  Set<ResolverBundle> conflictedBundles = null;
  for (ResolverConstraint conflict : conflictingConstraints) {
    if (conflict.isOptional()) {
      conflict.clearPossibleSuppliers();
      continue;
    }
    if (conflictedBundles == null)
      conflictedBundles = new HashSet<ResolverBundle>(conflictingConstraints.size());
    ResolverBundle conflictedBundle;
    if (conflict.isFromFragment())
      conflictedBundle = bundleMapping.get(conflict.getVersionConstraint().getBundle());
    else
      conflictedBundle = conflict.getBundle();
    if (conflictedBundle != null) {
      if (DEBUG_USES)
        System.out.println("Found conflicting constraint: " + conflict + " in bundle " + conflictedBundle); //$NON-NLS-1$//$NON-NLS-2$
      conflictedBundles.add(conflictedBundle);
      int type = conflict instanceof ResolverImport ? ResolverError.IMPORT_PACKAGE_USES_CONFLICT : ResolverError.REQUIRE_BUNDLE_USES_CONFLICT;
      state.addResolverError(conflictedBundle.getBundleDescription(), type, conflict.getVersionConstraint().toString(), conflict.getVersionConstraint());
      conflictedBundle.setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(conflictedBundle, false, false);
    }
  }
  reResolveBundles(conflictedBundles, bundles, platformProperties);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi.compatibility.state

private void checkUsesConstraints(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  List<ResolverConstraint> conflictingConstraints = findBestCombination(bundles, platformProperties);
  if (conflictingConstraints == null)
    return;
  Set<ResolverBundle> conflictedBundles = null;
  for (ResolverConstraint conflict : conflictingConstraints) {
    if (conflict.isOptional()) {
      conflict.clearPossibleSuppliers();
      continue;
    }
    if (conflictedBundles == null)
      conflictedBundles = new HashSet<>(conflictingConstraints.size());
    ResolverBundle conflictedBundle;
    if (conflict.isFromFragment())
      conflictedBundle = bundleMapping.get(conflict.getVersionConstraint().getBundle());
    else
      conflictedBundle = conflict.getBundle();
    if (conflictedBundle != null) {
      if (DEBUG_USES)
        System.out.println("Found conflicting constraint: " + conflict + " in bundle " + conflictedBundle); //$NON-NLS-1$//$NON-NLS-2$
      conflictedBundles.add(conflictedBundle);
      int type = conflict instanceof ResolverImport ? ResolverError.IMPORT_PACKAGE_USES_CONFLICT : ResolverError.REQUIRE_BUNDLE_USES_CONFLICT;
      state.addResolverError(conflictedBundle.getBundleDescription(), type, conflict.getVersionConstraint().toString(), conflict.getVersionConstraint());
      conflictedBundle.setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(conflictedBundle, false, false);
    }
  }
  reResolveBundles(conflictedBundles, bundles, platformProperties);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

private void checkUsesConstraints(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  List<ResolverConstraint> conflictingConstraints = findBestCombination(bundles, platformProperties);
  if (conflictingConstraints == null)
    return;
  Set<ResolverBundle> conflictedBundles = null;
  for (ResolverConstraint conflict : conflictingConstraints) {
    if (conflict.isOptional()) {
      conflict.clearPossibleSuppliers();
      continue;
    }
    if (conflictedBundles == null)
      conflictedBundles = new HashSet<ResolverBundle>(conflictingConstraints.size());
    ResolverBundle conflictedBundle;
    if (conflict.isFromFragment())
      conflictedBundle = bundleMapping.get(conflict.getVersionConstraint().getBundle());
    else
      conflictedBundle = conflict.getBundle();
    if (conflictedBundle != null) {
      if (DEBUG_USES)
        System.out.println("Found conflicting constraint: " + conflict + " in bundle " + conflictedBundle); //$NON-NLS-1$//$NON-NLS-2$
      conflictedBundles.add(conflictedBundle);
      int type = conflict instanceof ResolverImport ? ResolverError.IMPORT_PACKAGE_USES_CONFLICT : ResolverError.REQUIRE_BUNDLE_USES_CONFLICT;
      state.addResolverError(conflictedBundle.getBundleDescription(), type, conflict.getVersionConstraint().toString(), conflict.getVersionConstraint());
      conflictedBundle.setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(conflictedBundle, false, false);
    }
  }
  reResolveBundles(conflictedBundles, bundles, platformProperties);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

private void checkUsesConstraints(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  List<ResolverConstraint> conflictingConstraints = findBestCombination(bundles, platformProperties);
  if (conflictingConstraints == null)
    return;
  Set<ResolverBundle> conflictedBundles = null;
  for (ResolverConstraint conflict : conflictingConstraints) {
    if (conflict.isOptional()) {
      conflict.clearPossibleSuppliers();
      continue;
    }
    if (conflictedBundles == null)
      conflictedBundles = new HashSet<ResolverBundle>(conflictingConstraints.size());
    ResolverBundle conflictedBundle;
    if (conflict.isFromFragment())
      conflictedBundle = bundleMapping.get(conflict.getVersionConstraint().getBundle());
    else
      conflictedBundle = conflict.getBundle();
    if (conflictedBundle != null) {
      if (DEBUG_USES)
        System.out.println("Found conflicting constraint: " + conflict + " in bundle " + conflictedBundle); //$NON-NLS-1$//$NON-NLS-2$
      conflictedBundles.add(conflictedBundle);
      int type = conflict instanceof ResolverImport ? ResolverError.IMPORT_PACKAGE_USES_CONFLICT : ResolverError.REQUIRE_BUNDLE_USES_CONFLICT;
      state.addResolverError(conflictedBundle.getBundleDescription(), type, conflict.getVersionConstraint().toString(), conflict.getVersionConstraint());
      conflictedBundle.setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(conflictedBundle, false, false);
    }
  }
  reResolveBundles(conflictedBundles, bundles, platformProperties);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

state.addResolverError(bundle.getBundleDescription(), ResolverError.MISSING_FRAGMENT_HOST, bundle.getHost().getVersionConstraint().toString(), bundle.getHost().getVersionConstraint());

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

private ResolverBundle pickOneToResolve(Collection<ResolverBundle> pickOneToResolve) {
  ResolverBundle selectedVersion = null;
  for (ResolverBundle singleton : pickOneToResolve) {
    if (selectedVersion == null)
      selectedVersion = singleton;
    boolean higherVersion = selectionPolicy != null ? selectionPolicy.compare(selectedVersion.getBundleDescription(), singleton.getBundleDescription()) > 0 : selectedVersion.getVersion().compareTo(singleton.getVersion()) < 0;
    if (higherVersion)
      selectedVersion = singleton;
  }
  for (ResolverBundle singleton : pickOneToResolve) {
    if (singleton != selectedVersion) {
      singleton.setResolvable(false);
      state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, selectedVersion.getBundleDescription().toString(), null);
    }
  }
  return selectedVersion;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi.compatibility.state

private ResolverBundle pickOneToResolve(Collection<ResolverBundle> pickOneToResolve) {
  ResolverBundle selectedVersion = null;
  for (ResolverBundle singleton : pickOneToResolve) {
    if (selectedVersion == null)
      selectedVersion = singleton;
    boolean higherVersion = selectionPolicy != null ? selectionPolicy.compare(selectedVersion.getBundleDescription(), singleton.getBundleDescription()) > 0 : selectedVersion.getVersion().compareTo(singleton.getVersion()) < 0;
    if (higherVersion)
      selectedVersion = singleton;
  }
  for (ResolverBundle singleton : pickOneToResolve) {
    if (singleton != selectedVersion) {
      singleton.setResolvable(false);
      state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, selectedVersion.getBundleDescription().toString(), null);
    }
  }
  return selectedVersion;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

private void checkComposites(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  CompositeResolveHelperRegistry helpers = getCompositeHelpers();
  if (helpers == null)
    return;
  Set<ResolverBundle> exclude = null;
  for (int i = 0; i < bundles.length; i++) {
    CompositeResolveHelper helper = helpers.getCompositeResolveHelper(bundles[i].getBundleDescription());
    if (helper == null)
      continue;
    if (!bundles[i].isResolved())
      continue;
    if (!helper.giveExports(getExportsWiredTo(bundles[i], null))) {
      state.addResolverError(bundles[i].getBundleDescription(), ResolverError.DISABLED_BUNDLE, null, null);
      bundles[i].setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(bundles[i], false, false);
      if (exclude == null)
        exclude = new HashSet<ResolverBundle>(1);
      exclude.add(bundles[i]);
    }
  }
  reResolveBundles(exclude, bundles, platformProperties);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi.compatibility.state

private void checkComposites(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  CompositeResolveHelperRegistry helpers = getCompositeHelpers();
  if (helpers == null)
    return;
  Set<ResolverBundle> exclude = null;
  for (int i = 0; i < bundles.length; i++) {
    CompositeResolveHelper helper = helpers.getCompositeResolveHelper(bundles[i].getBundleDescription());
    if (helper == null)
      continue;
    if (!bundles[i].isResolved())
      continue;
    if (!helper.giveExports(getExportsWiredTo(bundles[i], null))) {
      state.addResolverError(bundles[i].getBundleDescription(), ResolverError.DISABLED_BUNDLE, null, null);
      bundles[i].setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(bundles[i], false, false);
      if (exclude == null)
        exclude = new HashSet<>(1);
      exclude.add(bundles[i]);
    }
  }
  reResolveBundles(exclude, bundles, platformProperties);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

private ResolverBundle pickOneToResolve(Collection<ResolverBundle> pickOneToResolve) {
  ResolverBundle selectedVersion = null;
  for (ResolverBundle singleton : pickOneToResolve) {
    if (selectedVersion == null)
      selectedVersion = singleton;
    boolean higherVersion = selectionPolicy != null ? selectionPolicy.compare(selectedVersion.getBundleDescription(), singleton.getBundleDescription()) > 0 : selectedVersion.getVersion().compareTo(singleton.getVersion()) < 0;
    if (higherVersion)
      selectedVersion = singleton;
  }
  for (ResolverBundle singleton : pickOneToResolve) {
    if (singleton != selectedVersion) {
      singleton.setResolvable(false);
      state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, selectedVersion.getBundleDescription().toString(), null);
    }
  }
  return selectedVersion;
}

代码示例来源:origin: org.eclipse/org.eclipse.osgi

private void checkComposites(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  CompositeResolveHelperRegistry helpers = getCompositeHelpers();
  if (helpers == null)
    return;
  Set<ResolverBundle> exclude = null;
  for (int i = 0; i < bundles.length; i++) {
    CompositeResolveHelper helper = helpers.getCompositeResolveHelper(bundles[i].getBundleDescription());
    if (helper == null)
      continue;
    if (!bundles[i].isResolved())
      continue;
    if (!helper.giveExports(getExportsWiredTo(bundles[i], null))) {
      state.addResolverError(bundles[i].getBundleDescription(), ResolverError.DISABLED_BUNDLE, null, null);
      bundles[i].setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(bundles[i], false, false);
      if (exclude == null)
        exclude = new HashSet<ResolverBundle>(1);
      exclude.add(bundles[i]);
    }
  }
  reResolveBundles(exclude, bundles, platformProperties);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

boolean constraintsConflict(BundleDescription fragment, ImportPackageSpecification[] newImports, BundleSpecification[] newRequires, GenericSpecification[] newGenericRequires) {
  // this method iterates over all additional constraints from a fragment
  // if the host is resolved then the fragment is not allowed to add new constraints;
  // if the host is resolved and it already has a constraint of the same name then ensure the supplier satisfies the fragment's constraint
  boolean result = false;
  for (int i = 0; i < newImports.length; i++) {
    ResolverImport hostImport = getImport(newImports[i].getName());
    ResolverExport resolvedExport = (ResolverExport) (hostImport == null ? null : hostImport.getSelectedSupplier());
    if ((resolvedExport == null && isResolved()) || (resolvedExport != null && !newImports[i].isSatisfiedBy(resolvedExport.getExportPackageDescription()))) {
      result = true;
      resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newImports[i].toString(), newImports[i]);
    }
  }
  for (int i = 0; i < newRequires.length; i++) {
    BundleConstraint hostRequire = getRequire(newRequires[i].getName());
    ResolverBundle resolvedRequire = (ResolverBundle) (hostRequire == null ? null : hostRequire.getSelectedSupplier());
    if ((resolvedRequire == null && isResolved()) || (resolvedRequire != null && !newRequires[i].isSatisfiedBy(resolvedRequire.getBundleDescription()))) {
      result = true;
      resolver.getState().addResolverError(fragment, ResolverError.FRAGMENT_CONFLICT, newRequires[i].toString(), newRequires[i]);
    }
  }
  // generic constraints cannot conflict; 
  // only check that a fragment does not add generics constraints to an already resolved host
  if (isResolved() && newGenericRequires != null && newGenericRequires.length > 0)
    result = true;
  return result;
}

代码示例来源:origin: org.eclipse/org.eclipse.osgi

private ResolverBundle pickOneToResolve(Collection<ResolverBundle> pickOneToResolve) {
  ResolverBundle selectedVersion = null;
  for (ResolverBundle singleton : pickOneToResolve) {
    if (selectedVersion == null)
      selectedVersion = singleton;
    boolean higherVersion = selectionPolicy != null ? selectionPolicy.compare(selectedVersion.getBundleDescription(), singleton.getBundleDescription()) > 0 : selectedVersion.getVersion().compareTo(singleton.getVersion()) < 0;
    if (higherVersion)
      selectedVersion = singleton;
  }
  for (ResolverBundle singleton : pickOneToResolve) {
    if (singleton != selectedVersion) {
      singleton.setResolvable(false);
      state.addResolverError(singleton.getBundleDescription(), ResolverError.SINGLETON_SELECTION, selectedVersion.getBundleDescription().toString(), null);
    }
  }
  return selectedVersion;
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

private void checkComposites(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
  CompositeResolveHelperRegistry helpers = getCompositeHelpers();
  if (helpers == null)
    return;
  Set<ResolverBundle> exclude = null;
  for (int i = 0; i < bundles.length; i++) {
    CompositeResolveHelper helper = helpers.getCompositeResolveHelper(bundles[i].getBundleDescription());
    if (helper == null)
      continue;
    if (!bundles[i].isResolved())
      continue;
    if (!helper.giveExports(getExportsWiredTo(bundles[i], null))) {
      state.addResolverError(bundles[i].getBundleDescription(), ResolverError.DISABLED_BUNDLE, null, null);
      bundles[i].setResolvable(false);
      // We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
      setBundleUnresolved(bundles[i], false, false);
      if (exclude == null)
        exclude = new HashSet<ResolverBundle>(1);
      exclude.add(bundles[i]);
    }
  }
  reResolveBundles(exclude, bundles, platformProperties);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi.compatibility.state

private boolean resolveOSGiEE(ResolverBundle bundle) {
  GenericConstraint[] requirements = bundle.getGenericRequires();
  for (GenericConstraint requirement : requirements) {
    if (!(StateImpl.OSGI_EE_NAMESPACE.equals(requirement.getNameSpace()) || requirement.isEffective()))
      continue;
    {
      if (!resolveGenericReq(requirement, new ArrayList<ResolverBundle>(0))) {
        if (DEBUG || DEBUG_GENERICS)
          ResolverImpl.log("** GENERICS " + requirement.getVersionConstraint().getName() + "[" + requirement.getBundleDescription() + "] failed to resolve"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        state.addResolverError(requirement.getVersionConstraint().getBundle(), ResolverError.MISSING_GENERIC_CAPABILITY, requirement.getVersionConstraint().toString(), requirement.getVersionConstraint());
        if (!developmentMode) {
          // fail fast; otherwise we want to attempt to resolver other constraints in dev mode
          return false;
        }
      } else {
        VersionSupplier supplier = requirement.getSelectedSupplier();
        Integer ee = supplier == null ? null : (Integer) ((GenericDescription) supplier.getBaseDescription()).getAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE);
        if (ee != null && ((BundleDescriptionImpl) bundle.getBaseDescription()).getEquinoxEE() < 0)
          ((BundleDescriptionImpl) bundle.getBundleDescription()).setEquinoxEE(ee);
      }
    }
  }
  return true;
}

代码示例来源:origin: org.eclipse/org.eclipse.osgi

private boolean resolveOSGiEE(ResolverBundle bundle) {
  GenericConstraint[] requirements = bundle.getGenericRequires();
  for (GenericConstraint requirement : requirements) {
    if (!(StateImpl.OSGI_EE_NAMESPACE.equals(requirement.getNameSpace()) || requirement.isEffective()))
      continue;
    {
      if (!resolveGenericReq(requirement, new ArrayList<ResolverBundle>(0))) {
        if (DEBUG || DEBUG_GENERICS)
          ResolverImpl.log("** GENERICS " + requirement.getVersionConstraint().getName() + "[" + requirement.getBundleDescription() + "] failed to resolve"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        state.addResolverError(requirement.getVersionConstraint().getBundle(), ResolverError.MISSING_GENERIC_CAPABILITY, requirement.getVersionConstraint().toString(), requirement.getVersionConstraint());
        if (!developmentMode) {
          // fail fast; otherwise we want to attempt to resolver other constraints in dev mode
          return false;
        }
      } else {
        VersionSupplier supplier = requirement.getSelectedSupplier();
        Integer ee = supplier == null ? null : (Integer) ((GenericDescription) supplier.getBaseDescription()).getAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE);
        if (ee != null && ((BundleDescriptionImpl) bundle.getBaseDescription()).getEquinoxEE() < 0)
          ((BundleDescriptionImpl) bundle.getBundleDescription()).setEquinoxEE(ee);
      }
    }
  }
  return true;
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

private boolean resolveOSGiEE(ResolverBundle bundle) {
  GenericConstraint[] requirements = bundle.getGenericRequires();
  for (GenericConstraint requirement : requirements) {
    if (!(StateImpl.OSGI_EE_NAMESPACE.equals(requirement.getNameSpace()) || requirement.isEffective()))
      continue;
    {
      if (!resolveGenericReq(requirement, new ArrayList<ResolverBundle>(0))) {
        if (DEBUG || DEBUG_GENERICS)
          ResolverImpl.log("** GENERICS " + requirement.getVersionConstraint().getName() + "[" + requirement.getBundleDescription() + "] failed to resolve"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        state.addResolverError(requirement.getVersionConstraint().getBundle(), ResolverError.MISSING_GENERIC_CAPABILITY, requirement.getVersionConstraint().toString(), requirement.getVersionConstraint());
        if (!developmentMode) {
          // fail fast; otherwise we want to attempt to resolver other constraints in dev mode
          return false;
        }
      } else {
        VersionSupplier supplier = requirement.getSelectedSupplier();
        Integer ee = supplier == null ? null : (Integer) ((GenericDescription) supplier.getBaseDescription()).getAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE);
        if (ee != null && ((BundleDescriptionImpl) bundle.getBaseDescription()).getEquinoxEE() < 0)
          ((BundleDescriptionImpl) bundle.getBundleDescription()).setEquinoxEE(ee);
      }
    }
  }
  return true;
}

相关文章