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

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

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

State.getExportedPackages介绍

[英]Returns all exported packages in this state, according to the OSGi rules for resolution.
[中]根据OSGi解析规则,返回此状态下的所有导出包。

代码示例

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

public ExportPackageDescription[] getExportedPackages() {
  return target.getExportedPackages();
}

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

public ExportPackageDescription[] getExportedPackages() {
  return target.getExportedPackages();
}

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

public ExportPackageDescription[] getExportedPackages() {
  return platformAdmin.getSystemState().getExportedPackages();
}

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

public ExportPackageDescription[] getExportedPackages() {
  return platformAdmin.getSystemState().getExportedPackages();
}

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

private static final Set<String> getAvailableExportedPackages() {
  State state = TargetPlatformHelper.getState();
  ExportPackageDescription[] packages = state.getExportedPackages();
  Set<String> set = new HashSet<>();
  for (ExportPackageDescription exportedPackage : packages) {
    set.add(exportedPackage.getName());
  }
  return set;
}

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

public ExportedPackage[] getExportedPackages(Bundle bundle) {
  List<ExportedPackage> allExports = new ArrayList<ExportedPackage>();
  FrameworkAdaptor adaptor = framework.adaptor;
  if (adaptor == null)
    return null;
  ExportPackageDescription[] allDescriptions = adaptor.getState().getExportedPackages();
  for (int i = 0; i < allDescriptions.length; i++) {
    ExportedPackageImpl exportedPackage = createExportedPackage(allDescriptions[i]);
    if (exportedPackage == null)
      continue;
    if (bundle == null || exportedPackage.getBundle() == bundle)
      allExports.add(exportedPackage);
  }
  return (allExports.size() == 0 ? null : allExports.toArray(new ExportedPackage[allExports.size()]));
}

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

public ExportedPackage[] getExportedPackages(Bundle bundle) {
  List<ExportedPackage> allExports = new ArrayList<ExportedPackage>();
  FrameworkAdaptor adaptor = framework.adaptor;
  if (adaptor == null)
    return null;
  ExportPackageDescription[] allDescriptions = adaptor.getState().getExportedPackages();
  for (int i = 0; i < allDescriptions.length; i++) {
    ExportedPackageImpl exportedPackage = createExportedPackage(allDescriptions[i]);
    if (exportedPackage == null)
      continue;
    if (bundle == null || exportedPackage.getBundle() == bundle)
      allExports.add(exportedPackage);
  }
  return (allExports.size() == 0 ? null : allExports.toArray(new ExportedPackage[allExports.size()]));
}

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

private boolean isResolvable(ImportPackageSpecification constraint, ResolverHook hook) {
  ExportPackageDescription[] exports = constraint.getBundle().getContainingState().getExportedPackages();
  return getPossibleCandidates(constraint, exports, null, hook, true).size() > 0;
}

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

private boolean isResolvable(ImportPackageSpecification constraint, ResolverHook hook) {
  ExportPackageDescription[] exports = constraint.getBundle().getContainingState().getExportedPackages();
  return getPossibleCandidates(constraint, exports, null, hook, true).size() > 0;
}

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

private boolean isResolvable(ImportPackageSpecification constraint, ResolverHook hook) {
  ExportPackageDescription[] exports = constraint.getBundle().getContainingState().getExportedPackages();
  return getPossibleCandidates(constraint, exports, null, hook, true).size() > 0;
}

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

private boolean isResolvable(ImportPackageSpecification constraint, ResolverHook hook) {
  ExportPackageDescription[] exports = constraint.getBundle().getContainingState().getExportedPackages();
  return getPossibleCandidates(constraint, exports, null, hook, true).size() > 0;
}

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

private static Map<String, ExportPackageDescription> getValidPackages(String pkgName, String qualifiedTypeToImport) {
  ExportPackageDescription[] knownPackages = PDECore.getDefault().getModelManager().getState().getState().getExportedPackages();
  Map<String, ExportPackageDescription> validPackages = new HashMap<>();
  for (ExportPackageDescription knownPackage : knownPackages) {
    if (knownPackage.getName().equals(pkgName)) {
      validPackages.put(knownPackage.getName(), knownPackage);
    }
  }
  // remove system packages if they happen to be included. Adding a system package won't resolve anything, since package package already comes from JRE
  if (!validPackages.isEmpty()) {
    knownPackages = PDECore.getDefault().getModelManager().getState().getState().getSystemPackages();
    for (ExportPackageDescription knownPackage : knownPackages) {
      validPackages.remove(knownPackage.getName());
    }
  }
  Map<String, ExportPackageDescription> packages = new HashMap<>();
  for (ExportPackageDescription exportPackageDescription : validPackages.values()) {
    packages.put(qualifiedTypeToImport, exportPackageDescription);
  }
  return packages;
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-shell-diagnose

private PackageEdge processImportPackage(PackageGraph graph, BundleDescription importer, ImportPackageSpecification importPackage, ImportPackageSpecification startImportPackage) {
  ExportPackageDescription exportedPackage = null;
  if (importer.isResolved()) {
    exportedPackage = findExportPackage(importPackage.getName(), importer.getResolvedImports());
  } else {
    exportedPackage = findExportPackage(importPackage, state.getExportedPackages());
    if (exportedPackage == null) {
      exportedPackage = findExportPackage(importPackage, importer.getExportPackages());
    }
  }
  if (exportedPackage == null) {
    String resolution = (String) importPackage.getDirective(Constants.RESOLUTION_DIRECTIVE);
    if (ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(resolution) ||
      ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(resolution)) {
      return null;
    } else {
      throw new RuntimeException(importPackage + " cannot be satisfied for " + Utils.bundleToString(importer));
    }
  }
  return new PackageEdge(processExportPackage(graph, exportedPackage, startImportPackage), importPackage);
}

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

ExportPackageDescription[] knownPackages = PDECore.getDefault().getModelManager().getState().getState().getExportedPackages();
for (ExportPackageDescription knownPackage : knownPackages) {
  if (packages.containsKey(knownPackage.getName())) {

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

private static void addImportedPackages(IBundlePluginModelBase base, HashSet<String> existingImports) {
  HashMap<String, ImportPackageObject> map = getImportPackages(base);
  if (map == null) {
    return;
  }
  ExportPackageDescription exported[] = PDECore.getDefault().getModelManager().getState().getState().getExportedPackages();
  for (int i = 0; i < exported.length; i++) {
    // iterate through all the exported packages
    ImportPackageObject ipo = map.get(exported[i].getName());
    // if we find an exported package that matches a pkg in the map, then the exported package matches a package on our import-package statement
    if (ipo != null) {
      // check version to make sure we only add bundles from valid packages
      String version = ipo.getVersion();
      if (version != null) {
        try {
          if (!new VersionRange(version).isIncluded(exported[i].getVersion()))
           {
            continue;
          // NFE if ImportPackageObject's version is improperly formatted - ignore any matching imported packages since version is invalid
          }
        } catch (NumberFormatException e) {
          continue;
        }
      }
      existingImports.add(exported[i].getSupplier().getSymbolicName());
    }
  }
}

相关文章